Skip to content

Commit 3f33d55

Browse files
authored
v2.7.2 gallseg key ui (#756)
* add desk wasm * add desk wasm * fix ci, bump to node 24 * use correct golang builder * allow nav to key manager * add route handler * fix hoon * fix hoon * add http-utils * add missing files * fix arms * fix syntax * fix syntax * fix layout * fix sponsors and fonts * update docket
1 parent ca57a19 commit 3f33d55

19 files changed

Lines changed: 1107 additions & 92 deletions

.github/workflows/slsa3-release.yaml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ jobs:
8080
glob: ${{ steps.fe.outputs.glob }}
8181
steps:
8282
- uses: actions/checkout@v4
83+
84+
- name: Setup Go
85+
uses: actions/setup-go@v4
86+
with:
87+
go-version: '1.23.2'
88+
cache: false
89+
90+
- name: Build Perigee WASM
91+
env:
92+
PERIGEE_WASM_REF: ${{ vars.PERIGEE_WASM_REF }}
93+
run: |
94+
set -euxo pipefail
95+
ref="${PERIGEE_WASM_REF:-groundseg-wasm}"
96+
git clone --depth 1 --branch "$ref" https://github.com/Native-Planet/perigee /tmp/perigee
97+
mkdir -p /tmp/groundseg/version/wasm
98+
cd /tmp/perigee
99+
GOOS=js GOARCH=wasm go build -o /tmp/groundseg/version/wasm/perigee.wasm ./wasm
100+
wasm_exec="$(go env GOROOT)/lib/wasm/wasm_exec.js"
101+
if [ ! -f "$wasm_exec" ]; then
102+
wasm_exec="$(go env GOROOT)/misc/wasm/wasm_exec.js"
103+
fi
104+
test -f "$wasm_exec"
105+
cp "$wasm_exec" /tmp/groundseg/version/wasm/wasm_exec.js
106+
sha256sum /tmp/groundseg/version/wasm/perigee.wasm /tmp/groundseg/version/wasm/wasm_exec.js
83107
84108
- name: Build Frontend
85109
id: fe
@@ -113,6 +137,13 @@ jobs:
113137
path: |
114138
/tmp/groundseg/version/glob
115139
140+
- name: Upload Perigee WASM
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: perigee-wasm
144+
path: |
145+
/tmp/groundseg/version/wasm
146+
116147
- name: Upload web files
117148
uses: actions/upload-artifact@v4
118149
with:
@@ -139,7 +170,7 @@ jobs:
139170
- name: Setup Go
140171
uses: actions/setup-go@v4
141172
with:
142-
go-version: '1.23.2'
173+
go-version: '1.26.3'
143174
cache: false
144175

145176
- name: Build binaries
@@ -250,6 +281,11 @@ jobs:
250281
uses: actions/download-artifact@v4
251282
with:
252283
name: glob-output
284+
- name: Download Perigee WASM
285+
uses: actions/download-artifact@v4
286+
with:
287+
name: perigee-wasm
288+
path: perigee-wasm
253289

254290
- name: Deploy Files
255291
run: |
@@ -287,6 +323,15 @@ jobs:
287323
}" \
288324
https://glob.native.computer/update-glob
289325
#
326+
### copy Perigee WASM into bucket
327+
#
328+
WASM_FILE=$(find perigee-wasm -type f -name perigee.wasm | head -n 1)
329+
WASM_EXEC_FILE=$(find perigee-wasm -type f -name wasm_exec.js | head -n 1)
330+
test -n "$WASM_FILE"
331+
test -n "$WASM_EXEC_FILE"
332+
rclone -vvv --config ~/.config/rclone/rclone.conf copy "$WASM_FILE" r2:groundseg/wasm
333+
rclone -vvv --config ~/.config/rclone/rclone.conf copy "$WASM_EXEC_FILE" r2:groundseg/wasm
334+
#
290335
### copy provenance into bucket
291336
#
292337
mv multiple.intoto.jsonl groundseg_${{ needs.args.outputs.channel }}_${{ needs.args.outputs.bin-tag }}.jsonl
@@ -387,6 +432,11 @@ jobs:
387432
uses: actions/download-artifact@v4
388433
with:
389434
name: glob-output
435+
- name: Download Perigee WASM
436+
uses: actions/download-artifact@v4
437+
with:
438+
name: perigee-wasm
439+
path: perigee-wasm
390440
- name: Upload glob to R2
391441
run: |
392442
mkdir -p ~/.config/rclone/
@@ -395,6 +445,12 @@ jobs:
395445
busybox unzip rclone.zip
396446
mv rclone-v*/rclone /usr/local/bin/
397447
chmod +x /usr/local/bin/rclone
448+
WASM_FILE=$(find perigee-wasm -type f -name perigee.wasm | head -n 1)
449+
WASM_EXEC_FILE=$(find perigee-wasm -type f -name wasm_exec.js | head -n 1)
450+
test -n "$WASM_FILE"
451+
test -n "$WASM_EXEC_FILE"
452+
rclone -vvv --config ~/.config/rclone/rclone.conf copy "$WASM_FILE" r2:groundseg/wasm
453+
rclone -vvv --config ~/.config/rclone/rclone.conf copy "$WASM_EXEC_FILE" r2:groundseg/wasm
398454
globfile=$(ls *.glob)
399455
rclone -vvv --config ~/.config/rclone/rclone.conf copy ${globfile} r2:groundseg/glob
400456
curl -X POST -w "%{http_code}" \

