Merge branch 'ford-turbo-eyre-sec' into ford-turbo

This commit is contained in:
Elliot Glaysher 2018-08-14 13:19:02 -07:00
commit 8f02e367b7
102 changed files with 86701 additions and 14182 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/sec/**/*.atom
*.swp
*.swo

2840
app/acme.hoon Normal file

File diff suppressed because it is too large Load Diff

674
app/collections.hoon Normal file
View File

@ -0,0 +1,674 @@
:: /app/collections/hoon
::
/? 309
/- hall
/+ collections
/= cols
/^ collection:collections
/; |= a=(map knot item:collections)
[*config:collections a]
/: /===/web/collections /_ /collections-item/
::
=, collections
=, space:userlib
::
|%
+= move [bone card]
+= card
$% [%info wire ship toro:clay]
[%poke wire dock poke]
[%perm wire ship desk path rite:clay]
==
+= poke
$% [%hall-action action:hall]
[%collections-action action:collections]
[%json json]
==
--
::
::::
::
|_ [bol=bowl:gall state=collection]
::
++ this .
::
::::
++ prep
|= old=(unit *)
^- (quip move _this)
?~ old
=< ta-done
(ta-hall-create-circle:ta /c 'collections')
=/ old-col ((soft collection) u.old)
?~ old-col
[~ this(state cols)]
=^ mow this
=< ta-done
(ta-update:ta u.old-col)
[mow this(state cols)]
::
:: mack: acknowledgement for permissions
::
++ mack
|= [wir=wire err=(unit tang)]
^- (quip move _this)
?~ err
[~ this]
(mean u.err)
::::::
:: utilities
::
++ base-spur `spur`/web/collections
++ base-beam `beam`[byk.bol (flop base-spur)]
++ base-path `path`(en-beam:format base-beam)
::
++ path-to-circle
|= pax=path
^- 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 '-'))
((hard @tas) seg)
[our.bol nam]
::
++ allowed-by
|= [who=@p dic=dict:clay]
=/ 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
|= [pax=path conf=config]
^- json
%- pairs:enjs:format
:~ ['owner' [%s (crip (scow %p owner.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
|= [pax=path raw=raw-item]
^- json
=/ owner (fall (~(get by meta.raw) %owner) ~.anon)
=/ dat (fall (~(get by meta.raw) %last-modified) (scot %da now.bol))
=/ nom (fall (~(get by meta.raw) %name) ~.no-title)
=/ typ (fall (~(get by meta.raw) %type) ~.no-type)
%- pairs:enjs:format
:~ ['owner' [%s owner]]
['path' [%a (turn pax |=(a=@ta `json`[%s a]))]]
['name' [%s nom]]
['date' [%s dat]]
['type' [%s typ]]
['content' [%s data.raw]]
==
::
++ front-to-wain
|= a=(map knot cord)
^- wain
=/ entries=wain
%+ turn ~(tap by a)
|= b=[knot cord]
=/ c=[term knot] ((hard ,[term knot]) b)
(crip " [{<-.c>} {<+.c>}]")
::
?~ entries ~
;: weld
[':- :~' ~]
entries
[' ==' ~]
==
::
++ update-umd-front
|= [fro=(map knot cord) umd=@t]
^- @t
%- of-wain:format
=/ tum (trip umd)
=/ 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)))
::
::
::
++ poke-noun
|= a=*
^- (quip move _this)
:: =/ pax ((hard path) a)
=/ yo=item (~(got by data.cols) ~.yoyo)
?> ?=(%both -.yo)
=/ new-front (~(put by meta.raw.yo) %new-field ~.fuck-off)
=/ new-body (crip (weld (trip data.raw.yo) "new line\0a"))
=/ new-contents (update-umd-front new-front data.raw.yo)
=/ act=action:collections
:* our.bol %home
:~ [%write /web/collections/yoyo/umd %umd new-body]
==
==
=/ mow=move
[ost.bol %poke /poke-act [our.bol %collections] %collections-action act]
[[mow]~ this]
::
++ poke-collections-action
|= act=action:collections
^- (quip move _this)
?. =(who.act our.bol)
::
:: forward poke if its not meant for us
:_ this
:_ ~
:* ost.bol %poke
/forward-collections-action
[who.act %collections]
%collections-action act
==
::
:: resolve %collection, %post, or %comment to %write action
=. acts.act
%+ turn acts.act
|= a=sub-action
^- sub-action
?: ?=(%collection -.a)
=/ conf=config
:* [byk.bol (flop (weld pax.a /[name.a]/collections-config))]
name.a
desc.a
our.bol
now.bol
now.bol
type.a
comments.a
~
visible.a
==
[%write (weld pax.a /[name.a]/collections-config) %collections-config conf]
::
?: ?=(%post -.a)
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%name name.a]
[%comments ?:(comments.a ~..y ~..n)]
[%owner (scot %p src.bol)]
[%date-created (scot %da now.bol)]
[%last-modified (scot %da now.bol)]
[%type type.a]
==
[%write (weld pax.a /[name.a]/umd) %umd `@t`(update-umd-front front content.a)]
::
?: ?=(%comment -.a)
=. content.a (crip (weld (trip content.a) "\0a"))
=/ dat (scot %da now.bol)
=/ front=(map knot cord)
%- my
:~ [%owner (scot %p src.bol)]
[%date-created dat]
[%last-modified dat]
[%type %comments]
==
[%write (weld pax.a /[dat]/umd) %umd (update-umd-front front content.a)]
::
a
::
:: if its from us no need to check permissions
?: =(src.bol our.bol)
ta-done:(ta-act:ta act)
::
:: if not from us, check if every action in the list is permitted
:: if even one isn't, don't reject the whole list
=/ success=?
%+ levy acts.act
|= a=sub-action
=/ pax (path +<.a)
?+ -.a !!
%write
=/ perms .^([dict:clay dict:clay] %cp pax)
(allowed-by src.bol +.perms)
%delete
=/ perms .^([dict:clay dict:clay] %cp pax)
(allowed-by src.bol +.perms)
%perms |
==
::
?: success
ta-done:(ta-act:ta act)
[~ this] :: XX TODO: report failure
::
::::::
::::::
::
++ ta
|_ moves=(list move)
::
:: core control
::
++ ta-this .
++ ta-done [(flop moves) this]
++ ta-emit
|= mov=move
%_ ta-this
moves [mov moves]
==
++ ta-emil
|= mos=(list move)
%_ ta-this
moves (welp (flop mos) moves)
==
::
:: interface
::
++ ta-act
|= act=action:collections
^+ ta-this
|-
?~ acts.act ta-this
=* a i.acts.act
=. ta-this
?+ -.a
!!
%write
?- -.for.a
%umd (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
%collections-config (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
==
%delete (ta-remove pax.a)
%perms (ta-set-permissions pax.a r.a w.a)
==
$(acts.act t.acts.act)
::
:: clay updates
::
++ ta-update
|= old=collection
^+ ta-this
:: ~& old+old
:: ~& new+cols
?: =(old cols)
:: ~& %no-update
ta-this
(ta-update-collection old cols /web/collections)
::
++ ta-insert-item
|= [new=item pax=path]
^+ ta-this
:: ~& insert+[-.new pax]
=/ parent-path (scag (dec (lent pax)) pax)
::
?- -.new
::
%collection
=. ta-this
(ta-hall-json parent-path 'new collection' (collection-notify pax meta.col.new))
::
=. ta-this (ta-hall-create-circle pax description.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-json parent-path 'new collection' (collection-notify pax meta.col.new))
=. ta-this
(ta-hall-json parent-path 'new item' (item-notify pax raw.new))
=. ta-this (ta-hall-create-circle pax description.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)
::
?: ?& (~(has by meta.raw.new) %comments)
=('.y' (~(got by meta.raw.new) %comments))
==
(ta-generate-comments pax)
ta-this
::
%raw
=. ta-this
(ta-hall-json parent-path 'new item' (item-notify pax raw.new))
?: ?& (~(has by meta.raw.new) %comments)
=('.y' (~(got by meta.raw.new) %comments))
==
(ta-generate-comments pax)
ta-this
::
==
::
++ ta-remove-item
|= [old=item pax=path]
^+ ta-this
:: ~& remove+[-.old pax]
:: flush permissions
:: notify parent of deletion
=/ parent (scag (dec (lent pax)) pax)
:: recurse for children
?- -.old
::
%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-hall-json parent 'deleted collection' (collection-notify pax meta.col.old))
=. ta-this
(ta-hall-json parent 'deleted item' (item-notify pax raw.old))
=. 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))
::
==
::
::
::
++ ta-update-item
:: always make sure removals happen first and insertions happen last
:: because removals flush permissions and insertions set them
::
|= [old=item new=item pax=path]
^+ ta-this
:: ~& update-item+[-.old -.new pax]
?: =(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)
::
ta-this
::
++ ta-update-raw-item
|= [old=raw-item new=raw-item pax=path]
^+ ta-this
:: ~& update-raw-item+[-.old -.new pax]
?: =(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)) :: XX fil
::
=? ta-this
?& =('.y' (fall (~(get by meta.new) %comments) '.n'))
=('.n' (fall (~(get by meta.old) %comments) '.n'))
==
:: create comments
(ta-generate-comments pax)
::
=? ta-this
?& =('.n' (fall (~(get by meta.new) %comments) '.n'))
=('.y' (fall (~(get by meta.old) %comments) '.n'))
==
:: delete comments
(ta-remove (weld pax /collections-config))
::
:: check if file has been modified
:: and if so update last modified field
=/ told (trip data.old)
=/ newt (trip data.new)
=/ old-con (slag (need (find ";>" told)) told)
=/ new-con (slag (need (find ";>" newt)) newt)
=? ta-this !=(old-con new-con)
=/ contents=@t
%+ update-umd-front
(~(put by meta.new) %last-modified (scot %da now.bol))
data.new
:: ~& %update-last-modified
:: ~& contents
:: ~& (weld pax /umd)
(ta-write (weld pax /umd) %umd !>(contents))
::
ta-this
::
++ ta-update-collection
|= $: old=collection
new=collection
pax=path
==
^+ ta-this
:: ~& update-collection+pax
::
=? 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])
:: ~& upd-new+(roll upd-new lam)
:: ~& upd-old+(roll upd-old lam)
:: ~& ins-new+(roll ins-new lam)
:: ~& del-old+(roll del-old lam)
::
=. 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
|= pax=path
^+ ta-this
=/ sup=path [%collections-config (flop pax)]
=/ pat (en-beam:format [byk.bol sup])
=/ cay=config
:* [byk.bol sup]
'comments'
'comments'
our.bol
now.bol
now.bol
%comments
|
~
|
==
(ta-write (flop sup) %collections-config !>(cay))
::
:: writing files
::
++ ta-write
|= [pax=path cay=cage]
^+ ta-this
=. pax (en-beam:format byk.bol (flop pax))
:: ~& w+(foal pax cay)
%+ ta-emit ost.bol
[%info (weld /ta-write pax) our.bol (foal pax cay)]
::
++ ta-remove
|= pax=path
=. pax (en-beam:format byk.bol (flop pax))
^+ ta-this
%+ ta-emit ost.bol
[%info (weld /ta-remove pax) our.bol (fray pax)]
::
:: permissions
::
++ ta-set-permissions
|= [pax=path r=rule:clay w=rule:clay]
:: =. pax (weld base-spur pax)
^+ ta-this
%+ ta-emit ost.bol
[%perm (weld /perms pax) our.bol q.byk.bol pax [%rw `r `w]]
::
++ ta-flush-permissions
|= pax=path
:: =. pax (weld base-spur pax)
^+ ta-this
%+ ta-emit ost.bol
[%perm (weld /perms pax) our.bol q.byk.bol pax [%rw ~ ~]]
::
:: hall
::
++ 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
|= 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 ::
|= [pax=path description=@t]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax)
=/ parent=circle:hall
?: =(nom.circ %c)
[our.bol %inbox]
(path-to-circle (scag (dec (lent pax)) pax))
:: ~& create+circ
:: ~& source+parent
%- ta-hall-actions
:: XX TODO make this depend on clay perms
:~ [%create nom.circ description %journal]
[%source nom.parent & (sy `source:hall`[circ ~] ~)]
==
::
++ ta-hall-lin
|= [pax=path msg=cord]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax)
%- ta-hall-action
[%phrase [circ ~ ~] [%lin | msg]~]
::
++ ta-hall-json
|= [pax=path header=@t jon=json]
^+ ta-this
=/ circ=circle:hall (path-to-circle pax)
%- ta-hall-action
:+ %phrase [circ ~ ~]
[%fat [%text ~[header]] [%lin | (crip (en-json:html jon))]]~
::
--
--

514
app/dns.hoon Normal file
View File

