Merge branch 'v0.8.0rc' into gut-by

This commit is contained in:
Fang 2019-07-10 01:48:13 +02:00
commit 12b8134c33
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
133 changed files with 856 additions and 213263 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d54b55a206ac61a1cec6c2a717a44b37c127625438f8577118adb29807e3c8a3
size 5282913
oid sha256:ff940a247fd3165fe55bd51f67762e857d63bb06220672599cc9e76ccf9f9e8e
size 5846934

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10a449d8c7cda596c15de2ae063336fd61788897eb116ced6e9e673bae657e63
size 7875970
oid sha256:4a471b053252770f870c4a06b19387e4afa7d5e16e282011ec7afbbfb67abc05
size 8555195

View File

@ -15,14 +15,27 @@ cleanup () {
trap cleanup EXIT
# update pill strategy to ensure correct staging
#
herb ./pier -p hood -d "+hood/mount /=home="
cp $ARVO/lib/pill.hoon ./pier/home/lib/
chmod -R u+rw ./pier/home/lib/
herb ./pier -p hood -d "+hood/commit %home"
herb ./pier -p hood -d "+hood/unmount %home"
# stage new desk for pill contents
#
herb ./pier -p hood -d '+hood/merge %stage our %home'
herb ./pier -p hood -d "+hood/mount /=stage="
rm -r ./pier/stage
rm -rf ./pier/stage
cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage
herb ./pier -p hood -d "+hood/commit %stage"
herb ./pier -p hood -d "+hood/unmount %stage"
herb ./pier -P solid.pill -d '+solid /=stage=/sys, =dub &'

View File

@ -55,4 +55,3 @@ I would like to get to a place where any direct scrying of the filesystem is dis
Implicit in having a standard way to write tests and a standard `+test` runner is the idea that all functionality on the current desk should be tested.
Let's say I'm shipping a program on Urbit and I use multiple third-party libraries. Each of those libraries should have their own test suites placed in `%/tests/`. When I `|merge` their desks into my application desk, having a standard test runner means that all their tests and all my application tests get run. If you're depending on a library, you want to make sure that the tests for your dependencies run when you test your application.

View File

@ -147,10 +147,10 @@
:: +card: output effect payload
::
+$ card
$% [%connect wire =binding:http-server app=term]
$% [%connect wire =binding:eyre app=term]
[%http-response =http-event:http]
[%poke wire dock poke]
[%request wire request:http outbound-config:http-client]
[%request wire request:http outbound-config:iris]
[%rule wire %cert (unit [wain wain])]
[%wait wire @da]
==
@ -394,7 +394,7 @@
++ request
|= [wir=wire req=hiss]
^- card
[%request wir (hiss-to-request:html req) *outbound-config:http-client]
[%request wir (hiss-to-request:html req) *outbound-config:iris]
:: +signed-request: JWS JSON POST
::
++ signed-request
@ -1131,7 +1131,7 @@
==
--
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this)
:: ignore progress reports
::
@ -1144,7 +1144,7 @@
?: ?=(%cancel -.response)
(retry:event t.wire)
::
=/ rep=httr (to-httr:http-client +.response)
=/ rep=httr (to-httr:iris +.response)
:: add nonce to pool, if present
::
=/ nonhed (skim q.rep |=((pair @t @t) ?=(%replay-nonce p)))
@ -1193,7 +1193,7 @@
:: Used to serve the domain validation challenge
::
++ poke-handle-http-request
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
~& [%handle-http +<]
=/ url=(unit (pair pork:eyre quay:eyre))
@ -1207,7 +1207,7 @@
~| [%unknown-url url.request.inbound-request] !!
::
:: XX these crashes should be restored
:: but %rver doesn't get an error notification from %gall
:: but %eyre doesn't get an error notification from %gall
::
:: ?. ?=(^ reg.act) ~|(%no-account !!)
:: ?. ?=(^ rod) ~|(%no-active-order !!)
@ -1315,7 +1315,7 @@
:: +bound: response to %connect binding request
::
++ bound
|= [=wire accepted=? =binding:http-server]
|= [=wire accepted=? =binding:eyre]
?: accepted
[~ this]
:: XX better error message

View File

