Merge branch 'develop' into lf/fix-encoding

This commit is contained in:
Hunter Miller 2024-01-30 11:10:45 -06:00
commit 5595d03d73
24 changed files with 184 additions and 48 deletions

View File

@ -1,5 +1,5 @@
name: 'glob'
description: 'Create a glob and push to master'
description: 'Create a glob and push to develop'
inputs:
folder:
description: "Folder to glob"

View File

@ -8,7 +8,7 @@ desk=$2
ship=$3
zone=$4
project=$5
ref=${6:-master}
ref=${6:-develop}
folder=$ship/$desk
set -e

View File

@ -9,11 +9,9 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
name: "Bumps versions and pushes to master"
name: "Bumps versions and pushes to develop"
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
- name: Bump
run: sed -i "s/version+\[.*]/version+[${{ github.event.inputs.tag }}]/" desk/desk.docket-0
- name: Commit

View File

@ -6,6 +6,10 @@ on:
type: string
required: false
description: Enter the tag to deploy
default: staging
push:
branches:
- staging
jobs:
deploy:
runs-on: ubuntu-latest

View File

@ -6,6 +6,7 @@ on:
type: string
required: true
description: Enter the tag to deploy
default: staging
kernel:
type: boolean
required: false

View File

@ -6,6 +6,7 @@ on:
type: string
required: true
description: Enter the tag to deploy
default: staging
jobs:
deploy:
runs-on: ubuntu-latest

View File

@ -5,8 +5,9 @@ on:
tag:
type: string
required: false
default: master
default: develop
description: Enter the tag to deploy
default: staging
jobs:
build-frontend:
runs-on: ubuntu-latest
@ -14,7 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- uses: actions/setup-node@v3
with:
@ -34,7 +34,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- uses: actions/download-artifact@v3
with:
@ -58,7 +57,7 @@ jobs:
git add desk/desk.docket-0
git commit -n -m "update glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit"
INPUT=${{ github.event.inputs.tag }}
BRANCH=${INPUT:-"master"}
BRANCH=${INPUT:-"develop"}
git pull origin $BRANCH --rebase --autostash
git push
deploy:
@ -68,7 +67,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- id: 'auth'
uses: 'google-github-actions/auth@v1'

View File

@ -6,6 +6,7 @@ on:
type: string
required: true
description: Enter the tag to deploy
default: staging
jobs:
deploy:
runs-on: ubuntu-latest

View File

@ -5,11 +5,11 @@ on:
tag:
type: string
required: false
default: master
default: develop
description: Enter the tag to deploy
push:
branches:
- 'master'
- 'develop'
jobs:
build-frontend:
runs-on: ubuntu-latest
@ -17,7 +17,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- uses: actions/setup-node@v3
with:
@ -37,7 +36,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- uses: actions/download-artifact@v3
with:
@ -61,7 +59,7 @@ jobs:
git add desk/desk.docket-0
git commit -n -m "update glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit"
INPUT=${{ github.event.inputs.tag }}
BRANCH=${INPUT:-"master"}
BRANCH=${INPUT:-"develop"}
git pull origin $BRANCH --rebase --autostash
git push
deploy:
@ -71,7 +69,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
ref: ${{ github.event.inputs.tag }}
- id: 'auth'
uses: 'google-github-actions/auth@v1'

View File

@ -115,6 +115,7 @@
++ abet [(flop out) state]
++ cor .
++ emit |=(c=card cor(out [c out]))
++ emil |=(c=(list card) cor(out (weld (flop c) out)))
++ give |=(=gift:agent:gall (emit %give gift))
++ pass |=([=wire =note:agent:gall] (emit %pass wire note))
::
@ -244,7 +245,7 @@
%- (slog 'contact-fail' u.p.sign)
pe-peer:si-epic(sag %fail)
::
%kick si-heed
%kick si-heed(sag ~)
::
:: [compat] we *should* maintain backcompat here
::
@ -402,10 +403,23 @@
|= old-vase=vase
^+ cor
|^ =+ !<([old=versioned-state cool=epic] old-vase)
=. state
?- -.old
%0 old
==
:: if there should be a sub (%chi saga), but there is none (in the
:: bowl), re-establish it. %kick handling used to be faulty.
:: we run this "repair" on every load, in the spirit of +inflate-io.
::
=^ cards rol.old
%+ roll ~(tap by rol.old)
|= [[who=ship foreign] caz=(list card) rol=rolodex]
?. ?& =([%chi ~] sag)
!(~(has by wex.bowl) [/contact who dap.bowl])
==
[caz (~(put by rol) who for sag)]
:- :_ caz
=/ =path [%contact ?~(for / /at/(scot %da wen.for))]
[%pass /contact %agent [who dap.bowl] %watch path]
(~(put by rol) who for %want)
=. state old
=. cor (emil cards)
:: [compat] if our protocol version changed
::
:: we first tell the world, then see if we can now understand