@ -0,0 +1,514 @@
/- dns
=, dns
!:
::
:: moves and state
::
|%
+= move (pair bone card)
+= poke
$% [%dns-bind for=ship him=ship target]
[%dns-bond for=ship him=ship turf]
[%dns-authority authority]
:: XX some other notification channel?
[%helm-send-hi ship (unit tape)]
==
+= card
$% [%tend wire ~]
[%wait wire @da]
[%poke wire dock poke]
[%rule wire %turf %put turf]
[%hiss wire [~ ~] %httr %hiss hiss:eyre]
==
:: +state: complete app state
::
+= state
$: :: dom: the set of our bindings
::
dom=(set turf)
:: per: per-dependent ips &c
::
per=(map ship relay)
:: nem: authoritative state
::
nem=(unit nameserver)
==
:: +join: dedup with :acme
::
++ join
|= [sep=@t hot=(list @t)]
^- @t
?> ?=(^ hot)
%+ rap 3
|- ^- (list @t)
?~ t.hot hot
[i.hot sep $(hot t.hot)]
:: +name: fully-qualified domain name
::
++ name
|= [him=ship dom=turf]
(cat 3 (join '.' [(crip +:(scow %p him)) (flop dom)]) '.')
:: +endpoint: append path to purl
::
++ endpoint
|= [bas=purl:eyre pat=path]
^+ bas
bas(q.q (weld q.q.bas pat))
:: +reserved: check if an ipv4 address is in a reserved range
::
++ reserved
|= a=@if
^- ?
=/ b (flop (rip 3 a))
:: 0.0.0.0/8 (software)
::
?. ?=([@ @ @ @ ~] b) &
?| :: 10.0.0.0/8 (private)
::
=(10 i.b)
:: 100.64.0.0/10 (carrier-grade NAT)
::
&(=(100 i.b) (gte i.t.b 64) (lte i.t.b 127))
:: 127.0.0.0/8 (localhost)
::
=(127 i.b)
:: 169.254.0.0/16 (link-local)
::
&(=(169 i.b) =(254 i.t.b))
:: 172.16.0.0/12 (private)
::
&(=(172 i.b) (gte i.t.b 16) (lte i.t.b 31))
:: 192.0.0.0/24 (protocol assignment)
::
&(=(192 i.b) =(0 i.t.b) =(0 i.t.t.b))
:: 192.0.2.0/24 (documentation)
::
&(=(192 i.b) =(0 i.t.b) =(2 i.t.t.b))
:: 192.18.0.0/15 (reserved, benchmark)
::
&(=(192 i.b) |(=(18 i.t.b) =(19 i.t.b)))
:: 192.51.100.0/24 (documentation)
::
&(=(192 i.b) =(51 i.t.b) =(100 i.t.t.b))
:: 192.88.99.0/24 (reserved, ex-anycast)
::
&(=(192 i.b) =(88 i.t.b) =(99 i.t.t.b))
:: 192.168.0.0/16 (private)
::
&(=(192 i.b) =(168 i.t.b))
:: 203.0.113/24 (documentation)
::
&(=(203 i.b) =(0 i.t.b) =(113 i.t.t.b))
:: 224.0.0.0/8 (multicast)
:: 240.0.0.0/4 (reserved, future)
:: 255.255.255.255/32 (broadcast)
::
(gte i.b 224)
==
:: |gcloud: provider-specific functions
::
++ gcloud
|_ aut=authority
:: +base: provider service endpoint
::
++ base
(need (de-purl:html 'https://www.googleapis.com/dns/v1/projects'))
:: +record: JSON-formatted provider-specific dns record
::
++ record
|= [him=ship tar=target]
^- json
:: ?> ?=([%gcloud *] pro.aut)
=+ ^- [typ=cord dat=cord]
?: ?=(%direct -.tar)
['A' (crip +:(scow %if p.tar))]
['CNAME' (name p.tar dom.aut)]
:- %o %- my :~
name+s+(name him dom.aut)
type+s+typ
:: XX make configureable?
ttl+n+~.300
rrdatas+a+[s+dat ~]
==
:: +request: provider-specific record-creation request
::
++ request
=, eyre
|= [him=ship tar=target pre=(unit target)]
^- hiss
:: ?> ?=([%gcloud *] pro.aut)
=/ url=purl
%+ endpoint base
/[project.pro.aut]/['managedZones']/[zone.pro.aut]/changes
=/ hed=math
(my content-type+['application/json' ~] ~)
=/ bod=octs
%- as-octt:mimes:html
%- en-json:html
:- %o %- my
:- additions+a+[(record him tar) ~]
?~ pre ~
[deletions+a+[(record him u.pre) ~] ~]
[url %post hed `bod]
--
--
::
:: the app itself
::
|_ [bow=bowl:gall state]
++ this .
:: +poke-noun: debugging
::
++ poke-noun
|= a=*
^- (quip move _this)
~& +<+:this
[~ this]
:: +sigh-httr: accept http response
::
++ sigh-httr
|= [wir=wire rep=httr:eyre]
^- (quip move _this)
?- wir
[%authority %confirm ~]
?~ nem
~& [%strange-authority wire=wir response=rep]
[~ this]
?. =(200 p.rep)
~& [%authority-confirm-fail rep]
[~ this(nem ~)]
:: XX anything to do here? parse body?
[~ this]
::
[%authority %create @ %for @ ~]
?~ nem
~& [%strange-authority wire=wir response=rep]
[~ this]
?. =(200 p.rep)
~& [%authority-create-fail wire=wir response=rep]
[~ this]
=/ him=ship (slav %p i.t.t.wir)
=/ for=ship (slav %p i.t.t.t.t.wir)
abet:(~(confirm bind u.nem) for him)
::
[%check @ ~]
=/ him=ship (slav %p i.t.wir)
?: =(200 p.rep)
abet:~(bind tell [him (~(get by per) him)])
:: cttp timeout
?: =(504 p.rep)
:: XX backoff, refactor
:_ this :_ ~
[ost.bow %wait wir (add now.bow ~m10)]
:: XX specific messages per status code
~& %direct-confirm-fail
abet:(~(fail tell [him (~(get by per) him)]) %failed-request)
::
*
~& +<
[~ this]
==
:: +sigh-tang: failed to make http request
::
++ sigh-tang
|= [wir=wire saw=tang]
^- (quip move _this)
~& [%sigh-tang wir]
?+ wir
[((slog saw) ~) this]
::
[%authority %confirm ~]
~& %authority-confirm-fail
[((slog saw) ~) this(nem ~)]
::
[%check @ ~]
~& %direct-confirm-fail
=/ him=ship (slav %p i.t.wir)
%- (slog saw)
abet:(~(fail tell [him (~(get by per) him)]) %crash)
==
:: +wake: timer callback
::
++ wake
|= [wir=wire ~]
^- (quip move _this)
?. ?=([%check @ ~] wir)
~& [%strange-wake wir]
[~ this]
=/ him=ship (slav %p i.t.wir)
abet:~(check tell [him (~(get by per) him)])
::
:: +poke-dns-authority: configure self as an authority
::
++ poke-dns-authority
|= aut=authority
^- (quip move _this)
~| %authority-reset-wat-do
?< ?=(^ nem)
abet:(init:bind aut)
:: +poke-dns-bind: create binding (if authority), forward request
::
++ poke-dns-bind
|= [for=ship him=ship tar=target]
^- (quip move _this)
~& [%bind src=src.bow +<.$]
=/ lan (clan:title him)
?: ?=(%czar lan)
~|(%bind-galazy !!)
?: =(for him)
~|(%bind-yoself !!)
?: ?& ?=(%king lan)
?=(%indirect -.tar)
==
~|(%bind-indirect-star !!)
:: always forward, there may be multiple authorities
::
=^ zom=(list move) ..this
abet:(~(forward tell [him (~(get by per) him)]) for tar)
=^ zam=(list move) ..this
?~ nem [~ this]
abet:(~(create bind u.nem) for him tar)
[(weld zom zam) this]
:: +poke-dns-bond: process established dns binding
::
++ poke-dns-bond
|= [for=ship him=ship dom=turf]
^- (quip move _this)
?: =(for him)
~|(%bond-yoself !!)
?: =(our.bow him)
~& [%bound-us dom]
:- [[ost.bow %rule /bound %turf %put dom] ~]
this(dom (~(put in ^dom) dom))
?: =(our.bow for)
~& [%bound-him him dom]
=< abet
(~(bake tell [him (~(get by per) him)]) dom)
~& [%strange-bond +<]
[~ this]
:: +coup: general poke acknowledgement or error
::
++ coup
|= [wir=wire saw=(unit tang)]
?~ saw [~ this]
~& [%coup-fallthru wir]
[((slog u.saw) ~) this]
:: +rove: hear %ames +lane change for child ships
::
++ rove
|= [wir=wire p=ship q=lane:ames]
^- (quip move _this)
:: XX move to %ames
?: =(our.bow p)
[~ this]
?. =(our.bow (sein:title p)) :: XX check will
~& [%rove-false p]
[~ this]
~& [%rove wir p q]
:: XX assert that we intend to be listening?
=< abet
(~(hear tell [p (~(get by per) p)]) q)
:: +prep: adapt state
::
:: ++ prep _[~ this]
++ prep
|= old=(unit state)
^- (quip move _this)
?^ old
[~ this(+<+ u.old)]
?: ?=(?(%czar %king) (clan:title our.bow))
abet:listen:tell
[~ this]
:: |bind: acting as zone authority
::
++ bind
=| moz=(list move)
|_ nam=nameserver
++ this .
:: +abet: finalize state changes, produce moves
::
++ abet
^- (quip move _^this)
[(flop moz) ^this(nem `nam)]
:: +emit: emit a move
::
++ emit
|= car=card
^+ this
this(moz [[ost.bow car] moz])
:: +init: establish zone authority (request confirmation)
::
++ init
|= aut=authority
:: ?> ?=(%gcloud pro.aut)
=/ wir=wire /authority/confirm
=/ url=purl:eyre
%+ endpoint base:gcloud
/[project.pro.aut]/['managedZones']/[zone.pro.aut]
~& url
%- emit(nam [aut ~ ~])
[%hiss wir [~ ~] %httr %hiss url %get ~ ~]
:: +create: bind :him, on behalf of :for
::
++ create
|= [for=ship him=ship tar=target]
:: XX defer %indirect where target isn't yet bound
?> ?| ?=(%direct -.tar)
(~(has by bon.nam) p.tar)
==
=/ wir=wire
/authority/create/(scot %p him)/for/(scot %p for)
=/ pre=(unit target)
=/ bon=(unit bound) (~(get by bon.nam) him)
?~(bon ~ `cur.u.bon)
:: ?> ?=(%gcloud pro.aut.nam)
=/ req=hiss:eyre
(~(request gcloud aut.nam) him tar pre)
%- emit(pen.nam (~(put by pen.nam) him tar)) :: XX save for
[%hiss wir [~ ~] %httr %hiss req]
:: +confirm: successfully bound
::
++ confirm
|= [for=ship him=ship]
=/ tar=target (~(got by pen.nam) him)
=/ bon=(unit bound)
(~(get by bon.nam) him)
=/ nob=bound
[now.bow tar ?~(bon ~ [[wen.u.bon cur.u.bon] hit.u.bon])]
=. pen.nam (~(del by pen.nam) him)
=. bon.nam (~(put by bon.nam) him nob)
=/ wir=wire
/bound/(scot %p him)/for/(scot %p for)
=/ dom=turf
(weld dom.aut.nam /(crip +:(scow %p him)))
%- emit
[%poke wir [for dap.bow] %dns-bond for him dom]
--
:: |tell: acting as planet parent or relay
::
++ tell
=| moz=(list move)
|_ [him=ship rel=(unit relay)]
++ this .
:: +abet: finalize state changes, produce moves
::
++ abet
^- (quip move _^this)
:- (flop moz)
?~ rel
^this
^this(per (~(put by per) him u.rel))
:: +emit: emit a move
::
++ emit
|= car=card
^+ this
this(moz [[ost.bow car] moz])
:: +listen: subscribe to %ames +lane changes for child ships
::
++ listen
^+ this
(emit [%tend /tend ~])
:: +hear: hear +lane change, maybe emit binding request
::
++ hear
|= lan=lane:ames
^+ this
=/ adr=(unit @if)
?.(?=([%if *] lan) ~ `r.lan)
=/ tar=target
?: ?| ?=(~ adr)
?=(%duke (clan:title him))
==
[%indirect our.bow]
[%direct %if u.adr]
?. ?| ?=(~ rel)
!=(tar tar.u.rel)
!bon.u.rel
==
this
=. rel `[wen=now.bow adr bon=| try=0 tar]
?:(?=(%indirect -.tar) bind check)
:: +check: confirm %direct target is accessible
::
++ check
^+ this
?> ?=(^ rel)
?> ?=(%direct -.tar.u.rel)
?: (reserved p.tar.u.rel)
(fail %reserved-ip)
?: (gth try.u.rel 2)
(fail %unreachable)
=. try.u.rel +(try.u.rel)
=/ wir=wire
/check/(scot %p him)
=/ url=purl:eyre
:- [sec=| por=~ host=[%| `@if`p.tar.u.rel]]
[[ext=`~.md path=~] query=~]
:: XX state mgmt
%- emit
[%hiss wir [~ ~] %httr %hiss url %get ~ ~]
:: +fail: %direct target is invalid or inaccessible
::
++ fail
|= err=@tas
^+ this
?> ?=(^ rel)
~& [%fail err him tar.u.rel]
=/ wir=wire
/fail/(scot %p him)
=/ msg=tape
?+ err
"dns binding failed"
::
%reserved-ip
?> ?=(%direct -.tar.u.rel)
"unable to create dns binding reserved address {(scow %if p.tar.u.rel)}"
==
:: XX state mgmt
%- emit
[%poke wir [our.bow %hood] %helm-send-hi him `msg]
:: +bind: request binding for target
::
:: Since we may be an authority, we poke ourselves.
::
++ bind
^+ this
?> ?=(^ rel)
:: XX state mgmt
=/ wir=wire
/bind/(scot %p him)/for/(scot %p our.bow)
%- emit
[%poke wir [our.bow dap.bow] %dns-bind our.bow him tar.u.rel]
:: +bake: successfully bound
::
++ bake
|= dom=turf
~& [%bake dom]
^+ this
?> ?=(^ rel)
=/ wir=wire
/forward/bound/(scot %p him)/for/(scot %p our.bow)
:: XX save domain, track bound-state per-domain
%- emit(bon.u.rel &)
[%poke wir [him dap.bow] %dns-bond our.bow him dom]
:: +forward: sending binding request up the network
::
++ forward
|= [for=ship tar=target]
~& [%forward tar]
^+ this
?: ?=(%~zod our.bow) :: ~zod don't forward
~& [%zod-no-forward him tar]
this
=/ to=ship
?- (clan:title our.bow)
%czar ~zod
* (sein:title our.bow)
==
=/ wir=wire
/forward/bind/(scot %p him)/for/(scot %p for)
%- emit :: XX for
[%poke wir [to dap.bow] %dns-bind for him tar]
--
--

View File

@ -23,10 +23,10 @@
poy/(unit dojo-project) :: working
$: :: sur: structure imports
::
sur=(list cable:ford-api)
sur=(list cable:ford)
:: lib: library imports
::
lib=(list cable:ford-api)
lib=(list cable:ford)
==
var/(map term cage) :: variable state
old/(set term) :: used TLVs
@ -108,7 +108,7 @@
mark
{$hiss hiss:eyre}
==
[%build wire @p ? schematic:ford-api]
[%build wire @p ? schematic:ford]
[%kill wire @p]
{$deal wire sock term club} ::
{$info wire @p toro:clay} ::
@ -126,7 +126,7 @@
$= result
$% :: %complete: contains the result of the completed build
::
[%complete build-result=build-result:ford-api]
[%complete build-result=build-result:ford]
:: %incomplete: couldn't finish build; contains error message
::
[%incomplete =tang]
@ -223,13 +223,13 @@
::
++ parse-cables
%+ cook
|= cables=(list cable:ford-api)
|= cables=(list cable:ford)
:+ 0 %ex
^- hoon
::
:- %clsg
%+ turn cables
|= cable=cable:ford-api
|= cable=cable:ford
^- hoon
::
:+ %clhp
@ -249,7 +249,7 @@
:: NOTE: This is a verbatim duplicate of Ford's cable parsing
::
++ parse-cable
%+ cook |=(a=cable:ford-api a)
%+ cook |=(a=cable:ford a)
;~ pose
(stag ~ ;~(pfix tar sym))
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
@ -338,7 +338,7 @@
++ dy-abet +>(poy `+<) :: resolve
++ dy-amok +>(poy ~) :: terminate
++ dy-ford :: send work to ford
|= [way=wire schematic=schematic:ford-api]
|= [way=wire schematic=schematic:ford]
^+ +>+>
?> ?=($~ pux)
:: pin all builds to :now.hid so they don't get cached forever
@ -361,7 +361,7 @@
++ dy-slam :: call by ford
|= {way/wire gat/vase sam/vase}
^+ +>+>
(dy-ford way `schematic:ford-api`[%call [%$ %noun gat] [%$ %noun sam]])
(dy-ford way `schematic:ford`[%call [%$ %noun gat] [%$ %noun sam]])
::
++ dy-errd :: reject change, abet
|= {rev/(unit sole-edit) err/@u}
@ -527,13 +527,13 @@
$lib
%_ .
lib
((dy-cast (list cable:ford-api) !>(*(list cable:ford-api))) q.cay)
((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay)
==
::
$sur
%_ .
sur
((dy-cast (list cable:ford-api) !>(*(list cable:ford-api))) q.cay)
((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay)
==
::
$dir =+ ^= pax ^- path
@ -1248,7 +1248,7 @@
++ dy-silk-vase |=(vax/vase [%$ %noun vax]) :: vase to silk
++ dy-silk-sources :: arglist to silk
|= src/(list dojo-source)
^- schematic:ford-api
^- schematic:ford
::
:+ %$ %noun
|-
@ -1257,7 +1257,7 @@
::
++ dy-silk-config :: configure
|= {cay/cage cig/dojo-config}
^- [wire schematic:ford-api]
^- [wire schematic:ford]
?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay)
::
:: naked gate
@ -1280,10 +1280,10 @@
:+ [%$ %noun !>([now=now.hid eny=eny.hid bec=he-beak])]
(dy-silk-sources p.cig)
:+ %mute [%$ %noun (fall (slew 27 gat) !>(~))]
^- (list [wing schematic:ford-api])
^- (list [wing schematic:ford])
%+ turn ~(tap by q.cig)
|= {a/term b/(unit dojo-source)}
^- [wing schematic:ford-api]
^- [wing schematic:ford]
:- [a ~]
:+ %$ %noun
?~(b !>([~ ~]) (dy-vase p.u.b))
@ -1373,7 +1373,7 @@
?: ?=($ur -.bil)
(dy-eyre /hand p.bil [q.bil %get ~ ~])
%- dy-ford
^- [path schematic:ford-api]
^- [path schematic:ford]
?- -.bil
$ge (dy-silk-config (dy-cage p.p.p.bil) q.p.bil)
$dv [/hand [%core [he-disc (weld /hoon (flop p.bil))]]]
@ -1419,13 +1419,13 @@
::
++ dy-mare :: build expression
|= gen/hoon
^- schematic:ford-api
^- schematic:ford
=+ too=(dy-hoon-mark gen)
=- ?~(too - [%cast he-disc u.too -])
:+ %ride gen
:- [%$ dy-hoon-head]
:^ %plan he-rail `coin`blob+**
`scaffold:ford-api`[he-rail zuse sur lib ~ ~]
`scaffold:ford`[he-rail zuse sur lib ~ ~]
::
++ dy-step :: advance project
|= nex/@ud
@ -1544,7 +1544,7 @@
|= $: way=wire
date=@da
$= result
$% [%complete build-result=build-result:ford-api]
$% [%complete build-result=build-result:ford]
[%incomplete =tang]
== ==
^+ +>
@ -1559,7 +1559,7 @@
::
%success
::
%. (result-to-cage:ford-api build-result.result)
%. (result-to-cage:ford build-result.result)
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
{$hand $~} dy-hand:dye

View File

@ -1,109 +0,0 @@
/+ ford-turbo
::
:: testing application for ford-turbo
::
:: To test our integration with clay, we have a minimal app which translates
:: calls from vane move form to gall moves. This proxies filesystem calls
:: back and forth.
::
=, clay
::
=/ test-pit=vase !>(.)
=/ ford-gate (ford-turbo test-pit)
::
|%
++ move (pair bone card)
++ card
$% [%warp wire sock riff]
==
--
::
|_ {bol/bowl:gall turbo/_(ford-gate)}
:: +prep: clear the state on each reload
::
++ prep _`.
:: +poke-noun: invoke with `:ford-turbo &atom 0`
::
++ poke-noun
|= a/*
^- [(list move) _+>.$]
::
=. turbo (turbo now.bol eny.bol our-scry)
::
=^ vane-moves turbo
%- call:turbo
:* duct=~[/ford-test] type=~ %make our.bol
[%scry %c %x rail=[[our.bol %home] /hoon/code/gen]]
==
::
(convert-moves vane-moves)
:: clay response to a %multi
::
++ wris
|= {way/wire p/[%da @da] q/(set (pair care path))}
^- [(list move) _+>.$]
~& [%wris way p q]
::
=. turbo (turbo now.bol eny.bol our-scry)
::
=^ vane-moves turbo
%- take:turbo
:* wire=way duct=~ *type [%c %wris p q]
==
(convert-moves vane-moves)
:: clay response to a %sing
::
++ writ
|= {way/wire rot/riot}
^- [(list move) _+>.$]
~& [%writ way rot]
::
=. turbo (turbo now.bol eny.bol our-scry)
::
=^ vane-moves turbo
%- take:turbo
:* wire=way duct=~ *type [%c %writ rot]
==
(convert-moves vane-moves)
:: +convert-moves: converts vane moves to gall moves
::
:: The moves that come out of a raw call to ford-turbo are set up for
:: arvo. Change them so they're in gall format.
::
++ convert-moves
|= vane-moves=(list move:ford-gate)
^- [(list move) _+>.$]
::
=/ gall-moves=(list move)
%+ murn vane-moves
|= [=duct card=(wind note:ford-gate gift:able:ford-api:ford-gate)]
^- (unit move)
::
?+ -.card !!
%pass
=* wire p.card
?+ -.q.card !!
%c `[ost.bol %warp wire sock.q.card riff.q.card]
==
::
%give
:: print out the result, but don't do anything else.
~& [%give card]
~
==
::
~& [%gall-moves gall-moves]
::
[gall-moves +>.$]
:: +our-scry: scry function for ford to use.
::
:: OK, so maybe we can't just scry here. When we hit .^, we're telling what's
:: interpreting us to block if we can't answer synchronously. So the real deal
:: is to always block, so ford will emit moves asking for everything asynchronously.
++ our-scry
|= [one=* two=(unit (set monk)) =term =beam]
^- (unit (unit cage))
::
~& [%scrying-for term beam]
~
--

View File

@ -1331,6 +1331,7 @@
?=(^ tal.u.ran.src)
::
?- -.u.tal.u.ran.src
$sd &
$da (gte now.bol +.u.tal.u.ran.src)
$ud ?& ?=(^ seq)
(gte u.seq +.u.tal.u.ran.src)
@ -1353,8 +1354,12 @@
=. ran
?~ ran `[[%ud 0] `[%ud count]]
=* hed hed.u.ran
=? hed ?=($sd -.hed)
[%ud (sub count (min count (abs:si +.hed)))]
?~ tal.u.ran `[hed `[%ud count]]
=* tal u.tal.u.ran
=? tal ?=($sd -.tal)
[%ud (sub count (min count (abs:si +.tal)))]
ran
:: never fails, but compiler needs it.
?> &(?=(^ ran) ?=(^ tal.u.ran))
@ -1363,15 +1368,17 @@
%- flop
|- ^- (list telegram)
?~ gaz zeg
?: ?- -.tal :: after the end
$ud (lth +.tal num)
$da (lth +.tal wen.i.gaz)
?: ?- -.u.tal.u.ran :: after the end
$ud (lth +.u.tal.u.ran num)
$da (lth +.u.tal.u.ran wen.i.gaz)
$sd !! :: caught above
==
:: if past the range, we're done searching.
zeg
?: ?- -.hed :: before the start
$ud (lth num +.hed)
$da (lth wen.i.gaz +.hed)
?: ?- -.hed.u.ran :: before the start
$ud (lth num +.hed.u.ran)
$da (lth wen.i.gaz +.hed.u.ran)
$sd !! :: caught above
==
:: if before the range, continue onward.
$(num +(num), gaz t.gaz)
@ -1391,18 +1398,18 @@
^- {in/? done/?}
?~ ran [& |]
=/ min
=* hed hed.u.ran
?- -.hed
$ud (gth count +.hed)
$da (gth now.bol +.hed)
?- -.hed.u.ran
$sd & :: relative is always in.
$ud (gth count +.hed.u.ran)
$da (gth now.bol +.hed.u.ran)
==
?~ tal.u.ran
[min |]
=- [&(min -) !-]
=* tal u.tal.u.ran
?- -.tal
$ud (gte +(+.tal) count)
$da (gte +.tal now.bol)
?- -.u.tal.u.ran
$sd | :: relative is always done.
$ud (gte +(+.u.tal.u.ran) count)
$da (gte +.u.tal.u.ran now.bol)
==
::
:> #
@ -2361,13 +2368,13 @@
=- (~(so-first-grams so:ta nom.qer ~ -) ran.qer)
::TODO this can be done more efficiently.
?~ wer.qer u.soy
%_ u.soy
grams
?. (~(has by sourced.u.soy) u.wer.qer) ~
%+ turn (~(got by sourced.u.soy) u.wer.qer)
|= n/@ud
(snag n grams.u.soy)
==
=- u.soy(grams -, count (lent -))
?. (~(has by sourced.u.soy) u.wer.qer) ~
%+ turn
%- flop
(~(got by sourced.u.soy) u.wer.qer)
|= n/@ud
(snag n grams.u.soy)
(cury gram-to-envelope nom.qer)
:- shape.u.soy
?. (~(has in wat.qer) %config-r) ~

View File

@ -285,8 +285,8 @@
%+ welp /circle/[inbox]/grams/config/group
?. =(0 count)
[(scot %ud last) ~]
=+ history-days=~d5
[(scot %da (sub now.bol history-days)) ~]
=+ history-msgs=200
[(cat 3 '-' (scot %ud history-msgs)) ~]
==
::
:> #

View File

@ -134,12 +134,19 @@
:- /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/x-urb "temporarily disabled"
:- /ren/x-htm "temporarily disabled"
:- /ren/x-collections-snip "temporarily disabled"
:- /ren/x-collections-json "temporarily disabled"
:- /ren/urb "temporarily disabled"
::
:- /app/gh "hangs for some reason"
:- /mar/gh "hangs for some reason"
:- /app/twit "slow and/or crash"
:- /gen/twit "slow and/or crash"
:- /mar/twit "slow and/or crash"
:- /web/landscape "/$ doensn't work in tests"
==
::
++ failing

30
gen/dns/authority.hoon Normal file
View File

@ -0,0 +1,30 @@
:: DNS: configure zone authority
::
:::: /hoon/authority/dns/gen
::
/- dns, sole
=, [dns sole]
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
[arg=$@(~ [dom=path ~])]
~
==
^- (sole-result [%dns-authority authority])
=- ?~ arg -
(fun.q.q [%& dom.arg])
%+ sole-lo
[%& %dns-domain "dns domain: "]
%+ sole-go thos:de-purl:html
|= hot=host:eyre
?: ?=($| -.hot)
~|(%ips-unsupported !!)
%+ sole-lo
[%& %project "gcloud project: "]
%+ sole-go urs:ab
|= project=@ta
%+ sole-lo
[%& %zone "dns zone: "]
%+ sole-go urs:ab
|= zone=@ta
%+ sole-so %dns-authority
[p.hot %gcloud project zone]

View File