build-gallseg-ui.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cd ./ui
2-
DOCKER_BUILDKIT=0 docker build -t web-builder -f gallseg.Dockerfile .
2+
DOCKER_BUILDKIT=0 docker build \
3+
--build-arg GS_PERIGEE_WASM_URL="${GS_PERIGEE_WASM_URL:-https://files.native.computer/wasm/perigee.wasm}" \
4+
--build-arg GS_PERIGEE_WASM_EXEC_URL="${GS_PERIGEE_WASM_EXEC_URL:-https://files.native.computer/wasm/wasm_exec.js}" \
5+
-t web-builder -f gallseg.Dockerfile .
36
container_id=$(docker create web-builder)
47
docker cp $container_id:/webui/build ./web
58
curl https://bootstrap.urbit.org/globberv3.tgz | tar xzk

gallseg/app/groundseg.hoon

Lines changed: 128 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
::
1818
++ on-init
1919
^- (quip card _this)
20-
`this
20+
:_ this
21+
~[[%pass /eyre/connect %arvo %e %connect [~ /'~groundseg'/roller] dap.bowl]]
2122
::
2223
++ on-save
2324
^- vase
@@ -26,17 +27,21 @@
2627
++ on-load
2728
|= old-state=vase
2829
^- (quip card _this)
29-
=/ old !<(versioned-state old-state)
30-
?- -.old
31-
%0 `this(state old)
32-
==
30+
=/ old=state-0
31+
=/ loaded (mule |.(!<(state-0 old-state)))
32+
?: ?=(%& -.loaded) p.loaded
33+
*state-0
34+
:_ this(state old)
35+
~[[%pass /eyre/connect %arvo %e %connect [~ /'~groundseg'/roller] dap.bowl]]
3336
::
3437
++ on-poke
3538
|= [=mark =vase]
3639
^- (quip card _this)
3740
|^
3841
?> =(src.bowl our.bowl)
3942
?+ mark (on-poke:def mark vase)
43+
%handle-http-request
44+
(handle-http !<([@ta inbound-request:eyre] vase))
4045
:: toggle lick port
4146
%port
4247
=^ cards state
@@ -53,6 +58,16 @@
5358
[cards this]
5459
==
5560
::
61+
++ handle-http
62+
|= [eid=@ta req=inbound-request:eyre]
63+
^- (quip card _this)
64+
?: =(%'OPTIONS' method.request.req)
65+
:_ this
66+
%^ give-http eid
67+
[204 ~[['access-control-allow-origin' '*'] ['access-control-allow-methods' 'POST, OPTIONS'] ['access-control-allow-headers' 'Content-Type, X-Groundseg-Roller-URL'] ['access-control-max-age' '3600']]]
68+
~
69+
[[(fetch-roller eid req)]~ this]
70+
::
5671
++ handle-port
5772
|= open=?
5873
^- (quip card _state)
@@ -72,11 +87,49 @@
7287
|= b=@
7388
^- (quip card _state)
7489
`state(alive now.bowl)
90+
::
91+
++ roller-target
92+
|= headers=(list [@t @t])
93+
^- @t
94+
=/ target (get-header:http 'x-groundseg-roller-url' headers)
95+
?~ target
96+
'https://roller.urbit.org/v1/roller'
97+
u.target
98+
::
99+
++ fetch-roller
100+
|= [eid=@ta req=inbound-request:eyre]
101+
^- card
102+
=/ request=request:http request.req
103+
=. url.request (roller-target header-list.request)
104+
=. header-list.request
105+
%+ skip header-list.request
106+
|= [k=@t @t]
107+
?| =('cookie' k)
108+
=('x-groundseg-roller-url' k)
109+
==
110+
=. header-list.request
111+
=- (set-header:http 'forwarded' - header-list.request)
112+
%+ rap 3
113+
:~ 'for="groundseg";'
114+
'proto=' ?:(secure.req 'https' 'http')
115+
==
116+
[%pass /roller-fetch/[eid]/(scot %t url.request) %arvo %i %request request *outbound-config:iris]
117+
::
118+
++ give-http
119+
|= [eid=@ta =response-header:http data=(unit octs)]
120+
^- (list card)
121+
=/ =path /http-response/[eid]
122+
:~ [%give %fact ~[path] %http-response-header !>(response-header)]
123+
[%give %fact ~[path] %http-response-data !>(data)]
124+
[%give %kick ~[path] ~]
125+
==
75126
--
76127
++ on-watch :: on-watch:def
77128
|= =path
78129
^- (quip card _this)
79130
?+ path (on-watch:def path)
131+
[%http-response @ ~]
132+
`this
80133
[%broadcast ~]
81134
:_ this(alive now.bowl)
82135
:~
@@ -92,28 +145,80 @@
92145
++ on-arvo
93146
|= [=wire sign=sign-arvo]
94147
^- (quip card _this)
95-
?. ?=([%lick %soak *] sign) (on-arvo:def +<)
96-
?+ [mark noun]:sign (on-arvo:def +<)
97-
[%connect ~]
98-
((slog 'groundseg socket connected' ~) `this)
99-
::
100-
[%disconnect ~]
101-
((slog 'groundseg socket disconnected' ~) `this)
102-
::
103-
[%error *]
104-
((slog leaf+"socket {(trip ;;(@t noun.sign))}" ~) `this)
105-
::
106-
[%broadcast *]
107-
?. ?=(@ noun.sign)
108-
((slog 'invalid broadcast' ~) `this)
109-
?: (gte `@dr`(sub now.bowl alive.state) ~s15)
148+
|^
149+
?+ wire
150+
?. ?=([%lick %soak *] sign) `this
151+
?+ [mark noun]:sign `this
152+
[%connect ~]
153+
((slog 'groundseg socket connected' ~) `this)
154+
::
155+
[%disconnect ~]
156+
((slog 'groundseg socket disconnected' ~) `this)
157+
::
158+
[%error *]
159+
((slog leaf+"socket {(trip ;;(@t noun.sign))}" ~) `this)
160+
::
161+
[%broadcast *]
162+
?. ?=(@ noun.sign)
163+
((slog 'invalid broadcast' ~) `this)
164+
?: (gte `@dr`(sub now.bowl alive.state) ~s15)
165+
:_ this
166+
:~ [%pass /lick %arvo %l %shut /'groundseg.sock']
167+
==
110168
:_ this
111-
:~ [%pass /lick %arvo %l %shut /'groundseg.sock']
169+
:~ [%give %fact ~[/broadcast] %broadcast !>(`broadcast`noun.sign)]
112170
==
113-
:_ this
114-
:~ [%give %fact ~[/broadcast] %broadcast !>(`broadcast`noun.sign)]
115171
==
172+
[%eyre %connect ~]
173+
?> ?=(%bound +<.sign)
174+
?: accepted.sign
175+
((slog 'groundseg roller proxy bound' ~) `this)
176+
((slog 'groundseg roller proxy bind failed' ~) `this)
177+
[%roller-fetch @ @ ~]
178+
=/ eid=@ta i.t.wire
179+
?> ?=([%iris %http-response *] sign)
180+
=* res client-response.sign
181+
=? res ?=(%progress -.res)
182+
[%cancel ~]
183+
?: ?=(%cancel -.res)
184+
:_ this
185+
(give-status eid 502 'cancelled')
186+
?> ?=(%finished -.res)
187+
:_ this
188+
%^ give-http eid
189+
[status-code.response-header.res (response-headers headers.response-header.res)]
190+
?~ full-file.res ~
191+
`data.u.full-file.res
116192
==
193+
::
194+
++ give-http
195+
|= [eid=@ta =response-header:http data=(unit octs)]
196+
^- (list card)
197+
=/ =path /http-response/[eid]
198+
:~ [%give %fact ~[path] %http-response-header !>(response-header)]
199+
[%give %fact ~[path] %http-response-data !>(data)]
200+
[%give %kick ~[path] ~]
201+
==
202+
::
203+
++ give-status
204+
|= [eid=@ta status=@ud msg=@t]
205+
^- (list card)
206+
%^ give-http eid
207+
[status ~[['content-type' 'text/plain']]]
208+
`(as-octs:mimes:html msg)
209+
::
210+
++ response-headers
211+
|= headers=(list [@t @t])
212+
^- (list [@t @t])
213+
=/ clean=(list [@t @t])
214+
%+ skip headers
215+
|= [key=@t value=@t]
216+
?| =(key 'transfer-encoding')
217+
=(key 'connection')
218+
==
219+
%+ weld clean
220+
~[['x-groundseg-roller' 'finished'] ['access-control-allow-origin' '*']]
221+
--
117222
::
118223
++ on-fail on-fail:def
119224
--

gallseg/desk.docket-0

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title+'GroundSeg'
33
info+'GroundSeg Wrapper'
44
color+0x2c.3a2e
5-
version+[1 0 0]
5+
version+[2 7 2]
66
website+'https://nativeplanet.io'
77
license+'MIT'
88
base+'groundseg'
99
image+'https://files.native.computer/groundseg-logo-2.svg'
10-
glob-http+['gallseg-edge-2.4.6-rc0-0v3.2r5a0.o6gth.t28ur.02sbk.ed27r.glob' 0v3.2r5a0.o6gth.t28ur.02sbk.ed27r]
10+
glob-http+['https://files.native.computer/glob/gallseg-edge-2.7.2-rc5-0v1.kpmbk.4v4t8.mnpmr.n7jcq.44sij.glob' 0v1.kpmbk.4v4t8.mnpmr.n7jcq.44sij]
1111
==

0 commit comments

Comments
 (0)