mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-26 16:32:29 +03:00
Merge pull request #5238 from urbit/m/dist-ames-glob-fixes
docket: hash-based glob-ames, handled within app
This commit is contained in:
commit
712eabc153
@ -383,7 +383,9 @@
|
||||
~_ leaf/"kiln: {<lac>} not installed"
|
||||
vats(loc lac, rak (~(got by ark) lac))
|
||||
::
|
||||
++ here "{<loc>} from {<[ship desk]:ral>}"
|
||||
++ here ?~ rail.rak "{<loc>} from local"
|
||||
"{<loc>} from {<[ship desk]:ral>}"
|
||||
::
|
||||
++ make-wire |=(step=@tas /kiln/vats/[loc]/[step])
|
||||
++ from-wire
|
||||
|= =wire
|
||||
@ -487,7 +489,7 @@
|
||||
=: loc lac
|
||||
rak [~ *rein]
|
||||
==
|
||||
~> %slog.0^leaf/"kiln: local install {here}"
|
||||
~> %slog.0^leaf/"kiln: beginning install into {here}"
|
||||
=. vats (update-running-apps (get-apps-diff our loc now rein.rak))
|
||||
=. vats (emit listen:pass)
|
||||
vats
|
||||
|
@ -2,7 +2,7 @@
|
||||
title+'Bitcoin'
|
||||
info+'BTC wallet for Urbit. Testing'
|
||||
color+0xf9.8e40
|
||||
glob-http+'https://bootstrap.urbit.org/glob-0v4.ghaim.of1as.9ucee.uj93f.a9nbs.glob'
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v4.ghaim.of1as.9ucee.uj93f.a9nbs.glob' 0v4.ghaim.of1as.9ucee.uj93f.a9nbs]
|
||||
image+'https://urbit.ewr1.vultrobjects.com/hastuc-dibtux/2021.8.24..02.57.38-bitcoin.svg'
|
||||
base+'bitcoin'
|
||||
version+[0 0 1]
|
||||
|
@ -7,8 +7,8 @@
|
||||
$: title=(unit @t)
|
||||
info=(unit @t)
|
||||
color=(unit @ux)
|
||||
glob-http=(unit url)
|
||||
glob-ames=(unit =ship)
|
||||
glob-http=(unit [=url hash=@uvH])
|
||||
glob-ames=(unit [=ship hash=@uvH])
|
||||
base=(unit term)
|
||||
site=(unit path)
|
||||
image=(unit url)
|
||||
@ -30,10 +30,10 @@
|
||||
?^ site.draft `[%site u.site.draft]
|
||||
?~ base.draft ~
|
||||
?^ glob-http.draft
|
||||
`[%glob [u.base %http u.glob-http]:draft]
|
||||
`[%glob u.base hash.u.glob-http %http url.u.glob-http]:draft
|
||||
?~ glob-ames.draft
|
||||
~
|
||||
`[%glob [u.base %ames u.glob-ames]:draft]
|
||||
`[%glob u.base hash.u.glob-ames %ames ship.u.glob-ames]:draft
|
||||
?~ href ~
|
||||
=, draft
|
||||
:- ~
|
||||
@ -60,8 +60,8 @@
|
||||
%title draft(title `title.clause)
|
||||
%info draft(info `info.clause)
|
||||
%color draft(color `color.clause)
|
||||
%glob-http draft(glob-http `url.clause)
|
||||
%glob-ames draft(glob-ames `ship:clause)
|
||||
%glob-http draft(glob-http `[url hash]:clause)
|
||||
%glob-ames draft(glob-ames `[ship hash]:clause)
|
||||
%base draft(base `base.clause)
|
||||
%site draft(site `path.clause)
|
||||
%image draft(image `url.clause)
|
||||
@ -84,11 +84,11 @@
|
||||
==
|
||||
?~ image.d ~ ~[image+u.image.d]
|
||||
?: ?=(%site -.href.d) ~[site+path.href.d]
|
||||
=/ loc=glob-location glob-location.href.d
|
||||
=/ ref=glob-reference glob-reference.href.d
|
||||
:~ base+base.href.d
|
||||
?- -.loc
|
||||
%http [%glob-http url.loc]
|
||||
%ames [%glob-ames ship.loc]
|
||||
?- -.location.ref
|
||||
%http [%glob-http url.location.ref hash.ref]
|
||||
%ames [%glob-ames ship.location.ref hash.ref]
|
||||
== == ==
|
||||
::
|
||||
++ spit-clause
|
||||
@ -98,8 +98,13 @@
|
||||
?+ -.clause "'{(trip +.clause)}'"
|
||||
%color (scow %ux color.clause)
|
||||
%site (spud path.clause)
|
||||
%glob-ames (scow %p ship.clause)
|
||||
::
|
||||
::
|
||||
%glob-http
|
||||
"[{(trip url.clause)} {(scow %uv hash.clause)}]"
|
||||
::
|
||||
%glob-ames
|
||||
"[{(scow %p ship.clause)} {(scow %uv hash.clause)}]"
|
||||
::
|
||||
%version
|
||||
=, version.clause
|
||||
"[{(scow %ud major)} {(scow %ud minor)} {(scow %ud patch)}]"
|
||||
@ -127,10 +132,10 @@
|
||||
?- -.u
|
||||
%del-charge s+desk.u
|
||||
::
|
||||
%initial
|
||||
%initial
|
||||
%- pairs
|
||||
%+ turn ~(tap by initial.u)
|
||||
|=([=desk c=^charge] [desk (charge c)])
|
||||
|=([=desk c=^charge] [desk (charge c)])
|
||||
::
|
||||
%add-charge
|
||||
%- pairs
|
||||
@ -167,17 +172,24 @@
|
||||
%glob
|
||||
%- pairs
|
||||
:~ base+s+base.h
|
||||
glob-location+(glob-location glob-location.h)
|
||||
glob-reference+(glob-reference glob-reference.h)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ glob-reference
|
||||
|= ref=^glob-reference
|
||||
%- pairs
|
||||
:~ hash+s+(scot %uv hash.ref)
|
||||
location+(glob-location location.ref)
|
||||
==
|
||||
::
|
||||
++ glob-location
|
||||
|= loc=^glob-location
|
||||
^- json
|
||||
%+ frond -.loc
|
||||
?- -.loc
|
||||
%http (pairs url+s+url.loc ~)
|
||||
%ames (ship ship.loc)
|
||||
%http s+url.loc
|
||||
%ames s+(scot %p ship.loc)
|
||||
==
|
||||
::
|
||||
++ charge
|
||||
|
@ -8,6 +8,9 @@
|
||||
+$ url cord
|
||||
:: $glob-location: How to retrieve a glob
|
||||
::
|
||||
+$ glob-reference
|
||||
[hash=@uvH location=glob-location]
|
||||
::
|
||||
+$ glob-location
|
||||
$% [%http =url]
|
||||
[%ames =ship]
|
||||
@ -15,7 +18,7 @@
|
||||
:: $href: Where a tile links to
|
||||
::
|
||||
+$ href
|
||||
$% [%glob base=term =glob-location]
|
||||
$% [%glob base=term =glob-reference]
|
||||
[%site =path]
|
||||
==
|
||||
:: $chad: State of a docket
|
||||
@ -24,9 +27,9 @@
|
||||
$% :: Done
|
||||
[%glob =glob]
|
||||
[%site ~]
|
||||
:: Waiting
|
||||
:: Waiting
|
||||
[%install ~]
|
||||
[%suspend ~]
|
||||
[%suspend glob=(unit glob)]
|
||||
:: Error
|
||||
[%hung err=cord]
|
||||
==
|
||||
@ -46,8 +49,8 @@
|
||||
$% [%title title=@t]
|
||||
[%info info=@t]
|
||||
[%color color=@ux]
|
||||
[%glob-http url=cord]
|
||||
[%glob-ames =ship]
|
||||
[%glob-http url=cord hash=@uvH]
|
||||
[%glob-ames =ship hash=@uvH]
|
||||
[%image =url]
|
||||
[%site =path]
|
||||
[%base base=term]
|
||||
@ -62,7 +65,7 @@
|
||||
$: %1
|
||||
title=@t
|
||||
info=@t
|
||||
color=@ux
|
||||
color=@ux
|
||||
=href
|
||||
image=(unit url)
|
||||
=version
|
||||
|
@ -123,10 +123,13 @@
|
||||
?> (team:title [our src]:bowl)
|
||||
`state
|
||||
::
|
||||
[%glob @ ~]
|
||||
[%glob @ @ ~]
|
||||
=* base i.t.path
|
||||
=* hash (slav %uv i.t.t.path)
|
||||
=/ desk ~|(path/path (~(got by by-base) i.t.path))
|
||||
=/ =charge ~|(desk/desk (~(got by charges) desk))
|
||||
?> ?=(%glob -.chad.charge)
|
||||
?> =(hash (hash-glob:cc glob.chad.charge))
|
||||
:_ state
|
||||
:~ [%give %fact ~[path] %glob !>(`glob`glob.chad.charge)]
|
||||
[%give %kick ~[path] ~]
|
||||
@ -150,7 +153,9 @@
|
||||
%- ~(run by charges)
|
||||
|= =charge
|
||||
=? chad.charge ?=(%glob -.chad.charge)
|
||||
[%glob *glob]
|
||||
:- %glob
|
||||
%- ~(run by glob.chad.charge)
|
||||
|=(=mime mime(q.q 1.337))
|
||||
charge
|
||||
==
|
||||
::
|
||||
@ -191,18 +196,45 @@
|
||||
%commit
|
||||
=* cha ~(. ch desk.diff)
|
||||
?. docket-exists:cha `state
|
||||
=/ =docket docket:cha
|
||||
:: always update the docket in state to match clay's
|
||||
::
|
||||
=/ =docket docket:cha
|
||||
=/ pre=(unit charge) (~(get by charges) desk.diff)
|
||||
=. charges (new-docket:cha docket)
|
||||
:: if the new chad is a site, we're instantly done
|
||||
::
|
||||
?: ?=(%site -.href.docket)
|
||||
:_ state(charges (~(put by charges) desk.diff [docket [%site ~]]))
|
||||
~[add-fact:cha]
|
||||
=. charges (~(put by charges) desk.diff [docket %install ~])
|
||||
:- ~[add-fact:cha]
|
||||
=. charges (new-chad:cha %site ~)
|
||||
state
|
||||
::
|
||||
=. by-base (~(put by by-base) base.href.docket desk.diff)
|
||||
:_ state
|
||||
[add-fact:cha fetch-glob:cha]
|
||||
:: if the glob specification is unchanged, keep it
|
||||
::
|
||||
?: &(?=(^ pre) =(href.docket.u.pre `href.docket))
|
||||
[~[add-fact:cha] state]
|
||||
:: if the glob spec changed, but we already host it, keep it
|
||||
:: (this is the "just locally uploaded" case)
|
||||
::
|
||||
?: ?& ?=(^ pre)
|
||||
?=(%glob -.chad.u.pre)
|
||||
::
|
||||
.= [(sham glob.chad.u.pre) %ames our.bowl]
|
||||
glob-reference.href.docket
|
||||
==
|
||||
[~[add-fact:cha] state]
|
||||
:: if the glob changed, forget the old and fetch the new
|
||||
::
|
||||
=. charges (new-chad:cha %install ~)
|
||||
[[add-fact:cha fetch-glob:cha] state]
|
||||
::
|
||||
%suspend
|
||||
?. (~(has by charges) desk.diff) `state
|
||||
=. charges (new-chad:cha %suspend ~)
|
||||
=/ glob=(unit glob)
|
||||
=/ =chad
|
||||
chad:(~(got by charges) desk.diff)
|
||||
?:(?=(%glob -.chad) `glob.chad ~)
|
||||
=. charges (new-chad:cha %suspend glob)
|
||||
:_(state ~[add-fact:cha])
|
||||
::
|
||||
%revive
|
||||
@ -211,7 +243,11 @@
|
||||
?. ?=(%glob -.href.docket.charge)
|
||||
=. charges (new-chad:cha %site ~)
|
||||
:_(state ~[add-fact:cha])
|
||||
=. charges (new-chad:cha %install ~)
|
||||
=. charges
|
||||
%- new-chad:cha
|
||||
?. ?=([%suspend ~ *] chad.charge)
|
||||
[%install ~]
|
||||
[%glob u.glob.chad.charge]
|
||||
:_(state [add-fact fetch-glob]:cha)
|
||||
==
|
||||
==
|
||||
@ -235,7 +271,35 @@
|
||||
?~ p.sign `state
|
||||
((slog leaf+"Failed to uninstall %{(trip desk)}" u.p.sign) `state)
|
||||
::
|
||||
[%glob ~]
|
||||
[%glob-ames ~]
|
||||
?- -.sign
|
||||
%kick `state
|
||||
%poke-ack ~&([dap.bowl %unexpected-poke-ack] `state)
|
||||
::
|
||||
%watch-ack
|
||||
?~ p.sign `state
|
||||
%- %- slog
|
||||
leaf+"docket: failed to fetch glob over ames for {(trip desk)}"
|
||||
=. charges (new-chad:cha hung+'failed to fetch glob via ames')
|
||||
[~[add-fact:cha] state]
|
||||
::
|
||||
%fact
|
||||
?. =(%glob p.cage.sign)
|
||||
~& [dap.bowl %unexpected-fact from=src.bowl p.cage.sign]
|
||||
`state
|
||||
=+ !<(=glob q.cage.sign)
|
||||
=/ =docket docket:(~(got by charges) desk)
|
||||
?. ?=([%glob * %ames *] href.docket)
|
||||
`state
|
||||
?. =(hash.glob-reference.href.docket (hash-glob glob))
|
||||
~& [dap.bowl %glob-hash-mismatch on=desk from=src.bowl]
|
||||
`state
|
||||
=. charges (new-chad:cha glob+glob)
|
||||
=. by-base (~(put by by-base) base.href.docket desk)
|
||||
[~[add-fact:cha] state]
|
||||
==
|
||||
::
|
||||
[%glob-http ~]
|
||||
?- -.sign
|
||||
%kick `state
|
||||
::
|
||||
@ -291,6 +355,8 @@
|
||||
++ pass pass:io
|
||||
++ def ~(. (default-agent state %|) bowl)
|
||||
::
|
||||
++ hash-glob sham
|
||||
::
|
||||
++ handle-http-request
|
||||
|= [eyre-id=@ta inbound-request:eyre]
|
||||
^- (quip card _state)
|
||||
@ -415,13 +481,31 @@
|
||||
:_ [~ state]
|
||||
[[400 ~] `(upload-page err)]
|
||||
:- [[200 ~] `(upload-page 'successfully globbed' ~)]
|
||||
?> ?=(%glob -.href.docket.charge)
|
||||
::
|
||||
=. charges (new-chad:cha glob+glob)
|
||||
=. by-base
|
||||
=- (~(put by by-base) - desk)
|
||||
?> ?=(%glob -.href.docket.charge)
|
||||
base.href.docket.charge
|
||||
[~[add-fact:cha] state]
|
||||
::
|
||||
:_ state
|
||||
::
|
||||
=/ ours=?
|
||||
=/ loc location.glob-reference.href.docket.charge
|
||||
?& ?=(%ames -.loc)
|
||||
=(our.bowl ship.loc)
|
||||
==
|
||||
::
|
||||
:* add-fact:cha
|
||||
::
|
||||
?. ours ~
|
||||
^- (list card)
|
||||
=- [%pass /write/[desk] %arvo %c %info -]~
|
||||
%+ foal:space:userlib
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/desk/docket
|
||||
=- [%docket !>(`docket`-)]
|
||||
docket.charge(glob-reference.href [(hash-glob glob) %ames our.bowl])
|
||||
==
|
||||
::
|
||||
?~ parts=(de-request:multipart [header-list body]:request)
|
||||
~& headers=header-list.request
|
||||
@ -518,18 +602,29 @@
|
||||
(poke-our:(pass %install) %hood kiln-install+!>([desk ship remote]))
|
||||
++ uninstall
|
||||
(poke-our:(pass %uninstall) %hood kiln-uninstall+!>(desk))
|
||||
++ new-docket |=(d=^docket (~(jab by charges) desk |=(charge +<(docket d))))
|
||||
++ new-chad |=(c=chad (~(jab by charges) desk |=(charge +<(chad c))))
|
||||
++ fetch-glob
|
||||
^- (list card)
|
||||
=/ =charge
|
||||
~| desk/desk
|
||||
(~(got by charges) desk)
|
||||
=/ tid=@t (cat 3 'docket-' (scot %uv (sham (mix eny.bowl desk))))
|
||||
?> ?=(%glob -.href.docket.charge)
|
||||
=* loc glob-location.href.docket.charge
|
||||
~> %slog.0^leaf/"docket: fetching glob for {<desk>} desk"
|
||||
=/ =cage spider-start+!>([~ `tid byk.bowl(r da+now.bowl) %glob !>(`[loc desk])])
|
||||
:~ (watch-our:(pass %glob) %spider /thread-result/[tid])
|
||||
(poke-our:(pass %glob) %spider cage)
|
||||
=/ ref glob-reference.href.docket.charge
|
||||
?: ?=(%ames -.location.ref)
|
||||
?: =(our.bowl ship.location.ref)
|
||||
~> %slog.0^leaf/"docket: awaiting manual glob for {<desk>} desk"
|
||||
~
|
||||
~> %slog.0^leaf/"docket: fetching ames glob for {<desk>} desk"
|
||||
:_ ~
|
||||
%+ watch:(pass %glob-ames)
|
||||
[ship.location.ref %docket]
|
||||
/glob/[base.href.docket.charge]/(scot %uv hash.ref)
|
||||
~> %slog.0^leaf/"docket: fetching http glob for {<desk>} desk"
|
||||
=/ =cage spider-start+!>([~ `tid byk.bowl(r da+now.bowl) %glob !>(`[ref desk])])
|
||||
:~ (watch-our:(pass %glob-http) %spider /thread-result/[tid])
|
||||
(poke-our:(pass %glob-http) %spider cage)
|
||||
==
|
||||
++ docket-exists .^(? %cu (scry:io desk /desk/docket))
|
||||
++ docket .^(^docket %cx (scry:io desk /desk/docket))
|
||||
|
@ -1,8 +1,9 @@
|
||||
:~ title+'Garden'
|
||||
info+'An app launcher for Urbit. '
|
||||
color+0xee.5432
|
||||
glob-http+'https://bootstrap.urbit.org/glob-0v7.1jqf3.5gao8.67i4k.64c49.i6kr8.glob'
|
||||
::glob-ames+~zod
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v2.dne76.9hibl.1o442.h6l11.cn7os.glob' 0v2.dne76.9hibl.1o442.h6l11.cn7os]
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v7.1jqf3.5gao8.67i4k.64c49.i6kr8.glob' 0v7.1jqf3.5gao8.67i4k.64c49.i6kr8]
|
||||
::glob-ames+~zod^0v0
|
||||
base+'grid'
|
||||
version+[0 0 1]
|
||||
website+'https://tlon.io'
|
||||
|
@ -5,15 +5,15 @@
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<([~ loc=glob-location:docket base=term] arg)
|
||||
=+ !<([~ ref=glob-reference:docket base=term] arg)
|
||||
|^
|
||||
?- -.loc
|
||||
%http (fetch-http url.loc)
|
||||
%ames (fetch-ames ship.loc base)
|
||||
?- -.location.ref
|
||||
%http (fetch-http [url.location hash]:ref)
|
||||
%ames !! ::NOTE done within docket itself
|
||||
==
|
||||
::
|
||||
++ fetch-http
|
||||
|= url=cord
|
||||
|= [url=cord hash=@uvH]
|
||||
^- form:m
|
||||
;< =glob:docket bind:m
|
||||
%+ (retry:strandio ,glob:docket) `5
|
||||
@ -22,16 +22,7 @@
|
||||
%- pure:n
|
||||
%- mole
|
||||
|.
|
||||
=- ?>(=(hash (sham -)) -)
|
||||
;;(=glob:docket (cue cord))
|
||||
(pure:m !>(glob))
|
||||
::
|
||||
:: download from ship's docket state
|
||||
++ fetch-ames
|
||||
|= [=ship base=term]
|
||||
^- form:m
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
;< =cage bind:m
|
||||
(watch-one:strandio /glob/(scot %da now.bowl) [ship %docket] /glob/[base])
|
||||
?> ?=(%glob p.cage)
|
||||
(pure:m q.cage)
|
||||
--
|
||||
|
@ -1,7 +1,7 @@
|
||||
:~ title+'Landscape'
|
||||
info+'A suite of applications to communicate on Urbit'
|
||||
color+0xee.5432
|
||||
glob-http+'https://bootstrap.urbit.org/glob-0v1.vu4e7.efplp.stcdg.7hhds.0tp5v.glob'
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v1.vu4e7.efplp.stcdg.7hhds.0tp5v.glob' 0v1.vu4e7.efplp.stcdg.7hhds.0tp5v]
|
||||
base+'landscape'
|
||||
version+[1 3 5]
|
||||
website+'https://tlon.io'
|
||||
|
@ -1,7 +1,7 @@
|
||||
:~ title+'Web Terminal'
|
||||
info+'A web interface for dill, through herm.'
|
||||
color+0x2e.4347
|
||||
glob-http+'https://bootstrap.urbit.org/glob-0v4.8ui32.ui10d.t0v4d.n9g1s.1ftua.glob'
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v4.8ui32.ui10d.t0v4d.n9g1s.1ftua.glob' 0v4.8ui32.ui10d.t0v4d.n9g1s.1ftua]
|
||||
base+'webterm'
|
||||
version+[0 0 1]
|
||||
website+'https://tlon.io'
|
||||
|
Loading…
Reference in New Issue
Block a user