View File

@ -656,16 +656,17 @@
?~ file [glob 'file without filename' err]
?~ type [glob (cat 3 'file without type: ' u.file) err]
?^ code [glob (cat 3 'strange encoding: ' u.code) err]
=/ filp (fip u.file)
=/ filp (rush u.file fip)
?~ filp [glob (cat 3 'strange filename: ' u.file) err]
:: ignore metadata files and other "junk"
::TODO consider expanding coverage
::
?: =('.DS_Store' (rear `path`filp))
?: =('.DS_Store' (rear `path`u.filp))
[glob err]
:: make sure to exclude the top-level dir from the path
::
:_ err
%+ ~(put by glob) (slag 1 `path`filp)
%+ ~(put by glob) (slag 1 `path`u.filp)
[u.type (as-octs:mimes:html body)]
::
++ split-at

View File

@ -11,14 +11,16 @@
$% state-zero
state-one
state-two
state-three
==
::
+$ state-zero [%0 =credentials:zero:past =configuration:zero:past]
+$ state-one [%1 =credentials:one:past =configuration:one:past]
+$ state-two [%2 =credentials =configuration]
+$ state-zero [%0 =credentials:zero:past =configuration:zero:past]
+$ state-one [%1 =credentials:one:past =configuration:one:past]
+$ state-two [%2 =credentials:two:past =configuration:two:past]
+$ state-three [%3 =credentials =configuration]
--
::
=| state-two
=| state-three
=* state -
::
%- agent:dbug
@ -49,9 +51,10 @@
=/ old u.old
|-
?- -.old
%0 $(old (state-0-to-1 old))
%3 `this(state old)
%2 $(old (state-2-to-3 old))
%1 $(old (state-1-to-2 old))
%2 `this(state old)
%0 $(old (state-0-to-1 old))
==
++ state-0-to-1
|= zer=state-zero
@ -79,13 +82,30 @@
::
++ configuration-1-to-2
|= conf=configuration:one:past
^- ^configuration
^- configuration:two:past
:* buckets.conf
current-bucket.conf
region.conf
''
%credentials
==
++ state-2-to-3
|= two=state-two
^- state-three
:* %3
credentials.two
(configuration-2-to-3 configuration.two)
==
++ configuration-2-to-3
|= conf=configuration:two:past
^- ^configuration
:* buckets.conf
current-bucket.conf
region.conf
presigned-url.conf
service.conf
''
==
--
::
++ on-poke
@ -138,6 +158,9 @@
::
%set-region
state(region.configuration region.act)
::
%set-public-url-base
state(public-url-base.configuration public-url-base.act)
::
%set-current-bucket
%_ state

View File

@ -1,7 +1,7 @@
:~ title+'Landscape'
info+'An app launcher for Urbit.'
color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0vl3em1.kjg7n.vm8jv.kj32h.frlt3.glob' 0vl3em1.kjg7n.vm8jv.kj32h.frlt3]
glob-http+['https://bootstrap.urbit.org/glob-0v7.c3mlj.gm8sb.1cmkv.ugntt.pg185.glob' 0v7.c3mlj.gm8sb.1cmkv.ugntt.pg185]
::glob-ames+~zod^0v0
base+'landscape'
version+[1 20 0]

View File