@ -1,9 +1,9 @@
/+ tester
::
/= ford-turbo /: /===/sys/vane/turbo
/= ford-turbo /: /===/sys/vane/ford
/!noun/
::
=, ford-api
=, ford
::
:- %say
|= [[now=@da eny=@ bek=beak] ~ ~]
@ -112,6 +112,7 @@
test-mute
test-bake-renderer
test-bake-mark
test-bake-mark-fallback
test-diff
test-diff-form
test-pact
@ -2967,9 +2968,19 @@
call-args=[duct=~[/alts] type=~ %build ~nul live=%.y alts]
::
^= moves
:~ :* duct=~[/alts] %give %made ~1234.5.6 %complete
[%error [%leaf "%alts: all options failed"]~]
==
:~ :* duct=~[/alts] %give %made ~1234.5.6 %complete %error
:~ [%leaf "%alts: all options failed"]
[%leaf "option"]
:+ %rose [" " "\{" "}"] :~
[%leaf "scry failed for"]
[%leaf "%cx /~nul/home/~1234.5.6/scry/one"]
==
[%leaf "option"]
:+ %rose [" " "\{" "}"] :~
[%leaf "scry failed for"]
[%leaf "%cx /~nul/home/~1234.5.6/scry/two"]
==
== ==
:* duct=~[/alts] %pass wire=/~nul/clay-sub/~nul/home/~1234.5.6
%c %warp [~nul ~nul] %home
`[%mult [%da ~1234.5.6] (sy [%x /scry/two] [%x /scry/one] ~)]
@ -5495,7 +5506,7 @@
::
%+ weld
%- expect-eq !>
:- %noun
:- %foo
p.cage
::
%+ weld
@ -5601,6 +5612,90 @@
results1
(expect-ford-empty ford-gate ~nul)
==
:: renderers can fail, and we should fall back to using the mark
::
++ test-bake-mark-fallback
:- `tank`leaf+"test-bake-mark-fallback"
::
=/ hoon-src-type=type [%atom %$ ~]
=/ scry-results=(map [term beam] (unit cage))
%- my :~
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/dat/ren]]
:^ ~ %hoon hoon-src-type
'''
/= data /~ !!
data
'''
::
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/dat/mar]]
:^ ~ %hoon hoon-src-type
'''
|_ atom=@
++ grab
|%
++ txt @
--
--
'''
::
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/txt/mar]]
~
::
:- [%cx [[~nul %home %da ~1234.5.6] /txt/data]]
:^ ~ %txt hoon-src-type
'''
one
'''
::
:- [%cy [[~nul %home %da ~1234.5.6] /data]]
`[%arch !>(`arch`[fil=~ dir=(my [%txt ~]~)])]
::
:- [%cy [[~nul %home %da ~1234.5.6] /txt/data]]
`[%arch !>(`arch`[fil=`*@uv dir=~])]
==
::
=^ results1 ford-gate
%- test-ford-call-with-comparator :*
ford-gate
now=~1234.5.6
scry=(scry-with-results-and-failures scry-results)
::
::
^= call-args
:* duct=~[/path] type=~ %build ~nul live=%.n
[%bake %dat *coin `rail:ford-gate`[[~nul %home] /data]]
==
::
^= comparator
|= moves=(list move:ford-gate)
::
?> =(1 (lent moves))
?> ?=(^ moves)
?> ?=([* %give %made @da %complete *] i.moves)
=/ result result.p.card.i.moves
?> ?=([%success %bake *] build-result.result)
::
=/ =cage cage.build-result.result
::
%+ weld
%- expect-eq !>
:- %dat
p.cage
::
%+ weld
%- expect-eq !>
:- 'one'
q.q.cage
::
%- expect-eq !>
:- &
(~(nest ut p.q.cage) | -:!>('one'))
==
::
;: weld
results1
(expect-ford-empty ford-gate ~nul)
==
::
++ test-diff
:- `tank`leaf+"test-diff"
@ -7344,6 +7439,7 @@
^- tang
=/ ford *ford-gate
%- expect-eq !>
:- (my [ship *ford-state:ford]~)
state-by-ship.ax.+>+<.ford
:- *ford-state:ford
=/ state (~(got by state-by-ship.ax.+>+<.ford) ship)
state(cache cache:*ford-state:ford)
--

View File

@ -62,7 +62,6 @@
[%g /vane/gall]
[%e /vane/eyre]
[%f /vane/ford]
[%t /vane/turbo]
==
|- ^+ all
?~ vay all

56
lib/collections.hoon Normal file
View File

@ -0,0 +1,56 @@
::
:::: /hoon/collections/lib
::
/? 309
/+ cram
::
::
|%
+= collection [meta=config data=(map nom=knot =item)]
+= item
$% [%collection col=collection]
[%raw raw=raw-item]
[%both col=collection raw=raw-item]
==
+= raw-item
$% [%umd meta=(map knot cord) data=@t]
==
::
+= config
$: full-path=beam
name=@ta
description=@t
::
owner=@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=@ta desc=@t comments=? visible=? type=@tas]
[%post pax=path name=@ta type=@tas comments=? content=@t]
[%comment pax=path content=@t]
==
::
+= form
$% [%umd @t]
[%collections-config config]
==
::
--

167
lib/colls.hoon Normal file
View File

@ -0,0 +1,167 @@
/+ old-zuse
=, old-zuse
|%
:: sort knots by date
:: TODO when we change the write path to have trailing sig, remove here before sort
++ dor
|= [a=knot b=knot]
(gth (unt:chrono:userlib (slav %da a)) (unt:chrono:userlib (slav %da b)))
:: checks if authorized
++ authed
|= gas/epic
^- ?
%+ lien
~(tap in (~(get ju aut.ced.gas) %$))
|= b/knot
=((scot %p p.bem.gas) b)
++ no-title
|= wat/wain
^- wain
?: =((scag 2 (trip -:wat)) "# ")
+:wat
wat
++ esoo
|= d/@d
^- tape
=/ t (yore d)
;: welp
(scag 1 (scow %ud y.t))
(swag [2 3] (scow %ud y.t))
"-"
(double m.t)
"-"
(double d.t.t)
"T"
(double h.t.t)
":"
(double m.t.t)
":"
(double s.t.t)
"Z"
==
:: ud to leading zero tape
++ double
|= a/@ud
^- tape
=/ x (scow %ud a)
?: (lth a 10)
(welp "0" x)
x
:: takes a map of knot * where knot is a serialized @da and returns the newest
++ latest
|* a/(map knot *)
^- (pair knot *)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(dor p.b p.c)
?~ sa
*(pair knot *)
i.sa
++ latest-post
'''
/- collections
/+ colls
/= gas /$ fuel:html
/= configs /: /===/web/collections
/^ (map knot config:collections) /_ /collections-config/
:: tried to pull this func into a lib, but couldn't get the gill working correctly. grr.
/= metawcom /; |= a/(map knot topicful:collections)
^- (pair knot topicful:collections)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(gth (unt:chrono:userlib (slav %da p.b)) (unt:chrono:userlib (slav %da p.c)))
?~ sa
*(pair knot topicful:collections)
i.sa
/: /%%/
/^ (map knot topicful:collections) /_ /collections-topic-full/
/= content /; |= a/(map knot manx)
^- (pair knot manx)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(gth (unt:chrono:userlib (slav %da p.b)) (unt:chrono:userlib (slav %da p.c)))
?~ sa
*(pair knot manx)
i.sa
/: /%%/
/^ (map knot manx) /_
/&elem&md&/collections-topic/
=/ config (~(get by configs) +<:s.bem.gas)
~& metawcom
::
=, old-zuse
^- manx
;div.container
;div.row
;input(type "hidden", name "urb-header", value "collection-index", title "{(trip desc:(need config))}", id "{(trip +<:s.bem.gas)}", ship "{(scow %p p.bem.gas)}");
;div.col-sm-10.col-sm-offset-2
;div.post.collection-post-page
;div.row.collection-date
;span.mr-2.text-black.text-500(urb-component "Elapsed", urb-timestring "{(esoo:colls mod.info.q.metawcom)}");
;span: {(trip -:s.bem.gas)}
==
::
;div#show
;div.row.tit.mt-6.collection-title
;h3: {(trip tit.info.q.metawcom)}
==
;* ?: (authed:colls gas)
;=
;a(href ".collections-edit")
;button#edit-btn.btn.btn-primary.mb-4
; Edit →
==
==
==
;=
;div;
==
;div.row.content.mb-18.mt-6
;div: +{q.content}
==
;* ?: comm:(need config)
;=
;div
;div.mb-2
;span(urb-component "IconComment");
;span: {<~(wyt by coms.q.metawcom)>}
==
;ul
;* %+ turn
%+ sort
~(tap by coms.q.metawcom)
|= [a=[c=@da d=[mod=@da who=@p wat=wain]] b=[c=@da d=[mod=@da who=@p wat=wain]]]
(lth (unt c.a) (unt c.b))
::
|= [c=@da d=[mod=@da who=@p wat=wain]]
;li.collection-comment
;div.collection-comment-avatar
;div(urb-component "AvatarSample1");
==
;div
;div
;a.collection-comment-author.text-mono(href "/~~/pages/nutalk/profile"): {(trip (scot %p who.d))}
==
;p: {(trip (of-wain:format wat.d))}
==
;span.collection-date.text-black.mr-2(urb-component "Elapsed", urb-timestring "{(esoo:colls mod.d)}");
;span.collection-date: {(esoo:colls mod.d)}
==
==
;div(urb-component "CommentCreate", urb-coll "{(trip +<:s.bem.gas)}", urb-top "{(trip -:s.bem.gas)}");
==
==
~
==
==
==
==
==
'''
--

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,8 @@
::
|= pla/place
^- knot
(scot -.pla +.pla)
?. ?=($sd -.pla) (scot -.pla +.pla)
(cat 3 '-' (scot %ud (abs:si +.pla)))
::
++ path-to-range
:> path to msg range
@ -101,10 +102,14 @@
;~ pose
(stag %ud dem:ag)
::
=- (stag %da (sear - ;~(pfix sig crub:so)))
=- (stag %da (sear - crub:so))
|= a/dime
^- (unit @da)
?:(?=($da p.a) `q.a ~)
::
%+ stag %sd
%+ cook (cury new:si |)
;~(pfix hep dem:ag)
==
::
++ change-glyphs :< ...

View File

@ -78,10 +78,17 @@
%- ~(gas in *(set well:gall))
^- (list well:gall)
=+ myr=(clan:title our)
:: TODO: Make sure all the other apps compile later.
::
:: ?: ?=($pawn myr)
:: [[%base %hall] [%base %talk] [%base %dojo] ~]
:: [[%home %hall] [%home %talk] [%home %dojo] ~]
[[%home %dojo] ~]
:: [[%base %collections] [%base %hall] [%base %talk] [%base %dojo] ~]
:~ [%home %collections]
[%home %acme]
[%home %dns]
[%home %dojo]
:: [%home %hall]
:: [%home %talk]
==
::
++ deft-fish :: default connects
|= our/ship

View File

@ -179,7 +179,6 @@
[%e /vane/eyre]
[%f /vane/ford]
[%g /vane/gall]
[%t /vane/turbo]
==
|= {p/@tas q/path}
=+ way=`path`(welp top q)

View File

@ -61,7 +61,7 @@
?> =(src our)
=> |% :: arvo structures
++ card ::
$% {$exec wire @p $~ {beak silk:ford}} ::
$% {$build wire @p ? schematic:ford} ::
{$drop wire @p @tas} ::
{$info wire @p @tas nori} ::
{$mont wire @tas beam} ::
@ -200,7 +200,7 @@
|%
++ emit |=(a/card +>(..autoload (^emit a)))
++ tracked-vanes
`(list @tas)`~[%ames %behn %clay %dill %eyre %ford %gall %turbo]
`(list @tas)`~[%ames %behn %clay %dill %eyre %ford %gall]
::
++ our-home /(scot %p our)/home/(scot %da now)
++ sys-hash |=(pax/path .^(@uvI %cz :(welp our-home /sys pax)))
@ -287,8 +287,8 @@
|= {way/wire are/(each (set path) (pair term tang))}
abet:abet:(mere:(take way) are)
::
++ take-made ::
|= {way/wire dep/@uvH reg/gage:ford}
++ take-made
|= [way=wire date=@da result=made-result:ford]
:: hack for |overload
::
:: We might have gotten an ignorable response back for our cache priming
@ -297,7 +297,7 @@
?: =(/prime/cache way)
~& %cache-primed
abet
abet:abet:(made:(take way) dep reg)
abet:abet:(made:(take way) date result)
::
++ take-coup-fancy ::
|= {way/wire saw/(unit tang)}
@ -342,23 +342,7 @@
|= {way/wire $~}
?> ?=({@ $~} way)
=+ tym=(slav %dr i.way)
:: this builds up a ford build for the front page to prime the cache.
=. +>.$
=/ request-data :~
[0 [0 8.080] 0 'localhost' ~]
:: associate 0 as the anonymous ship, which is the ++add result.
[[0 (scot %p (add our ^~((bex 64))))] ~ ~]
'not-yet-implemented'
`'en-US,en;q=0.9'
`.127.0.0.1
==
=/ monies/coin [%many ~[[%blob request-data] [%$ ~.n 0]]]
=/ request/silk:ford [%bake %urb monies [our %home [%da now]] /web]
(emit `card`[%exec /kiln/prime/cache our `[[our %home [%da now]] request]])
=. +>.$
(emit %wipe /kiln/overload/[i.way] our ~)
=. +>.$
(emit %wait /kiln/overload/[i.way] (add tym now))
~& %wake-overload-deprecated
abet
::
++ spam
@ -484,30 +468,6 @@
p.res
(ford-fail p.res)
::
++ gage-to-cages
|= gag/gage:ford ^- (list (pair cage cage))
(unwrap-tang (gage-to-tage gag))
::
++ gage-to-tage
|= gag/gage:ford
^- (each (list (pair cage cage)) tang)
?. ?=($tabl -.gag)
(mule |.(`$~`(ford-fail >%strange-gage< ~)))
=< ?+(. [%& .] {@ *} .)
|- ^- ?((list {cage cage}) (each $~ tang))
?~ p.gag ~
?- -.p.i.p.gag
$tabl (mule |.(`$~`(ford-fail >%strange-gage< ~)))
$| (mule |.(`$~`(ford-fail p.p.i.p.gag)))
$&
?- -.q.i.p.gag
$tabl (mule |.(`$~`(ford-fail >%strange-gage< ~)))
$| (mule |.(`$~`(ford-fail p.q.i.p.gag)))
$& =+ $(p.gag t.p.gag)
?+(- [[p.p p.q]:i.p.gag -] {@ *} -)
==
==
::
++ perform ::
^+ .
(blab [ost %merg /kiln/[syd] our syd her sud cas gem] ~)
@ -554,23 +514,29 @@
=> .(+>.$ (spam leaf+- ~))
=+ tic=(cat 3 syd '-scratch')
%- blab :_ ~
:* ost %exec /kiln/[syd]
our ~ [our tic %da now] %tabl
^- (list (pair silk:ford silk:ford))
=, ford
:* ost %build /kiln/[syd] our live=%.n
^- schematic
:- %list
^- (list schematic)
:: ~& > kiln-mashing+[p.are syd=syd +<.abet]
%+ turn ~(tap in p.are)
|= pax/path
^- (pair silk:ford silk:ford)
^- [schematic schematic]
:- [%$ %path -:!>(*path) pax]
=+ base=[%file [our tic %da now] (flop pax)]
=+ alis=[%file [her sud cas] (flop pax)]
=+ bobs=[%file [our syd %da now] (flop pax)]
=+ dali=[%diff base alis]
=+ dbob=[%diff base bobs]
=/ base=schematic [%scry %c %x `rail`[[our tic] (flop pax)]]
?> ?=([%da @] cas)
=/ alis=schematic
[%pin p.cas `schematic`[%scry %c %x [[our syd] (flop pax)]]]
=/ bobs=schematic
[%scry %c %x [[our syd] (flop pax)]]
=/ dali=schematic [%diff [our syd] base alis]
=/ dbob=schematic [%diff [our syd] base bobs]
=+ ^- for/mark
=+ (slag (dec (lent pax)) pax)
?~(- %$ i.-)
[%mash for [her sud dali] [our syd dbob]]
^- schematic
[%mash [our tic] for [[her sud] for dali] [[our syd] for dbob]]
==
=+ "failed to merge with strategy meld"
lose:(spam leaf+- >p.p.are< q.p.are)
@ -624,15 +590,26 @@
(welp (tape-to-tanks "\0a{c}{a}") >b< ~)
::
++ made
|= {dep/@uvH reg/gage:ford}
|= [date=@da result=made-result:ford]
:: |= {dep/@uvH reg/gage:ford}
^+ +>
?: ?=($| -.reg)
::
?: ?=([%incomplete *] result)
=+ "failed to mash"
lose:(spam leaf+- p.reg)
lose:(spam leaf+- tang.result)
?: ?=([%complete %error *] result)
=+ "failed to mash"
lose:(spam leaf+- message.build-result.result)
?> ?=([%complete %success %list *] result)
=+ ^- can/(list (pair path (unit miso)))
%+ turn (gage-to-cages reg)
|= {pax/cage dif/cage}
%+ turn results.build-result.result
|= res=build-result:ford
^- (pair path (unit miso))
?> ?=([%success ^ *] res)
~! res
=+ pax=(result-to-cage:ford head.res)
=+ dif=(result-to-cage:ford tail.res)
::
?. ?=($path p.pax)
~| "strange path mark: {<p.pax>}"
!!

View File

@ -16,7 +16,7 @@
::
|%
++ data $%({$json json} {$mime mime})
++ card $% {$exec wire @p $~ {beak silk:ford}}
++ card $% {$build wire @p ? schematic:ford}
{$info wire @p toro:clay}
==
--
@ -129,18 +129,35 @@
?~ ext $(ext [~ -.dat])
=+ cay=?-(-.dat $json [-.dat !>(+.dat)], $mime [-.dat !>(+.dat)])
?: =(u.ext -.dat)
(made pax ~ &+cay)
(made pax now [%complete %success %$ cay])
=< abet
%^ emit %exec write+pax :: XX defer %nice
[our ~ beak-now %cast u.ext $+cay]
%- emit :*
%build
write+pax
our
live=%.n :: XX defer %nice
^- schematic:ford :: SYNTAX ERROR AT START OF LINE?
=/ =beak beak-now
[%cast [p q]:beak u.ext [%$ cay]]
==
::
++ made
|= {pax/wire @ res/gage:ford} ^+ abet
|= [pax=wire date=@da result=made-result:ford]
^+ abet
:: |= {pax/wire @ res/gage:ford} ^+ abet
:: ?. =(our src)
:: ~|(foreign-write/[our=our src=src] !!)
?+ -.res ~|(gage+-.res !!)
$| (mean p.res)
$& =- abet:(emit %info write+~ our -)
(foal :(welp (en-beam beak-now ~) pax /[-.p.res]) p.res)
==
?: ?=(%incomplete -.result)
(mean tang.result)
::
=/ build-result build-result.result
::
?: ?=([%error *] build-result)
(mean message.build-result)
::
=/ =cage (result-to-cage:ford build-result)
::
=- abet:(emit %info write+~ our -)
::
(foal :(welp (en-beam beak-now ~) pax /[-.cage]) cage)
--

21
lib/nutalk.hoon Normal file
View File

@ -0,0 +1,21 @@
|= inner=manx
^- manx
;html
::
;head
;title: Nutalk
;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.js";
==
::
==

View File

@ -102,7 +102,7 @@
|= a/$@(@t purl) ^- hiss
(post-quay (parse-url a) oauth-callback+oauth-callback ~)
::
++ our-host .^(hart %e /(scot %p our)/host/fake)
++ our-host .^(hart %e /(scot %p our)/host/real)
++ oauth-callback
~& [%oauth-warning "Make sure this urbit ".
"is running on {(en-purl:html our-host `~ ~)}"]

View File

@ -101,7 +101,7 @@
%+ rap 3 :- (wack a)
(turn b |=(c/knot (cat 3 '_' (wack c))))
::
++ our-host .^(hart %e /(scot %p our)/host/fake)
++ our-host .^(hart %e /(scot %p our)/host/real)
++ redirect-uri
%- crip %- en-purl
%^ into-url:interpolate 'https://our-host/~/ac/:domain/:user/in'

View File

@ -253,17 +253,6 @@
++ gram gram:eyre :: inter-ship message
++ kiss-eyre task:able:eyre :: in request ->$
++ gift-eyre gift:able:eyre :: out result <-$
++ hood hood:ford :: assembly plan
++ hoof hoof:ford :: resource reference
++ hoop hoop:ford :: source in hood
++ hops hops:ford :: XX late-bound path
++ horn horn:ford :: resource tree
++ milk milk:ford :: sourced silk
++ silk silk:ford :: construction layer
++ bilk bilk:ford :: sourced request
++ gage gage:ford :: recursive cage+tang
++ kiss-ford task:able:ford :: in request ->$
++ gift-ford gift:able:ford :: out result <-$
++ club club:gall :: agent action
++ cuft cuft:gall :: internal gift
++ culm culm:gall :: config action

16
lib/rekey.hoon Normal file
View File