@ -1,154 +0,0 @@
::
:::: /hoon/ask/app
::
/? 310
/+ sole, prey
=, sole
|%
++ card
$% {$diff $sole-effect sole-effect}
==
++ invited ?($new $sent $ignored)
++ email @t
--
::
=, gall
|_ $: bow/bowl
adr/(map email {time invited})
sos/(map bone sole-share)
wom/(unit ship)
admins/(set ship)
==
++ prompt
^- sole-prompt
?~ wom [& %ask-ship ":womb-ship? ~"]
=/ new new-adrs
?~ new [& %$ "<listening> (0) [l,a,i,w,?]"]
[& %$ ": approve {<ask.i.new>}? ({<(lent new)>}) [y,n,l,a,i,w,?]"]
::
++ peer-sole
|= path
^- (quip {bone card} _+>)
~| [%not-in-whitelist src.bow]
?> |((~(has in admins) src.bow) =(our.bow src.bow))
:_ +>.$(sos (~(put by sos) ost.bow *sole-share))
=- [(effect %mor pro+prompt -)]~
=+ all=adrs
[(render all) (turn all put-mail)]
::
++ render :: show list of invites
|= a/(list {time email invited}) ^- sole-effect
?: =(~ a) txt+"~"
tan+(flop (turn a message))
::
++ adrs
=- (sort - |=([a=[=time *] b=[=time *]] (lth time.a time.b)))
%+ turn ~(tap by adr)
|=({a/email b/time c/invited} [tym=b ask=a inv=c])
::
++ new-adrs (skim adrs |=({@ @ inv/invited} =(%new inv)))
++ ignored-adrs (skim adrs |=({@ @ inv/invited} =(%ignored inv)))
++ effect |=(fec/sole-effect [ost.bow %diff %sole-effect fec])
++ message
|= {now/time ask/@t inv/invited} ^- tank
=. now (sub now (mod now ~s1))
leaf+"ask: {<inv>} {<now>} {(trip ask)}"
::
++ put-mail |=({@ ask/@t inv/invited} =+(pax=(rash ask unix-path) [%sav pax `@t`inv]))
++ unix-path :: split into path of "name" and "extension"
;~ (glue dot)
(cook crip (star ;~(less dot next)))
;~(plug (cook crip (star next)) (easy ~))
==
::
++ poke-ask-admins
|= a/(set ship)
?> =(our.bow src.bow)
`+>.$(admins a)
::
++ poke-ask-mail
|= ask/@t
^- (quip {bone card} _+>)
~| have-mail+ask
?< (~(has by adr) ask)
=. adr (~(put by adr) ask now.bow %new) :: XX electroplating
:_ +>.$
=/ new [now.bow ask %new]
=+ [mez=[(message new)]~ pro=prompt sav=(put-mail new)]
%+ turn (prey /sole bow)
|=({ost/bone ^} (effect(ost.bow ost) %mor tan+mez pro+prompt sav ~))
::
++ poke-sole-action
|= act/sole-action
^- (quip {bone card} _+>)
=/ som (~(got by sos) ost.bow)
?- -.act
$clr `+>.$
$ret
?^ wom [[(effect mor+help)]~ +>.$] :: show help
?: =(~ buf.som) [[(effect txt+"Please enter womb ship")]~ +>.$]
=/ try (rose (tufa buf.som) fed:ag)
?. ?=({%& ^} try)
[[(effect bel+~)]~ +>.$]
=> .(wom p.try) :: XX TMI
(transmit set+~ pro+prompt ~) :: XX handle multiple links?
::
$det :: reject all input
=^ inv som (~(transceive sole som) +.act)
=. sos (~(put by sos) ost.bow som)
?~ wom
=/ try (rose (tufa buf.som) fed:ag)
?: -.try `+>.$
(transmit inv bel+~ ~)
?: =(`*`"?" buf.som) (transmit inv help)
?: =(`*`"a" buf.som) (transmit inv (render adrs) ~)
?: =(`*`"l" buf.som) (transmit inv (render new-adrs) ~)
?: =(`*`"i" buf.som) (transmit inv (render ignored-adrs) ~)
?: =(`*`"n" buf.som)
=/ new new-adrs
?~ new (transmit inv bel+~ ~)
=. inv.i.new %ignored
=. adr (~(put by adr) ask.i.new [tym inv]:i.new)
(transmit inv tan+[(message i.new)]~ pro+prompt ~)
?: =(`*`"y" buf.som)
=/ new new-adrs
?~ new (transmit inv bel+~ ~)
=. inv.i.new %sent :: XX pending
=- [[(invite ask.i.new) -<] ->]
=. adr (~(put by adr) ask.i.new [tym inv]:i.new)
(transmit inv tan+[(message i.new)]~ pro+prompt ~)
?: =(`*`"w" buf.som)
=> .(wom ~) :: XX TMI
(transmit inv pro+prompt ~)
(transmit inv bel+~ ~)
==
++ transmit
|= {inv/sole-edit mor/(list sole-effect)}
=/ som (~(got by sos) ost.bow)
=^ det som (~(transmit sole som) inv)
=. sos (~(put by sos) ost.bow som)
[[(effect mor+[det+det mor])]~ +>.$]
::
++ help
^- (list sole-effect)
=- (scan - (more (just '\0a') (stag %txt (star prn))))
%+ welp
?~ [new-adrs] ""
"""
y - invite current ask
n - ignore current ask
"""
"""
l - list new asks
i - list ignored asks
a - list all asks
w - reset womb ship
? - print help
"""
::
++ invite
|= ask/email
~| %ask-stub-invite
!!
--

View File

@ -50,7 +50,8 @@
++ prep
|= old=(unit state)
^- (quip move _this)
=/ launchnoun [%noun [%chat /chattile '/~chat/js/tile.js']]
=/ launcha/poke
[%launch-action [%chat /chattile '/~chat/js/tile.js']]
?~ old
=/ inboxpat /circle/inbox/config/group
=/ circlespat /circles/[(scot %p our.bol)]
@ -63,9 +64,9 @@
[ost.bol %peer circlespat [our.bol %hall] circlespat]
[ost.bol %connect / [~ /'~chat'] %chat]
[ost.bol %poke /chat [our.bol %hall] inboxi]
[ost.bol %poke /chat [our.bol %launch] launchnoun]
[ost.bol %poke /chat [our.bol %launch] launcha]
==
:- [ost.bol %poke /chat [our.bol %launch] launchnoun]~
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
this(sta u.old)
::
::
@ -477,7 +478,7 @@
:: +bound: lient tells us we successfully bound our server to the ~chat url
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
@ -485,7 +486,7 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
::
=+ request-line=(parse-request-line url.request.inbound-request)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -15,13 +15,13 @@
:: +card: output effect payload
::
+$ poke
$% [%noun [@tas path @t]]
$% [%launch-action [@tas path @t]]
==
::
+$ card
$% [%poke wire dock poke]
[%http-response =http-event:http]
[%connect wire binding:http-server term]
[%connect wire binding:eyre term]
[%diff %json json]
==
::
@ -32,18 +32,19 @@
++ this .
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
++ prep
|= old=(unit ~)
^- (quip move _this)
=/ launchnoun [%noun [%clock /tile '/~clock/js/tile.js']]
=/ launcha
[%launch-action [%clock /tile '/~clock/js/tile.js']]
:_ this
:~
[ost.bol %connect / [~ /'~clock'] %clock]
[ost.bol %poke /clock [our.bol %launch] launchnoun]
[ost.bol %poke /clock [our.bol %launch] launcha]
==
::
++ peer-tile
@ -60,7 +61,7 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
=/ request-line (parse-request-line url.request.inbound-request)
=/ back-path (flop site.request-line)

File diff suppressed because one or more lines are too long

View File

@ -1,610 +0,0 @@
::
:::: /app/collections/hoon
::
/? 309
/- hall
/+ collections
::
:: cols:
::
:: run collections-item renderer on children of /web/collections
:: combine with a bunted config in a +collection structure defined in
:: /lib/collections because the top level collection has no config file
::
:: whenever any of the clay files that compose this renderer change, this app
:: will recompile and the +prep arm will fire. we then check which files
:: changed and notify the corresponding hall circle of that change
::
/= cols
/^ collection:collections
/; |= a=(map knot item:collections)
[*config:collections a]
/: /===/web/collections /_ /collections-item/
::
=, collections
=, space:userlib
::
:: state:
::
:: stores the collection built by above by :cols so that we can compare old
:: and new versions whenever the rendered data changes
::
~% %landscape ..^is ~
|_ [bol=bowl:gall sta=state]
::
:: +this: app core subject
::
++ this .
::
:: +prep:
::
:: on initial boot, create top level hall circle for collections, called %c
::
:: on subsequent compiles, call +ta-update:ta on the old collection data,
:: then update state to store the new collection data
::
++ prep
~/ %land-prep
|= old=(unit state)
^- (quip move _this)
?~ old
:_ this
;: welp
=< ta-done
(~(ta-hall-create-circle ta ~ bol) /c 'collections')
::
:~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
[ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]
[ost.bol %peer /invites [our.bol %hall] /circle/i/grams]
::
:: ?. =(%duke (clan:title our.bol))
:: ~
:: :_ ~
:: :* ost.bol %poke /client-action [our.bol %hall]
:: %hall-action %source %inbox &
:: (sy [[(^sein:title our.bol) %urbit-meta] ~]~)
:: ==
==
==
?- -.u.old
%0
=/ mow=(list move)
=< ta-done
(~(ta-update ta ~ bol) col.u.old cols)
:- mow
%= this
sta [%0 cols str.u.old]
==
==
::
:: +mack:
::
:: recieve acknowledgement for permissions changes, print error if it failed
::
++ mack
|= [wir=wire err=(unit tang)]
^- (quip move _this)
?~ err
[~ this]
(mean u.err)
::
:: +coup: recieve acknowledgement for poke, print error if it failed
::
++ coup
|= [wir=wire err=(unit tang)]
^- (quip move _this)
?~ err
[~ this]
(mean u.err)
::
:: +poke-collections-action:
::
:: the main interface for creating and deleting collections and items
::
++ poke-collections-action
~/ %coll-poke-collections-action
|= act=action
^- (quip move _this)
?: =(who.act our.bol)
:_ this
=< ta-done
(~(ta-act ta ~ bol) act)
:: forward poke if its not meant for us
::
:_ this
:_ ~
:* ost.bol %poke
/forward-collections-action
[who.act %collections]
%collections-action act
==
::
:: +poke-json
::
:: utility for setting whether or not to display the onboarding page
::
++ poke-json
~/ %coll-poke-json
|= jon=json
^- (quip move _this)
?: ?=([%o [[%onboard %b ?] ~ ~]] jon)
:_ this
=< ta-done
(~(ta-write ta ~ bol) /web/landscape/onboard/json [%json !>(jon)])
[~ this]
::
:: +poke-collections-command
::
++ poke-collections-command
|= cod=command
^- (quip move _this)
?- -.cod
%chat-invite
:_ this
:- :* ost.bol
%poke
/permit
[our.bol %hall]
%hall-action
%permit
nom.cod
%.y
who.cod
==
%+ turn ~(tap in who.cod)
|= guy=@p
^- move
:* ost.bol
%poke
/invite
[our.bol %hall]
%hall-action
%phrase
aud=(sy [guy %i] ~)
ses=[%inv & our.bol nom.cod]~
==
::
%collection-invite
:_ this
:- :* ost.bol
%poke
/permit
[our.bol %hall]
%hall-action
%permit
nom.cod
%.y
who.cod
==
%+ turn ~(tap in who.cod)
|= guy=@p
^- move
:* ost.bol
%poke
/invite
[our.bol %hall]
%hall-action
%phrase
aud=(sy [guy %i] ~)
ses=[%app col.cod [%inv & our.bol nom.cod]]~
==
==
::
:: +peer:
::
++ peer
|= wir=wire
^- (quip move _this)
=/ response=streams
?+ wir
%= str.sta
env.inbox (scag 1.000 env.inbox.str.sta)
==
:: negative range from latest
::
[%primary @t ~]
=/ val=@ (slav %ud i.t.wir)
%= str.sta
env.inbox (scag val env.inbox.str.sta)
==
:: negative range from offset
::
[%primary @t @t ~]
=/ offset=@ (slav %ud i.t.wir)
=/ num=@ (slav %ud i.t.t.wir)
%= str.sta
env.inbox (swag [offset num] env.inbox.str.sta)
==
::
==
:_ this
[ost.bol %diff %collections-prize response]~
::
:: +reap: recieve acknowledgement for peer, retry on failure
::
++ reap
|= [wir=wire err=(unit tang)]
^- (quip move _this)
::~& reap+[wir =(~ err)]
?~ err
:: XX send message to users inbox
[~ this]
?~ wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
?+ i.wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
::
%circles
:_ this
[ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]~
::
%inbox
:_ this
[ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]~
::
%invites
:_ this
[ost.bol %peer /invites [our.bol %hall] /circle/i/grams]~
::
%our
?< ?=(~ t.wir)
:_ this
[ost.bol %peer /our/[i.t.wir] [our.bol %hall] /circle/[i.t.wir]/config]~
==
::
:: +quit:
::
++ quit
|= wir=wire
^- (quip move _this)
?~ wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
?+ i.wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
::
%circles
:_ this
[ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]~
::
%inbox
:_ this
[ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]~
::
%invites
:_ this
[ost.bol %peer /invites [our.bol %hall] /circle/i/grams]~
::
%our
?< ?=(~ t.wir)
:_ this
[ost.bol %peer /our/[i.t.wir] [our.bol %hall] /circle/[i.t.wir]/config]~
==
::
:: +diff-hall-prize:
::
++ diff-hall-prize
|= [wir=wire piz=prize:hall]
^- (quip move _this)
::
::
::~& prize+[wir piz]
?~ wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
?+ i.wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
::
:: %circles: subscribe to the configuration of each of our circles
::
%circles
?> ?=(%circles -.piz)
=/ noms=(set name:hall) (~(dif in cis.piz) (sy ~[%inbox %i %public]))
:_ this(our-circles.str.sta (~(uni in our-circles.str.sta) noms))
^- (list move)
%+ turn ~(tap in noms)
|= nom=name:hall
^- move
[ost.bol %peer /our/[nom] [our.bol %hall] /circle/[nom]/config]
::
:: %inbox: fill inbox config, messages and remote configs with prize data
::
%inbox
?> ?=(%circle -.piz)
:- ~
%= this
con.inbox.str.sta `loc.cos.piz
::
env.inbox.str.sta nes.piz
::
circles.str.sta
%- ~(uni in circles.str.sta)
^- (map circle:hall (unit config:hall))
(~(run by rem.cos.piz) |=(a=config:hall `a))
==
::
:: %invites: fill invite messages with prize data
::
%invites
?> ?=(%circle -.piz)
:- ~
%= this
invites.str.sta nes.piz
==
::
:: %our:
::
%our
?> ?=(%circle -.piz)
=/ nom=name:hall &2:wir
:: XX todo: send rumor or let config-change handle it?
::
:- ~
%= this
circles.str.sta
(~(put by circles.str.sta) [our.bol nom] `loc.cos.piz)
::
our-circles.str.sta (~(put in our-circles.str.sta) nom)
==
==
::
:: +diff-hall-rumor
::
++ diff-hall-rumor
|= [wir=wire rum=rumor:hall]
^- (quip move _this)
::~& rumor+[wir rum]
?~ wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
=; upd=[mow=(list move) sta=_this]
:_ sta.upd
%+ welp mow.upd
%+ turn (prey:pubsub:userlib /primary bol)
|= [=bone *]
[bone %diff %hall-rumor rum]
?+ i.wir
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
::
:: %circles:
::
%circles
::~& %circles
?> ?=(%circles -.rum)
=? dms.str.sta
?& (is-dm-circle our.bol cir.rum)
!(~(has by dms.str.sta) cir.rum)
==
(~(put by dms.str.sta) cir.rum our.bol ~)
?: add.rum
:_ this(our-circles.str.sta (~(put in our-circles.str.sta) cir.rum))
[ost.bol %peer /our/[cir.rum] [our.bol %hall] /circle/[cir.rum]/config]~
:_ this(our-circles.str.sta (~(del in our-circles.str.sta) cir.rum))
[ost.bol %pull /our/[cir.rum] [our.bol %hall] ~]~
::
:: %inbox:
::
%inbox
?> ?=(%circle -.rum)
?+ -.rum.rum
::~& inbox-unprocessed-rumor+rum.rum
[~ this]
::
:: %remove:
::
%remove
::~& %inbox-remove
::~& %removed-story
[~ this]
::
:: %gram: inbox has recieved messages
::
%gram
::~& %inbox-gram
:: XX TODO: handle stack trace message when foreign circle is killed?
::
?: (is-dm-circle src.rum.rum)
=/ dms=[ini=ship env=(list envelope:hall)]
(~(got by dms.str.sta) nom.src.rum.rum)
=. env.dms [nev.rum.rum env.dms]
:- ~
%= this
env.inbox.str.sta [nev.rum.rum env.inbox.str.sta]
dms.str.sta (~(put by dms.str.sta) nom.src.rum.rum dms)
==
:- ~ ::(send-rumor [%new-msg %inbox nev.rum.rum])
this(env.inbox.str.sta [nev.rum.rum env.inbox.str.sta])
::
:: %config: inbox config has changed
::
%config
=* circ cir.rum.rum
?+ -.dif.rum.rum
::~& inbox-unprocessed-config+dif.rum.rum
[~ this]
::
:: %remove: circle has been erased
::
%remove
::~& %inbox-config-remove
:- ~ ::(send-rumor %config-change cir.rum.rum ~)
%= this
circles.str.sta
(~(del by circles.str.sta) cir.rum.rum)
==
::
:: %source: the sources of our inbox have changed
::
%source
::~& %inbox-config-source
?. =(circ [our.bol %inbox])
[~ this]
:: we've added a source to our inbox
::
?> ?=(^ con.inbox.str.sta)
?: add.dif.rum.rum
=/ conf=config:hall
%= u.con.inbox.str.sta
src (~(put in src.u.con.inbox.str.sta) src.dif.rum.rum)
==
:- ~ ::(send-rumor %config-change [our.bol %inbox] `conf)
%= this
con.inbox.str.sta `conf
::
circles.str.sta
?: (~(has by circles.str.sta) cir.src.dif.rum.rum)
circles.str.sta
(~(put by circles.str.sta) cir.src.dif.rum.rum ~)
==
:: we've removed a source from our inbox
::
=/ conf=config:hall
%= u.con.inbox.str.sta
src (~(del in src.u.con.inbox.str.sta) src.dif.rum.rum)
==
::~& inbox+conf
:- ~ ::(send-rumor %config-change [our.bol %inbox] `conf)
%= this
con.inbox.str.sta `conf
::
circles.str.sta
?: =(our.bol hos.cir.src.dif.rum.rum)
circles.str.sta
(~(del by circles.str.sta) cir.src.dif.rum.rum)
==
::
:: %full: recieved a full config update for one of our sources
::
%full
::~& %inbox-config-full
=* conf cof.dif.rum.rum
:- ~ ::(send-rumor %config-change circ `conf)
%= this
circles.str.sta (~(put by circles.str.sta) circ `conf)
==
::
:: %read: recieved a read reciept
::
%read
?. =([our.bol %inbox] cir.rum.rum)
[~ this]
?> ?=(^ con.inbox.str.sta)
:- ~
%= this
red.u.con.inbox.str.sta red.dif.rum.rum
==
==
==
::
:: %invites:
::
%invites
::~& %invites
?> ?=(%circle -.rum)
?> ?=(%gram -.rum.rum)
?+ -.sep.gam.nev.rum.rum
[~ this(invites.str.sta [nev.rum.rum invites.str.sta])]
::
%inv
=/ circ=circle:hall cir.sep.gam.nev.rum.rum
?: (is-dm-circle circ)
=/ who=(set ship) (sy (rash nom.circ (more dot fed:ag)))
=/ act=poke [%hall-action %newdm who]
:- [ost.bol %poke /join-dm [our.bol %hall] act]~
%= this
invites.str.sta [nev.rum.rum invites.str.sta]
dms.str.sta (~(put by dms.str.sta) nom.circ hos.circ ~)
==
=/ act=poke [%hall-action %source %inbox & (sy [circ ~] ~)]
:- ~
this(invites.str.sta [nev.rum.rum invites.str.sta])
==
::
:: %our:
::
%our
?> ?=(%circle -.rum)
?+ -.rum.rum
::~& our-unprocessed-rumor+rum.rum
[~ this]
::
:: %remove:
::
%remove
::~& %our-remove
[~ this]
::
:: %config:
::
%config
=* circ cir.rum.rum
=* diff dif.rum.rum
?+ -.diff
::~& our-unprocessed-config+diff
[~ this]
::
:: %full: recieved a full config update for one of our sources
::
%full
::~& %our-config-full
=* conf cof.dif.rum.rum
:- ~ ::(send-rumor %config-change circ `conf)
%= this
circles.str.sta (~(put by circles.str.sta) circ `conf)
==
::
:: %read: recieved a read reciept
::
%read
=/ conf (need (~(got by circles.str.sta) circ))
=. red.conf red.dif.rum.rum
:- ~
%= this
circles.str.sta (~(put by circles.str.sta) circ `conf)
==
==
==
==
::
:: +send-rumor: send a rumor to all subscribers
::
++ send-rumor
|= rum=rumor
::~& send-rumor+rum
^- (list move)
%+ turn (prey:pubsub:userlib /primary bol)
|= [=bone *]
[bone %diff %collections-rumor rum]
::
:: +poke-noun: debugging stuff
::
++ poke-noun
|= a=@tas
^- (quip move _this)
?+ a
[~ this]
::
%check-all-subs
~& 'here are all incoming subs'
~& ^- (list (pair ship path))
%+ turn ~(tap by sup.bol)
|= [b=bone s=ship p=path]
^- (pair ship path)
[s p]
[~ this]
::
%print-state
~& str.sta
[~ this]
::
%rebuild-subs
:_ this
:~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]
[ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]
[ost.bol %peer /invites [our.bol %hall] /circle/i/grams]
==
==
::
++ is-dm-circle
|= circ=circle:hall
^- ?
?= ^
(rush nom.circ (more dot fed:ag))
--

View File

@ -15,7 +15,7 @@
+$ in-poke-data
$% [%dns-authority =authority]
[%dns-bind =ship =target]
[%handle-http-request =inbound-request:http-server]
[%handle-http-request =inbound-request:eyre]
==
+$ out-poke-data
$% [%dns-bind =ship =target]
@ -62,7 +62,7 @@
^- @t
:: XX can't scry in +mule
::
:: =/ =hart:eyre .^(hart:eyre %r /(scot %p our)/host/real)
:: =/ =hart:eyre .^(hart:eyre %e /(scot %p our)/host/real)
(crip (en-purl:html [hart [~ path] ~]))
::
:: XX can't scry in +mule
@ -821,7 +821,7 @@
::
;< ~ bind:m
(send-request:stdio (retrieve-access-token:(oauth2-core bowl scry.pro.aut.nam) code))
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response:stdio
:: XX retry
::

View File

@ -12,7 +12,7 @@
==
+$ peek-data _!!
+$ in-poke-data
$% [%dns-auto ~]
$% [%dns-auto ames-domains=(list turf)]
[%dns-address =address:dns]
==
+$ out-poke-data
@ -125,12 +125,15 @@
:: +galaxy-domains
::
++ galaxy-domains
|= ames-domains=(list turf)
=/ m (async:stdio ,~)
^- form:m
;< our=@p bind:m get-identity:stdio
;< now=@da bind:m get-time:stdio
=/ ames-domains=(list turf)
.^((list turf) %j /(scot %p our)/turf/(scot %da now))
:: XX urbit/urbit#1314
::
:: ;< now=@da bind:m get-time:stdio
:: =/ ames-domains=(list turf)
:: .^((list turf) %j /(scot %p our)/turf/(scot %da now))
|- ^- form:m
=* loop $
?~ ames-domains
@ -194,7 +197,7 @@
::
~& %galaxy-only
(pure:m state)
;< ~ bind:m galaxy-domains
;< ~ bind:m (galaxy-domains ames-domains.in-poke-data)
(pure:m state)
::
:: manual dns binding -- by explicit ipv4

View File

@ -106,7 +106,7 @@
++ card :: general card
$% {$diff $sole-effect sole-effect} ::
{$send wire {ship term} clap} ::
[%request wire request:http outbound-config:http-client] :: %l
[%request wire request:http outbound-config:iris] :: %l
[%build wire ? schematic:ford]
[%kill wire ~]
{$deal wire sock term club} ::
@ -363,7 +363,7 @@
|= [way=wire =request:http]
^+ +>+>
?> ?=(~ pux)
(he-card(poy `+>+<(pux `way)) %request way request *outbound-config:http-client)
(he-card(poy `+>+<(pux `way)) %request way request *outbound-config:iris)
::
++ dy-stop :: stop work
^+ +>
@ -951,7 +951,7 @@
:: +he-http-response: result from http-client
::
++ he-http-response
|= [way=wire response=client-response:http-client]
|= [way=wire response=client-response:iris]
^+ +>
?> ?=(^ poy)
=< he-pine
@ -960,7 +960,7 @@
+>
::
~! response
%. [%httr !>((to-httr:http-client response-header.response full-file.response))]
%. [%httr !>((to-httr:iris response-header.response full-file.response))]
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
{$hand ~} dy-hand:dye

View File

@ -1,104 +0,0 @@
::
:: /app/fora/hoon
::
::TODO maybe stop relying on %hood one day.
::
/- hall
/+ hall, time-to-id
=, format
=, title
::
|%
++ move (pair bone card)
++ card
$% {$poke wire dock poke}
{$info wire @p toro:clay}
==
++ poke
$% {$hall-action action:hall}
{$write-fora-post spur ship cord cord}
{$write-comment spur ship cord}
==
--
::
|_ {bol/bowl:gall ~}
::
++ prep
|= old/(unit ~)
^- (quip move _..prep)
?^ old [~ ..prep(+<+ u.old)]
:_ ..prep
:~ (act %create %fora-posts 'fora posts' %journal)
(act %create %fora-comments 'fora comments' %journal)
==
::
++ act
|= a/action:hall
^- move
[ost.bol %poke / [our.bol %hall] %hall-action a]
::
++ ra-base-hart .^(hart:eyre %r /(scot %p our.bol)/host/(scot %da now.bol))
::
++ poke-fora-post
|= {pax/path sup/spur hed/@t txt/@t}
^- (quip move _+>)
:_ +>
::
:: if txt is blank then return no moves.
::
?: ?=(^ (rush txt spac:de-json:html)) ~
::
:: otherwise, post the content.
::
:~ %- act
:+ %phrase [[our.bol %fora-posts] ~ ~]
:_ ~
:+ %app dap.bol
:+ %fat
:+ %name
(crip "post by {(cite src.bol)}: {(trip hed)}")
text+(to-wain txt)
=. pax (welp pax /posts/(crip "{<now.bol>}~"))
[%url [ra-base-hart `pax ~] ~]
::
:* ost.bol
%poke
/fora-post
[our.bol %hood]
[%write-fora-post sup src.bol hed txt]
==
==
::
++ poke-fora-comment
|= {pax/path sup/spur txt/@t}
^- (quip move _+>)
:_ +>
::
:: if txt is blank then return no moves.
::
?: ?=(^ (rush txt spac:de-json:html)) ~
::
:: otherwise, post the content.
::
:~ ^- move
%- act
:+ %phrase [[our.bol %fora-comments] ~ ~]
:_ ~
:+ %app dap.bol
^- speech:hall
:+ %fat
:+ %name
=+ nam=?~(sup "" (trip i.sup))
(crip "comment by {(cite src.bol)} on /{nam}")
text+(to-wain txt)
=+ fra=(crip (time-to-id now.bol))
[%url [ra-base-hart `pax ~] `fra]
::
:* ost.bol
%poke
/fora-comment
[our.bol %hood]
[%write-comment sup src.bol txt]
==
==
--

View File

@ -129,7 +129,6 @@
:: :: ::
++ coup-drum-phat (wrap take-coup-phat):from-drum
++ coup-helm-hi (wrap coup-hi):from-helm
++ coup-helm-ask (wrap coup-ask):from-helm
++ coup-kiln-fancy (wrap take-coup-fancy):from-kiln
++ coup-kiln-reload (wrap take-coup-reload):from-kiln
++ coup-kiln-spam (wrap take-coup-spam):from-kiln
@ -160,13 +159,9 @@
++ poke-helm-reset (wrap poke-reset):from-helm
++ poke-helm-serve (wrap poke-serve):from-helm
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-send-ask (wrap poke-send-ask):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):from-helm
++ poke-helm-nuke (wrap poke-nuke):from-helm
++ poke-helm-tlon-add-fora (wrap poke-tlon-add-fora):from-helm
++ poke-helm-tlon-add-stream (wrap poke-tlon-add-stream):from-helm
++ poke-helm-tlon-init-stream (wrap poke-tlon-init-stream):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm
++ poke-helm-bonk (wrap poke-bonk):from-helm
@ -192,10 +187,6 @@
++ poke-kiln-permission (wrap poke-permission):from-kiln
++ poke-write-sec-atom (wrap poke-sec-atom):from-write
++ poke-write-paste (wrap poke-paste):from-write
++ poke-write-comment (wrap poke-comment):from-write
++ poke-write-fora-post (wrap poke-fora-post):from-write
++ poke-write-plan-info (wrap poke-plan-info):from-write
++ poke-write-plan-account (wrap poke-plan-account):from-write
++ poke-write-tree (wrap poke-tree):from-write
++ poke-write-wipe (wrap poke-wipe):from-write
++ quit-drum-phat (wrap quit-phat):from-drum

View File

@ -1,5 +1,4 @@
/+ *server, collections
/+ *server, launch
/= index
/^ $-(marl manx)
/: /===/app/launch/index /!noun/
@ -21,23 +20,7 @@
/^ (map knot @)
/: /===/app/launch/img /_ /png/
::
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:http-server term]
[%peer wire dock path]
[%diff %json json]
==
+$ tile [name=@tas subscribe=path]
+$ tile-data (map @tas [jon=json url=@t])
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
--
=, launch
::
|_ [bol=bowl:gall sta=state]
::
@ -46,32 +29,37 @@
++ prep
|= old=(unit state)
^- (quip move _this)
~& 'launch prep'
?~ old
:_ this
[ost.bol %connect / [~ /] %launch]~
[~ this(sta u.old)]
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
++ poke-launch-action
|= act=action:launch
^- (quip move _this)
[~ this]
::
++ poke-noun
|= [name=@tas subscribe=path url=@t]
^- (quip move _this)
=/ beforedata (~(get by data.sta) name)
=/ beforedata (~(get by data.sta) name.act)
=/ newdata
?~ beforedata
(~(put by data.sta) name [*json url])
(~(put by data.sta) name [jon.u.beforedata url])
:- [ost.bol %peer subscribe [our.bol name] subscribe]~
(~(put by data.sta) name.act [*json url.act])
(~(put by data.sta) name.act [jon.u.beforedata url.act])
:- [ost.bol %peer subscribe.act [our.bol name.act] subscribe.act]~
%= this
tiles.sta (~(put in tiles.sta) [name subscribe])
tiles.sta (~(put in tiles.sta) [name.act subscribe.act])
data.sta newdata
path-to-tile.sta (~(put by path-to-tile.sta) subscribe name)
path-to-tile.sta (~(put by path-to-tile.sta) subscribe.act name.act)
==
::
++ peer-main
|= [pax=path]
^- (quip move _this)
=/ data/json
%- pairs:enjs:format
%+ turn ~(tap by data.sta)
|= [key=@tas [jon=json url=@t]]
[key jon]
:_ this
[ost.bol %diff %json data]~
::
++ diff-json
|= [pax=path jon=json]
^- (quip move _this)
@ -89,17 +77,6 @@
data.sta (~(put by data.sta) name [jon url.u.data])
==
::
++ peer-main
|= [pax=path]
^- (quip move _this)
=/ data/json
%- pairs:enjs:format
%+ turn ~(tap by data.sta)
|= [key=@tas [jon=json url=@t]]
[key jon]
:_ this
[ost.bol %diff %json data]~
::
++ generate-script-marl
|= data=tile-data
^- marl
@ -110,12 +87,12 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
::
=+ request-line=(parse-request-line url.request.inbound-request)
=/ request-line (parse-request-line url.request.inbound-request)
=/ name=@t
=+ back-path=(flop site.request-line)
=/ back-path (flop site.request-line)
?~ back-path
''
i.back-path
@ -148,4 +125,9 @@
[ost.bol %http-response (png-response:app img)]~
==
::
++ bound
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
--

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
:: +card: output effect payload
::
+$ card
$% [%connect wire binding:http-server term]
$% [%connect wire binding:eyre term]
[%http-response =http-event:http]
[%peel wire dock mark path]
[%poke wire dock poke]
@ -41,13 +41,13 @@
:: alerts us that we were bound. we need this because the vane calls back.
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
++ poke-handle-http-request
%- (require-authorization:app ost.bow move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
?^ job.state
:_ this
@ -101,7 +101,7 @@
:: +poke-handle-http-cancel: received when a connection was killed
::
++ poke-handle-http-cancel
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
:: the only long lived connections we keep state about are the stream ones.
::

View File

@ -6,8 +6,8 @@
:: +card: output effect payload
::
+$ card
$% [%connect wire binding:http-server term]
[%disconnect wire binding:http-server]
$% [%connect wire binding:eyre term]
[%disconnect wire binding:eyre]
[%http-response =http-event:http]
==
::
@ -28,7 +28,7 @@
:: alerts us that we were bound. we need this because the vane calls back.
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
@ -44,7 +44,7 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bow move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
[[ost.bow %http-response (js-response:app session-js)]~ this]
::

View File

@ -1,214 +0,0 @@
|%
:: +move: output effect
::
+$ move [bone card]
:: +card: output effect payload
::
+$ card
$% [%connect wire [(unit @t) (list @t)] %server]
[%wait wire @da]
[%http-response =http-event:http]
[%diff %json json]
==
--
:: utilities:
::
|%
::
++ parse-request-line
|= url=@t
^- [[(unit @ta) site=(list @t)] args=(list [key=@t value=@t])]
(fall (rush url ;~(plug apat:de-purl:html yque:de-purl:html)) [[~ ~] ~])
:: +hello:
::
++ hello
|= name=@t
^- octs
%- as-octs:mimes:html
%- crip
%- en-xml:html
;html
;head
;title:"Hello, {(trip name)}"
==
;body
;h1:"Hello, {(trip name)}"
;p
; Time is
;span#time:"?????"
==
;button#start:"Start Timer"
;button#poke:"Random Poke"
;script(type "module", src "/~server/hello.js");
==
==
::
++ hello-js
^- octs
%- as-octs:mimes:html
'''
import * as urb from '/~/channel/channel.js';
var c = urb.newChannel();
// The poke button just sends a poke
document.getElementById("poke").addEventListener("click", function(){
c.poke("zod", "server", "json", 5,
function() {
console.log("Poke worked");
},
function(err) {
console.log("Poke failed: " + err);
});
});
function doSubs() {
// The subscription sends the time which makes the thing work.
//
c.subscribe("zod", "server", "/timer",
function(err) {
console.log("Failed initial connection: " + err);
},
function(json) {
console.log("Subscription update: ", json);
var message = document.getElementById("time");
message.innerHTML = json;
},
function() {
console.log("Subscription quit");
// resubscribe because Gall is broken
//
// Galls queuing mechanism is broken and will
// break subscriptions whenever 20 messages have
// been sent.
//
doSubs();
});
}
doSubs();
'''
:: +require-authorization: redirect to the login page when unauthenticated
::
++ require-authorization
|* [=bone move=mold this=*]
|= handler=$-(inbound-request:http-server (quip move _this))
|= =inbound-request:http-server
^- (quip move _this)
::
?: authenticated.inbound-request
(handler inbound-request)
::
:_ this
^- (list move)
=/ redirect=cord
%- crip
"/~/login?redirect={(trip url.request.inbound-request)}"
[bone [%http-response %start [307 ['location' redirect]~] ~ %.y]]~
--
|%
::
+$ state
$: next-timer=(unit @da)
==
--
::
|_ [bow=bowl:gall state]
::
++ this .
::
++ prep
|= old=(unit state)
^- (quip move _this)
~& %prep
:- [`move`[ost.bow [%connect / [~ /'~server'] %server]] ~]
?~ old
this
this(+<+ u.old)
:: alerts us that we were bound. we need this because the vane calls back.
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
~& [%bound success]
[~ this]
::
:: +wake: responds to a %wait send from +handle-start-stream
::
++ wake
|= [wir=wire ~]
^- (quip move _this)
::
~& [%timer-tick wir now.bow]
::
=/ moves=(list move)
%+ turn (prey:pubsub:userlib /timer bow)
|= [=bone ^]
[bone %diff %json %s (scot %da now.bow)]
:: if we have outbound moves, say that we have another timer.
::
=. next-timer
?: ?=(^ moves)
`(add now.bow ~s1)
~
:: if we have any subscribers, add another timer for the future
::
=? moves ?=(^ moves)
[[ost.bow %wait /timer (add now.bow ~s1)] moves]
::
[moves this]
:: +poke-handle-http-request: received on a new connection established
::
++ poke-handle-http-request
%- (require-authorization ost.bow move this)
|= =inbound-request:http-server
^- (quip move _this)
::
=+ request-line=(parse-request-line url.request.inbound-request)
~& [%request-line request-line]
=/ name=@t
=+ back-path=(flop site.request-line)
?~ back-path
'World'
i.back-path
::
?: =(name 'hello')
:_ this
:~ ^- move
:- ost.bow
:* %http-response
[%start [200 ['content-type' 'application/javascript']~] [~ hello-js] %.y]
==
==
::
:_ this
:~ ^- move
:- ost.bow
:* %http-response
[%start [200 ['content-type' 'text/html']~] [~ (hello name)] %.y]
==
==
:: +poke-handle-http-cancel: received when a connection was killed
::
++ poke-handle-http-cancel
|= =inbound-request:http-server
^- (quip move _this)
:: the only long lived connections we keep state about are the stream ones.
::
[~ this]
::
++ poke-json
|= =json
^- (quip move _this)
~& [%poke-json json]
[~ this]
::
++ peer-timer
|= pax/path
^- (quip move _this)
:: if we don't have a timer, set a timer.
?: ?=(^ next-timer)
[~ this]
::
:- [ost.bow %wait /timer (add now.bow ~s1)]~
this(next-timer `(unit @da)`[~ (add now.bow ~s1)])
--

View File

@ -152,19 +152,8 @@
++ skip-completely
^~ ^- (map path tape)
%- my :~ ::TODO don't hardcode
:- /ren/css "not meant to be called outside /web/pack"
:- /ren/js "not meant to be called outside /web/pack"
:- /ren/run "not meant to be called except on a (different) hoon file"
:- /ren/collections "temporarily disabled"
:- /ren/rss-xml "scrys into eyre"
:- /ren/test-gen "temporarily disabled"
:- /ren/urb "temporarily disabled"
:- /ren/x-urb "temporarily disabled"
:- /ren/x-htm "temporarily disabled"
:- /ren/x-collections-snip "temporarily disabled"
:- /ren/x-collections-json "temporarily disabled"
::
:- /web/landscape "/$ doensn't work in tests"
==
::
++ failing

View File

@ -18,13 +18,13 @@
:: +card: output effect payload
::
+$ poke
$% [%noun [@tas path @t]]
$% [%launch-action [@tas path @t]]
==
::
+$ card
$% [%poke wire dock poke]
[%http-response =http-event:http]
[%connect wire binding:http-server term]
[%connect wire binding:eyre term]
[%diff %json json]
[%wait wire @da]
[%rest wire @da]
@ -37,18 +37,18 @@
++ this .
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
++ prep
|= old=(unit tim=@da)
^- (quip move _this)
=/ launchnoun [%noun [%timer /tile '/~timer/js/tile.js']]
=/ launcha [%launch-action [%timer /tile '/~timer/js/tile.js']]
:-
:~
[ost.bol %connect / [~ /'~timer'] %timer]
[ost.bol %poke /timer [our.bol %launch] launchnoun]
[ost.bol %poke /timer [our.bol %launch] launcha]
==
?~ old
this
@ -87,7 +87,7 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
=/ request-line (parse-request-line url.request.inbound-request)
=/ back-path (flop site.request-line)
@ -116,7 +116,10 @@
++ wake
|= [wir=wire err=(unit tang)]
^- (quip move _this)
:- (send-tile-diff [%s 'alarm'])
this(tim *@da)
?~ err
:- (send-tile-diff [%s 'alarm'])
this(tim *@da)
~& err
[~ this]
::
--

File diff suppressed because one or more lines are too long

View File

@ -21,12 +21,12 @@
$% [%poke wire dock poke]
[%http-response =http-event:http]
[%diff %json json]
[%connect wire binding:http-server term]
[%request wire request:http outbound-config:http-client]
[%connect wire binding:eyre term]
[%request wire request:http outbound-config:iris]
[%wait wire @da]
==
+$ poke
$% [%noun [@tas path @t]]
$% [%launch-action [@tas path @t]]
==
+$ state
$% [%0 data=json time=@da location=@t timer=(unit @da)]
@ -38,17 +38,19 @@
++ this .
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
++ prep
|= old=(unit state)
^- (quip move _this)
=/ launcha
[%launch-action [%weather /weathertile '/~weather/js/tile.js']]
:-
:~
[ost.bol %connect / [~ /'~weather'] %weather]
[ost.bol %poke /weather [our.bol %launch] [%noun [%weather /weathertile '/~weather/js/tile.js']]]
[ost.bol %poke /weather [our.bol %launch] launcha]
==
?~ old
this
@ -69,16 +71,15 @@
[~ this]
=/ str/@t +.jon
=/ req/request:http (request-darksky str)
=/ out *outbound-config:http-client
=/ out *outbound-config:iris
=/ lismov [ost.bol %request /[(scot %da now.bol)] req out]~
?~ timer
:- %+ weld
`(list move)`[ost.bol %wait /timer (add now.bol ~d1)]~
`(list move)`[ost.bol %request /[(scot %da now.bol)] req out]~
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
%= this
location str
timer `(add now.bol ~d1)
timer `(add now.bol ~h3)
==
:- [ost.bol %request /[(scot %da now.bol)] req out]~
:- lismov
%= this
location str
==
@ -101,37 +102,41 @@
[bone %diff %json jon]
::
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this)
:: ignore all but %finished
?. ?=(%finished -.response)
[~ this]
=/ data/(unit mime-data:http-client) full-file.response
=/ data/(unit mime-data:iris) full-file.response
?~ data
:: data is null
[~ this]
=/ jon/(unit json) (de-json:html q.data.u.data)
?~ jon
=/ ujon/(unit json) (de-json:html q.data.u.data)
?~ ujon
[~ this]
?> ?=(%o -.u.jon)
=/ ayyy/json %- pairs:enjs:format :~
currently+(~(got by p.u.jon) 'currently')
daily+(~(got by p.u.jon) 'daily')
?> ?=(%o -.u.ujon)
?: (gth 200 status-code.response-header.response)
~& weather+u.ujon
~& weather+location
[~ this]
=/ jon/json %- pairs:enjs:format :~
currently+(~(got by p.u.ujon) 'currently')
daily+(~(got by p.u.ujon) 'daily')
==
:- (send-tile-diff ayyy)
:- (send-tile-diff jon)
%= this
data ayyy
data jon
time now.bol
==
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
=+ request-line=(parse-request-line url.request.inbound-request)
=+ back-path=(flop site.request-line)
=/ request-line (parse-request-line url.request.inbound-request)
=/ back-path (flop site.request-line)
=/ name=@t
=+ back-path=(flop site.request-line)
=/ back-path (flop site.request-line)
?~ back-path
''
i.back-path
@ -150,12 +155,16 @@
++ wake
|= [wir=wire err=(unit tang)]
^- (quip move _this)
=/ req/request:http (request-darksky location)
=/ lismov/(list move)
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:http-client]~
?~ timer
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~h3)]~)
this(timer `(add now.bol ~h3))
[lismov this]
?~ err
=/ req/request:http (request-darksky location)
=/ out *outbound-config:iris
=/ lismov/(list move)
[ost.bol %request /[(scot %da now.bol)] req out]~
?~ timer
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
this(timer `(add now.bol ~h3))
[lismov this]
~& err
[~ this]
::
--

File diff suppressed because one or more lines are too long

View File

@ -47,15 +47,15 @@
[%diff diff]
[%build wire ? schematic:ford]
[%kill wire ~]
[%connect wire binding:http-server term]
[%connect wire binding:eyre term]
[%http-response http-event:http]
[%disconnect binding:http-server]
[%disconnect binding:eyre]
==
::
+$ poke
$% [%hall-action action:hall]
[%write-action action]
[%noun @tas path @t]
[%launch-action @tas path @t]
==
::
+$ diff
@ -188,7 +188,7 @@
:_ this(sat *state)
:~ [ost.bol %connect / [~ /'~publish'] %write]
:* ost.bol %poke /publish [our.bol %launch]
%noun %write /publishtile '/~publish/tile.js'
%launch-action %write /publishtile '/~publish/tile.js'
==
==
::
@ -314,7 +314,6 @@
%total
=? contributors.dat.del =(our.bol who.del)
(get-contributors col.del)
=. last-update.dat.del now.bol
=? pubs.sat =(our.bol who.del)
(~(put by pubs.sat) col.del dat.del)
=? subs.sat !=(our.bol who.del)
@ -1238,7 +1237,7 @@
==
::
++ bound
|= [wir=wire success=? binding=binding:http-server]
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
@ -1246,7 +1245,7 @@
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
::
=/ request-line (parse-request-line url.request.inbound-request)
@ -1432,7 +1431,7 @@
:: +poke-handle-http-cancel: received when a connection was killed
::
++ poke-handle-http-cancel
|= =inbound-request:http-server
|= =inbound-request:eyre
^- (quip move _this)
[~ this]
::

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,458 +0,0 @@
!:
:- %say
|= *
:- %noun
=- %hello
=> |%
++ tope :: topographic type
$@ $? %& :: cell or atom
%| :: atom
== ::
(pair tope tope) :: cell
--
|%
++ ax
=+ :* dom=`axis`1
doc=*(list what)
==
|_ mod/tile
++ home
:: express a hoon against the original subject
::
|=(gen/hoon ^-(hoon ?:(=(1 dom) gen [%tsgr [%$ dom] gen])))
::
++ default
:: produce a hoon that makes the model's default value, untyped
::
|- ^- hoon
?- mod
{^ *}
[$(mod -.mod) $(mod +.mod)]
::
{$axil *}
?+ p.mod [%rock %$ 0]
$cell [[%rock %$ 0] [%rock %$ 0]]
$void [%zpzp ~]
==
::
{$bark *}
$(mod q.mod)
::
{$herb *}
=+ cys=~(boil ap p.mod)
?: ?=($herb -.cys)
(home [%tsgl [%limb %$] p.mod])
$(mod cys)
::
{$deet *}
$(mod q.mod)
::
{$fern *}
:: last entry is the default value
::
|- ^- hoon
?~(t.p.mod ^$(mod i.p.mod) $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod))
::
{$kelp *}
:: last entry is the default value
::
|- ^- hoon
?~(t.p.mod ^$(mod i.p.mod) $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod))
::
{$leaf *}
[%rock p.mod q.mod]
::
{$plow *}
$(mod q.mod)
::
{$reed *}
$(mod p.mod)
::
{$vine *}
$(mod q.mod)
::
{$weed *}
(home p.mod)
==
::
++ trivial
:: ersatz by trivial construction
::
^- hoon
:+ %tsls
[%bust %noun]
~(construct sample [2 %|])
::
++ basic
|= bas/base
?- bas
::
{$atom *}
:: trivial zero
::
[%sand p.bas 0]
::
$noun
:: raw nock produces noun type
::
=+([%rock %$ 0] [%ktls [%dttr - - [%rock %$ 1]] -])
::
$cell
:: reduce to pair of nouns
::
=+($(mod [%axil %noun]) [- -])
::
$bean
:: comparison produces boolean type
::
=+([%rock %$ 0] [%ktls [%dtts - -] -])
::
$null
[%rock %n 0]
::
$void
:: should not actually be a thing
::
[%zpzp ~]
==
::
++ decorate
:: document
::
|= gen/hoon
^- hoon
?~ doc gen
=/ fin $(doc t.doc)
?~(i.doc gen [%docs u.i.doc gen])
::
++ ersatz
:: produce a correctly typed instance without subject
::
^- hoon
?- mod
{^ *}
%- decorate
=. doc ~
[ersatz(mod -.mod) ersatz(mod +.mod)]
::
{$axil *}
(decorate (basic p.mod))
::
{$bark *}
[%ktts p.mod ersatz(mod q.mod)]
::
{$herb *}
%- decorate
=. doc ~
=+ cys=~(boil ap p.mod)
?: ?=($herb -.cys)
(home [%tsgl [%limb %$] p.mod])
ersatz(mod cys)
::
{$deet *}
[%dbug p.mod ersatz(mod q.mod)]
::
{$fern *}
trivial
::
{$kelp *}
trivial
::
{$leaf *}
(decorate [%rock p.mod q.mod])
::
{$plow *}
ersatz(mod q.mod, doc [p.mod doc])
:: atom/cell, $@
::
{$reed *}
trivial
:: pair/switch, $^
::
{$vine *}
trivial
::
{$weed *}
(home p.mod)
==
::
++ factory
:: produce a normalizing gate (mold)
::
^- hoon
:^ %brts ~^~
[%base %noun]
~(construct sample [6 %&])
::
++ sample
:: normalize a sample of the subject
::
|_ $: :: axe: axis to sample
:: top: topographic type of sample
::
axe/axis
top/tope
==
++ basic
|= bas/base
:: apply documentation
::
?^ doc document
?- bas
{%atom *}
:: rez: fake instance
::
=/ rez ersatz
?^ top rez
?: =(%| top)
:: xx sanitize
::
fetch
[%wtpt fetch-wing fetch rez]
::
$noun
fetch
::
$cell
?^ top fetch
:: rez: fake instance
::
=/ rez ersatz
?: =(%| top)
rez
[%wtpt fetch-wing rez fetch]
::
$bean
?^ top ersatz
:^ %wtcl
[%dtts [%rock %$ |] [%$ axe]]
[%rock %f |]
[%rock %f &]
::
$null
ersatz
::
$void
ersatz
==
++ fetch
:: load the sample
::
^- hoon
[%$ axe]
::
++ fetch-wing
:: load, as a wing
::
^- wing
[[%& axe] ~]
::
++ choice
:: match full models, by trying them
::
|= $: :: one: first option
:: rep: other options
::
one/tile
rep/(list tile)
==
^- hoon
:: if no other choices, construct head
::
?~ rep construct(mod one)
:: fin: loop completion
::
=/ fin/hoon $(one i.rep, rep t.rep)
:: new: trial product
:: old: original subject
::
=/ new [%$ 2]
=* old [%$ 3]
:: build trial noun
::
:+ %tsls
:: build the sample with the first option
::
construct(mod one)
:: build test
::
:^ %wtcl
:: if the trial noun equals the sample
::
[%dtts new fetch]
:: produce the trial noun
::
new
:: continue with the original subject
::
[%tsgr old fin]
::
++ switch
|= $: :: one: first format
:: two: more formats
::
one/line
rep/(list line)
==
^- hoon
:: if no other choices, construct head
::
?~ rep construct(mod `tile`one)
:: fin: loop completion
::
=/ fin/hoon $(one i.rep, rep t.rep)
:: interrogate this instance
::
:^ %wtcl
:: test if we match this wing
::
[%wtts p.i.rep fetch-wing]
:: use this format
::
:- `hoon`p.i.rep
construct(mod q.i.rep, top &, axe (peg axe 3))
:: continue in the loop
::
fin
::
++ probe
:: probe for cell or default
::
^- hoon
:: against constructor
::
:+ %tsgr
:: constructor trap
::
:+ %brdt ~^~
:: construct within trap
::
%= construct
:: old context within trap context
::
dom (peg 3 dom)
:: old sample within trap sample
::
axe (peg 3 axe)
:: only kick trap if sample is known cell
::
top [& &]
==
:: boc: call constructor
:: but: default, but coerce type to call
::
=/ boc/hoon [%limb %$]
=/ but/hoon [%ktls boc default]
?: =(& top)
:: may be atom or cell; default or construct
::
[%wtpt fetch-wing but boc]
:: must be atom; construct
::
but
::
++ document
:: document and construct
::
|- ^- hoon
?~ doc construct
=/ fin $(doc t.doc)
?~(i.doc fin [%docs u.i.doc fin])
::
++ construct
:: constructor at arbitrary sample
::
^- hoon
?- mod
::
:: cell
::
{^ *}
:: apply help
::
?^ doc document
:: probe unless we know the sample is a cell
::
?@ top probe
:: if known cell, descend directly
::
:- construct(mod -.mod, top p.top, axe (peg axe 2))
construct(mod +.mod, top q.top, axe (peg axe 3))
::
:: base
::
{$axil *}
(basic p.mod)
::
:: name, $=
::
{$bark *}
[%ktts p.mod construct(mod q.mod)]
::
:: debug
::
{$deet *}
[%dbug p.mod construct(mod q.mod)]
::
:: choice, $?
::
{$fern *}
(choice i.p.mod t.p.mod)
::
:: synthesis, $;
::
{$herb *}
?^ doc document
=+ cys=~(boil ap p.mod)
?: ?=($herb -.cys)
[%cnhp (home p.mod) fetch ~]
construct(mod cys)
::
:: switch, $%
::
{$kelp *}
:: if atom or unknown, probe
::
?@ top probe
:: if cell, enter switch directly
::
(switch i.p.mod t.p.mod)
::
:: constant
::
{$leaf *}
(decorate [%rock p.mod q.mod])
::
:: documentation
::
{$plow *}
construct(doc [p.mod doc], mod q.mod)
::
:: branch, $@
::
{$reed *}
?^ doc document
?@ top
?: =(%| top)
construct(mod p.mod)
[%wtpt fetch-wing construct(mod p.mod) construct(mod q.mod)]
construct(mod q.mod)
::
:: bridge, $^
::
{$vine *}
?^ doc document
?@ top probe
:^ %wtpt
fetch-wing(axe (peg axe 2))
construct(mod q.mod)
construct(mod p.mod)
::
:: weed, $_
::
{$weed *}
(decorate (home p.mod))
==
--
--
--

View File

@ -1,15 +0,0 @@
:: Set admin users
::
:::: /hoon/admins/ask/gen
::
/? 310
::
::::
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{who/(list ship) ~}
==
:- %ask-admins ^- (set ship)
~? =(~ who) %admins-unset
(silt who)

View File

@ -1,57 +0,0 @@
!:
:- %say
|= *
:- %noun
=- "hello, world"
|%
+$ scan [=loop=(map =@ud =xray) =xray]
+$ xray
$~ %noun
$@ $? %noun
%void
==
$% :: %bark: atom selection
::
[%bark =(map atom aura)]
:: %bush: head-of-cell superposition
::
[%bush wide=xray tall=xray]
:: %cell: ordered pair
::
[%cell head=xray tail=xray]
:: %core: functional attribute battery
::
[%core =vair =xray =(map term (map term xray))]
:: %face: namespace
::
[%face =term =xray]
:: %fork: disordered superposition
::
[%fork =(set xray)]
:: %hint: context-preserving type hint
::
[%hint [=type =note] =xray]
:: %knot: recursion root
::
[%knot =(set @ud) =xray]
:: %loop: recursion point
::
[%loop index=@ud]
:: %rock: constant
::
[%rock =atom =aura]
:: %root: atom/cell superposition
::
[%root flat=xray deep=xray]
:: %sand: variable atom
::
[%sand =aura]
:: %wood: tagged superposition
::
[%wood =(map atom (pair aura xray))]
==
++ foo
|= bar=xray
!!
--

View File

@ -13,7 +13,7 @@
=* our p.bec
:: XX must be evaluated outside tapp core due to +mule
::
=/ =hart:eyre .^(hart:eyre %r /(scot %p our)/host/real)
=/ =hart:eyre .^(hart:eyre %e /(scot %p our)/host/real)
:: XX terrible
=/ domain /com/googleapis
=/ code

View File

@ -6,7 +6,7 @@
/+ *generators
:- %ask
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
^- (sole-result [%dns-auto ~])
^- (sole-result [%dns-auto (list turf)])
=* our p.bec
=/ rac (clan:title our)
::
@ -23,4 +23,7 @@
%+ print leaf+msg3
%+ print leaf+msg2
(print leaf+msg1 no-product)
(produce [%dns-auto ~])
::
=/ ames-domains=(list turf)
.^((list turf) %j /(scot %p our)/turf/(scot %da now))
(produce [%dns-auto ames-domains])

View File

@ -1,11 +0,0 @@
:: Request a planet from Tlon Inc.
::
:::: /hoon/ask/hood/gen
::
/? 310
:- %say
|= {^ {mel/cord ~} ~}
=+ adr=(star ;~(less (mask "\"\\()[],:;<>@") prn))
=+ dom=[;~(plug dlab dot (most dot dlab))]:de-purl:html
=+ ~|(bad-email+mel (rash mel ;~((glue vat) adr dom)))
helm-send-ask+mel

View File

@ -1,14 +0,0 @@
:: Eyre: set web root
::
:::: /hoon/serve/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
~
~
==
[%helm-serve [~ /] [%home /gen/frontpage/hoon ~]]

View File

@ -1,13 +0,0 @@
:: Helm: break arvo somehow?? XX unknown
::
:::: /hoon/deset/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{arg/~ ~}
==
[%helm-deset ~]

View File

@ -1,11 +0,0 @@
:: tlon: add fora notifications to local urbit-meta
::
:: make the local urbit-meta pull from {for}'s fora notification channels.
::
:::: /gen/hood/tlon/add-fora/hoon
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{{for/ship ~} ~}
==
[%helm-tlon-add-fora for]

View File

@ -1,11 +0,0 @@
:: tlon: add stream to local urbit-meta
::
:: make the local urbit-meta pull from {web}'s stream.
::
:::: /gen/hood/tlon/add-stream/hoon
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{{web/ship ~} ~}
==
[%helm-tlon-add-stream web]

View File

@ -1,12 +0,0 @@
:: tlon: configure stream ship
::
:: create a local stream channel and have it pull from
:: {met}'s urbit-meta.
::
:::: /gen/hood/tlon/init-stream/hoon
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{{met/ship ~} ~}
==
[%helm-tlon-init-stream met]

View File

@ -6,7 +6,7 @@
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:http-server term]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
@ -24,7 +24,7 @@
::
+$ poke
$% [%hall-action action:hall]
[%noun [@tas path @t]]
[%launch-action [@tas path @t]]
==
::
+$ state

View File

@ -1,992 +0,0 @@
::
:::: /hoon/collections/lib
::
/? 309
/- hall
/+ cram, elem-to-react-json
:: ::
~% %collections-lib ..is ~
|%
+$ move [bone card]
::
+$ card
$% [%info wire toro:clay]
[%poke wire dock poke]
[%perm wire desk path rite:clay]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
::
+$ diff
$% [%collections-prize prize]
[%collections-rumor rumor]
[%hall-rumor rumor:hall]
==
::
+$ poke
$% [%hall-action action:hall]
[%collections-action action]
[%json json]
==
::
+$ state
$% [%0 col=collection str=streams]
==
::
+$ streams
$: :: inbox config and messages
::
inbox=[con=(unit config:hall) env=(list envelope:hall)]
:: names and configs of all circles we know about
::
circles=(map circle:hall (unit config:hall))
:: names of all circles we own
::
our-circles=(set name:hall)
:: list of messages in all our DM circles
::
dms=(map name:hall [ini=ship env=(list envelope:hall)])
:: all the DM invites we've received
::
invites=(list envelope:hall)
==
::
+$ prize
$: :: inbox config and messages
::
inbox=[con=(unit config:hall) env=(list envelope:hall)]
:: names and configs of all circles we know about
::
circles=(map circle:hall (unit config:hall))
:: names of all circles we own
::
our-circles=(set name:hall)
:: list of messages in all our DM circles
::
dms=(map name:hall [ini=ship env=(list envelope:hall)])
:: all the DM invites we've received
::
invites=(list envelope:hall)
==
::
+$ rumor
$% :: if config is given, either add new circle or update existing one
:: if config is nil then delete circle
::
[%config-change cir=circle:hall con=(unit config:hall)]
:: recieved a new inbox message or DM invite
::
[%new-msg nom=?(%inbox %invites) env=envelope:hall]
==
::
+$ command
$% [%chat-invite nom=name:hall who=(set ship)]
[%collection-invite nom=name:hall col=term who=(set ship)]
==
+$ collection [meta=config data=(map nom=knot =item)]
::
+$ item
$~ [%error ~]
$% [%collection col=collection]
[%raw raw=raw-item]
[%both col=collection raw=raw-item]
[%error ~]
==
::
+$ raw-item
$% [%udon meta=(map knot cord) data=@t]
==
::
+$ config
$: full-path=beam
name=@t
description=@t
::
author=@p
::
date-created=@da
last-modified=@da
::
type=@tas
comments=?
sort-key=(unit @)
visible=?
::
==
::
+$ action
$: who=ship
dek=desk
acts=(list sub-action)
==
::
+$ sub-action
$% [%write pax=path for=form]
[%delete pax=path]
[%perms pax=path r=rule:clay w=rule:clay]
::
[%collection pax=path name=@t desc=@t comments=? visible=? type=@tas]
[%post pax=path name=@t type=@tas comments=? content=@t edit=?]
[%comment pax=path content=@t]
==
::
+$ form
$% [%udon @t]
[%collections-config config]
==
::
++ collection-error
~/ %coll-collection-error
|= col=collection
^- ?
|-
=/ vals=(list item) ~(val by data.col)
%+ roll vals
|= [i=item out=_|]
^- ?
?: out out
?+ -.i
%.n
%error %.y
%collection ^$(col col.i)
%both ^$(col col.i)
==
::::
:::: /mar/snip
::::
++ words 1
++ hedtal
=| met/marl
|= a/marl ^- {hed/marl tal/marl}
?~ a [~ ~]
:: looks like it only terminates if it finds an h1?
?. ?=($h1 n.g.i.a)
?: ?=($meta n.g.i.a)
$(a t.a, met [i.a met])
=+ had=$(a c.i.a)
?^ -.had had
$(a t.a)
[c.i.a (weld (flop met) (limit words t.a))]
::
::
++ limit
~/ %coll-limit
|= {lim/@u mal/marl}
=< res
|- ^- {rem/@u res/marl}
?~ mal [lim ~]
?~ lim [0 ~]
=+ ^- {lam/@u hed/manx}
?: ?=(_;/(**) i.mal)
[lim ;/(tay)]:(deword lim v.i.a.g.i.mal)
[rem ele(c res)]:[ele=i.mal $(mal c.i.mal)]
[rem - res]:[hed $(lim lam, mal t.mal)]
::
++ deword
~/ %coll-deword
|= {lim/@u tay/tape} ^- {lim/@u tay/tape}
?~ tay [lim tay]
?~ lim [0 ~]
=+ wer=(dot 1^1 tay)
?~ q.wer
[lim - tay]:[i.tay $(tay t.tay)]
=+ nex=$(lim (dec lim), tay q.q.u.q.wer)
[-.nex [(wonk wer) +.nex]]
::
:: json
::
++ item-to-json
~/ %coll-item-to-json
|= itm=item
^- json
?- -.itm
%error (frond:enjs:format %error ~)
::
%collection
%+ frond:enjs:format
%collection (collection-to-json col.itm)
::
%raw
%- frond:enjs:format
[%item (raw-to-json raw.itm)]
::
%both
%- pairs:enjs:format
:~ [%item (raw-to-json raw.itm)]
[%collection (collection-to-json col.itm)]
==
==
::
++ collection-to-json
~/ %coll-collection-to-json
|= col=collection
^- json
%- pairs:enjs:format
:~ [%meta (config-to-json meta.col)]
:+ %data %a
%+ turn ~(tap by data.col)
|= [nom=knot ite=item]
^- json
%- pairs:enjs:format
:~ [%filename %s nom]
[%item (item-to-json ite)]
==
==
::
++ raw-to-json
~/ %coll-raw-to-json
|= raw=raw-item
^- json
=/ elm=manx elm:(static:cram (ream data.raw))
=/ rec=json (elem-to-react-json elm)
%- pairs:enjs:format
:~ [%data rec]
[%meta (meta-to-json meta.raw)]
==
::
++ config-to-json
~/ %coll-config-to-json
|= con=config
^- json
?: =(con *config)
~
%- pairs:enjs:format
:~ :- %full-path
:- %a
%+ turn (en-beam:format full-path.con)
|= a=@ta
[%s a]
:- %name [%s name.con]
:- %desc [%s description.con]
:- %author (ship:enjs:format author.con)
:- %date-created (time:enjs:format date-created.con)
:- %last-modified (time:enjs:format last-modified.con)
:- %type [%s type.con]
:- %comments [%b comments.con]
:- %sort-key ?~(sort-key.con ~ (numb:enjs:format u.sort-key.con))
:- %visible [%b visible.con]
==
::
++ meta-to-json
~/ %coll-meta-to-json
|= meta=(map knot cord)
^- json
%- pairs:enjs:format
%+ turn ~(tap by meta)
|= [key=@t val=@t]
^- [@t json]
[key [%s val]]
::
++ udon-to-front
~/ %coll-udon-to-front
|= u=@t
^- (map knot cord)
%- ~(run by inf:(static:cram (ream u)))
|= a=dime ^- cord
?+ (end 3 1 p.a) (scot a)
%t q.a
==
::
:: +path-to-circle:
::
:: takes a clay path and returns a hall circle
:: for a path /foo/bar it returns a circle with a :name %c-foo-bar
::
++ path-to-circle
~/ %coll-path-to-circle
|= [pax=path our=@p]
^- circle:hall
=. pax
?: ?=([%web %collections *] pax)
(weld /c (slag 2 `path`pax))
?: ?=([%collections *] pax)
(weld /c (slag 1 `path`pax))
?: ?=([%c *] pax)
`path`pax
`path`(weld /c pax)
=/ nam=term
%+ roll `(list @ta)`pax
|= [seg=@ta out=term]
%^ cat 3
?:(=(%$ out) out (cat 3 out '-'))
;;(@tas seg)
[our nam]
::
:: +allowed-by: checks if ship :who is allowed by the permission rules in :dic
::
++ allowed-by
~/ %coll-allowed-by
|= [who=@p dic=dict:clay our=@p]
^- ?
?: =(who our) &
=/ in-list=?
?| (~(has in p.who.rul.dic) who)
::
%- ~(rep by q.who.rul.dic)
|= [[@ta cru=crew:clay] out=_|]
?: out &
(~(has in cru) who)
==
?: =(%black mod.rul.dic)
!in-list
in-list
::
:: +collection-notify: XX
::
++ collection-notify
~/ %coll-collection-notify
|= [pax=path conf=config]
^- json
%- pairs:enjs:format
:~ ['author' [%s (crip (scow %p author.conf))]]
['host' [%s (crip (scow %p p.full-path.conf))]]
['path' [%a (turn pax |=(a=@ta `json`[%s a]))]]
['name' [%s name.conf]]
['date' [%s (crip (scow %da last-modified.conf))]]
['type' [%s type.conf]]
==
::
:: +item-notify: XX
::
++ item-notify
~/ %coll-item-notify
|= [pax=path raw=raw-item now=@da byk=beak]
^- json
=/ author (~(gut by meta.raw) %author ~.anon)
=/ host (~(gut by meta.raw) %host ~.anon)
=/ dat (~(gut by meta.raw) %last-modified (scot %da now))
=/ nom (~(gut by meta.raw) %name ~.no-title)
=/ typ (~(gut by meta.raw) %type ~.no-type)
::
=/ elm=manx elm:(static:cram (ream data.raw))
=/ snip=marl tal:(hedtal +.elm)
=/ inner
?~ snip
(crip (en-xml:html elm))
(crip (en-xml:html i.snip)) :: inner html
::
=/ parent-spur (slag 1 (flop pax))
=/ bek=beak byk(r [%da now])
=/ parent-path (en-beam:format [bek parent-spur])
=/ parent-dir .^(arch %cy parent-path)
::
=/ parent-conf=json
?: (~(has in dir.parent-dir) ~.udon ~)
%- meta-to-json
%- udon-to-front
.^(@t %cx (weld parent-path /udon))
?: (~(has in dir.parent-dir) ~.collections-config ~)
%- config-to-json
.^(config %cx (weld parent-path /collections-config))
~
::
%- pairs:enjs:format
:~ ['author' [%s author]]
['host' [%s host]]
['path' [%a (turn pax |=(a=@ta `json`[%s a]))]]
['name' [%s nom]]
['date' [%s dat]]
['type' [%s typ]]
['content' [%s data.raw]]
['snip' [%s inner]]
['parent-config' parent-conf]
==
::
:: +front-to-wain: XX
::
++ front-to-wain
~/ %coll-front-to-wain
|= a=(map knot cord)
^- wain
=/ entries=wain
%+ turn ~(tap by a)
|= b=[knot cord]
=/ c=[term cord] ;;([term cord] b)
(crip " [{<-.c>} {<+.c>}]")
::
?~ entries ~
;: weld
[':- :~' ~]
entries
[' ==' ~]
==
::
:: +update-udon-front: XX
::
++ update-udon-front
~/ %coll-update-udon-front
|= [fro=(map knot cord) udon=@t]
^- @t
%- of-wain:format
=/ tum (trip udon)
=/ id (find ";>" tum)
?~ id
%+ weld (front-to-wain fro)
(to-wain:format (crip (weld ";>\0a" tum)))
%+ weld (front-to-wain fro)
(to-wain:format (crip (slag u.id tum)))
::
:: _ta: main event core for collections
::
++ ta
~/ %coll-ta
|_ $: moves=(list move)
bol=bowl:gall
==
::
:: +ta-this: ta core subject
::
++ ta-this .
::
:: +ta-done:
::
:: flop :moves for finalization, since moves are prepended to the list
::
++ ta-done (flop moves)
::
:: +ta-emit: add a +move to :moves
::
++ ta-emit
~/ %coll-ta-emit
|= mov=move
%_ ta-this
moves [mov moves]
==
::
:: +ta-emil: add a list of +move to :moves
::
++ ta-emil
~/ %coll-ta-emil
|= mos=(list move)
%_ ta-this
moves (welp (flop mos) moves)
==
::
:: +ta-act: process collection-action
::
++ ta-act
~/ %coll-ta-act
|= act=action
^+ ta-this
::
:: iterate through list of +sub-action of +action
::
|-
?~ acts.act ta-this
=* a i.acts.act
::
=/ now-id=@da (sub now.bol (div (dis now.bol ~s0..fffe) 2))
=/ dat (scot %da now-id)
=/ bek=beak byk.bol(r [%da now-id])
=/ sap (en-beam:format [bek (flop (path +<.a))])
::
=. ta-this
?- -.a
%write
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms our.bol)
?- -.for.a
%udon (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
%collections-config (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
==
ta-this
::
%delete
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms our.bol)
(ta-remove pax.a)
ta-this
::
%perms
?: =(src.bol our.bol) :: XX admin privileges for other users?
(ta-set-permissions pax.a r.a w.a)
ta-this
::
::
:: XX some of this is redunant
::
%collection
=/ perms
.^([dict:clay dict:clay] %cp (weld sap /[dat]/collections-config))
?. (allowed-by src.bol +.perms our.bol)
ta-this
=/ conf=config
:* [bek (flop (weld pax.a /[dat]/collections-config))]
name.a
desc.a
our.bol
now-id
now-id
type.a
comments.a
~
visible.a
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/collections-config)
[%collections-config !>(conf)]
:: restrict permissions on config file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/collections-config)
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on collection items
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
::
%post
=? pax.a !edit.a
(weld pax.a /[dat])
=? sap !edit.a
(en-beam:format [bek (flop pax.a)])
=/ perms .^([dict:clay dict:clay] %cp (weld sap /udon))
?. (allowed-by src.bol +.perms our.bol)
ta-this
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%name name.a]
[%comments ?:(comments.a ~..y ~..n)]
[%author (scot %p src.bol)]
[%host (scot %p our.bol)]
[%date-created (snag 0 (flop pax.a))]
[%last-modified dat]
[%type type.a]
==
=. ta-this
%+ ta-write (weld pax.a /udon)
[%udon !>((update-udon-front front content.a))]
:: restrict permissions on udon file
=. ta-this
%^ ta-set-permissions (weld pax.a /udon)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on comments
=. ta-this
%^ ta-set-permissions pax.a
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
::
%comment
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[dat]/udon))
?. (allowed-by src.bol +.perms our.bol)
ta-this
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%author (scot %p src.bol)]
[%host (scot %p our.bol)]
[%date-created dat]
[%last-modified dat]
[%type %comments]
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/udon)
[%udon !>((update-udon-front front content.a))]
:: restrict permissions on udon file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/udon)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
ta-this
::
==
$(acts.act t.acts.act)
::
:: +ta-update:
::
::
::
++ ta-update
~/ %coll-ta-update
|= [old=collection new=collection]
^+ ta-this
?: =(old new)
ta-this
(ta-update-collection old new /web/collections)
::
++ ta-insert-item
~/ %coll-ta-insert-item
|= [new=item pax=path]
^+ ta-this
=/ parent-path (scag (dec (lent pax)) pax)
::
?- -.new
::
%error
(ta-hall-lin parent-path 'error')
::
%collection
=. ta-this
%^ ta-hall-json parent-path 'new collection'
(collection-notify pax meta.col.new)
::
=. ta-this (ta-hall-create-circle pax name.meta.col.new)
=/ items=(list [nom=@ta =item]) ~(tap by data.col.new)
|-
?~ items ta-this
=. ta-this (ta-insert-item item.i.items (weld pax [nom.i.items ~]))
$(items t.items)
::
%both
=. ta-this (ta-hall-create-circle pax name.meta.col.new)
=/ items=(list [nom=@ta =item]) ~(tap by data.col.new)
=. ta-this
|-
?~ items ta-this
=. ta-this (ta-insert-item item.i.items (weld pax [nom.i.items ~]))
$(items t.items)
::
ta-this
::
%raw
=. ta-this
%^ ta-hall-json
parent-path
'new item'
(item-notify pax raw.new now.bol byk.bol)
?: ?& (~(has by meta.raw.new) %comments)
=('.y' (~(got by meta.raw.new) %comments))
==
=/ author=(unit @ta) (~(get by meta.raw.new) %author)
=/ author-p=@p
?~ author our.bol
(fall (rush u.author ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax author-p)
ta-this
::
==
::
++ ta-remove-item
~/ %coll-ta-remove-item
|= [old=item pax=path]
^+ ta-this
:: flush permissions
:: notify parent of deletion
=/ parent (scag (dec (lent pax)) pax)
:: recurse for children
?- -.old
::
%error
(ta-hall-lin parent 'error')
::
%collection
=. ta-this
%^ ta-hall-json parent 'deleted collection'
(collection-notify pax meta.col.old)
=. ta-this (ta-flush-permissions (weld pax /collections-config))
=/ items=(list [nom=@ta =item]) ~(tap by data.col.old)
|-
?~ items ta-this
=. ta-this (ta-remove-item item.i.items (weld pax [nom.i.items ~]))
$(items t.items)
::
%both
=. ta-this (ta-flush-permissions pax)
=. ta-this (ta-flush-permissions (weld pax /collections-config))
=/ items=(list [nom=@ta =item]) ~(tap by data.col.old)
|-
?~ items ta-this
=. ta-this (ta-remove-item item.i.items (weld pax [nom.i.items ~]))
$(items t.items)
::
%raw
=. ta-this (ta-flush-permissions pax)
%^ ta-hall-json
parent
'deleted item'
(item-notify pax raw.old now.bol byk.bol)
::
==
::
::
::
++ ta-update-item
:: always make sure removals happen first and insertions happen last
:: because removals flush permissions and insertions set them
::
~/ %coll-ta-update-item
|= [old=item new=item pax=path]
^+ ta-this
?: =(old new)
ta-this
::
:: check for changes in item type
?: &(?=(%collection -.old) ?=(%collection -.new))
(ta-update-collection col.old col.new pax)
?: &(?=(%raw -.old) ?=(%raw -.new))
(ta-update-raw-item raw.old raw.new pax)
?: &(?=(%both -.old) ?=(%both -.new))
:: update raw item
=. ta-this (ta-update-collection col.old col.new pax)
(ta-update-raw-item raw.old raw.new pax)
::
?: &(?=(%collection -.old) ?=(%raw -.new))
:: remove collection
:: insert raw item
=. ta-this (ta-remove-item old pax)
(ta-insert-item new pax)
::
?: &(?=(%collection -.old) ?=(%both -.new))
:: insert raw item
:: update-collection
=. ta-this (ta-update-collection col.old col.new pax)
(ta-insert-item new pax)
::
?: &(?=(%raw -.old) ?=(%collection -.new))
:: remove raw item
:: insert collection
=. ta-this (ta-remove-item old pax)
(ta-insert-item new pax)
::
?: &(?=(%raw -.old) ?=(%both -.new))
:: insert collection
:: update raw item
=. ta-this (ta-update-raw-item raw.old raw.new pax)
(ta-insert-item new pax)
::
?: &(?=(%both -.old) ?=(%raw -.new))
:: remove collection
:: update raw item
=. ta-this (ta-remove-item [%collection col.old] pax)
(ta-update-raw-item raw.old raw.new pax)
::
?: &(?=(%both -.old) ?=(%collection -.new))
:: remove raw item
:: update collection
=. ta-this (ta-remove-item [%raw raw.old] pax)
(ta-update-collection col.old col.new pax)
::
::
?: &(?=(%error -.old) ?=(%error -.new))
ta-this
?: &(?=(%error -.old) ?=(%collection -.new))
(ta-insert-item new pax)
?: &(?=(%error -.old) ?=(%raw -.new))
(ta-insert-item new pax)
?: &(?=(%error -.old) ?=(%both -.new))
(ta-insert-item new pax)
?: ?=(%error -.new)
(ta-hall-lin pax 'error')
::
ta-this
::
++ ta-update-raw-item
~/ %coll-ta-update-raw-item
|= [old=raw-item new=raw-item pax=path]
^+ ta-this
?: =(old new)
ta-this
::
=? ta-this !=(data.old data.new)
=/ parent-path (scag (dec (lent pax)) pax)
%^ ta-hall-json
parent-path
'edited item'
(item-notify pax new now.bol byk.bol)
::
=? ta-this
?& =('.y' (~(gut by meta.new) %comments '.n'))
=('.n' (~(gut by meta.old) %comments '.n'))
==
=/ author=(unit @ta) (~(get by meta.new) %author)
=/ author-p=@p
?~ author our.bol
(fall (rush u.author ;~(pfix sig fed:ag)) our.bol)
(ta-generate-comments pax author-p)
::
=? ta-this
?& =('.n' (~(gut by meta.new) %comments '.n'))
=('.y' (~(gut by meta.old) %comments '.n'))
==
:: delete comments
(ta-remove (weld pax /collections-config))
::
ta-this
::
++ ta-update-collection
~/ %coll-ta-update-collection
|= $: old=collection
new=collection
pax=path
==
^+ ta-this
::
=? ta-this !=(meta.old meta.new)
=/ parent-path (scag (dec (lent pax)) pax)
%^ ta-hall-json parent-path 'edited collection'
(collection-notify pax meta.new)
::
?: =(data.old data.new)
ta-this
::
:: new values of all changed items
=/ upd-new (~(dif in (~(int by data.old) data.new)) data.old)
:: old values of all changed items
=/ upd-old (~(dif in (~(int by data.new) data.old)) data.new)
:: all totally new entries
=/ ins-new (~(dif by data.new) data.old)
:: all deleted entries
=/ del-old (~(dif by data.old) data.new)
::
=/ upd-new=(list [nom=knot =item]) ~(tap by upd-new)
=/ upd-old=(list [nom=knot =item]) ~(tap by upd-old)
=/ ins-new=(list [nom=knot =item]) ~(tap by ins-new)
=/ del-old=(list [nom=knot =item]) ~(tap by del-old)
::
=/ lam |=([[a=knot item] out=(list path)] [(weld pax [a ~]) out])
::
=. ta-this |-
?~ upd-new
ta-this
?< ?=(~ upd-old)
=* new-item i.upd-new
=* old-item i.upd-old
=/ new-pax (weld pax [nom.new-item ~])
=. ta-this (ta-update-item item.old-item item.new-item new-pax)
::
%= $
upd-new t.upd-new
upd-old t.upd-old
==
::
=. ta-this |-
?~ ins-new
ta-this
=* new-item i.ins-new
=/ new-pax (weld pax [nom.new-item ~])
=. ta-this (ta-insert-item +.new-item (weld pax [-.new-item ~]))
$(ins-new t.ins-new)
::
=. ta-this |-
?~ del-old
ta-this
=* old-item i.del-old
=/ old-pax (weld pax [nom.old-item ~])
=. ta-this (ta-remove-item +.old-item (weld pax [-.old-item ~]))
$(del-old t.del-old)
::
ta-this
::
++ ta-generate-comments
~/ %coll-ta-generate-comments
|= [pax=path author=ship]
^+ ta-this
=/ sup=path [%collections-config (flop pax)]
=/ bek byk.bol(r [%da now.bol])
=/ pat (en-beam:format [bek sup])
=/ dat=@da (slav %da (snag 0 (flop pax)))
=/ cay=config
:* [bek sup]
'comments'
'comments'
author
dat
dat
%comments
|
~
|
==
(ta-write (flop sup) %collections-config !>(cay))
::
:: writing files
::
++ ta-write
~/ %coll-ta-write
=, space:userlib
|= [pax=path cay=cage]
^+ ta-this
=/ bek byk.bol(r [%da now.bol])
=. pax (en-beam:format bek (flop pax))
%+ ta-emit ost.bol
[%info (weld /ta-write pax) (foal pax cay)]
::
++ ta-remove
=, space:userlib
~/ %coll-ta-remove
|= pax=path
=/ bek byk.bol(r [%da now.bol])
=. pax (en-beam:format bek (flop pax))
^+ ta-this
%+ ta-emit ost.bol
[%info (weld /ta-remove pax) (fray pax)]
::
:: permissions
::
++ ta-set-permissions
~/ %coll-ta-set-permissions
|= [pax=path r=rule:clay w=rule:clay]
^+ ta-this
%+ ta-emit ost.bol
[%perm (weld /perms pax) q.byk.bol pax [%rw `r `w]]
::
++ ta-flush-permissions
~/ %coll-ta-flush-permissions
|= pax=path
^+ ta-this
%+ ta-emit ost.bol
[%perm (weld /perms pax) q.byk.bol pax [%rw ~ ~]]
::
:: hall
::
++ ta-hall-action
~/ %coll-ta-hall-action
|= act=action:hall
^+ ta-this
%+ ta-emit ost.bol
[%poke /col-hall-action [our.bol %hall] %hall-action act]
::
++ ta-hall-actions
~/ %coll-ta-hall-actions
|= act=(list $?(~ action:hall))
^+ ta-this
?~ act ta-this
?~ i.act $(act t.act)
%= $
ta-this (ta-hall-action i.act)
act t.act
==
::
++ ta-hall-create-circle
~/ %coll-ta-hall-create-circle
|= [pax=path name=@t]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax our.bol)
=/ parent=circle:hall
?: =(nom.circ %c)
[our.bol %inbox]
(path-to-circle (scag (dec (lent pax)) pax) our.bol)
=/ acts=(list action:hall)
:~ [%source nom.parent & (sy `source:hall`[circ ~] ~)]
[%create nom.circ name %journal]
==
:: XX should we also source comment circles?
=? acts =(nom.parent %c)
[[%source %inbox & (sy `source:hall`[circ ~] ~)] acts]
(ta-hall-actions (flop acts))
::
++ ta-hall-lin
~/ %coll-ta-hall-lin
|= [pax=path msg=cord]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax our.bol)
%- ta-hall-action
[%phrase [circ ~ ~] [%lin | msg]~]
::
++ ta-hall-json
~/ %coll-ta-hall-json
|= [pax=path header=@t jon=json]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax our.bol)
%- ta-hall-action
:+ %phrase [circ ~ ~]
[%fat [%text ~[header]] [%lin | (crip (en-json:html jon))]]~
::
--
--

View File

@ -42,7 +42,7 @@
{$flog wire flog:dill} ::
[%mint wire p=ship q=safe:rights:jael]
{$nuke wire ship} ::
[%serve wire binding:http-server generator:http-server]
[%serve wire binding:eyre generator:eyre]
{$poke wire dock pear} ::
{$rest wire @da} ::
{$wait wire @da} ::
@ -50,7 +50,6 @@
++ move (pair bone card) :: user-level move
++ pear :: poke fruit
$% {$hood-unsync desk ship desk} ::
{$ask-mail cord} ::
{$helm-hi cord} ::
{$drum-start well:gall} ::
{$hall-action action:hall} ::
@ -131,9 +130,6 @@
%^ emit %poke /helm/hi/(scot %p her)
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
::
++ poke-send-ask
|= mel/cord
abet
::
++ poke-hi
|= mes/@t
@ -155,11 +151,6 @@
?> ?=({@t ~} pax)
(emit %flog ~ %text "hi {(trip i.pax)} {?~(cop "" "un")}successful")
::
++ coup-ask
|= {pax/path cop/(unit tang)} =< abet
?> ?=({@t ~} pax)
(emit %flog ~ %text "ask {<src>} {?~(cop "" "un")}successful")
::
++ poke-reload |=(all/(list term) (poke-reload-desk %home all))
++ poke-reload-desk :: reload vanes
|: $:{syd/desk all/(list term)} =< abet
@ -218,57 +209,11 @@
(emit %flog ~ %text "woot: {<[way cop]>}")
::
++ poke-serve
|= [=binding:http-server =generator:http-server] =< abet
|= [=binding:eyre =generator:eyre] =< abet
(emit %serve /helm/serv binding generator)
::
++ take-bound
|= [wir=wire success=? binding=binding:http-server] =< abet
|= [wir=wire success=? binding=binding:eyre] =< abet
(emit %flog ~ %text "bound: {<success>}")
::
++ poke-tlon-init-stream
:: creates stream channel and makes it pull from
:: urbit-meta on {met}.
|= met/ship =< abet
%- emil
%- flop
:~ ^- card
:^ %poke /helm/web/stream/create [our %hall]
:- %hall-action
:- %create
[%stream 'stream relay channel' %channel]
::
:^ %poke /helm/web/stream/filter [our %hall]
:- %hall-action
:- %filter
[%stream | |]
::
:^ %poke /helm/web/stream/source [our %hall]
:- %hall-action
:- %source
[%stream & [[[met %urbit-meta] `[da+(sub now ~d1) ~]] ~ ~]]
==
::
++ poke-tlon-add-fora
:: makes the local urbit-meta pull from {for}'s fora
:: notification channels.
|= for/ship =< abet
%- emil
:~ :^ %poke /helm/web/fora/source [our %hall]
:- %hall-action
:- %source
[%urbit-meta & [[[for %fora-posts] `[da+now ~]] ~ ~]]
::
:^ %poke /helm/web/fora/source [our %hall]
:- %hall-action
:- %source
[%urbit-meta & [[[for %fora-comments] `[da+now ~]] ~ ~]]
==
::
++ poke-tlon-add-stream
:: makes the local urbit-meta pull from {web}'s stream.
|= web/ship =< abet
%- emit
:^ %poke /helm/web/stream/source [our %hall]
:+ %hall-action %source
[%urbit-meta & [[[web %stream] `[da+now ~]] ~ ~]]
--

View File

@ -196,7 +196,7 @@
++ emit |=(a/card +>(..autoload (^emit a)))
++ tracked-vanes
^- (list @tas)
~[%ames %behn %clay %dill %ford %gall %jael %lient %rver]
~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael]
::
++ our-home /(scot %p our)/home/(scot %da now)
++ sys-hash |=(pax/path .^(@uvI %cz :(welp our-home /sys pax)))

View File

@ -3,7 +3,6 @@
:::: /hoon/write/hood/lib
::
/? 310
/- plan-diff, plan-acct
=, format
=* as-octs as-octs:mimes:html
=, space:userlib
@ -41,45 +40,6 @@
|= {sup/path mim/mime} ^+ abet :: XX determine extension, beak
(poke--data [`%md (flop sup)] %mime mim)
::
++ poke-plan-account
|= {sev/knot usr/plan-acct} ^+ abet
(poke-plan-diff [~ ~ [[sev usr] ~ ~]])
::
++ poke-plan-info
|= {who/@t loc/@t}
(poke-plan-diff [[~ who loc] ~ ~])
::
++ poke-plan-diff
|= dif/plan-diff ^+ abet
?. =(our src)
~|(foreign-write+[our=our src=src] !!)
=/ sev
:: XX this scry will always fail. wat do?
::
=+ .^(path %e /(scot %p our)/serv/(scot %da now))
?>(?=({@tas @tas *} -) -)
=; sob/soba:clay
?~(sob abet abet:(emit %info write+~ `toro:clay`[i.t.sev %& sob]))
=+ pax=`path`/web/plan
=+ paf=(en-beam beak-now (flop pax))
?~ [fil:.^(arch %cy paf)]
=+ ins=(pact-plan [['' ''] ~] dif)
[pax %ins plan+!>(ins)]~
=+ ole=.^({{@t @t} (map knot plan-acct)} %cx paf)
=+ neu=(pact-plan ole dif)
?: =(ole neu) ~
[pax %dif plan-diff+!>(dif)]~
::
++ pact-plan :: XX clay should handle fused insert+diff
|= {all/{{who/@t loc/@t} acc/(map knot plan-acct)} dif/plan-diff}
^+ all
:- (fall inf.dif -.all)
=; neu (~(uni by neu) put.dif)
=+ del=~(tap by del.dif) :: XXX map functions
|- ^+ acc.all
?~ del acc.all
$(del t.del, acc.all (~(del by acc.all) p.i.del))
::
++ poke-paste
|= {typ/?($hoon $md $txt) txt/@t} ^+ abet
(poke--data [`typ /web/paste/(scot %da now)] %mime / (as-octs txt))

View File

@ -1,2 +0,0 @@
=, html
|=(hit/httr:eyre ~|(hit ?>(?=($2 (div p.hit 100)) (need (de-json q:(need r.hit))))))

View File

@ -1,21 +0,0 @@
|= inner=manx
^- manx
;html
::
;head
;title: Landscape
;meta(charset "utf-8");
;meta
=name "viewport"
=content "width=device-width, initial-scale=1, shrink-to-fit=no";
;link(rel "stylesheet", href "/~~/landscape/css/index.css");
==
::
;body
;div#root
;+ inner
==
;script@"/~~/landscape/js/index-min.js";
==
::
==

24
pkg/arvo/lib/launch.hoon Normal file
View File

@ -0,0 +1,24 @@
::
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
::
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
::
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
--
::

View File

@ -1,9 +0,0 @@
:: hoon data to json
::
:::: /hoon/map-to-json/lib
::
/? 310
=, format
|* {a/_cord b/_json} :: XX {a/$-(* cord) b/$-(* json)}
|= c/(map _+<.a _+<.b)
(pairs:enjs (turn ~(tap by c) |*(d/^ [(a -.d) (b +.d)])))

View File

@ -14,19 +14,6 @@
:~ :: sys/zuse: standard library
::
[%$ /zuse]
:: TODO: I really want these to be named http-client and http-server,
:: but this interacts badly with every piece of the system which
:: assumes that vane names are one letter, and that one letter is the
:: first letter of the file. This assumption is threaded through way
:: too many places in the entire system to modify it while doing
:: something else.
::
:: sys/vane/lient: http client
::
[%l /vane/lient]
:: sys/vane/rver: http server
::
[%r /vane/rver]
:: sys/vane/ames: network
::
[%a /vane/ames]
@ -39,15 +26,18 @@
:: sys/vane/dill: console
::
[%d /vane/dill]
:: sys/vane/eyre: web
:: sys/vane/eyre: http server
::
:: [%e /vane/eyre]
[%e /vane/eyre]
:: sys/vane/ford: build
::
[%f /vane/ford]
:: sys/vane/gall: applications
::
[%g /vane/gall]
:: sys/vane/iris: http client
::
[%i /vane/iris]
:: sys/vane/jael: security
::
[%j /vane/jael]

View File

@ -1 +0,0 @@
prey:pubsub:userlib

View File

@ -1,4 +1,4 @@
=, http-server
=, eyre
|%
::
:: +parse-request-line: take a cord and parse out a url
@ -25,8 +25,8 @@
::
++ require-authorization
|* [=bone move=mold this=*]
|= handler=$-(inbound-request:http-server (quip move _this))
|= =inbound-request:http-server
|= handler=$-(inbound-request:eyre (quip move _this))
|= =inbound-request:eyre
^- (quip move _this)
::
?: authenticated.inbound-request
@ -79,7 +79,7 @@
[%start [404 ~] ~ %.y]
::
++ login-redirect
|= =inbound-request:http-server
|= =inbound-request:eyre
^- http-event:http
=/ redirect=cord
%- crip

View File

@ -69,7 +69,7 @@
=/ m (async ,~)
^- form:m
=/ =card
[%request / request *outbound-config:http-client]
[%request / request *outbound-config:iris]
;< ~ bind:m (send-raw-card card)
(set-raw-contract & %request ~)
::
@ -82,7 +82,7 @@
:: Wait until we get an HTTP response or cancelation
::
++ take-response-raw
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
|= =async-input
:^ ~ ~ ~
@ -108,9 +108,9 @@
:: Wait until we get an HTTP response or cancelation and unset contract
::
++ take-maybe-response
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-response-raw
;< ~ bind:m (set-raw-contract | %request ~)
(pure:m rep)
@ -118,9 +118,9 @@
:: Wait until we get an HTTP response and unset contract
::
++ take-response
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response
?^ rep
(pure:m rep)
@ -132,7 +132,7 @@
++ take-maybe-sigh
=/ m (async (unit httr:eyre))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response
?~ rep
(pure:m ~)
@ -140,7 +140,7 @@
::
?. ?=(%finished -.u.rep)
(pure:m ~)
(pure:m (some (to-httr:http-client +.u.rep)))
(pure:m (some (to-httr:iris +.u.rep)))
::
:: Wait until we get an HTTP response and unset contract
::
@ -198,7 +198,7 @@
:: Incoming HTTP requests
::
++ bind-route-raw
|= [=binding:http-server =term]
|= [=binding:eyre =term]
=/ m (async ,~)
^- form:m
(send-raw-card [%connect / binding term])
@ -216,7 +216,7 @@
[%done success.sign]
::
++ bind-route
|= [=binding:http-server =term]
|= [=binding:eyre =term]
=/ m (async ?)
^- form:m
;< ~ bind:m (bind-route-raw binding term)

View File

@ -380,7 +380,7 @@
:: Pass response to async
::
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this-tapp)
(take-async bowl `[wire %http-response response])
::
@ -406,7 +406,7 @@
:: Receive route binding notification
::
++ bound
|= [=wire success=? =binding:http-server]
|= [=wire success=? =binding:eyre]
^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding])
::

View File

@ -1,19 +0,0 @@
::
:::: /hoon/ask-mail/mar
::
/? 310
=, format
=, mimes:html
|_ txt/cord
::
++ grab :: convert from
|%
++ noun @t :: clam from %noun
++ json so:dejs
--
++ grow
|%
++ psal ;div: {(trip txt)}
++ mime [text+/plain (as-octs txt)]
--
--

View File

@ -1,120 +0,0 @@
::
:::: /hoon/actions/collection/mar
::
/? 309
/+ collections
=, collections
=, format
::
|_ act=action:collections
::
++ grow
|%
++ tank >act<
--
::
++ grab
|%
++ noun action:collections
++ json
|= jon=^json
;; action:collections
=< (action jon)
|%
++ action
%- ot:dejs
:~ ship+(su:dejs fed:ag)
desk+(su:dejs sym)
:- %acts
%- ar:dejs
%- of:dejs
:~ write+write
delete+delete
perms+perms
collection+collection
post+post
comment+comment
==
==
::
++ write
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
mark+(su:dejs sym)
data+so:dejs
==
::
++ delete
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
==
::
++ perms
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
:- %read
%- ot:dejs
:~ mod+(su:dejs ;~(pose (jest %black) (jest %white)))
who+whoms
==
:- %write
%- ot:dejs
:~ mod+(su:dejs ;~(pose (jest %black) (jest %white)))
who+whoms
==
==
::
++ whoms
|= jon=^json
^- (set whom:clay)
=/ x ((ar:dejs (su:dejs fed:ag)) jon)
;; (set whom:clay)
%- ~(run in (sy x))
|=(w=@ [& w])
--
::
++ collection
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
name+sa
desc+so:dejs
comments+bo:dejs
visible+bo:dejs
type+(su:dejs sym)
==
::
++ post
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
name+sa
type+(su:dejs sym)
comments+bo:dejs
content+so:dejs
edit+bo:dejs
==
::
++ comment
%- ot:dejs
:~ path+(su:dejs ;~(pfix fas (more fas urs:ab)))
content+so:dejs
==
::
++ sa :: string as ta
|= jon=^json
?> ?=([%s *] jon)
(scot %tas p.jon)
--
::
--

View File

@ -1,11 +0,0 @@
/? 309
::
/- hall
/+ collections
::
|_ com=command:collections
++ grab
|%
++ noun command:collections
--
--

View File

@ -1,92 +0,0 @@
::
:::: /hoon/config/collection/mar
::
/+ collections
!:
|_ con=config:collections
::
::
++ grow
|%
++ mime
:- /text/x-collection-config
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
::
:~ (cat 3 'full-path: ' (spat (en-beam:format full-path.con)))
(cat 3 'name: ' name.con)
(cat 3 'description: ' description.con)
::
(cat 3 'author: ' (scot %p author.con))
::
(cat 3 'date-created: ' (scot %da date-created.con))
(cat 3 'last-modified: ' (scot %da last-modified.con))
::
(cat 3 'type: ' type.con)
(cat 3 'comments: ' ?:(comments.con 'y' 'n'))
(cat 3 'sort-key: ' ?~(sort-key.con '~' (scot %ud u.sort-key.con)))
(cat 3 'visible: ' ?:(visible.con 'y' 'n'))
==
--
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
(txt (to-wain:format q.p))
++ txt
|= txs=(pole @t)
^- config:collections
:: TODO: putting ~ instead of * breaks this but shouldn't
::
?> ?= $: full-path=@t
name=@t
desc=@t
author=@t
dc=@t
lm=@t
type=@t
com=@t
sk=@t
vis=@t
*
==
txs
::
:* %- need
%+ rash full-path.txs
;~ pfix (jest 'full-path: ')
%+ cook de-beam:format
;~(pfix fas (more fas urs:ab))
==
::
(rash name.txs ;~(pfix (jest 'name: ') (cook crip (star next))))
::
(rash desc.txs ;~(pfix (jest 'description: ') (cook crip (star next))))
::
(rash author.txs ;~(pfix (jest 'author: ~') fed:ag))
::
%+ rash dc.txs
;~ pfix
(jest 'date-created: ~')
(cook year when:so)
==
::
%+ rash lm.txs
;~ pfix
(jest 'last-modified: ~')
(cook year when:so)
==
::
(rash type.txs ;~(pfix (jest 'type: ') (cook crip (star next))))
::
(rash com.txs ;~(pfix (jest 'comments: ') (fuss %y %n)))
::
(rush sk.txs ;~(pfix (jest 'sort-key: ') dem:ag))
::
(rash vis.txs ;~(pfix (jest 'visible: ') (fuss %y %n)))
==
++ noun config:collections
--
++ grad %mime
--

View File

@ -1,17 +0,0 @@
::
:::: /hoon/elem/collection/mar
::
/? 310
=, mimes:html
=, html
|_ own/manx
::
++ grow :: convert to
|%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
++ html (crip (en-xml hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

View File

@ -1,24 +0,0 @@
::
:::: /hoon/json/collection/mar
::
/? 309
::
:::: compute
::
=, eyre
=, format
=, html
|_ jon/json
::
++ grow :: convert to
|%
++ txt (crip (en-json jon))
++ json jon
--
++ grab
|% :: convert from
++ noun ^json :: clam from %noun
++ json ^json
--
++ grad %mime
--

View File

@ -1,54 +0,0 @@
::
::
/? 309
::
/- hall
/+ collections, hall-json
::
|_ piz=prize:collections
++ grow
|%
++ json
=, enjs:format
^- ^json
%+ frond %landscape
%+ frond %prize
%- pairs
:~ :- %inbox
%- pairs
:~ [%config ?~(con.inbox.piz ~ (conf:enjs:hall-json u.con.inbox.piz))]
[%messages %a (turn env.inbox.piz enve:enjs:hall-json)]
==
::
:+ %circles %a
%+ turn ~(tap by circles.piz)
|= [cir=circle:hall con=(unit config:hall)]
%- pairs
:~ [%circle (circ:enjs:hall-json cir)]
[%config ?~(con ~ (conf:enjs:hall-json u.con))]
==
::
:+ %circles-our %a
%+ turn ~(tap in our-circles.piz)
|= nom=name:hall
[%s nom]
::
:- %dms
%- pairs
%+ turn ~(tap by dms.piz)
|= [nom=name:hall ini=@p env=(list envelope:hall)]
:- nom
%- pairs
:~ [%initiator (ship ini)]
[%messages %a (turn env enve:enjs:hall-json)]
==
::
[%invites %a (turn invites.piz enve:enjs:hall-json)]
==
--
::
++ grab
|%
++ noun prize:collections
--
--

View File

@ -1,36 +0,0 @@
::
::
/? 309
::
/+ collections, hall-json
::
|_ rum=rumor:collections
++ grow
|%
++ json
=, enjs:format
^- ^json
%+ frond %landscape
%+ frond %rumor
%+ frond -.rum
?- -.rum
%config-change
%- pairs
:~ [%circle (circ:enjs:hall-json cir.rum)]
[%config ?~(con.rum ~ (conf:enjs:hall-json u.con.rum))]
==
::
%new-msg
%- pairs
:~ [%circle [%s nom.rum]]
[%message (enve:enjs:hall-json env.rum)]
==
==
--
::
++ grab
|%
++ noun rumor:collections
--
--

View File

@ -1,11 +0,0 @@
::
:::: /hoon/email/mar
::
/? 310
|_ {adr/@ta tyl/tape mez/wall}
::
++ grab :: convert from
|%
++ noun {@ta tape wall} :: clam from %noun
--
--

View File

@ -1,12 +0,0 @@
::
:::: /mar/fora/comment/hoon
::
/? 310
|_ {pax/path sup/spur txt/@t}
++ grab
|%
++ noun {path spur @t}
++ json
(corl need =>(dejs-soft:format (ot pax+(su fel:stab) sup+(su fel:stab) txt+so ~)))
--
--

View File

@ -1,12 +0,0 @@
::
:::: /mar/fora/post/hoon
::
/? 310
|_ {pax/path sup/spur hed/@t txt/@t}
++ grab
|%
++ noun {path spur @t @t}
++ json
(corl need =>(dejs-soft:format (ot pax+(su fel:stab) sup+(su fel:stab) hed+so txt+so ~)))
--
--

View File

@ -1,23 +0,0 @@
::
:::: /mar/hall/speeches/hoon
::
/? 310
/- hall
/+ hall,map-to-json
::
=+ hall
|_ gam/(list speech)
::
++ grab
|%
++ noun (list speech)
--
::
++ grad
|%
++ form %hall-speeches
++ diff |=((list speech) +<)
++ pact |=((list speech) +<)
++ join |=({(list speech) (list speech)} `(unit mime)`~)
--
--

View File

@ -0,0 +1,11 @@
::
::
/+ launch
::
|_ act=action:launch
::
++ grab
|%
++ noun action:launch
--
--

View File

@ -1,11 +0,0 @@
::
:::: /hoon/plan-diff/mar
::
/? 310
/- plan-diff
::
:::: ~fyr
::
|_ plan-diff
++ grab |% ++ noun plan-diff
-- --

View File

@ -1,102 +0,0 @@
::
:::: /hoon/plan/mar
::
/? 310
/- plan-acct, plan-diff
::
:::: ~fyr
::
=, eyre
=, html
=, format
|_ all/{{who/@txname loc/@txloc} acc/(map knot plan-acct)}
::
++ grow :: convert to
=+ all
|%
++ txt
^- wain
:+ (cat 3 'User ' ?~(who 'of Urbit' who))
(cat 3 'Location ' ?~(loc %unknown loc))
%+ turn (sort ~(tap by acc) aor)
|= {a/knot b/plan-acct} ^- cord
%+ rap 3
:^ a ': ' usr.b
?~(url.b ~ [', ' (apix:en-purl u.url.b)])
::
++ plan-json
%- pairs:enjs :~
who+?~(who ~ s+who)
loc+?~(loc ~ s+loc)
acc+o+(~(run by acc) json-acct)
==
++ json-acct :: helper
|= a/plan-acct ^- json
=/ url ?~(url.a ~ (tape:enjs (apix:en-purl u.url.a)))
(pairs:enjs usr+s+usr.a url+url ~)
--
++ grab |% :: convert from
++ noun {{cord cord} (map knot plan-acct)} :: clam from %noun
++ txt
|^ |= a/wain ^+ all
?> ?=({@t @t *} a)
:- [(rash i.a user) (rash i.t.a location)]
(malt (turn t.t.a |=(b/cord (rash b account))))
::
++ user ;~(pfix (jest 'User ') (cook crip (star prn)))
++ knot %+ cook crip
(plus ;~(pose nud low hig hep dot sig cab))
++ location ;~(pfix (jest 'Location ') (cook crip (star prn)))
++ account
;~ plug
knot
;~(pfix col ace knot)
(punt ;~(pfix com ace aurf:de-purl))
==
--
++ mime |=({* a/octs} (txt (to-wain q.a))) :: XX mark translation
--
++ grad
|%
++ form %plan-diff
++ diff
|= neu/_all ^- plan-diff :: XXX map functions
:+ ?:(=(-.all -.neu) ~ (some -.neu))
=< (malt `(list {knot ~})`(murn ~(tap by acc.all) .))
|= {a/knot *} ^- (unit {knot ~})
?:((~(has by acc.neu) a) ~ (some [a ~]))
=< (malt (murn ~(tap by acc.neu) .))
|= {a/knot b/plan-acct} ^- (unit {knot plan-acct})
?: =([~ b] (~(get by acc.all) a))
~
(some [a b])
::
++ pact
|= dif/plan-diff ^+ all :: XXX map functions
:- (fall inf.dif -.all)
=; neu (~(uni by neu) put.dif)
=+ del=~(tap by del.dif)
|- ^+ acc.all
?~ del acc.all
$(del t.del, acc.all (~(del by acc.all) p.i.del))
::
++ can-join
|= {ali/plan-diff bob/plan-diff} ^- ?
?& !&(?=({{^ *} {^ *}} +<) !=(u.inf.ali u.inf.bob)) :: compatible info
=(~ (~(int by `(map knot *)`del.ali) put.bob)) :: no del-put
=(~ (~(int by `(map knot *)`put.ali) del.bob)) :: conflicts
.= (~(int by put.ali) put.bob) :: and all put
(~(int by put.bob) put.ali) :: values match
==
::
++ join
|= {ali/plan-diff bob/plan-diff}
^- (unit plan-diff)
?. (can-join ali bob)
~
%^ some
(mate inf.ali inf.bob)
(~(uni by del.ali) del.bob)
(~(uni by put.ali) put.bob)
--
--

View File

@ -1,17 +0,0 @@
::
:::: /hoon/quri/mar
::
/? 310
=, eyre
=, mimes:html
=, html
|_ url/quri
::
++ grow |% ++ mime [text+/x-uri (as-octt (apex:en-purl url))]
--
++ grab :: convert from
|%
++ noun quri :: clam from %noun
++ mime |=(mim/^mime (rash q.q.mim zest:de-purl))
--
--

View File

@ -1,31 +0,0 @@
:: Possibly non-fatal http error
::
:::: /hoon/recoverable-error/mar
::
/- recoverable-error
::
:::: ~fyr
::
=, eyre
=, format
=, html
|_ recoverable-error
++ grab
|%
++ noun recoverable-error
++ httr
|= a/^httr ^- recoverable-error
~& [%recoverable-httr a]
~! a
?+ p.a ~|(non-recoverable+p.a !!)
$429 :+ p.a %rate-limit
%. %x-rate-limit-reset
;~ biff
~(get by (malt q.a))
de-json
ni:dejs-soft
==
==
--
++ grow |% ++ tank >[+<]< --
--

View File

@ -1,10 +0,0 @@
::
:::: /hoon/rss-xml/mar
::
/? 310
::
:: alias
/: /===/mar/xml
/!noun/
::
-

View File

@ -1,26 +0,0 @@
::
:::: /hoon/x-collections-json/mar
::
/? 310
::
:::: compute
::
=, eyre
=, format
=, html
|_ jon/json
::
++ grow :: convert to
|%
++ mime [/application/json (as-octs:mimes txt)] :: convert to %mime
++ txt (crip (en-json jon))
--
++ grab
|% :: convert from
++ mime |=({p/mite q/octs} (fall (rush (@t q.q) apex:de-json) *json))
++ noun json :: clam from %noun
++ numb numb:enjs
++ time time:enjs
--
++ grad %mime
--

View File

@ -1,3 +0,0 @@
|_ a=json
++ grab |% ++ noun json
-- --

View File

@ -1,21 +0,0 @@
/? 310
|_ [hed=marl tal=marl]
++ grow
|%
++ mime
=< mime
|%
++ elem ;div:(h1:"*{hed}" div:"*{tal}") :: convert to %elem
++ hymn ;html:(head:title:"snip" body:"+{elem}") :: convert to %hymn
++ html (crip (en-xml:^html hymn)) :: convert to %html
++ mime [/text/html (as-octs:mimes:^html html)] :: convert to %mime
--
++ collections-snip [hed tal]
--
::
++ grab
|%
+$ noun [marl marl]
--
--

View File

@ -1,3 +0,0 @@
|_ a=manx
++ grab |% ++ noun manx
-- --

View File

@ -1,17 +0,0 @@
::
:::: /hoon/elem/urb/mar
::
/? 310
=, mimes:html
=, html
|_ own/manx
::
++ grow :: convert to
|%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
++ html (crip (en-xml hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

View File

@ -1,20 +0,0 @@
::
:::: /hoon/x-urb/mar
::
/? 310
=, format
=, mimes:html
=, html
::
|_ max=manx
++ grow :: convert to
|%
++ mime [/text/html (as-octs html)] :: convert to %mime
++ html (crip (en-xml hymn)) :: convert to %html
++ hymn max
--
++ grab
|% :: convert from
++ noun manx :: clam from %noun
--
--

View File

@ -1,22 +0,0 @@
::
:::: /ren/collections/hoon
::
/? 309
/+ collections
::
:: collections:
::
:: get collection-config file at rendered path,
:: and all collections-item files the subpath.
:: outputs a +collection defined in /lib/collections/hoon
::
:: recursive renderer, see its counterpart in /ren/collections/item/hoon
::
/= collection
/^ collection:collections
/; |= [a=config:collections b=(map knot item:collections) ~]
[a b]
/. /collections-config/
/_ /collections-item/
==
collection

View File

@ -1,322 +0,0 @@
::
::::
::
/? 309
/+ collections, cram
/= gas /$ fuel:html
/= itm /collections-web-item/
::
::
/= collection-post
/: /===/web/landscape/collections/post /!noun/
::
=< (item-to-elem itm)
|%
++ item-to-elem
!:
|= itm=item:collections
^- manx
?< =(/collections/web s.bem.gas)
=/ sho (~(gut by qix.gas) %show %default)
;div.container
;+
?+ -.itm !!
%error ;div: 404
::
%collection
?+ sho !!
::
%default
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
;+ (meta-to-elem itm sho)
;+ (collection-to-elem col.itm)
==
==
;+ ?: =(type.meta.col.itm %blog)
;div.flex-col-5;
?: =(type.meta.col.itm %fora)
;div.flex-col-4;
;div.flex-col-4;
==
::
%post
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
;+ (meta-to-elem itm sho)
;+ (collection-post ~ (flop s.bem.gas))
==
==
;div.flex-col-2;
==
==
:: %raw
::
%both
?+ sho !!
::
%default
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
;+ (meta-to-elem itm sho)
;+ (both-to-elem col.itm raw.itm)
==
==
;div.flex-col-3;
==
::
%edit
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
;+ (meta-to-elem itm sho)
;+ (collection-post `raw.itm (flop s.bem.gas))
==
==
;div.flex-col-2;
==
==
==
==
++ collection-to-elem
|= col=collection:collections
^- manx
;ul.vanilla
;* %+ roll
%+ sort ~(tap by data.col)
|= [[knot a=item:collections] [knot b=item:collections]]
=/ a-dat (extract-date-created a)
=/ b-dat (extract-date-created b)
(lth a-dat b-dat)
|= [[nom=knot ite=item:collections] out=marl]
^- marl
?: ?=(%error -.ite)
out
:_ out
^- manx
;li.collection-post.mt-6
;+ (item-to-snip nom ite)
==
==
::
++ raw-to-elem
|= raw=raw-item:collections
^- manx
=/ elm elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
=/ title (~(gut by meta.raw) %name -.s.bem.gas)
=/ date (~(gut by meta.raw) %date-created 'missing date')
=/ author (~(gut by meta.raw) %author 'anonymous')
::
;div.mb-18.mt-4
;+ elm
==
::
++ both-to-elem
|= [col=collection:collections raw=raw-item:collections]
^- manx
;div
;+ (raw-to-elem raw)
::
;div
;div.flex.align-center.mb-5
;div(urb-component "IconComment");
;div.ml-2.text-small.text-mono.text-600: {<~(wyt by data.col)>}
==
::
;ul.vanilla
;* %+ turn
%+ sort ~(tap by data.col)
|= [[knot a=item:collections] [knot b=item:collections]]
=/ a-dat (extract-date-created a)
=/ b-dat (extract-date-created b)
(lte a-dat b-dat)
|= [nom=knot ite=item:collections]
^- manx
?> ?=(%raw -.ite)
=/ author (~(gut by meta.raw.ite) %author 'anonymous')
=/ host (~(gut by meta.raw.ite) %host 'anonymous')
=/ date (~(gut by meta.raw.ite) %date-created 'missing date')
;li.mb-6
;div.flex.align-center
;div.mr-2
=urb-component "Sigil"
=urb-ship "{(trip author)}"
=urb-size "18"
=urb-prefix "true";
;div
;a.vanilla.text-mono.text-small.text-700.mr-4
=href "/~~/{(trip host)}/==/web/landscape/profile"
; {(trip author)}
==
==
;div.text-host-breadcrumb
=urb-component "Elapsed"
=urb-timestring "{(trip date)}";
==
;div.collection-comment-content
;+ elm:(static:cram (ream data.raw.ite))
==
==
==
::
;div
=urb-component "CommentCreate"
=urb-pax "{<(flop s.bem.gas)>}"
=urb-ship "{(scow %p p.bem.gas)}";
==
==
::
++ extract-date-created
|= i=item:collections
^- @da
?- -.i
%error *@da
%collection date-created.meta.col.i
%both date-created.meta.col.i
%raw (slav %da (~(got by meta.raw.i) %date-created))
==
::
::
::
++ item-to-snip
|= [nom=knot itm=item:collections]
^- manx
?- -.itm
%error
;div: 404
%collection
(collection-to-snip nom col.itm)
%raw
(raw-to-snip nom raw.itm)
%both
(both-to-snip nom col.itm raw.itm)
==
::
++ collection-to-snip
|= [nom=knot col=collection:collections]
^- manx
=/ lnk=tape
"/~~/{(scow %p p.full-path.meta.col)}/=={(spud (flop (slag 1 s.full-path.meta.col)))}"
;div
;div.collection-date: {<date-created.meta.col>}
;h2.mt-0.mb-0
;a(href lnk): {(trip name.meta.col)}
==
;div.who.text-mono.text-600: {<author.meta.col>}
;div.meta-cont
;div.com-count.ml-12
; {(trip (scot %ud ~(wyt by data.col)))} comments
==
==
==
::
++ raw-to-snip
|= [nom=knot raw=raw-item:collections]
^- manx
=/ elm=manx elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (~(gut by meta.raw) %name nom)
=/ date (~(gut by meta.raw) %date-created 'missing date')
=/ author (~(gut by meta.raw) %author 'anonymous')
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
::
;div
;div.collection-date: {(trip date)}
;h2
;+ ?~ hed.ht
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.who.text-mono.text-600: {(trip author)}
;div.snippet
;* tal.ht
==
==
::
++ both-to-snip
|= [nom=knot col=collection:collections raw=raw-item:collections]
^- manx
=/ elm=manx elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (~(gut by meta.raw) %name nom)
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
::
;div
;div.collection-date: {<date-created.meta.col>}
;h2.mt-0.mb-0.text-500
;+ ?~ hed.ht
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.text-mono.text-small.text-300.mt-1.mb-1: {<author.meta.col>}
;div
;div.icon-label.justify-start
;div(urb-component "IconComment");
;div.ml-2
; {(trip (scot %ud ~(wyt by data.col)))}
==
==
==
==
::
++ meta-to-elem
|= [itm=item:collections sho=@tas]
^- manx
=/ mat=mart
:~ [%type "hidden"]
[%name "urb-metadata"]
[%urb-show (trip sho)]
[%urb-path (spud (flop s.bem.gas))]
==
:_ ~
:- %input
%+ weld mat
^- mart
?- -.itm
%error ~
%collection
=* met meta.col.itm
:~ [%urb-name (trip name.met)]
[%urb-author (scow %p author.met)]
[%urb-host (scow %p p.full-path.met)]
[%urb-date-created (scow %da date-created.met)]
[%urb-last-modified (scow %da last-modified.met)]
[%urb-content-type (trip type.met)]
[%urb-structure-type "collection-index"]
==
%raw
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-author (trip (met %author))]
[%urb-host (trip (met %host))]
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]
[%urb-content-type (trip (met %type))]
[%urb-structure-type "collection-post"]
==
%both
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-author (trip (met %author))]
[%urb-host (trip (met %host))]
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]
[%urb-content-type (trip (met %type))]
[%urb-structure-type "collection-post"]
==
==
--

View File

@ -1,56 +0,0 @@
::
:::: /ren/collections/item/hoon
::
/? 309
/+ collections
::
:: item:
::
:: render a collection-item at this path
:: outputs a +item defined in /lib/collections/hoon
::
:: recursive renderer, see its counterpart in /ren/collections/hoon
::
/= item
/^ item:collections
::
:: run a gate which checks if the output of the renderers below are null or not,
:: crash in the case that both are null
:: tag them with %collection, %raw, or %both for the 3 remaining permissible cases,
::
/; |= $: raw=?(~ raw-item:collections)
col=?(~ collection:collections)
~
==
?~ raw
?~ col
[%error ~]
[%collection col]
?~ col
[%raw raw]
[%both col raw]
::
:: run a pair of renderers
::
:: 1. get a .udon file together with its frontmatter, or else return ~
::
:: 2. run the collections renderer, if it fails return ~
:: (it fails if .collections-config file does not exist at this path)
::
/.
::
/| /; |= [a=(map knot cord) b=@t ~]
[%udon a b]
/. /front/
/udon/
==
/~ ~
==
::
/| /collections/
/~ ~
==
::
==
::
item

View File

@ -1,10 +0,0 @@
/? 309
/+ collections
/= gas /$ fuel:html
/= jon
/^ json
/; item-to-json:collections
::
/collections-web-item/
::
jon

View File

@ -1,50 +0,0 @@
/+ collections
/= gas /$ fuel:html
/= raw
/^ $@(~ raw-item:collections)
/| /; |= [a=(map knot cord) b=@t ~]
^- raw-item:collections
[%udon a b]
/. /front/
/udon/
==
::
/~ ~
==
::
/= col
/^ $@ ~
$% [%config config=config:collections items=(map knot item:collections) ~]
[%no-config items=(map knot item:collections) ~]
==
/| /. /~ %config
/collections-config/
/_ /collections-item/
==
::
/. /~ %no-config
/_ /collections-item/
==
::
/~ ~
==
::
::
^- item:collections
?~ col
?~ raw
[%error ~]
[%raw raw]
::
?: ?=(%no-config -.col)
?: =(s.bem.gas /collections/web)
?~ raw
[%collection *config:collections items.col]
[%both [*config:collections items.col] raw]
?~ raw
[%error ~]
[%raw raw]
?~ raw
[%collection config.col items.col]
[%both [config.col items.col] raw]

View File

@ -1,9 +0,0 @@
:: /!css/ in /===web/pack
::
:::: /hoon/css/ren
::
/? 310
/, /web/pack/css /!css/
/ /~ !!
==
-.-

View File

@ -1,9 +0,0 @@
:: /!js/ in /===web/pack
::
:::: /hoon/js/ren
::
/? 309
/, /web/pack/js /!js/
/ /~ !!
==
-.-

View File

@ -1,36 +0,0 @@
:: Simple rss transformer
::
:::: /hoon/rss-xml/ren
::
/? 310
/= sum /&snip&elem&/|(/elem/ /~[;div;])
/= kid /^ (map knot {marl marl})
/_ /&snip&/elem/
/$ |=({bem/beam *} [our=p.bem tub=(slag 1 (flop s.bem))])
::
:::: ~fyr, ~tasfyn-partyv
::
::~& [sum=sum kid=kid]
:: Link from relative path
=, eyre
=, html
=+ hok=.^(hart %r /(scot %p our)/host/real)
=+ ref=|=(a/path (en-purl hok `(weld tub a) ~))
:: urb:front attrs confuse RSS validators, readers
=+ no-meta=|=(a/marl ^+(a ?~(a ~ ?.(?=($meta n.g.i.a) a $(a t.a)))))
::
%- crip %- en-xml
;rss(version "2.0")
;channel
;title: *{hed.sum}
;link: {(ref /)}
;description: *{(no-meta tal.sum)}
;* %+ turn ~(tap by kid)
|= {nom/@t hed/marl tal/marl}
;item
;title: *{hed}
;description: *{(no-meta tal)}
;link: {(ref /[nom])}
==
==
==

View File

@ -1,19 +0,0 @@
::
:::: /hoon/urb/ren
::
/? 309
/+ landscape
/= full-page
/^ manx
/|
/, /web/collections /; landscape /collections-elem/
/web/landscape /; landscape /!hymn/
/web/pages /| /!hymn/
/hymn/
==
/ /; landscape /!hymn/
==
::
/: /===/web/404 /; landscape /!hymn/
==
full-page

View File

@ -1,13 +0,0 @@
::
:::: /hoon/json/ren
::
/? 309
/= page
/^ json
/, /web/collections
/& json
/collections-json/
/
/!json/
==
page

View File

@ -1 +0,0 @@
|=(a=json a)

View File

@ -1,16 +0,0 @@
::
:: no snip view for collections, only items
::
/= snipped-udon
/& snip
/& elem
/udon/
^- manx
;div
;h1
;* hed.snipped-udon
==
;* tal.snipped-udon
==

View File

@ -1 +0,0 @@
|=(a=manx [*marl ~[a]])

View File

@ -1,12 +0,0 @@
::
:::: /hoon/elem/x-htm/ren
::
/? 309
/= page
/^ manx
/, /web/collections
/collections-elem/
/
/!hymn/
==
page

View File

@ -1 +0,0 @@
|=(a=manx a)

View File

@ -1,16 +0,0 @@
::
:::: /hoon/elem/x-urb/ren
::
/? 309
/= inner
/^ manx
/|
/, /web/collections /collections-elem/
/ /| /!hymn/
/hymn/
==
==
::
/: /===/web/404 /!hymn/
==
inner

View File

@ -1,14 +0,0 @@
:: Add tree chrome
::
:::: /hoon/wrap/urb/ren
::
/? 309
/+ landscape
/= wrapped
/^ $-(inr=manx out=manx)
/, /web/collections /~ landscape
/web/landscape /~ landscape
/web/pages /~ |=(manx +<)
/ /~ landscape
==
wrapped

View File

@ -1,185 +0,0 @@
:: https://developer.github.com/v3/
::
:: These types correspond to the types that Github's API
:: produces, so please check Github's documentation for
:: details.
::
:: For parsing JSON into these types, check out the gh-parse
:: library.
::
|%
++ repository
$: id/id
name/@t
full-name/@t
owner/user
private/?
html-url/@t
description/@t
fork/?
url/@t
forks-url/@t
keys-url/@t
collaborators-url/@t
teams-url/@t
hooks-url/@t
issue-events-url/@t
events-url/@t
assignees-url/@t
branches-url/@t
tags-url/@t
blobs-url/@t
git-tags-url/@t
git-refs-url/@t
trees-url/@t
statuses-url/@t
languages-url/@t
stargazers-url/@t
contributors-url/@t
subscribers-url/@t
subscription-url/@t
commits-url/@t
git-commits-url/@t
comments-url/@t
issue-comment-url/@t
contents-url/@t
compare-url/@t
merges-url/@t
archive-url/@t
downloads-url/@t
issues-urls/@t
pulls-url/@t
milestones-url/@t
notifications-url/@t
labels-url/@t
releases-url/@t
created-at/time
updated-at/time
pushed-at/time
git-url/@t
ssh-url/@t
clone-url/@t
svn-url/@t
homepage/json
size/@ud
stargazers-count/@ud
watchers-count/@ud
language/json
has-issues/?
has-downloads/?
has-wiki/?
has-pages/?
forks-count/@ud
mirror-url/json
open-issues-count/@ud
forks/@ud
open-issues/@ud
watchers/@ud
default-branch/@t
==
++ commit
$: sha/@t
url/@t
author/author
committer/author
message/@t
tree/point
parents/(list point)
verification/verification
==
++ user
$: login/@t
id/id
avatar-url/@t
gravatar-id/@t
url/@t
html-url/@t
followers-url/@t
following-url/@t
gists-url/@t
starred-url/@t
subscriptions-url/@t
organizations-url/@t
repos-url/@t
events-url/@t
received-events/@t
type/@t
site-admin/?
==
++ issue
$: raw/json
url/@t
labels-url/@t
comments-url/@t
events-url/@t
html-url/@t
id/id
number/@ud
title/@t
user/user
labels/(list label)
state/@t
locked/?
assignee/(unit user)
milestone/json
comments/@ud
created-at/time
updated-at/time
closed-at/(unit time)
body/@t
==
++ author
$: date/@t
name/@t
email/@t
==
++ point
$: url/@t
sha/@t
==
++ verification
$: verified/?
reason/@t
signature/(unit @t)
payload/(unit @t)
==
++ label
$: url/@t
name/@t
color/@t
==
++ comment
$: url/@t
html-url/@t
issue-url/@t
id/id
user/user
created-at/time
updated-at/time
body/@t
==
++ id @t
++ time @t
++ issues
$: repository/repository
sender/user
$= action
$% {$assigned assignee/user}
{$unassigned assignee/user}
{$labeled label/label}
{$unlabeled label/label}
{$opened ~}
{$closed ~}
{$reopened ~}
==
issue/issue
==
++ issue-comment
$: repository/repository
sender/user
action/@t
issue/issue
comment/comment
==
++ ping {repo/json sender/json hok/(list @t) hook-id/@t zen/json}
--

View File

@ -1 +0,0 @@
{usr/knot url/(unit purf:eyre)}

Some files were not shown because too many files have changed in this diff Show More