@ -11,6 +11,7 @@
[%set-access-key-id so:dejs]
[%set-secret-access-key so:dejs]
[%set-region so:dejs]
[%set-public-url-base so:dejs]
[%add-bucket so:dejs]
[%remove-bucket so:dejs]
[%set-current-bucket so:dejs]
@ -26,14 +27,15 @@
%+ frond:enjs %storage-update
%- pairs:enjs
:~ ?- -.upd
%set-current-bucket [%'setCurrentBucket' s+bucket.upd]
%add-bucket [%'addBucket' s+bucket.upd]
%set-region [%'setRegion' s+region.upd]
%remove-bucket [%'removeBucket' s+bucket.upd]
%set-endpoint [%'setEndpoint' s+endpoint.upd]
%set-access-key-id [%'setAccessKeyId' s+access-key-id.upd]
%set-presigned-url [%'setPresignedUrl' s+url.upd]
%toggle-service [%'toggleService' s+service.upd]
%set-current-bucket [%'setCurrentBucket' s+bucket.upd]
%add-bucket [%'addBucket' s+bucket.upd]
%set-region [%'setRegion' s+region.upd]
%set-public-url-base [%'setPublicUrlBase' s+public-url-base.upd]
%remove-bucket [%'removeBucket' s+bucket.upd]
%set-endpoint [%'setEndpoint' s+endpoint.upd]
%set-access-key-id [%'setAccessKeyId' s+access-key-id.upd]
%set-presigned-url [%'setPresignedUrl' s+url.upd]
%toggle-service [%'toggleService' s+service.upd]
%set-secret-access-key
[%'setSecretAccessKey' s+secret-access-key.upd]
::
@ -51,6 +53,7 @@
:~ [%buckets a+(turn ~(tap in buckets.configuration.upd) |=(a=@t s+a))]
[%'currentBucket' s+current-bucket.configuration.upd]
[%'region' s+region.configuration.upd]
[%'publicUrlBase' s+public-url-base.configuration.upd]
[%'service' s+service.configuration.upd]
[%'presignedUrl' s+presigned-url.configuration.upd]
==

42
desk/sur/storage-2.hoon Normal file
View File

@ -0,0 +1,42 @@
|%
+$ service ?(%presigned-url %credentials)
+$ credentials
$: endpoint=@t
access-key-id=@t
secret-access-key=@t
==
::
:: $configuration: the upload configuration
::
:: $buckets: the buckets available
:: $current-bucket: the current bucket we use to upload
:: $region: the region of the current bucket
:: $presigned-url: the presigned url endpoint
:: $service: whether to use a presigned url service or direct S3 uploads
::
+$ configuration
$: buckets=(set @t)
current-bucket=@t
region=@t
presigned-url=@t
=service
==
::
+$ action
$% [%set-endpoint endpoint=@t]
[%set-access-key-id access-key-id=@t]
[%set-secret-access-key secret-access-key=@t]
[%add-bucket bucket=@t]
[%remove-bucket bucket=@t]
[%set-current-bucket bucket=@t]
[%set-region region=@t]
[%set-presigned-url url=@t]
[%toggle-service =service]
==
::
+$ update
$% [%credentials =credentials]
[%configuration =configuration]
action
==
--

View File

@ -1,9 +1,10 @@
/- zer=storage-0, uno=storage-1
/- zer=storage-0, uno=storage-1, dos=storage-2
|%
++ past
|%
++ zero zer
++ one uno
++ two dos
--
+$ service ?(%presigned-url %credentials)
+$ credentials
@ -19,6 +20,7 @@
:: $region: the region of the current bucket
:: $presigned-url: the presigned url endpoint
:: $service: whether to use a presigned url service or direct S3 uploads
:: $public-url-base: URL base to substitute into returned object URLs
::
+$ configuration
$: buckets=(set @t)
@ -26,6 +28,7 @@
region=@t
presigned-url=@t
=service
public-url-base=@t
==
::
+$ action
@ -36,6 +39,7 @@
[%remove-bucket bucket=@t]
[%set-current-bucket bucket=@t]
[%set-region region=@t]
[%set-public-url-base public-url-base=@t]
[%set-presigned-url url=@t]
[%toggle-service =service]
==

View File

@ -1 +1,2 @@
[%zuse 412]
[%zuse 411]

View File

@ -8,6 +8,7 @@ import {
StorageUpdateAccessKeyId,
StorageUpdateSecretAccessKey,
StorageUpdateRegion,
StorageUpdatePublicUrlBase,
StorageService,
StorageUpdateSetPresignedUrl,
StorageUpdateToggleService,
@ -60,6 +61,13 @@ export const setRegion = (region: string): Poke<StorageUpdateRegion> =>
'set-region': region,
});
export const setPublicUrlBase = (
publicUrlBase: string
): Poke<StorageUpdatePublicUrlBase> =>
storageAction({
'set-public-url-base': publicUrlBase,
});
export const setPresignedUrl = (
presignedUrl: string
): Poke<StorageUpdateSetPresignedUrl> =>

View File