@ -0,0 +1,16 @@
:: Userspace implementation of old /_ @foo behavior
:: :: ::
:::: /hoon/rekey/lib :: ::
:: :: ::
/? 310 :: version
:: :: ::
:::: :: ::
:: :: ::
=, wired
|* typ=@tas
|* inp=(map knot *) ^- (map (odo:raid typ) _(~(got by inp)))
=> .(inp `(map knot _(~(got by inp)))`inp)
%- malt
%+ murn ~(tap by inp)
|* [a=knot b=*] ^- (unit [(odo:raid typ) _b])
(both (slaw typ a) `b)

9
mar/acme/order.hoon Normal file
View File

@ -0,0 +1,9 @@
::
:::: /mar/acme/order/hoon
::
|_ a=(set (list @t))
++ grab
|%
++ noun (set (list @t))
--
--

119
mar/collections/action.hoon Normal file
View File

@ -0,0 +1,119 @@
::
:::: /hoon/actions/collection/mar
::
/? 309
/+ collections
=, collections
=, format
::
|_ act=action:collections
::
++ grow
|%
++ tank >act<
--
::
++ grab
|%
++ noun action:collections
++ json
|= jon=^json
%- (hard 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)
%- (hard (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
==
::
++ 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

@ -0,0 +1,96 @@
::
:::: /hoon/config/collection/mar
::
/+ collections
|_ con=config:collections
::
::
++ grow
|%
++ mime
:- /text/x-collection-config
(as-octs:mimes:html (jam con))
:: ++ txt
:: |^
:: ^- (list @t)
:: ;: weld
:: ::
:: :~ (cat 3 'name: ' goodname.con)
:: (cat 3 'owner: ' (scot %p owner.con))
:: (cat 3 'date-created: ' (scot %da date-created.con))
:: (cat 3 'last-modified: ' (scot %da last-modified.con))
:: (cat 3 'comments: ' ?:(comments.con 'y' 'n'))
:: ==
:: ::
:: ?~ sort-key.con ~
:: [(cat 3 'sort-key: ' (scot %ud u.sortkey.con)) ~]
:: ::
:: :- 'config-permissions:'
:: (rules-to-txt r.config-permissions.con w.config-permissions.con)
:: ::
:: :- 'content-permissions:'
:: (rules-to-txt r.content-permissions.con w.content-permissions.con)
:: ::
:: ==
:: ++ rules-to-txt
:: |= [r=rule:clay w=rule:clay]
:: ^- (list @t)
:: ;: weld
:: ::
:: :* (cat 3 ' read: ' mod.r)
:: %+ turn ~(tap by who.r)
:: |= hoe=whom:clay
:: ?- -.hoe
:: %& (cat 3 ' ' (scot %p +.hoe))
:: %| (cat 3 ' ' +.hoe)
:: ==
:: ==
:: ::
:: [' ==' ~]
:: ::
:: :* (cat 3 ' write: ' mod.w)
:: %+ turn ~(tap by who.w)
:: |= hoe=whom:clay
:: ?- -.hoe
:: %& (cat 3 ' ' (scot %p +.hoe))
:: %| (cat 3 ' ' +.hoe)
:: ==
:: ==
:: ::
:: [' ==' ~]
:: ==
:: --
--
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
((hard config:collections) (cue q.p))
:: ++ txt
:: |= txs=(list @t)
:: ?> ?= $: name=@t
:: owner=@t
:: dc=@t
:: lm=@t
:: com=@t
:: res=(lest @t)
:: ==
:: txs
:: ::
:: =/ top
:: :* (rash name.txs ;~(pfix (jest 'name: ') (cook crip (star next))))
:: (rash owner.txs ;~(pfix (jest 'owner: ~') (fed:ag)))
:: (rash dc.txs ;~(pfix (jest 'date-created: ~') (cook |=(a=^ +.a) crub:so)))
:: (rash lm.txs ;~(pfix (jest 'last-modified: ~') (cook |=(a=^ +.a) crub:so)))
:: (rash com.txs ;~(pfix (jest 'comments: ') (flag %y %n)))
:: ==
++ noun config:collections
--
++ grad %mime
--

17
mar/collections/elem.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /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
-- --

24
mar/collections/json.hoon Normal file
View File

@ -0,0 +1,24 @@
::
:::: /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
--

11
mar/dns/bind.hoon Normal file
View File

@ -0,0 +1,11 @@
::
:::: /mar/dns/bind/hoon
::
/- dns
=, dns
|_ [for=ship him=ship target]
++ grab
|%
++ noun ,[for=ship him=ship target]
--
--

11
mar/dns/bond.hoon Normal file
View File

@ -0,0 +1,11 @@
::
:::: /mar/dns/bond/hoon
::
/- dns
=, dns
|_ [for=ship him=ship turf]
++ grab
|%
++ noun ,[for=ship him=ship turf]
--
--

13
mar/htm.hoon Normal file
View File

@ -0,0 +1,13 @@
::
:::: /hoon/htm/mar
::
/? 310
|_ own/manx
::
++ grow :: convert to
|%
++ hymn own
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

12
mar/png.hoon Normal file
View File

@ -0,0 +1,12 @@
|_ dat/@t
++ grow
|%
++ mime [/image/png (as-octs:mimes:html dat)]
--
++ grab
|%
++ mime |=({p/mite q/octs} q.q)
++ noun @t
--
++ grad %mime
--

View File

@ -15,6 +15,7 @@
++ noun recoverable-error
++ httr
|= a/^httr ^- recoverable-error
~& [%recoverable-httr a]
~! a
?+ p.a ~|(non-recoverable+p.a !!)
$429 :+ p.a %rate-limit

View File

@ -1,44 +1,17 @@
::
:::: /hoon/urb/mar
:::: /hoon/elem/urb/mar
::
/? 310
/= urb-wasp-data-js /: /%/wasp-data /js/
=, format
=, mimes:html
=, html
|_ own/manx
::
|_ {{dep/@uvH hed/marl} {dep-bod/@uvH bod/marl}}
++ grow :: convert to
|%
++ mime [/text/html (as-octs html)] :: convert to %mime
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
++ html (crip (en-xml hymn)) :: convert to %html
++ hymn :: inject dependencies
^- manx
;html
;head
;meta(charset "utf-8", urb_injected "");
;* hed
==
;body
;* bod
;* ?~ dep ~
:~ ;script@"/~/on/{<dep>}.js"(urb_injected "", async "", onload "setTimeout(urb.onDep,2000)");
;script(urb_injected "")
;- (trip urb-wasp-data-js)
; urb.waspWait = []
; urb.wasp = urb.wasp || [].push.bind(urb.waspWait)
; urb.onDep = function()\{
; urb.waspWait.map(urb.wasp)
; urb.onLoadUrbJS()
; urb.waspData({(en-json %s (scot %uv dep-bod))})
; }
==
==
==
==
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ grab
|% :: convert from
++ noun {@uvH manx} :: clam from %noun
--
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

View File

@ -0,0 +1,26 @@
::
:::: /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

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

View File

@ -0,0 +1,20 @@
/? 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

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

3
mar/x-htm.hoon Normal file
View File

@ -0,0 +1,3 @@
|_ a=manx
++ grow |% ++ htm a
-- --

3
mar/x-htm/elem.hoon Normal file
View File

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

17
mar/x-urb-elem.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /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
-- --

20
mar/x-urb.hoon Normal file
View File

@ -0,0 +1,20 @@
::
:::: /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
--
--

9
ren/collections.hoon Normal file
View File

@ -0,0 +1,9 @@
/+ collections
/= collection
/^ collection:collections
/; |= [a=config:collections b=(map knot item:collections) ~]
[a b]
/. /collections-config/
/_ /collections-item/
==
collection

269
ren/collections/elem.hoon Normal file
View File

@ -0,0 +1,269 @@
::
::::
::
/? 309
/+ collections, cram
/= gas /$ fuel:html
/= itm /% /collections-web-item/
::
::
/= collection-post
:: /^ $-(raw-item:collections manx)
/: /===/web/landscape/collections/post /!noun/
/= collection-details
/^ manx
/: /===/web/landscape/collections/details /!hymn/
::
::
=< (item-to-elem itm)
|%
++ item-to-elem
|= itm=item:collections
^- manx
=/ sho (fall (~(get by qix.gas) %show) %default)
;div.container
;input
=type "hidden"
=name "urb-header"
=value "collection"
=station "{(scow %p p.bem.gas)}/{<(flop s.bem.gas)>}"
=ship "{(scow %p p.bem.gas)}";
;div.row
;div.col-sm-10.col-sm-offset-2
;div.collection-index.mt-12
;+
?- -.itm
::
%collection
?+ sho !!
%default (collection-to-elem col.itm)
%post (collection-post ~ (flop s.bem.gas))
%edit !!
%details collection-details
==
::
%raw
?+ sho !!
%default (raw-to-elem raw.itm)
%post !!
%edit (collection-post `raw.itm (flop s.bem.gas))
%details collection-details
==
::
%both
?+ sho !!
%default (both-to-elem col.itm raw.itm)
%post !!
%edit (collection-post `raw.itm (flop s.bem.gas))
%details collection-details
==
::
==
==
==
==
==
++ collection-to-elem
|= col=collection:collections
^- manx
;ul
;* %+ turn ~(tap by data.col)
|= [nom=knot ite=item:collections]
^- 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 +.elm)
=/ title (fall (~(get by meta.raw) %name) -.s.bem.gas)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
::
;div
;div.collection-date: {(trip date)}
::
;div#show
;div.row.tit.mt-6.collection-title
;+ ?~ hed.ht
;h3: {(trip title)}
;h3: *{hed.ht}
==
==
::
;div.who.text-mono.text-600: {(trip owner)}
;div.row.content.mb-18.mt-6
;+ elm
==
::
:: if comments are enabled it should be a %both not a %raw
:: XX REVIEW ^^ not robust enough?
==
::
++ both-to-elem
|= [col=collection:collections raw=raw-item:collections]
^- manx
;div
;+ (raw-to-elem raw)
::
;div
;div.mb-2
;span(urb-component "IconComment");
;span: {<~(wyt by data.col)>}
==
::
;ul
;* %+ turn ~(tap by data.col) :: XX TODO: sort
|= [nom=knot ite=item:collections]
^- manx
:: XX TODO: accept types other than comments
?> ?=(%raw -.ite)
?> =(%comments (~(got by meta.raw.ite) %type))
=/ owner (fall (~(get by meta.raw.ite) %owner) 'anonymous')
=/ date (fall (~(get by meta.raw.ite) %date-created) 'missing date')
;li.collection-comment
;div.collection-comment-avatar
;div(urb-component "AvatarSample1");
==
;div
;a.collection-comment-author.text-mono
=href "/~~/landscape/profile"
; {(trip owner)}
==
;+ elm:(static:cram (ream data.raw.ite))
==
;span.collection-date: {(trip date)}
==
==
::
;div
=urb-component "CommentCreate"
=urb-pax "{<(flop s.bem.gas)>}"
=urb-ship "{(scow %p p.bem.gas)}";
==
==
::
::
++ item-to-snip
|= [nom=knot itm=item:collections]
^- manx
?- -.itm
%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
;div
;div.collection-date: {<date-created.meta.col>}
;h3
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip name.meta.col)}
==
;div.who.text-mono.text-600: {<owner.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 +.elm)
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (fall (~(get by meta.raw) %name) nom)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
::
;div
;div.collection-date: {(trip date)}
;h3
;+ ?~ hed.ht
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip title)}
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): *{hed.ht}
==
;div.who.text-mono.text-600: {(trip owner)}
;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 +.elm)
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (fall (~(get by meta.raw) %name) nom)
::
;div
;div.collection-date: {<date-created.meta.col>}
;h3
;+ ?~ hed.ht
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip title)}
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): *{hed.ht}
==
;div.who.text-mono.text-600: {<owner.meta.col>}
;div.snippet: *{tal.ht}
;div.meta-cont
;div.com-count.ml-12
; {(trip (scot %ud ~(wyt by data.col)))} comments
==
==
==
::::
:::: /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
|= {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
|= {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]]
::
::
::
--

33
ren/collections/item.hoon Normal file
View File

@ -0,0 +1,33 @@
/+ collections
/= item
/^ item:collections
/; |= $: raw=?(~ raw-item:collections)
col=?(~ collection:collections)
~
==
?~ raw
?~ col
!!
[%collection col]
?~ col
[%raw raw]
[%both col raw]
::
/.
::
/| /; |= [a=(map knot cord) b=@t ~]
[%umd a b]
/. /front/
/umd/
==
::
/~ ~
==
::
/| /collections/
/~ ~
==
::
==
::
item

85
ren/collections/json.hoon Normal file
View File

@ -0,0 +1,85 @@
/? 309
/+ collections
/= gas /$ fuel:html
/= jon
/^ json
/; =< item-to-json
|%
::
++ item-to-json
|= itm=item:collections
^- json
?- -.itm
::
%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)]
[%colleciton (collection-to-json col.itm)]
==
==
::
++ collection-to-json
|= col=collection:collections
^- json
%- pairs:enjs:format
:~ [%meta (config-to-json meta.col)]
:+ %data %a
%+ turn ~(tap by data.col)
|= [nom=knot ite=item:collections]
^- json
%- pairs:enjs:format
:~ [%name %s nom]
[%item (item-to-json ite)]
==
==
::
++ raw-to-json
|= raw=raw-item:collections
^- json
%- pairs:enjs:format
:~ [%data [%s data.raw]]
[%meta (meta-to-json meta.raw)]
==
::
++ config-to-json
|= con=config:collections
^- json
?: =(con *config:collections)
~
%- pairs:enjs:format
:~ :- %full-path
:- %a
%+ turn (en-beam:format full-path.con)
|= a=@ta
[%s a]
:- %name [%s description.con]
:- %desc [%s description.con]
:- %owner (ship:enjs:format owner.con)
:- %date-created (time:enjs:format date-created.con)
:- %last-modified (time:enjs:format last-modified.con)
:- %comments [%b comments.con]
:- %sort-key ?~(sort-key.con ~ (numb:enjs:format u.sort-key.con))
==
::
++ meta-to-json
|= meta=(map knot cord)
^- json
%- pairs:enjs:format
%+ turn ~(tap by meta)
|= [key=@t val=@t]
^- [@t json]
[key [%s val]]
::
--
::
/collections-web-item/
::
jon

View File

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

View File

@ -3,7 +3,7 @@
:::: /hoon/css/ren
::
/? 310
/, /web/pack/css /% /!css/
/, /web/pack/css /!css/
/ /~ !!
==
-.-

View File

@ -2,8 +2,8 @@
::
:::: /hoon/js/ren
::
/? 310
/, /web/pack/js /% /!js/
/? 309
/, /web/pack/js /!js/
/ /~ !!
==
-.-

View File

@ -4,7 +4,7 @@
::
/? 310
/, /ren/run /~ ~|(%loop !!)
/ /% /!noun/
/ /!noun/
==
~& run+-.-
~

View File

@ -1,25 +0,0 @@
::
:::: /hoon/body/tree/ren
::
/? 310
/= dat /% /tree-json/ :: default include
/= dat-sen /| /: /%%/ /% /tree-json/ :: default include
/~ ~
==
=, format
=, html
::
|%
++ script-safe
!.
|= a/tape ^- tape
?~ a a
?. ?=({$'<' $'/' *} a) [i.a $(a t.a)]
['<' '\\' '/' $(a t.t.a)]
--
::
^- marl
=/ tree (script-safe (en-json (pairs:enjs data+dat sein+dat-sen ~)))
;= ;script(type "text/javascript"): window.tree = {tree}
;div#tree;
==

View File

@ -1,28 +0,0 @@
::
:::: /hoon/combine/tree/ren
::
/? 310
/- tree-include
/+ elem-to-react-json
/= mime /mime/
/= body /tree-elem/
/= sect /&json&/tree-index/
/= snip /&snip&elem&/tree-elem/
/= meta /&json&front&/|(/front/ /~[~])
/= plan /^ json /|(/plan-json/ /~[~])
/= comt /&json&/tree-comments/
/= bump /; |=(a/(list {p/time *}) =.(a (flop a) ?~(a '' (scot %da p.i.a))))
/tree-comments/
::
^- tree-include
=* rj elem-to-react-json
:* mime
(rj body)
(rj /h1 hed.snip) :: head
(rj /div tal.snip) :: snip
meta
sect
comt
plan
bump
==

View File

@ -1,21 +0,0 @@
::
:::: /hoon/comments/tree/ren
::
/? 310
/: /%/comments
/; |= a/(map knot {ship marl})
=- (sort - dor)
%+ turn ~(tap by a)
|=({b/knot c/{ship marl}} [(slav %da b) c])
/_
/; |= a/manx ^- {ship marl}
~| a
?> ?=(_[/div ;/(~) ~[[%h2 **] ~[[%code **] ;/(who=**)]] kid=**] a)
%. a
|: a=[/div ;/(~) ~[[%h2 **] ~[[%code **] ;/(who=*tape)]] kid=*marl]
[(slav %p (crip who.a)) kid.a]
/&elem&/md/
::
::::
::
`(list (pair time {ship marl}))`-.-

View File

@ -1,9 +0,0 @@
::
:::: /hoon/elem/tree/ren
::
/? 310
/% /,
/web /|(/!elem/ /elem/)
/ /elem/
==
`manx`-.-

View File

@ -1,66 +0,0 @@
::
:::: /hoon/head/tree/ren
::
::
/? 310
/= tub /$ |=({bem/beam *} (slag (lent /web) (flop s.bem)))
/= aut
/$ %+ cork fuel:html :: after parsing params,
=, title
|= gas/epic:eyre ^- ? :: check that the fcgi
%+ lien ~(tap in (~(get ju aut.ced.gas) %$)) :: has an identity
|=(a/knot !=(%pawn (clan (slav %p a)))) :: which isn't a comet
/= dbg
/^ {nopack/? nomin/?}
/$ %+ cork fuel:html :: after parsing params,
|= gas/epic:eyre ^- {? ?} :: check if the query
:- (~(has by qix.gas) 'dbg.nopack') :: dictates separate files
(~(has by qix.gas) 'dbg.nomin') :: and/or unminified assets
/= extras /: /===/ren/tree/head/extras :: additional scripts
/^ (map knot cord) /_ /js/
::
|%
++ cdnjs
|=(a/tape "//cdnjs.cloudflare.com/ajax/libs/{a}{?:(nomin.dbg "" ".min")}.js")
++ maxcdn
|=(a/tape "//maxcdn.bootstrapcdn.com/{a}{?:(nomin.dbg "" ".min")}.js")
--
::
::::
::
^- marl
;= ;title: Urbit - A personal server
;meta(name "viewport", content "width=device-width, initial-scale=1");
;link(type "text/css", rel "stylesheet", href "//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.min.css");
;* ?. nopack.dbg
:_ ~
;link(type "text/css", rel "stylesheet", href "/===/web/pack/css/codemirror-fonts-bootstrap-tree.css");
;=
;link(type "text/css", rel "stylesheet", href "/===/web/lib/css/fonts.css");
;link(type "text/css", rel "stylesheet", href "/===/web/lib/css/bootstrap.css");
;link(type "text/css", rel "stylesheet", href "/===/web/lib/css/codemirror.css");
;link(type "text/css", rel "stylesheet", href "/===/web/tree/main.css");
==
;script(type "text/javascript", src "{(cdnjs "jquery/2.1.3/jquery")}");
;script(type "text/javascript", src "{(maxcdn "bootstrap/3.3.6/js/bootstrap")}");
;script(type "text/javascript", src "{(cdnjs "lodash.js/2.4.1/lodash")}");
;script(type "text/javascript", src "{(cdnjs "react/0.14.6/react")}");
;script(type "text/javascript", src "{(cdnjs "react/0.14.6/react-dom")}");
;script(type "text/javascript", src "{(cdnjs "flux/2.1.1/Flux")}");
;* (turn ~(tap by extras) |=({@ a/@t} ;script(type "text/javascript"):"{(trip a)}"))
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js");
:: ;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/".
:: "codemirror/4.3.0/mode/markdown/markdown.min.js");
;* ?. nopack.dbg
:_ ~
;script(type "text/javascript", src "{?.(aut "" "/~~/~/at")}".
"/===/web/pack/js/tree-urb.js");
:: "/===/web/pack/js/tree-hoon-urb.js");
;=
:: ;script(type "text/javascript", src "/===/web/lib/js/hoon.js");
;script(type "text/javascript", src "/===/web/tree/main.js");
;script(type "text/javascript", src "{?.(aut "" "/~~/~/at")}".
"/===/web/lib/js/urb.js");
==
;link(type "application/rss+xml", rel "alternate", href "{(spud tub)}.rss-xml");
==

View File

@ -1,9 +0,0 @@
::
:::: /hoon/include/tree/ren
::
/? 310
/- tree-include
/| /tree-combine/
/:/===/web/404:/tree-combine/ :: XX merge into tree-elem?
==
`tree-include`-<

View File

@ -1,18 +0,0 @@
::
:::: /hoon/index/tree/ren
::
/? 310
/+ tree
/, /
/; (getall:tree /h1/h2/h3/h4/h5/h6) /tree-elem/
::
/pub/docs/dev/hoon/runes
/; |= {tip/marl sub/(map knot marl) $~}
(zing `(list marl)`[tip (turn ~(tap by sub) tail)])
/. /; (getall:tree %h1 ~) /tree-elem/
/_ /; (getall:tree %h1 ~) /tree-elem/
== ==
::
::::
::
`(map path marl)`[[/ -.-] ~ ~]

View File

@ -1,89 +0,0 @@
::
:::: /hoon/json/tree/ren
::
/? 310
/- tree-include
/+ tree
/= gas /$ fuel:html
/= dat /^ tree-include /tree-include/
/= kid /^ (map knot tree-include)
/_ /tree-include/
=, format
=, mimes:html
::
::::
::
|%
++ schema (dict {term $@(mark schema)})
++ dict |*(a/_* $^({a (dict a)} a))
++ plist (list {term $@(mark plist)})
++ query
$% {$kids p/(list query)}
{$name $t}
{$path $t}
{$spur $t}
::
{$bump $t}
{$beak $t}
{$comt $j}
{$plan $j}
{$head $r}
{$sect $j}
{$snip $r}
{$body $r}
{$meta $j}
{$mime $m}
==
++ schema-to-plist :: pad improper list
|= a/schema ^- plist
?@(-.a [(to-item a) ~] [(to-item -.a) $(a +.a)])
::
++ to-item
|= b/{term $@(mark schema)} ^- {term $@(mark plist)}
?@(+.b b [-.b (schema-to-plist +.b)])
::
++ from-type :: XX holding out for noun odors
|= a/$%({$t p/cord} {$r p/json} {$j p/json} {$m mime})
?- -.a
$t [%s p.a]
$m (pairs:enjs mite+[%s (en-mite p.a)] octs+(tape:enjs (en-base64 q.q.a)) ~)
$r p.a
$j p.a
==
++ from-queries
|= {bem/beam quy/(list query)}
=< (pairs:enjs (turn quy .))
|= a/query
:- -.a
?- -.a
$name (from-type +.a ?^(s.bem i.s.bem q.bem))
$beak (from-type +.a (crip (spud (en-beam bem(s /)))))
$path (from-type +.a (crip (spud (flop s.bem))))
$spur (from-type +.a (crip (spud s.bem)))
$bump (from-type +.a bump.dat)
$plan (from-type +.a plan.dat)
$comt (from-type +.a comt.dat)
$head (from-type +.a head.dat)
$snip (from-type +.a snip.dat)
$sect (from-type +.a sect.dat)
$meta (from-type +.a meta.dat)
$mime (from-type +.a mime.dat)
$body (from-type +.a body.dat)
$kids ?< (~(has by (malt p.a)) %kids) :: XX recursion?
=< o+(~(urn by kid) .)
|= {dir/knot dak/tree-include} ^- json
^^$(quy p.a, s.bem [dir s.bem], dat dak, kid ~)
==
--
::
::::
::
=, tree
^- json
=+ default='spur.t_body.r_comt.j_plan.j_beak.t_meta.j_kids_meta.j_head.r_bump.t'
=+ ^= schem
=+ seh=(fall (~(get by qix.gas) 'q') default)
~|(bad-noun+seh ;;(schema (rash seh read-schem)))
%+ from-queries bem.gas
~| invalid-query+schem
;;((list query) (schema-to-plist schem))

View File

@ -1,26 +1,15 @@
::
:::: /hoon/urb/ren
:::: /hoon/elem/urb/ren
::
/? 310
/+ urb-split :: for single-page apps
/% /^ {hed/{@uvH marl} bod/{@uvH marl}}
/, /web/pages
/; urb-split /# /!hymn/
/web/static
::
:: TODO: remove once we no longer need static site generator
::
/; |= urb=manx
^- [hed=[@uvH marl] bod=[@uvH marl]]
?: ?=({{$html $~} {{$head $~} *} {{$body $~} *} $~} urb)
=+ `{{$html $~} {{$head $~} hed/marl} {{$body $~} bod/marl} $~}`urb
:- [0v0 hed]
[0v0 bod]
:- [0v0 ~]
[0v0 [urb ~]]
/&hymn&/html/
::
/
/urb-tree/
/? 309
:: nutalk ::FIXME write ren/urb/nutalk
/= inner
/^ manx
/, :: /web/pages/nutalk /# /!htm/
/web/pages /!hymn/
:: put collections through the same .htm
:: routing structure as nutalk
:: /web/collections /# /htm/ ::a lot of stuff in here isn't .hoon files
/ /!hymn/ :: /tree-elem/
==
-.-
inner

View File

@ -1,9 +0,0 @@
:: Combine /tree-head/ and /tree-body/
::
:::: /hoon/tree/urb/ren
::
/? 310
/= hed /# /% /tree-head/
/= bod /# /% /tree-body/
^- {hed/{@uvH marl} bod/{@uvH marl}}
[hed bod]

View File

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

View File

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

View File

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

View File

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

12
ren/x-htm/elem.hoon Normal file
View File

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

1
ren/x-htm/wrap.hoon Normal file
View File

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

14
ren/x-urb/elem.hoon Normal file
View File

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

22
ren/x-urb/wrap.hoon Normal file
View File

@ -0,0 +1,22 @@
:: Add tree chrome
::
:::: /hoon/wrap/urb/ren
::
/? 309
/+ nutalk
/= wrapped
/^ $-(inr=manx out=manx)
/~ nutalk
:: /, /web/pages/nutalk /~ nutalk
:: /web/pages /~ urb-split
:: :: put collections through the same .htm
:: :: routing structure as nutalk
:: /web/collections /~ nutalk
:: ::
:: /
:: :: /urb-tree/
:: /~
:: |= [@ manx] ^- urb
:: ~|(%tree-unimplemented !!)
:: ==
wrapped

View File

@ -29,6 +29,8 @@
:~ 'https://mail.google.com'
'https://www.googleapis.com/auth/plus.me'
'https://www.googleapis.com/auth/userinfo.email'
'https://www.googleapis.com/auth/ndev.clouddns.readwrite'
'https://www.googleapis.com/auth/cloud-platform.read-only'
==
::
++ exchange-url 'https://www.googleapis.com/oauth2/v4/token'

59
sur/dns.hoon Normal file
View File

@ -0,0 +1,59 @@
|%
:: +turf: a domain, TLD first
::
+= turf (list @t)
:: +provider: DNS service provider (gcloud only for now)
::
+= provider
$% [%gcloud project=@ta zone=@ta]
==
:: +authority: responsibility for a DNS zone
::
+= authority
$: :: dom: authority over a fully-qualified domain
::
dom=turf
:: pro: DNS service provider
::
pro=provider
==
:: +target: a ship is bound to a ...
::
+= target
$% :: %direct: an A record
::
[%direct %if p=@if]
:: %indirect: a CNAME record
::
[%indirect p=ship]
==
:: +bound: an established binding, plus history
::
+= bound
$: :: wen: established
::
wen=@da
:: cur: current target
::
cur=target
:: hit: historical targets
::
hit=(list (pair @da target))
==
:: +nameserver: a b s o l u t e p o w e r
::
+= nameserver
$: aut=authority
pen=(map ship target)
bon=(map ship bound)
==
:: +relay: a good parent keeps track
::
+= relay
$: wen=@da
wer=(unit @if)
bon=?
try=@ud
tar=target
==
--

View File

@ -55,6 +55,7 @@
++ place :> range indicators
$% {$da @da} :< date
{$ud @ud} :< message number
{$sd @sd} :< previous messages
== ::
++ prize :> query result
$% {$client prize-client} :< /client

5
sur/urb.hoon Normal file
View File

@ -0,0 +1,5 @@
:: Disassembled page <head>/<body>
::
:::: /hoon/urb/sur
::
{hed/{dep/@uvH ele/marl} bod/{dep/@uvH ele/marl}}

View File

@ -166,7 +166,6 @@
++ slur-e ~/(%slur-e |=({gat/vase hil/mill} =+(%e (slur gat hil))))
++ slur-f ~/(%slur-f |=({gat/vase hil/mill} =+(%f (slur gat hil))))
++ slur-g ~/(%slur-g |=({gat/vase hil/mill} =+(%g (slur gat hil))))
++ slur-t ~/(%slur-t |=({gat/vase hil/mill} =+(%t (slur gat hil))))
++ slur-z ~/(%slur-z |=({gat/vase hil/mill} =+(%z (slur gat hil))))
::
++ slur-pro :: profiling slur
@ -180,7 +179,6 @@
$e (slur-e gat hil)
$f (slur-f gat hil)
$g (slur-g gat hil)
$t (slur-t gat hil)
==
::
++ song :: reduce metacard

View File

@ -4,7 +4,8 @@
=> =~
:: structures
=, ames
=+ protocol-version=2
:: this number needs to be below 8
=+ protocol-version=0
|%
+= move [p=duct q=(wind note:able gift:able)] :: local move
--
@ -445,6 +446,7 @@
+>.$(hoc.saf (~(put by hoc.saf) her [[~31337.1.1 ~ wil] ~ *clot]))
::
++ lax :: lax:as:go
=| rov=(unit lane) :: maybe lane change
|_ [her=ship dur=dore] :: per client
++ cluy :: cluy:lax:as:go
^- [p=life q=gens r=acru] :: client crypto
@ -518,6 +520,25 @@
[~ ryn]
lun.wod.dur
[~ ryn]
::
rov
|- ^- (unit lane)
:: XX check will
?: ?| !=(our (sein:title her))
?=(?(%earl %pawn) (clan:title her))
==
~
?- ryn
[%if *] ?. ?=([~ %if *] lun.wod.dur)
`ryn
?:(=(r.u.lun.wod.dur r.ryn) ~ `ryn)
::
[%ix *] ?. ?=([~ %ix *] lun.wod.dur)
`ryn
?:(=(r.u.lun.wod.dur r.ryn) ~ `ryn)
::
[%is *] ?~(q.ryn ~ $(ryn u.q.ryn))
==
==
::
++ wist :: wist:lax:as:go
@ -1471,8 +1492,10 @@
==
::
++ zank :: zank:ho:um:am
=? bin ?=(^ rov.diz)
[[%maze her u.rov.diz] bin]
%= +>.$ :: resolve
gus (nux:gus diz)
gus (nux:gus diz(rov ~))
wab.weg (~(put by wab.weg) her bah(sop abet:puz))
==
-- :: --ho:um:am
@ -1553,9 +1576,14 @@
(hunt lth doz rtn.sop.bah)
::
++ load
|= old=fort
~& %ames-reload
..^$(fox old)
=/ old-fort
(cork fort |=(fort [%0 gad=gad hop=hop bad=bad ton=ton zac=zac]))
|= old=?(fort old-fort)
?- old
[%0 *] $(old [%1 gad hop bad ton zac ~]:old)
[%1 *] ~& %ames-reload
..^$(fox old)
==
::
++ scry
|= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path]
@ -1604,6 +1632,11 @@
:_ fox
:~ [s.bon %give %woot q.p.bon r.bon]
==
::
%maze
:_ fox
%+ turn ~(tap in ten.fox)
|=(hen=duct [hen %give %rove p.bon q.bon])
::
%mead :_(fox [[hen [%give %hear p.bon q.bon]] ~])
%milk
@ -1713,6 +1746,14 @@
::
%sith
(~(czar am [now fox]) p.kyz q.kyz r.kyz)
::
%tend
:: XX exclude comets and moons? and planets?
:: ?> &(?=(^ hen) ?=([@ @ *] i.hen))
:: =/ who=@p (slav %p i.t.i.hen)
:: ?: ?=((%earl %pawn) (clan:title who))
:: [~ fox]
[~ fox(ten (~(put in ten.fox) hen))]
::
%nuke
:- ~

View File

@ -1,3 +1,4 @@
!:
:: clay (4c), revision control
::
:: This is split in three top-level sections: structure definitions, main
@ -44,9 +45,9 @@
:: Type of request.
::
:: %d produces a set of desks, %p gets file permissions, %u checks for
:: existence, %v produces a ++dome of all desk data, %w gets @ud and @da
:: variants for the given case, %x gets file contents, %y gets a directory
:: listing, and %z gets a recursive hash of the file contents and children.
:: existence, %v produces a ++dome of all desk data, %w gets a revision
:: number/date, %x gets file contents, %y gets a directory listing, and %z gets
:: a recursive hash of the file contents and children.
::
:: ++ care ?($d $p $u $v $w $x $y $z)
::
@ -334,8 +335,8 @@
$: $d ::
$% {$flog p/{$crud p/@tas q/(list tank)}} :: to %dill
== == ::
$: $t ::
$% [%build our=@p live=? schematic=schematic:ford-api] ::
$: $f ::
$% [%build our=@p live=? schematic=schematic:ford] ::
== ==
$: $b ::
$% {$wait p/@da} ::
@ -352,8 +353,8 @@
{$mere p/(each (set path) (pair term tang))}
{$writ p/riot} ::
== == ::
$: $t ::
$% [%made date=@da result=made-result:ford-api] ::
$: $f ::
$% [%made date=@da result=made-result:ford] ::
== == ::
$: $b ::
$% {$wake $~} :: timer activate
@ -482,7 +483,7 @@
:: ++gage-to-success-cages?
::
++ made-result-to-cages
|= result=made-result:ford-api
|= result=made-result:ford
^- (list (pair cage cage))
(unwrap-tang (made-result-to-cages-or-error result))
::
@ -490,20 +491,19 @@
:: ++gage-to-cages?
::
++ made-result-to-success-cages
|= result=made-result:ford-api
|= result=made-result:ford
^- (list (pair cage cage))
?. ?=([%complete %success %list *] result)
(ford-fail >%strange-ford-result< ~)
:: process each row in the list, filtering out errors
::
%+ murn results.build-result.result
|= row=build-result:ford-api
|= row=build-result:ford
^- (unit [cage cage])
::
?. ?=([%success [%success *] [%success *]] row)
~
=, ford-api
`[(result-to-cage head.row) (result-to-cage tail.row)]
`[(result-to-cage:ford head.row) (result-to-cage:ford tail.row)]
::
:: Expects a single-level gage (i.e. a list of pairs of cages). If the
:: result is of a different form, or if some of the computations in the gage
@ -511,14 +511,14 @@
:: of cages.
::
++ made-result-to-cages-or-error
|= result=made-result:ford-api
|= result=made-result:ford
^- (each (list (pair cage cage)) tang)
::
?: ?=([%incomplete *] result)
(mule |.(`$~`(ford-fail tang.result)))
?. ?=([%complete %success %list *] result)
(mule |.(`$~`(ford-fail >%strange-ford-result -.build-result.result< ~)))
=/ results=(list build-result:ford-api)
=/ results=(list build-result:ford)
results.build-result.result
=< ?+(. [%& .] {@ *} .)
|-
@ -534,8 +534,8 @@
::
=+ $(results t.results)
?: ?=([@ *] -) -
=, ford-api
[[(result-to-cage head.i.results) (result-to-cage tail.i.results)] -]
:_ -
[(result-to-cage:ford head.i.results) (result-to-cage:ford tail.i.results)]
::
:: Assumes the list of pairs of cages is actually a listified map of paths
:: to cages, and converts it to (map path cage) or a stack trace on error.
@ -596,7 +596,7 @@
(emit hen %give %writ ~ [p.mun q.mun syd] r.mun p.dat)
%- emit
:* hen %pass [%blab p.mun (scot q.mun) syd r.mun]
%t %build our live=%.n %pin
%f %build our live=%.n %pin
(case-to-date q.mun)
(lobe-to-schematic:ze [her syd] r.mun p.dat)
==
@ -811,9 +811,9 @@
+>.$
%- emit
^- move
:* hen %pass [%ergoing (scot %p her) syd ~] %t
:* hen %pass [%ergoing (scot %p her) syd ~] %f
%build our live=%.n %list
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ turn `(list path)`mus
|= a/path
:- [%$ %path !>(a)]
@ -1129,8 +1129,8 @@
^- (list move)
:~ :* hen %pass
[%inserting (scot %p her) syd (scot %da wen) ~]
%t %build our live=%.n %pin wen %list
^- (list schematic:ford-api)
%f %build our live=%.n %pin wen %list
^- (list schematic:ford)
%+ turn ins
|= {pax/path mis/miso}
?> ?=($ins -.mis)
@ -1140,8 +1140,8 @@
==
:* hen %pass
[%diffing (scot %p her) syd (scot %da wen) ~]
%t %build our live=%.n %pin wen %list
^- (list schematic:ford-api)
%f %build our live=%.n %pin wen %list
^- (list schematic:ford)
%+ turn dif
|= {pax/path mis/miso}
?> ?=($dif -.mis)
@ -1152,9 +1152,9 @@
==
:* hen %pass
[%castifying (scot %p her) syd (scot %da wen) ~]
%t %build our live=%.n %pin wen %list
%f %build our live=%.n %pin wen %list
::~ [her syd %da wen] %tabl
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ turn mut
|= {pax/path mis/miso}
?> ?=($mut -.mis)
@ -1229,7 +1229,7 @@
:: diffs and mutations), then we go ahead and run ++apply-edit.
::
++ take-inserting
|= {wen/@da res/made-result:ford-api}
|= {wen/@da res/made-result:ford}
^+ +>
?~ dok
~& %clay-take-inserting-unexpected-made +>.$
@ -1257,7 +1257,7 @@
:: insertions and mutations), then we go ahead and run ++apply-edit.
::
++ take-diffing
|= {wen/@da res/made-result:ford-api}
|= {wen/@da res/made-result:ford}
^+ +>
?~ dok
~& %clay-take-diffing-unexpected-made +>.$
@ -1288,7 +1288,7 @@
:: this is handled in ++take-mutating.
::
++ take-castify
|= {wen/@da res/made-result:ford-api}
|= {wen/@da res/made-result:ford}
^+ +>
?~ dok
~& %clay-take-castifying-unexpected-made +>.$
@ -1308,8 +1308,8 @@
%- emit
:* hen %pass
[%mutating (scot %p her) syd (scot %da wen) ~]
%t %build our live=%.n %pin wen %list
^- (list schematic:ford-api)
%f %build our live=%.n %pin wen %list
^- (list schematic:ford)
%+ turn cat
|= {pax/path cay/cage}
:- [%$ %path -:!>(*path) pax]
@ -1327,7 +1327,7 @@
:: ++apply-edit.
::
++ take-mutating
|= {wen/@da res/made-result:ford-api}
|= {wen/@da res/made-result:ford}
^+ +>
?~ dok
~& %clay-take-mutating-unexpected-made +>.$
@ -1404,12 +1404,12 @@
|= hat/(map path lobe)
^+ +>
%- emit
:* hen %pass [%patching (scot %p her) syd ~] %t
:* hen %pass [%patching (scot %p her) syd ~] %f
%build our live=%.n %list
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ turn ~(tap by hat)
|= {a/path b/lobe}
^- schematic:ford-api
^- schematic:ford
:- [%$ %path-hash !>([a b])]
(lobe-to-schematic:ze [her syd] a b)
==
@ -1425,12 +1425,12 @@
:: mim in dok). The result is handled in ++take-ergo.
::
++ take-patch
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
:: ~& %taking-patch
?. ?=([%complete %success *] res)
=. dok ~
=* message (made-result-as-error:ford-api res)
=* message (made-result-as-error:ford res)
(print-to-dill '!' %rose [" " "" ""] leaf+"clay patch failed" message)
:: ~& %editing
=+ ^- sim/(list (pair path misu))
@ -1491,12 +1491,12 @@
:: ~& %forming-ergo
:: =- ~& %formed-ergo -
%- emit(dok ~)
:* hen %pass [%ergoing (scot %p her) syd ~] %t
:* hen %pass [%ergoing (scot %p her) syd ~] %f
%build our live=%.n %list
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ turn ~(tap in sum)
|= a/path
^- schematic:ford-api
^- schematic:ford
:- [%$ %path !>(a)]
=+ b=(~(got by can) a)
?: ?=($del -.b)
@ -1517,7 +1517,7 @@
:: an %ergo card) to keep unix up-to-date. Send this to unix.
::
++ take-ergo
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
?: ?=([%incomplete *] res)
(print-to-dill '!' %rose [" " "" ""] leaf+"clay ergo failed" tang.res)
@ -1663,7 +1663,7 @@
%- emit
:* hen %pass
[%foreign-x (scot %p our) (scot %p her) syd car (scot cas) pax]
%t %build our live=%.n %pin
%f %build our live=%.n %pin
(case-to-date cas)
(vale-page [her syd] peg)
==
@ -1674,8 +1674,8 @@
:: purposes.
::
++ vale-page
|= [disc=disc:ford-api a=page]
^- schematic:ford-api
|= [disc=disc:ford a=page]
^- schematic:ford
?. ?=($hoon p.a) [%vale disc a]
?. ?=(@t q.a) [%dude |.(>%weird-hoon<) %ride [%zpzp ~] %$ *cage]
[%$ p.a [%atom %t ~] q.a]
@ -1685,15 +1685,15 @@
:: This completes the receiving of %x foreign data.
::
++ take-foreign-x
|= {car/care cas/case pax/path res/made-result:ford-api}
|= {car/care cas/case pax/path res/made-result:ford}
^+ +>
?> ?=(^ ref)
?. ?=([%complete %success *] res)
~| "validate foreign x failed"
=+ why=(made-result-as-error:ford-api res)
=+ why=(made-result-as-error:ford res)
~> %mean.|.(%*(. >[%plop-fail %why]< |1.+> why))
!!
=* as-cage `(result-to-cage:ford-api build-result.res)
=* as-cage `(result-to-cage:ford build-result.res)
wake(haw.u.ref (~(put by haw.u.ref) [car cas pax] as-cage))
::
:: When we get a %w foreign update, store this in our state.
@ -1772,9 +1772,9 @@
%- emit
:* hen %pass
[%foreign-plops (scot %p our) (scot %p her) syd lum ~]
%t %build our live=%.n %pin (case-to-date cas)
%f %build our live=%.n %pin (case-to-date cas)
%list
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ turn ~(tap in pop)
|= a/plop
?- -.a
@ -1788,7 +1788,7 @@
:: state.
::
++ take-foreign-plops
|= {lem/(unit @da) res/made-result:ford-api}
|= {lem/(unit @da) res/made-result:ford}
^+ +>
?> ?=(^ ref)
?> ?=(^ nak.u.ref)
@ -2068,8 +2068,8 @@
:: Creates a schematic out of a page (which is a [mark noun]).
::
++ page-to-schematic
|= [disc=disc:ford-api a=page]
^- schematic:ford-api
|= [disc=disc:ford a=page]
^- schematic:ford
::
?. ?=($hoon p.a) [%volt disc a]
:: %hoon bootstrapping
@ -2078,15 +2078,15 @@
:: Creates a schematic out of a lobe (content hash).
::
++ lobe-to-schematic
|= [disc=disc:ford-api pax=path lob=lobe]
^- schematic:ford-api
|= [disc=disc:ford pax=path lob=lobe]
^- schematic:ford
::
=+ ^- hat/(map path lobe)
?: =(let.dom 0)
~
q:(aeon-to-yaki let.dom)
=+ lol=`(unit lobe)`?.(=(~ ref) `0vsen.tinel (~(get by hat) pax))
|- ^- schematic:ford-api
|- ^- schematic:ford
?: =([~ lob] lol)
=+ (need (need (read-x let.dom pax)))
?> ?=($& -<)
@ -2391,6 +2391,7 @@
$delta (~(put in $(lob q.q.gar)) lob)
==
::
::
:: Gets the permissions that apply to a particular node.
::
:: If the node has no permissions of its own, we use its parent's.
@ -2398,7 +2399,7 @@
:: we default to fully private (empty whitelist).
::
++ read-p
|= pax/path
|= pax=path
^- (unit (unit (each cage lobe)))
=- [~ ~ %& %noun !>(-)]
:- (read-p-in pax per.red)
@ -2748,7 +2749,7 @@
:: we're in, and call the appropriate function for that stage.
::
++ route
|= {sat/term res/(each riot made-result:ford-api)}
|= {sat/term res/(each riot made-result:ford)}
^+ +>.$
?. =(sat wat.dat)
~| :* %hold-your-horses-merge-out-of-order
@ -3035,11 +3036,11 @@
:* hen %pass
=+ (cat 3 %diff- nam)
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali - ~]
%t %build p.bob live=%.n %pin (case-to-date r.oth) %list
^- (list schematic:ford-api)
%f %build p.bob live=%.n %pin (case-to-date r.oth) %list
^- (list schematic:ford)
%+ murn ~(tap by q.bas.dat)
|= {pax/path lob/lobe}
^- (unit schematic:ford-api)
^- (unit schematic:ford)
=+ a=(~(get by q.yak) pax)
?~ a
~
@ -3066,7 +3067,7 @@
:: call ++diff-bob.
::
++ diffed-ali
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
@ -3114,7 +3115,7 @@
:: call ++merge.
::
++ diffed-bob
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
@ -3164,11 +3165,11 @@
%- emit(wat.dat %merge)
:* hen %pass
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %merge ~]
%t %build p.bob live=%.n %list
^- (list schematic:ford-api)
%f %build p.bob live=%.n %list
^- (list schematic:ford)
%+ turn ~(tap by (~(int by can.dal.dat) can.dob.dat))
|= {pax/path *}
^- schematic:ford-api
^- schematic:ford
=+ cal=(~(got by can.dal.dat) pax)
=+ cob=(~(got by can.dob.dat) pax)
=+ ^= her
@ -3182,7 +3183,7 @@
:: Put merged changes in bof.dat and call ++build.
::
++ merged
|= res/made-result:ford-api
|= res/made-result:ford
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
(error:he %merge-bad-made leaf+"merging failed" p.tay)
@ -3204,11 +3205,11 @@
%- emit(wat.dat %build)
:* hen %pass
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %build ~]
%t %build p.bob live=%.n %list
^- (list schematic:ford-api)
%f %build p.bob live=%.n %list
^- (list schematic:ford)
%+ murn ~(tap by bof.dat)
|= {pax/path cay/(unit cage)}
^- (unit schematic:ford-api)
^- (unit schematic:ford)
?~ cay
~
:- ~
@ -3230,7 +3231,7 @@
:: Sum all the changes into a new commit (new.dat), and checkout.
::
++ built
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
@ -3350,12 +3351,12 @@
%- emit(wat.dat %checkout)
:* hen %pass
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %checkout ~]
%t %build p.bob live=%.n %pin (case-to-date r.val) %list
%f %build p.bob live=%.n %pin (case-to-date r.val) %list
:: ~ val %tabl
^- (list schematic:ford-api)
^- (list schematic:ford)
%+ murn ~(tap by q.new.dat)
|= {pax/path lob/lobe}
^- (unit schematic:ford-api)
^- (unit schematic:ford)
?: (~(has by bop.dat) pax)
~
`[[%$ %path !>(pax)] (merge-lobe-to-schematic:he [p q]:val pax lob)]
@ -3365,7 +3366,7 @@
:: some of the changes, call ++ergo.
::
++ checked-out
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
@ -3408,11 +3409,11 @@
%- emit(wat.dat %ergo)
:* hen %pass
[%merge (scot %p p.bob) q.bob (scot %p p.ali) q.ali %ergo ~]
%t %build p.bob live=%.n %pin (case-to-date r.val) %list
^- (list schematic:ford-api)
%f %build p.bob live=%.n %pin (case-to-date r.val) %list
^- (list schematic:ford)
%+ turn ~(tap in sum)
|= a/path
^- schematic:ford-api
^- schematic:ford
:- [%$ %path !>(a)]
=+ b=(~(got by erg.dat) a)
?. b
@ -3425,7 +3426,7 @@
:: Tell unix about the changes made by the merge.
::
++ ergoed
|= res/made-result:ford-api
|= res/made-result:ford
^+ +>
=+ tay=(made-result-to-cages-or-error res)
?: ?=($| -.tay)
@ -3484,8 +3485,8 @@
:: We short-circuit if we already have the content somewhere.
::
++ merge-lobe-to-schematic
|= [disc=disc:ford-api pax=path lob=lobe]
^- schematic:ford-api
|= [disc=disc:ford pax=path lob=lobe]
^- schematic:ford
=+ hat=q.ali.dat
=+ hot=q.bob.dat
=+ ^= lal
@ -3493,7 +3494,7 @@
|= had/dome
(~(get by q:(tako-to-yaki (~(got by hit.had) let.had))) pax)
=+ lol=(~(get by hot) pax)
|- ^- schematic:ford-api
|- ^- schematic:ford
?: =([~ lob] lol)
=+ (need (need (read-x let.dom pax)))
?> ?=($& -<)
@ -3950,7 +3951,7 @@
?> ?=($made +<.q.hin)
?. ?=([%complete %success *] result.q.hin)
~| %blab-fail
~> %mean.|.((made-result-as-error:ford-api result.q.hin))
~> %mean.|.((made-result-as-error:ford result.q.hin))
!! :: interpolate ford fail into stack trace
:_ ..^$ :_ ~
:* hen %give %writ ~
@ -3958,7 +3959,7 @@
[i.t.tea ((hard case) +>:(slay i.t.t.tea)) i.t.t.t.tea]
::
`path`t.t.t.t.tea
`cage`(result-to-cage:ford-api build-result.result.q.hin)
`cage`(result-to-cage:ford build-result.result.q.hin)
==
?- -.+.q.hin
::

View File

@ -1,3 +1,4 @@
!:
:: :: %eyre, http servant
!? 164
::::
@ -28,10 +29,10 @@
{$this p/? q/clip r/httq} :: proxied request
{$meta vase} :: type check
== == ::
$: $f :: to %ford
$% {$exec p/@p q/(unit {beak silk:ford})} ::
{$wasp p/@p q/@uvH r/?} ::
== == ::
$: $f ::
$% [%build our=@p live=? schematic=schematic:ford]
[%kill our=@p]
== ==
$: $g :: to %gall
$% {$deal p/sock q/cush:gall} :: full transmission
== == == ::
@ -49,10 +50,9 @@
$: $e :: by self
$% {$thou p/httr} :: response for proxy
== == ::
$: $f :: by %ford
$% {$made p/@uvH q/gage:ford} ::
{$news p/@uvH} ::
== == ::
$: $f
$% [%made date=@da result=made-result:ford] ::
== ==
$: @tas :: by any
$% {$crud p/@tas q/(list tank)} ::
== == == ::
@ -85,7 +85,11 @@
-- ::
|% :: models
++ bolo :: eyre state
$: $0 :: version
$: $1 :: version
dom/(set (list @t)) :: domain names
fig/http-config :: config
por/{clr/@ud sek/(unit @ud)} :: live ports
wel/wank :: .well-known
gub/@t :: random identity
hov/(unit ship) :: master for remote
top/beam :: ford serve prefix
@ -150,6 +154,7 @@
{$spur p/spur}
{$subs p/?($put $delt) q/{dock $json wire path}}
{$view p/ixor q/{$~ u/@ud}}
::{$view p/ixor q/{$~ u/@ud} r/(unit @dr)}
==
::
++ perk-auth :: parsed auth
@ -172,6 +177,9 @@
{$html p/manx} :: successful page
{$htme p/manx} :: authentication fail
==
::
++ wank :: .well-known ankh
{p/(unit mime) q/(map @ta wank)}
-- ::
|%
++ eat-headers
@ -221,6 +229,25 @@
^- wall
(zing (turn tan |=(a/tank (wash 0^wid a))))
::
++ yank :: get .well-known
|= [wel=wank pat=path]
^- (unit mime)
?~ pat p.wel
=/ wan (~(get by q.wel) i.pat)
?~ wan ~
$(wel u.wan, pat t.pat)
::
++ dank :: put/del .well-known
|= [wel=wank pat=path mim=(unit mime)]
^- wank
?~ pat wel(p mim)
=/ wan (~(get by q.wel) i.pat)
?: &(?=(~ wan) ?=(~ mim))
wel
:- p.wel
%+ ~(put by q.wel)
i.pat
$(wel ?~(wan *wank u.wan), pat t.pat)
::
++ add-cookies
|= {cug/(list @t) hit/httr} ^- httr
@ -274,6 +301,16 @@
;script@"/~/on/{<dep>}.js";
==
::
++ render-turbo-tang
|= tan/tang
;html
;head
;link(rel "stylesheet", href "/lib/base.css");
;title: server error
==
;body:div#c.err:pre:code:"*{(add-links (wush 80 tan))}"
==
::
++ favi :: XX favicon
0w3.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.
~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.~~~~~.
@ -635,7 +672,46 @@
=. our ?~(hov our u.hov) :: XX
=. p.top our :: XX necessary?
?- -.kyz
$born +>.$(ged hen) :: register external
$born
:: XX capture IPs too
=/ mod/(set (list @t))
%- ~(gas in *(set (list @t)))
%+ turn
(skim p.kyz |=(a=host ?=(%& -.a)))
|=(a=host ?>(?=(%& -.a) p.a))
=/ dif/(set (list @t)) (~(dif in mod) dom)
=? dom ?=(^ dif) (~(uni in dom) mod)
=? mow ?=(^ dif)
=/ cmd [%acme %poke `cage`[%acme-order !>(dom)]]
:_(mow [hen %pass /acme/order %g %deal [our our] cmd])
%= +>.$
ged hen :: register external
mow :_(mow [hen [%give %form fig]])
==
::
$live
+>.$(clr.por p.kyz, sek.por q.kyz)
::
$rule
?- -.p.kyz
$cert
?: =(secure.fig p.p.kyz) +>.$
=. secure.fig p.p.kyz
+>.$(mow :_(mow [ged [%give %form fig]]))
::
$turf
=/ mod/(set (list @t))
?: ?=(%put p.p.kyz)
(~(put in dom) q.p.kyz)
(~(del in dom) q.p.kyz)
?: =(dom mod) +>.$
=/ cmd [%acme %poke `cage`[%acme-order !>(mod)]]
%= +>.$
dom mod
mow :_(mow [hen %pass /acme/order %g %deal [our our] cmd])
==
==
::
$serv
=< ~&([%serving (en-beam top)] .)
?^(p.kyz +>.$(top p.kyz) +>.$(q.top p.kyz))
@ -645,6 +721,7 @@
::
$init :: register ownership
=. our ?~(hov p.kyz (min u.hov p.kyz))
=. fig [~ ?=(%king (clan:title our)) & &]
+>.$(hov [~ our], top [[our %home ud+0] /web])
::
?($chis $this) :: inbound request
@ -696,7 +773,7 @@
:: ==
:: ~& eyre-them+(en-purl p.u.p.kyz)
=+ usr=?~(p.kyz '~' (scot %ta u.p.kyz))
(back hi+/[usr]/[q.kyz] %hiss r.kyz)
(back-turbo hi+/[usr]/[q.kyz] %hiss r.kyz)
::
$they :: inbound response
=+ kas=(need (~(get by q.ask) p.kyz))
@ -714,7 +791,7 @@
:: ~& did-thud+[-.lid hen]
?- -.lid
$exec
(pass-note p.lid %f [%exec our ~])
(pass-note p.lid %f [%kill our])
::
$poll
?. (~(has by wix) p.lid)
@ -731,6 +808,9 @@
?~ p.lid +>.^$
(del-deps:$(p.lid t.p.lid) i.p.lid %& hen)
==
::
$well
+>.$(wel (dank wel p.kyz q.kyz))
::
$went
:: this won't happen until we send responses.
@ -739,6 +819,7 @@
$west :: remote request
=. mow :_(mow [hen %give %mack ~])
=+ mez=((soft gram) q.kyz)
~& [%west mez]
?~ mez
~& e+[%strange-west p.kyz]
~|(%strange-west !!)
@ -762,9 +843,44 @@
(ames-gram q.p.kyz aut+~ p.u.mez)
=. sop (~(put by sop) p.u.mez q.p.kyz |)
(ames-gram q.p.kyz hat+~ p.u.mez our-host)
::
$get-inner
%+ exec-turbo-live ay+(dray p+uv+~ q.p.kyz p.u.mez)
[%bake q.u.mez r.u.mez [[p q] s]:s.u.mez]
::
$got-inner
?. (~(has by pox) p.u.mez)
~& lost-gram-inner+p.kyz^p.u.mez
+>.$
=: hen (~(got by pox) p.u.mez)
pox (~(del by pox) p.u.mez)
==
?- -.q.u.mez
%|
=/ dep 0v0 ::XX remote dependency?
(fail 500 dep p.q.u.mez)
::
%&
=/ res/(cask) p.q.u.mez
=/ dep 0v0 ::XX remote dependency?
=/ bek -.top ::XX where is wrapper-renderer beak stored exactly
:: XX store request mark
=/ ext (end 3 (sub (met 3 p.res) (met 3 '-elem')) p.res) :: %x-urb-elem -> %x-urb
=+ norm=(norm-beak bek)
::
%+ exec-turbo-live ha+(en-beam bek ~)
:^ %cast [p q]:norm ext
:+ %call
[%core [p q]:norm /hoon/wrap/[ext]/ren]
[%vale [p q]:norm res]
==
::
$not +>.$(mow :_(mow [ged [%give %that q.p.kyz p.u.mez]]))
==
::
$wegh !! :: handled elsewhere
::
$wise (ames-gram p.kyz [%not ~] q.kyz) :: proxy notification
==
::
::++ axom :: old response
@ -794,6 +910,7 @@
::
::
$thou
~& %axon-thou
?+ -.tee !!
$ay (ames-gram (slav %p p.tee) got+~ (slav %uv q.tee) |2.sih)
$hi (cast-thou q.tee httr+!>(p.sih))
@ -811,7 +928,7 @@
$diff
?. ?=($json p.p.cuf)
:: ~> %slog.`%*(. >[%backing p.p.cuf %q-p-cuf]< &3.+> (sell q.p.cuf))
(back tee %json p.cuf)
(back-turbo tee %json p.cuf)
(get-rush:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
::
$quit ~&(quit+tee (get-quit:(ire-ix p.tee) q.tee))
@ -823,35 +940,55 @@
abut:(ire-ix p.tee)
=> wake:(ire-ix p.tee)
(give-json 200 ~ (frond:enjs %beat %b &))
::
$news :: dependency updated
?: ?=({$se *} tee)
(get-news:(dom-vi q.tee) p.sih)
?. ?=({$on $~} tee)
~&(e+lost+[tee hen] +>.$)
%+ roll ~(tap in (~(get ju liz) p.sih))
=< .(con ..axon(liz (~(del by liz) p.sih)))
|= {sus/(each duct ixor) con/_..axon}
=. ..axon con
?- -.sus
$& (give-json(hen p.sus) 200 ~ %s (scot %uv p.sih))
$| (get-even:(ire-ix p.sus) +.sih)
==
::
$made
?< ?=($tabl -.q.sih)
=. our (need hov) :: XX
=| ses/(unit hole)
|- ^+ ..axon
?- tee
$@($~ {?($on $ay $ow) *}) ~|(e+ford+lost+tee !!)
{$of @ $~} ~|(e+ford+lost+tee !!)
{$si $~} (give-sigh q.sih)
{$se ^} (get-made:(dom-vi q.tee) p.tee [p q]:sih)
?+ tee ~& [%tee tee] !!
{$si $~} (give-turbo-sigh result.sih)
{$se ^} (get-made:(dom-vi q.tee) p.tee result:sih)
::
{$ay ^}
=/ res/(each (cask) tang)
?: ?=(%incomplete -.result.sih)
[%| tang.result.sih]
?: ?=([%complete %error *] result.sih)
[%| message.build-result.result.sih]
[%& [p q.q]:(result-to-cage:ford build-result.result.sih)]
(ames-gram (slav %p p.tee) got-inner+~ (slav %uv q.tee) res)
::
{$ha *}
%- emule |. ^+ ..apex
?: ?=([%incomplete *] result.sih)
(fail-turbo 404 tang.result.sih)
?: ?=([%complete %error *] result.sih)
(fail-turbo 404 message.build-result.result.sih)
=/ cay=cage (result-to-cage:ford build-result.result.sih)
?: ?=($red-quri p.cay)
=+ url=(apex:en-purl ((hard quri) q.q.cay))
(give-thou 307 [location+(crip url)]~ ~)
:: (give-html:abet 200 ~ (redir:xml url))
?. ?=($mime p.cay)
=+ bek=(norm-beak -:(need (de-beam p.tee)))
=+ tee-ses=?~(ses tee [%ac u.ses tee])
:: TODO: Why cast here? Shouldn't the cast wrap the previous result?
::
(exec-turbo-live tee-ses [%cast [p q]:bek %mime [%$ cay]])
=+ cug=?~(ses ~ cug:(~(got by wup) u.ses))
=+ ((hard {mit/mite rez/octs}) q.q.cay)
:: TODO: This used to use dep for etag control.
::
:: =+ dep=(crip "W/{(en-json %s (scot %uv p.sih))}")
=+ hit=[200 ~[content-type+(en-mite mit)] ~ rez] :: etag+dep
~& [%giving-turbo-thou tee]
(give-thou (add-cookies cug hit))
::
{$hi ^}
?: ?=($| -.q.sih)
(give-sigh q.sih) :: XX crash?
=* cay p.q.sih
?. ?=([%complete %success *] result.sih)
(give-turbo-sigh result.sih)
::
=/ cay/cage (result-to-cage:ford build-result.result.sih)
?> ?=($hiss p.cay)
?: =('~' p.tee)
(eyre-them tee q.cay)
@ -862,61 +999,15 @@
(eyre-them tee q.cay)
(get-req:(dom-vi usr (scag 2 p.r.p.pul)) q.tee q.cay)
::
:: {$hi ^}
:: ?: ?=($| -.q.sih)
:: (give-sigh q.sih) :: XX crash?
:: =* cay p.q.sih
:: ?> ?=($hiss p.cay)
:: (eyre-them p.tee q.cay)
::
{$he *} :: XX hack
=. ..axon $(tee p.tee)
%_ ..axon
mow %+ turn mow
|= a/move
?+ q.a a
{$give $thou *} a(r.p.p.q ~)
{$pass ^} ?.(=(p.tee p.q.a) a a(p.q tee))
== ==
::
{$of @ ^}
?: ?=($| -.q.sih)
((slog p.q.sih) +>.^$) :: XX get-even %mean
?: ?=([%incomplete *] result.sih)
((slog tang.result.sih) +>.^$)
?: ?=([%complete %error *] result.sih)
((slog message.build-result.result.sih) +>.^$)
=/ cay=cage (result-to-cage:ford build-result.result.sih)
%+ get-rush:(ire-ix p.tee) q.tee
?> ?=($json p.p.q.sih) :: XX others
((hard json) q.q.p.q.sih)
::
{$at ^}
?: ?=($| -.q.sih) $(tee q.tee)
?. ?=($js -.p.q.sih)
~& e+at-lost+[-.p.q.sih q.tee]
$(tee q.tee)
?> ?=(@ q.q.p.q.sih)
=. ses (some p.tee)
=+ cyz=(~(got by wup) p.tee)
=^ jon ..ya ~(stat-json ya p.tee cyz)
$(tee q.tee, q.q.p.q.sih (add-json jon q.q.p.q.sih))
::
{$ac ^} ?>((~(has by wup) p.tee) $(ses `p.tee, tee q.tee))
{$ha *}
%- emule |. ^+ ..apex
?. ?=($& -.q.sih)
(fail 404 p.sih p.q.sih)
=* cay p.q.sih
?: ?=($red-quri p.cay)
=+ url=(apex:en-purl ((hard quri) q.q.cay))
(give-thou 307 [location+(crip url)]~ ~)
:: (give-html:abet 200 ~ (redir:xml url))
?. ?=($mime p.cay)
=+ bek=(norm-beak -:(need (de-beam p.tee)))
=+ tee-ses=?~(ses tee [%ac u.ses tee])
(exec-live tee-ses bek [%flag [p.sih `~] %cast %mime [%$ p.q.sih]])
~| q.q.cay
=+ cug=?~(ses ~ cug:(~(got by wup) u.ses))
=+ ((hard {mit/mite rez/octs}) q.q.cay)
=+ dep=(crip "W/{(en-json %s (scot %uv p.sih))}")
=+ hit=[200 ~[etag+dep content-type+(en-mite mit)] ~ rez]
(give-thou (add-cookies cug hit))
?> ?=($json p.cay) :: XX others
((hard json) q.q.cay)
==
==
::
@ -956,15 +1047,22 @@
++ ames-gram
|=({him/ship gam/gram} (pass-note ~ %a %want [our him] [%e -.gam] +.gam))
::
++ back :: %ford bounce
|= {tea/whir mar/mark cay/cage}
(execute tea (norm-beak -.top) [%cast mar $+cay])
++ back-turbo
|= [tea=whir mar=mark cay=cage]
=/ disc [p q]:(norm-beak -.top)
%^ execute-turbo tea live=%.n
^- schematic:ford
[%cast disc mar [%$ cay]]
::
++ cast-thou
|= {mar/mark cay/cage}
?: ?=($httr mar) (give-sigh %& cay)
%^ execute si+~ (norm-beak -.top)
[%alts [%cast mar $+cay] [%cast %recoverable-error $+cay] ~]
++ cast-thou :: turbo
|= [mar=mark cay=cage]
?: ?=($httr mar)
~& [%cast-thou-immediate mar]
(give-sigh %& cay)
~& [%cast-thou mar]
%^ execute-turbo si+~ live=%.n
=/ =beak (norm-beak -.top)
[%alts [%cast [p q]:beak mar $+cay] [%cast [p q]:beak %recoverable-error $+cay] ~]
::
++ del-deps
|= {a/@uvH b/(each duct ixor)} ^+ +>.$
@ -973,7 +1071,10 @@
:: ~& del-deps+[a (~(get ju liz) a)]
?: (~(has by liz) a) +>.$
=- -(hen hen.+)
(pass-note(hen `~) on+~ %f [%wasp our a |])
:: TODO: %wasp is no longer supported.
::
~& %deprecated-del-deps
+>.$
::
++ new-deps
|= {a/@uvH b/(each duct ixor)} ^+ +>.$
@ -983,19 +1084,22 @@
=. liz (~(put ju liz) a b)
?: had +>.$
=- -(hen hen.+)
(pass-note(hen `~) on+~ %f [%wasp our a &])
:: TODO: %wasp is no longer supported.
::
~& %deprecated-new-deps
+>.$
::
++ ford-req |=({bek/beak kas/silk:ford} [%f [%exec our `[bek kas]]])
++ exec-live
|= {tea/whir req/{beak silk:ford}}
++ exec-turbo-live
|= [tea=whir req=schematic:ford]
=. lyv (~(put by lyv) hen [%exec tea])
(execute tea req)
(execute-turbo tea live=%.n req)
::
++ execute
|= {tea/whir bek/beak sil/silk:ford}
++ execute-turbo
|= [tea=whir live=? request=schematic:ford]
%+ pass-note tea
:^ %f %exec our
`[bek [%dude [|.(+)]:[%leaf "eyre: execute {<tea>}"] sil]]
:* %f %build our live
[%dude [|.(+)]:[%leaf "eyre: execute {<tea>}"] request]
==
::
++ fail
|= {sas/@ud dep/@uvH mez/tang}
@ -1003,6 +1107,12 @@
:: (back ha+~ dep %tang !>(mez)) ::tang->urb chain may be source of failure
(give-html sas ~ (render-tang dep mez))
::
++ fail-turbo :: failing faster
|= [sas=@ud mez=tang]
^+ +>
:: (back ha+~ dep %tang !>(mez)) ::tang->urb chain may be source of failure
(give-html sas ~ (render-turbo-tang mez))
::
++ give-html
|= {sas/@ud cug/(list @t) max/manx}
%- give-thou
@ -1028,6 +1138,14 @@
?. ?=($| -.res) p.res
[%tang !>(p.res)]
::
++ give-turbo-sigh
|= result=made-result:ford
~& %give-turbo-sigh
=- +>.$(mow :_(mow [hen %give %sigh `cage`-]))
?: ?=(%incomplete -.result)
[%tang !>(tang.result)]
(result-to-cage:ford build-result.result)
::
++ mean-json |=({sas/@uG err/ares} (give-json sas ~ (ares-to-json err)))
++ nice-json |=(* (give-json 200 ~ (frond:enjs %ok %b &)))
::
@ -1060,7 +1178,8 @@
++ teba |*(a/$-(* _..handle) |*(b/* %_(done ..handle (a b))))
++ del-deps (teba ^del-deps)
++ new-deps (teba ^new-deps)
++ exec-live (teba ^exec-live)
++ ames-gram (teba ^ames-gram)
++ exec-turbo-live (teba ^exec-turbo-live)
++ give-html (teba ^give-html)
++ give-thou (teba ^give-thou)
++ give-json (teba ^give-json)
@ -1098,9 +1217,17 @@
$html (give-html 200 cug p.pez)
$htme (give-html 401 cug p.pez)
$bake
=+ req=[%bake mar=q.pez [r s]:pez]
=+ red=req(mar %red-quri)
(exec-live p.pez -.s.pez `silk:ford`[%alts ~[req red]])
~& [%bake pez]
%+ exec-turbo-live p.pez
^- schematic:ford
:- %alts :~
^- schematic:ford
[%bake q.pez r.pez [[p q] s]:s.pez]
::
^- schematic:ford
[%bake %red-quri r.pez [[p q] s]:s.pez]
==
::
$red
=+ url=(en-purl hat pok(p [~ %html]) quy)
@ -1176,6 +1303,11 @@
:~ 'User-agent: *'
'Disallow: '
==
::
{@tas $'.well-known' ^} :: XX file extension?
=/ mim (yank wel (tail q.pok))
?~ mim ~
`(resp 200 p.u.mim q.q.u.mim)
==
::
++ is-spur |(?~(q.pok & ((sane %ta) i.q.pok)))
@ -1244,8 +1376,16 @@
::
$of
:+ %view ?>(?=({@ $~} but) i.but)
?> ?=({{$poll @} $~} quy) :: XX eventsource
?> ?=({{$poll @} $~} quy)
:: :^ %view
:: ?> ?=({@ $~} but)
:: i.but
:: ?> ?=({{$poll @} *} quy) :: XX eventsource
[~ (rash q.i.quy dem)]
:: ?: ?=({{$t @} $~} +.quy)
:: =/ s (rash q.i.t.quy dem)
:: `(yule [0 0 0 s ~])
:: ~
::
$to
=+ ^- dir/{p/ship q/term r/mark}
@ -1332,11 +1472,18 @@
$away [%& %html logout-page:xml]
?($beam $spur)
=^ payload mef process-payload
=+ ext=(fall p.pok %urb)
=+ ext=(fall p.pok %x-urb)
=+ bem=?-(-.hem $beam p.hem, $spur [-.top (weld p.hem s.top)])
~| bad-beam+q.bem
?< =- ?~(- | =(-.u.- 0))
(sky [151 %noun] %cw (en-beam bem(+ ~, r [%da now])))
?< =([~ 0] (sky [151 %noun] %cw (en-beam bem(+ ~, r [%da now]))))
?: ::!=(our p.bem) ::TODO also if it is?
=('x-' (end 3 2 ext))
=. ext (cat 3 ext '-elem')
=. -.bem (norm-beak -.bem)
=/ han (sham hen)
=. pox (~(put by pox) han hen)
=+ arg=(fcgi payload fcgi-cred)
[%| (ames-gram p.bem [%get-inner ~] han ext arg bem)]
=+ wir=`whir`[%ha (en-beam -.bem ~)]
=. wir ?+(mef !! $get wir, $head [%he wir])
=. r.bem ?+(r.bem r.bem {$ud $0} da+now)
@ -1388,6 +1535,7 @@
::
$view
~| lost-ixor+p.hem
:: [%| ((teba poll:(ire-ix p.hem)) u.q.hem r.hem)]
[%| ((teba poll:(ire-ix p.hem)) u.q.hem)]
==
::
@ -1743,11 +1891,15 @@
++ pop-duct =^(ned med ~(get to med) abet(hen ned))
++ poll
|= a/@u ^+ ..ix
:: |= [a/@u t=(unit @dr)]
:: ^+ ..ix
=< abet
=. ..poll refresh
?: =(a p.eve)
=. ..poll poll-rest
=. era (add ~s30 now)
=. era (add ~s8 now)
:: ?~ t (add ~s30 now)
:: (add u.t now)
=. lyv (~(put by lyv) hen [%poll ire])
pass-wait(ude [~ hen &])
?: (gth a p.eve) ~|(seq-high+cur=p.eve !!)
@ -1784,8 +1936,9 @@
==
++ self .
++ abet +>(sec (~(put by sec) +<- +<+))
++ execute
|=({a/whir-se b/{beak silk:ford}} (execute:abet se+[a usr dom] b))
++ execute-turbo
|= [wir=whir-se live=? schematic=schematic:ford]
(execute-turbo:abet se+[wir usr dom] live schematic)
++ dead-this |=(a/tang (fail:abet 500 0v0 a))
++ dead-hiss |=(a/tang pump(req ~(nap to req), ..vi (give-sigh %| a)))
++ eyre-them |=({a/whir-se b/vase} (eyre-them:abet se+[a usr dom] b))
@ -1800,31 +1953,35 @@
++ cor-type ?~(cor %void ?~(u.cor %void p.u.cor))
++ has-arm ~(has in (silt (sloe cor-type)))
++ build
%^ execute %core root-beak
%^ execute-turbo %core live=%.y
:::+ %dude [|.(+)]:>%mod-samp<
^- silk:ford
:^ %mute core+[root-beak (flop %_(dom . sec+dom))]
[[%& 12]~ %$ bale+!>(*(bale @))] :: XX specify on type?
?~ cor ~
?~ u.cor ~
?: (has-arm %discard-state) ~
?: (has-arm %update)
[[%& 13]~ ride+[limb+%update prep-cor]]~
[[%& 13]~ %$ noun+(slot 13 u.cor)]~
^- schematic:ford
:+ %mute
^- schematic:ford
[%core [[our %home] (flop %_(dom . sec+dom))]]
^- (list (pair wing schematic:ford))
:* [[%& 12]~ %$ bale+!>(*(bale @))] :: XX specify on type?
?~ cor ~
?~ u.cor ~
?: (has-arm %discard-state) ~
?: (has-arm %update)
[[%& 13]~ ride+[limb+%update prep-cor]]~
[[%& 13]~ %$ noun+(slot 13 u.cor)]~
==
::
++ call
|= {arm/vi-arm sam/cage}
%^ execute arm root-beak
%^ execute-turbo arm live=%.n
call+[ride+[limb+arm prep-cor] [%$ sam]]
::
++ prep-cor ^- silk:ford
++ prep-cor ^- schematic:ford
?~ cor ~|(%no-core !!)
?~ u.cor ~|(%nil-driver !!)
:+ %$ %core
%_ u.cor
+12.q
=+ ^= ato
%- sky
%- sky
[[151 %noun] %cx (en-beam root-beak [%atom (flop %_(dom . sec+dom))])]
=+ key=?~(ato '' ;;(@t u.ato)) :: XX jael
=. key
@ -1858,7 +2015,6 @@
::
:: Interfaces
::
++ get-news _build
++ get-quay |=(quy/quay (call %receive-auth-query-string quay+!>(quy)))
++ get-req |=(a/{mark vase:hiss} pump(req (~(put to req) hen a)))
++ get-thou
@ -1872,9 +2028,10 @@
==
::
++ get-made
|= {wir/whir-se dep/@uvH res/(each cage tang)} ^+ abet
?: ?=($core wir) (made-core dep res)
%. res
|= [wir/whir-se result=made-result:ford] ^+ abet
:: |= {wir/whir-se dep/@uvH res/(each cage tang)} ^+ abet
?: ?=($core wir) (made-core result)
%. result
?- wir
?($filter-request $out) made-filter-request
?($filter-response $res) made-filter-response
@ -1883,14 +2040,21 @@
==
::
++ made-core
|= {dep/@uvH gag/(each cage tang)}
|= [result=made-result:ford]
:: |= {dep/@uvH gag/(each cage tang)}
:: ~& got-update/dep
=. ..vi (pass-note %core [%f [%wasp our dep &]])
?~ -.gag pump(cor `q.p.gag)
:: =. ..vi (pass-note %core [%f [%wasp our dep &]])
?: ?=([%complete %success *] result)
=/ =cage (result-to-cage:ford build-result.result)
pump(cor `q:cage)
?: &(=(~ cor) =(%$ usr))
=. cor `~
pump ::(cor `~) :: userless %hiss defaults to "nop" driver
(warn p.gag)
%- warn
?: ?=(%incomplete -.result)
tang.result
?> ?=(%error -.build-result.result)
message.build-result.result
::
++ made-filter-request
%+ on-ford-fail dead-hiss
@ -1952,17 +2116,25 @@
$(a t.a)
::
++ on-ford-fail
|= {err/$-(tang _abet) try/$-((each cage tang) _abet)}
|= a/(each cage tang) ^+ abet
?-(-.a $| (err p.a), $& (try a))
|= {err/$-(tang _abet) try/$-(made-result:ford _abet)}
|= a/made-result:ford ^+ abet
?: ?=(%incomplete -.a)
(err tang.a)
?: ?=(%error -.build-result.a)
(err message.build-result.a)
(try a)
::
++ on-error
|= {err/$-(tang _abet) handle-move/_|.(|~(vase abet))}
|= a/(each cage tang) ^+ abet
|= a=made-result:ford ^+ abet
=+ try=(possibly-stateful |=(b/_self (handle-move(+ b)))) :: XX types
?: ?=($| -.a) (err p.a)
?: ?=(%incomplete -.a)
(err tang.a)
?: ?=(%error -.build-result.a)
(err message.build-result.a)
=/ =cage (result-to-cage:ford build-result.a)
=- ?-(-.- $& p.-, $| (err p.-))
(mule |.(~|(driver+dom ~|(bad-res+p.q.p.a (try q.p.a)))))
(mule |.(~|(driver+dom ~|(bad-res+p.q.cage (try q.cage)))))
::
++ possibly-stateful
|= han/$-(_self $-(vase _abet)) :: XX |.(|+(vase abet))
@ -2026,10 +2198,20 @@
~
::
++ load :: take previous state
::|= * %. (bolo +<)
|= old/?(bolo) ^+ ..^$
=> |%
++ bolo-old (cork bolo |=(bolo [%0 |5.+<]))
--
|= old/?(bolo-old bolo)
^+ ..^$
?- -.old
$0 ..^$(+>- old)
$0 $(old [%1 ~ *http-config [8.080 ~] [~ ~] +.old])
::
$1 :: XX temporary fix for bad proxy config
::
=/ rox=? ?~ hov.old
proxy.fig.old
?=(%king (clan:title u.hov.old))
..^$(+>- old(proxy.fig rox))
==
::
++ scry
@ -2057,7 +2239,14 @@
?+ p.lot [~ ~]
{$tas $fake} ``[& [~ 8.443] %& /localhost] :: XX from unix
{$tas $real}
``~(our-host ye [`duct`~[/] [now eny our sky] ~] bol)
=/ hot=host [%& ?^(dom n.dom /localhost)]
=/ sek=? &(?=(^ sek.por) !?=(hoke hot))
=/ por=(unit @ud)
?. sek
?:(=(80 clr.por) ~ `clr.por)
?> ?=(^ sek.por)
?:(=(443 u.sek.por) ~ sek.por)
``[sek por hot]
==
==
::

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
!:
:: :: %gall, agent execution
!? 163
::::
@ -150,7 +151,7 @@
:: +mo-recieve-core: receives an app core built by ford-turbo
::
++ mo-recieve-core
|= [dap=dude byk=beak made-result=made-result:ford-api]
|= [dap=dude byk=beak made-result=made-result:ford]
^+ +>
::
?: ?=([%incomplete *] made-result)
@ -161,7 +162,7 @@
?: ?=([%error *] build-result)
(mo-give %onto %| message.build-result)
::
=/ result-cage=cage (result-to-cage:ford-api build-result)
=/ result-cage=cage (result-to-cage:ford build-result)
::
=/ app-data=(unit seat) (~(get by bum) dap)
?^ app-data
@ -206,7 +207,7 @@
^+ +>
%+ mo-pass [%sys %core dap (scot %p p.byk) q.byk (scot r.byk) ~]
^- note-arvo
[%t %build our live=%.y [%core [[p q]:byk [%hoon dap %app ~]]]]
[%f %build our live=%.y [%core [[p q]:byk [%hoon dap %app ~]]]]
::
++ mo-away :: foreign request
|= {him/ship caz/cush} ::
@ -306,14 +307,14 @@
^+ +>
?+ -.pax !!
$core
?> ?=([%t %made *] sih)
?> ?=([%f %made *] sih)
?> ?=({@ @ @ @ $~} t.pax)
(mo-recieve-core i.t.pax (mo-chew t.t.pax) result.sih)
::
%pel :: translated peer
?> ?=({@ $~} t.pax)
=+ mar=i.t.pax
?> ?=([%t %made *] sih)
?> ?=([%f %made *] sih)
::
?: ?=([%incomplete *] result.sih)
(mo-give %unto %coup `tang.result.sih)
@ -323,7 +324,7 @@
?: ?=([%error *] build-result)
(mo-give %unto %coup `message.build-result)
::
(mo-give %unto %diff (result-to-cage:ford-api build-result))
(mo-give %unto %diff (result-to-cage:ford build-result))
::
$red :: diff ack
?> ?=({@ @ @ $~} t.pax)
@ -343,7 +344,7 @@
::
%rep :: reverse request
?> ?=({@ @ @ $~} t.pax)
?> ?=([%t %made *] sih)
?> ?=([%f %made *] sih)
=+ :* him=(slav %p i.t.pax)
dap=i.t.t.pax
num=(slav %ud i.t.t.t.pax)
@ -361,7 +362,7 @@
::
:: "XX pump should ack"
=. +>.$ (mo-give %mack ~)
=* result-cage (result-to-cage:ford-api build-result)
=* result-cage (result-to-cage:ford build-result)
(mo-give(hen (mo-ball him num)) %unto %diff result-cage)
::
$req :: inbound request
@ -371,11 +372,17 @@
num=(slav %ud i.t.t.t.pax)
==
?: ?=({$f $made *} sih)
?- -.q.+>.sih
$tabl ~|(%made-tabl !!)
$| (mo-give %mack `p.q.+>.sih) :: XX should crash
$& (mo-pass [%sys pax] %g %deal [him our] i.t.t.pax %poke p.q.+>.sih)
==
?: ?=([%incomplete *] result.sih)
:: "XX should crash"
(mo-give %mack `tang.result.sih)
::
=/ build-result build-result.result.sih
::
?: ?=([%error *] build-result)
:: "XX should crash"
(mo-give %mack `message.build-result)
=/ cay/cage (result-to-cage:ford build-result)
(mo-pass [%sys pax] %g %deal [him our] i.t.t.pax %poke cay)
?: ?=({$a $woot *} sih) +>.$ :: quit ack, boring
?> ?=({$g $unto *} sih)
=+ cuf=`cuft`+>.sih
@ -391,7 +398,7 @@
%val :: inbound validate
?> ?=({@ @ $~} t.pax)
=+ [him=(slav %p i.t.pax) dap=i.t.t.pax]
?> ?=([%t %made *] sih)
?> ?=([%f %made *] sih)
::
?: ?=([%incomplete *] result.sih)
(mo-give %unto %coup `tang.result.sih)
@ -401,7 +408,7 @@
?: ?=([%error *] build-result)
(mo-give %unto %coup `message.build-result)
::
=* result-cage (result-to-cage:ford-api build-result)
=* result-cage (result-to-cage:ford build-result)
(mo-clip dap `prey`[%high ~ him] [%poke result-cage])
::
$way :: outbound request
@ -468,12 +475,12 @@
?: ?=($puff -.cub)
%+ mo-pass
[%sys %val (scot %p q.q.pry) dap ~]
[%t %build our live=%.n [%vale [p q]:(mo-beak dap) +.cub]]
[%f %build our live=%.n [%vale [p q]:(mo-beak dap) +.cub]]
?: ?=($punk -.cub)
%+ mo-pass
[%sys %val (scot %p q.q.pry) dap ~]
:* %t %build our live=%.n
^- schematic:ford-api
:* %f %build our live=%.n
^- schematic:ford
[%cast [p q]:(mo-beak dap) p.cub [%$ q.cub]]
==
?: ?=($peer-not -.cub)
@ -510,7 +517,7 @@
$d
%+ mo-pass
[%sys %rep (scot %p him) dap (scot %ud num) ~]
[%t %build our live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]]
[%f %build our live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]]
::
$x =. +> (mo-give %mack ~) :: XX should crash
(mo-give(hen (mo-ball him num)) %unto %quit ~)
@ -588,7 +595,7 @@
?: =(mar p.cay) [%give %unto p.q.cov]
:+ %pass
[%sys %pel dap ~]
[%t %build our live=%.n [%cast [p q]:(mo-beak dap) mar [%$ cay]]]
[%f %build our live=%.n [%cast [p q]:(mo-beak dap) mar [%$ cay]]]
::
$pass
:+ %pass `path`[%use dap p.q.cov]
@ -1213,23 +1220,25 @@
$crew `%c
$crow `%c
$deal `%g
$exec `%f
$build `%f
$kill `%f
$flog `%d
$drop `%c
$info `%c
%kill `%t
%build `%t
$merg `%c
$mont `%c
$nuke `%a
$ogre `%c
$perm `%c
$rule `%e
$serv `%e
$tend `%a
$them `%e
$wait `%b
$want `%a
$warp `%c
$wipe `%f :: XX cache clear
$well `%e
:: $wipe `%f :: XX cache clear
==
--
--

File diff suppressed because it is too large Load Diff

View File

@ -135,6 +135,7 @@
{$init p/@p} :: report install
{$mack p/(unit tang)} ::
{$mass p/mass} :: memory usage
{$rove p/ship q/lane} :: lane change
{$send p/lane q/@} :: transmit packet
{$woot p/ship q/coop} :: reaction message
== ::
@ -161,6 +162,7 @@
{$nuke p/@p} :: toggle auto-block
{$make p/(unit @t) q/@ud r/@ s/?} :: wild license
{$sith p/@p q/@uw r/?} :: imperial generator
{$tend $~} :: watch lane changes
{$wake $~} :: timer activate
{$wegh $~} :: report memory
{$west p/sack q/path r/*} :: network request
@ -203,6 +205,7 @@
++ boon :: fort output
$% {$beer p/ship q/@uvG} :: gained ownership
{$cake p/sock q/soap r/coop s/duct} :: e2e message result
{$maze p/ship q/lane} :: lane change
{$mead p/lane q/rock} :: accept packet
{$milk p/sock q/soap r/*} :: e2e pass message
{$ouzo p/lane q/rock} :: transmit packet
@ -240,12 +243,13 @@
wid/@ud :: logical wdow msgs
== ::
++ fort :: formal state
$: $0 :: version
$: $1 :: version
gad/duct :: client interface
hop/@da :: network boot date
bad/(set @p) :: bad ships
ton/town :: security
zac/(map ship corn) :: flows by server
ten/(set duct) :: watch lanes
== ::
++ gcos :: id description
$% {$czar $~} :: 8-bit ship
@ -666,9 +670,11 @@
++ able ^?
|%
+= gift :: out result <-$
$% [%mass p=mass] :: memory usage
$% [%form p=http-config] :: configuration
[%mass p=mass] :: memory usage
[%mack p=(unit tang)] :: message ack
[%sigh p=cage] :: marked http response
[%that p=@p q=prox] :: get proxied request
[%thou p=httr] :: raw http response
[%thus p=@ud q=(unit hiss)] :: http request+cancel
[%veer p=@ta q=path r=@t] :: drop-through
@ -676,10 +682,12 @@
[%velo p=@t q=@t] :: drop-through
== ::
+= task :: in request ->$
$% [%born ~] :: new unix process
$% [%born p=(list host)] :: new unix process
[%crud p=@tas q=(list tank)] :: XX rethink
[%hiss p=(unit user) q=mark r=cage] :: outbound user req
[%init p=@p] :: report install
[%live p=@ud q=(unit @ud)] :: http/s ports
[%rule p=http-rule] :: update config
[%serv p=$@(desk beam)] :: set serving root
[%them p=(unit hiss)] :: outbound request
[%they p=@ud q=httr] :: inbound response
@ -687,8 +695,10 @@
[%this p=? q=clip r=httq] :: inbound request
[%thud ~] :: inbound cancel
[%wegh ~] :: report memory
[%well p=path q=(unit mime)] :: put/del .well-known
[%went p=sack q=path r=@ud s=coop] :: response confirm
[%west p=sack q=[path *]] :: network request
[%wise p=ship q=prox] :: proxy notification
== ::
-- ::able
::
@ -722,6 +732,11 @@
[[%get ~] p=@uvH q=[? clip httq]] :: remote request
[[%got ~] p=@uvH q=httr] :: remote response
[[%gib ~] p=@uvH] :: remote cancel
::
[[%get-inner ~] p=@uvH q=mark r=coin s=beam] ::TODO details?
[[%got-inner ~] p=@uvH q=(each (cask) tang)] ::TODO details?
::
[[%not ~] p=prox] :: proxy notification
== ::
++ hart {p/? q/(unit @ud) r/host} :: http sec+port+host
++ hate {p/purl q/@p r/moth} :: semi-cooked request
@ -732,6 +747,34 @@
++ host (each (list @t) @if) :: http host
++ hoke %+ each {$localhost $~} :: local host
?($.0.0.0.0 $.127.0.0.1) ::
:: +http-config: full http-server configuration
::
+= http-config
$: :: secure: PEM-encoded RSA private key and cert or cert chain
::
secure=(unit [key=wain cert=wain])
:: proxy: reverse TCP proxy HTTP(s)
::
proxy=?
:: log: keep HTTP(s) access logs
::
log=?
:: redirect: send 301 redirects to upgrade HTTP to HTTPS
::
:: Note: requires certificate.
::
redirect=?
==
:: +http-rule: update configuration
::
+= http-rule
$% :: %cert: set or clear certificate and keypair
::
[%cert p=(unit [key=wain cert=wain])]
:: %turf: add or remove established dns binding
::
[%turf p=?(%put %del) q=(list @t)]
==
++ httq :: raw http request
$: p/meth :: method
q/@t :: unparsed url
@ -769,6 +812,22 @@
++ octs {p/@ud q/@t} :: octet-stream
++ oryx @t :: CSRF secret
++ pork {p/(unit @ta) q/(list @t)} :: fully parsed url
:: +prox: proxy notification
::
:: Used on both the proxy (ward) and upstream sides for
:: sending/receiving proxied-request notifications.
::
+= prox
$: :: por: tcp port
::
por=@ud
:: sek: secure?
::
sek=?
:: non: authentication nonce
::
non=@uvJ
==
++ purf (pair purl (unit @t)) :: url with fragment
++ purl {p/hart q/pork r/quay} :: parsed url
++ quay (list {p/@t q/@t}) :: parsed url query
@ -788,93 +847,9 @@
:: ::::
:::: ++ford :: (1f) build
:: ::::
++ ford ^?
|%
:: ::
:::: ++able:ford :: (1f1) arvo moves
:: ::::
++ able ^?
|%
++ gift :: out result <-$
$% {$made p/@uvH q/gage} :: computed result
{$mass p/mass} :: memory usage
{$news p/@uvH} :: fresh depends
== ::
++ task :: in request ->$
$% {$exec p/@p q/(unit bilk)} :: make / kill
{$wasp p/@p q/{@uvH ?}} :: depends ask / kill
{$wegh $~} :: report memory
{$wipe p/@p $~} :: clear cache
== ::
-- ::able
++ bilk (pair beak silk) :: sourced request
++ gage :: recursive cage+tang
$% {$& p/cage} :: success
{$| p/tang} :: error
{$tabl p/(list (pair gage gage))} :: table of results
== ::
++ hood :: assembly plan
$: zus/@ud :: zuse kelvin
sur/(list hoof) :: structures
lib/(list hoof) :: libraries
fan/(list horn) :: resources
src/(list hoop) :: program
== ::
++ hoof (trel ? term (unit (pair case ship))) :: resource reference
++ hoop :: source in hood
$% {$& p/hoon} :: direct hoon
{$| p/beam} :: resource location
== ::
++ hops :: XX late-bound path
$: pre/(unit tyke) ::
pof/(unit {p/@ud q/tyke}) ::
== ::
++ horn :: resource tree
$% {$fssg p/hoon} :: /~ twig by hand
{$fsbc p/hoon} :: /$ argument
{$fsbr p/(list horn)} :: /| options
{$fshx p/horn} :: /# insert dephash
{$fsts p/term q/horn} :: /= apply face
{$fsdt p/(list horn)} :: /. list
{$fscm p/(list (pair spur horn))} :: /, switch by path
{$fscn p/horn} :: /% propagate args
{$fspm p/(list mark) q/horn} :: /& translates
{$fscb p/horn} :: /_ homo map
{$fssm p/hoon q/horn} :: /; operate on
{$fscl p/hops q/horn} :: /: relative to
{$fskt p/hoon q/horn} :: /^ cast
{$fszp q/mark} :: /!mark/ eval value
{$fszy q/mark} :: /mark/ static/grow
== ::
++ milk (trel ship desk silk) :: sourced silk
++ silk :: construction layer
$^ {p/silk q/silk} :: cons
$% {$$ p/cage} :: literal
{$alts p/(list silk)} :: options
{$bake p/mark q/coin r/beam} :: local synthesis
{$bunt p/mark} :: example of mark
{$call p/silk q/silk} :: slam
{$cast p/mark q/silk} :: translate
{$core p/beam} :: build program
{$diff p/silk q/silk} :: diff
{$dude p/(trap tank) q/silk} :: error wrap
{$file p/beam} :: from clay
{$flag p/(set $@(@uvH beam)) q/silk} :: add dependencies
{$join p/mark q/silk r/silk} :: merge
{$mash p/mark q/milk r/milk} :: annotate
{$mute p/silk q/(list (pair wing silk))} :: mutant
{$pact p/silk q/silk} :: patch
{$plan p/beam q/coin r/hood} :: structured assembly
{$reef $~} :: kernel reef
{$ride p/hoon q/silk} :: silk thru hoon
{$tabl p/(list (pair silk silk))} :: list
{$vale p/mark q/*} :: validate
{$volt p/(cask *)} :: unsafe add type
== ::
-- ::ford
:: |ford: build system vane interface
::
++ ford-api ^?
++ ford ^?
|%
:: |able:ford: ford's public +move interface
::
@ -2638,11 +2613,14 @@
%+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7
%- flop
|- ^- (list @ux)
?: =(blocks 0) ~
:- (encrypt ctr)
$(ctr (inc mod ctr), blocks (dec blocks))
=| seed=(list @ux)
|- ^+ seed
?: =(blocks 0) seed
%= $
seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctra:aes:crypto
++ de :: decrypt
en
@ -2662,11 +2640,14 @@
%+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7
%- flop
|- ^- (list @ux)
?: =(blocks 0) ~
:- (encrypt ctr)
$(ctr (inc mod ctr), blocks (dec blocks))
=| seed=(list @ux)
|- ^+ seed
?: =(blocks 0) seed
%= $
seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctrb:aes:crypto
++ de :: decrypt
en
@ -2686,11 +2667,14 @@
%+ mix txt
%^ rsh 3 (sub (mul 16 blocks) len)
%+ rep 7
%- flop
|- ^- (list @ux)
?: =(blocks 0) ~
:- (encrypt ctr)
$(ctr (inc mod ctr), blocks (dec blocks))
=| seed=(list @ux)
|- ^+ seed
?: =(blocks 0) seed
%= $
seed [(encrypt ctr) seed]
ctr (inc mod ctr)
blocks (dec blocks)
==
:: :: ++de:ctrc:aes:crypto
++ de :: decrypt
en
@ -5764,7 +5748,6 @@
gift:able:eyre
gift:able:ford
gift:able:gall
gift:able:ford-api
==
++ task-arvo :: in request ->$
$? task:able:ames
@ -5774,7 +5757,6 @@
task:able:eyre
task:able:ford
task:able:gall
task:able:ford-api
==
++ note-arvo :: out request $->
$? {@tas $meta vase}
@ -5785,7 +5767,6 @@
{$e task:able:eyre}
{$f task:able:ford}
{$g task:able:gall}
{$t task:able:ford-api}
== ==
++ sign-arvo :: in result $<-
$% {$a gift:able:ames}
@ -5796,7 +5777,6 @@
{$f gift:able:ford}
{$g gift:able:gall}
{$j gift:able:jael}
{$t gift:able:ford-api}
==
::
++ unix-task :: input from unix

View File

@ -1,10 +0,0 @@
/+ ford-turbo, tester
::
|_ _tester:tester
++ test-ford-call
~& %ford-compiles
%- expect-eq !>
[1 1]
:: :- ~
:: -:(call:(ford-turbo *@da *@ *sley))
--

3
web.hoon Normal file
View File

@ -0,0 +1,3 @@
^- manx
;div(data-component "InboxPage");

17
web.md
View File

@ -1,17 +0,0 @@
---
container: false
layout: plan
anchor: none
title: Home
---
<div class="above">
<div class="container panel stack">
<panel></panel>
</div>
<div class="container plan stack">
<div class="col-md-9">
<plan></plan>
</div>
</div>
</div>

Binary file not shown.

Binary file not shown.

4
web/collections/blah.umd Normal file
View File

@ -0,0 +1,4 @@
:- ~[comments+&]
;>
this is blah.umd

Binary file not shown.

View File

@ -0,0 +1,5 @@
;>
this is moo.umd
no comments

5
web/collections/moo.umd Normal file
View File

@ -0,0 +1,5 @@
;>
this is moo.umd
no comments

View File

@ -0,0 +1,12 @@
::
::::
::
/= gas /$ fuel:html
^- manx
;div
;div
=urb-component "Details"
=urb-ship "{(scow %p p.bem.gas)}"
=urb-path "{<(flop s.bem.gas)>}";
;input(type "hidden", name "urb-header", value "collection-write", station "query");
==

View File

@ -0,0 +1,21 @@
::
::::
::
/+ collections
/= gas /$ fuel:html
=/ sho=@t (fall (~(get by qix.gas) %show) %default)
|= [raw=(unit raw-item:collections) pax=path]
=/ body ?~(raw '' data.u.raw)
=/ front ?~(raw ~ meta.u.raw)
=/ lastmod (fall (~(get by front) %last-modified) ~.missing-date)
^- manx
;div
;div
=urb-component "TopicCreatePage"
=urb-ship "{(scow %p p.bem.gas)}"
=urb-claypath "{<pax>}"
=urb-content "{(trip body)}"
=urb-show "{(trip sho)}"
=urb-lastedit "{(trip lastmod)}";
;input(type "hidden", name "urb-header", value "collection-write", station "query");
==

File diff suppressed because one or more lines are too long

74701
web/landscape/js/index.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,63 @@
/+ collections, colls
/= gas /$ fuel:html
::/= all-colls /: /===/web/collections
:: /collection-web-item/
|%
:: is this collection on the profile?
++ is-pro
|= col=collection:collections
visible.meta.col
--
^- manx
;div.profile-page
;input(type "hidden", name "urb-header", value "profile", ship "{(scow %p p.bem.gas)}");
;div.container
;div.row
;div.col-sm-offset-2.col-sm-10
;div.profile-avatar
;div(urb-component "AvatarLg", urb-ship "{(scow %p p.bem.gas)}");
;div.profile-shipname: {(scow %p p.bem.gas)}
;div(urb-component "ProfileMsgBtn", urb-ship "{(scow %p p.bem.gas)}");
==
==
==
;div.row
;div.col-sm-offset-2.col-sm-10
::;div.text-700.mt-8: Blogs, Forum and Notes
::;ul.vanilla
:: ;div;
:: ;* %+ turn
:: %+ sort
:: %+ skim
:: ~(tap by all-colls)
:: is-pro
:: |= [a=(pair knot *) b=(pair knot *)]
:: (gth (unt:chrono:userlib (slav %da p.a)) (unt:chrono:userlib (slav %da p.b)))
:: |= [t=knot col=collection:collections]
:: ;div.mt-2.text-500
:: ;a(href "/~~/{(scow %p p.bem.gas)}/==/web/collections/{(trip t)}")
:: ; {(trip desc.conf.col)}
:: ==
:: ==
::==
::;div.text-700.mt-8: Chats
;div(urb-component "ChatList", urb-hostship "{(scow %p p.bem.gas)}");
;div.text-700.mt-8: Meta
;div.mt-2.text-500.row
;span.col-sm-2: Started:
;span.col-sm-10.text-mono: ~2018.4.12..6.45.12
==
;div.mt-2.text-500.row
;span.col-sm-2: Issued:
;span.col-sm-10.text-mono
;a(href "/~~/{(scow %p (sein:title p.bem.gas))}/==/web/pages/nutalk/profile"): {(scow %p (sein:title p.bem.gas))}
==
==
;div.mt-2.text-500.row
;span.col-sm-2: Events:
;span.col-sm-10.text-mono: 852.129.320
==
==
==
==
==

View File

@ -0,0 +1,6 @@
^- manx
;div
;div(urb-component "ChatPage");
;input(type "hidden", name "urb-header", value "stream", station "query");
==

View File

@ -0,0 +1,3 @@
^- manx
;div(urb-component "StreamCreatePage");

View File

@ -0,0 +1,14 @@
input.red {
background: hsl(0, 100%, 60%);
}
form.inline {
display: inline;
}
.edit-toggle:checked ~ .edit-off {
display: none;
}
.edit-toggle:not(:checked) ~ .edit-on {
display: none;
}

47
web/lib/js/easy-form.js Normal file
View File

@ -0,0 +1,47 @@
//REVIEW this feels too complicated
let match_url_end = (pattern,out={})=> {
if(!pattern) return out
let here = document.location.pathname.split("/").reverse()
while(!here[0]) here.shift()
for(let segment of pattern.split("/").reverse()){
let val = here.shift()
if(segment[0] != ":") continue //REVIEW check for match?
out[segment.slice(1)] = val
}
return out
}
//
window.easy_form = {
submit: (form)=> {
const param = (key)=> {
var x = form.elements[`easy_form:${key}`]
return x && x.value
}
let mark = param("mark")
if(!mark) throw new TypeError("Need a mark")
let appl = param("appl") || mark.match(/^[^-]*/)[0]
let tag = param("tag")
//
if(param("confirm") != null && !confirm("Are you sure?"))
return false
//
let req = {}
req = match_url_end(param("url_end"),req)
//
for (let [k,v] of new FormData(form)){
if(!/^easy_form:/.test(k)) {
req[k] = v
}
}
if(tag) req = {[tag]:req}
fetch("/~/auth.json", {credentials: "same-origin"})
.then((res)=>res.json())
.then(({oryx})=> fetch(`/~/to/${appl}/${mark}`,{
method: "POST",
body:JSON.stringify({oryx,wire:"/",xyro:req}),
credentials: "same-origin"
}))
return false
}
}

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