@ -8,6 +8,7 @@ export interface StorageConfiguration {
buckets: Set<string>;
currentBucket: string;
region: string;
publicUrlBase: string;
presignedUrl: string;
service: StorageService;
}
@ -135,6 +136,10 @@ export interface StorageUpdateRegion {
setRegion: string;
}
export interface StorageUpdatePublicUrlBase {
setPublicUrlBase: string;
}
export interface StorageUpdateToggleService {
toggleService: string;
}
@ -153,5 +158,6 @@ export declare type StorageUpdate =
| StorageUpdateAccessKeyId
| StorageUpdateSecretAccessKey
| StorageUpdateRegion
| StorageUpdatePublicUrlBase
| StorageUpdateToggleService
| StorageUpdateSetPresignedUrl;

View File

@ -142,12 +142,12 @@ const NotificationContent: React.FC<NotificationContent> = ({
type,
content,
}) => {
const con = content;
const line = (content[1] || '').toString();
const mentionRe = new RegExp('mentioned');
const replyRe = new RegExp('replied');
const isMention = type === 'channel' && mentionRe.test(content[1].toString());
const isReply = type === 'channel' && replyRe.test(content[1].toString());
const isMention = type === 'channel' && mentionRe.test(line);
const isReply = type === 'channel' && replyRe.test(line);
function renderContent(c: YarnContent) {
if (typeof c === 'string') {

View File

@ -20,11 +20,13 @@ interface CredentialsSubmit {
accessId: string;
accessSecret: string;
region: string;
publicUrlBase: string;
bucket: string;
}
type S3Update =
| { 'set-region': string }
| { 'set-public-url-base': string }
| { 'set-endpoint': string }
| { 'set-access-key-id': string }
| { 'set-secret-access-key': string }
@ -60,6 +62,7 @@ export const StoragePrefs = () => {
api.poke(storagePoke({ 'set-secret-access-key': data.accessSecret }));
api.poke(storagePoke({ 'set-current-bucket': data.bucket }));
api.poke(storagePoke({ 'set-region': data.region }));
api.poke(storagePoke({ 'set-public-url-base': data.publicUrlBase }));
}, [])
);
@ -207,6 +210,23 @@ export const StoragePrefs = () => {
{!loaded && <Spinner className="absolute top-1 right-2" />}
</div>
</div>
<div className="mb-8 flex flex-col space-y-2">
<label className="font-semibold" htmlFor="publicUrlBase">
Public URL base (normally unnecessary)
</label>
<div className="relative">
<input
disabled={!loaded}
id="publicUrlBase"
type="text"
autoCorrect="off"
defaultValue={s3.configuration?.publicUrlBase}
{...register('publicUrlBase')}
className="input default-ring bg-gray-50"
/>
{!loaded && <Spinner className="absolute top-1 right-2" />}
</div>
</div>
<div className="mb-8 flex flex-col space-y-2">
<label className="font-semibold" htmlFor="bucket">
Bucket Name<span title="Required field">*</span>

View File

@ -28,6 +28,7 @@ const configuration = (
buckets: new Set(data.buckets),
currentBucket: data.currentBucket,
region: data.region,
publicUrlBase: data.publicUrlBase,
// if landscape is not up to date we need to default these so the
// client init logic still works
presignedUrl: data.presignedUrl || hostingUploadURL,
@ -105,6 +106,16 @@ const region = (json: StorageUpdate, state: StorageState): StorageState => {
return state;
};
const publicUrlBase = (
json: StorageUpdate, state: StorageState
): StorageState => {
const data = _.get(json, 'setPublicUrlBase', false);
if (data && state.s3.configuration) {
state.s3.configuration.publicUrlBase = data;
}
return state;
};
const presignedUrl = (
json: StorageUpdate,
state: StorageState
@ -137,6 +148,7 @@ const reduce = [
accessKeyId,
secretAccessKey,
region,
publicUrlBase,
presignedUrl,
toggleService,
];

View File

@ -26,6 +26,7 @@ export const useStorage = createState<BaseStorageState>(
buckets: new Set(),
currentBucket: '',
region: '',
publicUrlBase: '',
presignedUrl: hostingUploadURL,
service: 'credentials',
},

View File

@ -145,17 +145,18 @@ export const useFileStore = create<FileStore>((set, get) => ({
ACL: 'public-read',
});
const url = await getSignedUrl(client, command);
const url = config.publicUrlBase
? new URL(key, config.publicUrlBase).toString()
: await getSignedUrl(client, command).then((res) => res.split('?')[0]);
client
.send(command)
.then(() => {
const fileUrl = url.split('?')[0];
updateStatus(uploader, key, 'success');
imageSize(fileUrl).then((s) =>
imageSize(url).then((s) =>
updateFile(uploader, key, {
size: s,
url: fileUrl,
url,
})
);
})