Merge branch 'collections' into collections-merge

* collections: (127 commits)
  Revert "cross-ship permissions works now"
  deleted more unused files, updated json arm of collections mark
  removed unused index file (was used for debug)
  cross-ship permissions works now
  rendered MVE css and js 272af56804f822c23efa645aafcf1d5d8a8bfdff
  simplified latest alias
  new 'latest' page in colls
  deleted a swp file
  mve updates f83035d162dd60107b45798117cf924437070798
  isaac's eyre changes to polling parameters as requested by Logan
  rendered MVE f0a44584883e8789ec5bab9c80334ae0ee251e02
  source new circle to inbox in collections app
  relative href
  removed topic text from collection json
  patch back in realnet ames (was testnet ames in xship-wrap
  collections now sends invites to whitelist
  aded fascen to pass along fasbuc params
  add x-htm wrappers for &htm
  rename default eyre mark to x-urb, do xhsip on x- prefix requests
  updated json endpoints in accordance with logan's requests
  ...
This commit is contained in:
Joe Bryan 2018-06-19 20:51:22 -04:00
commit 9d72b8f92b
66 changed files with 77633 additions and 94 deletions

420
app/collections.hoon Normal file
View File

@ -0,0 +1,420 @@
:: /app/collection/hoon
::
/- hall, *collections
/+ hall, rekey, colls
/= cols /: /===/web/collections /collections/
::
:: things to keep in sync, unique by date:
:: collections: files, circles,
:: topics: files, circles, notify
:: comments: files, notify
::
:: filepaths:
:: /web/collections/my-coll.config
:: /web/collections/my-coll/some.topic
:: /web/collections/my-coll/some/1.comment
::
:: notification circles:
:: ~.collections_blog-date new/changed post notifications
:: ~.collections_blog-date__post-date new/changed comments notifications
::
::
::::
::
:: XX belongs back in zuse
|%
++ pack :: light path encoding
|= {a/term b/path} ^- knot
%+ rap 3 :- (wack a)
(turn b |=(c/knot (cat 3 '_' (wack c))))
::
++ pick :: light path decoding
=+ fel=(most cab (sear wick urt:ab))
|=(a/knot `(unit {p/term q/path})`(rush a fel))
::
--
=> |%
++ move (pair bone card) :: all actions
++ poke ::
$% {$hall-action action:hall} ::
== ::
++ card ::
$% {$info wire ship term nori:clay} ::
{$poke wire dock poke} ::
{$pull wire dock $~} ::
{$warp wire sock riff:clay} ::
{$quit $~} ::
== ::
--
::
::::
::
=, wired
=, space:userlib
|_ {bol/bowl:gall upd/@da}
::
++ prep ::< prepare state
::> adapts state.
::
::REVIEW this seems like not the ideal place to get the ford update
|= old/(unit @da)
^- (quip move _..prep)
=^ mow ..prep
ta-done:(ta-update:ta (fall old *@da))
[mow ..prep(upd now.bol)]
::
++ now-id
:: HACK "sanitized" now for id use, can't get mistaken for file with extension in url
`@da`(sub now.bol (div (dis now.bol ~s0..fffe) 2))
::
++ poke-noun
|= a=$@(?(~ @da) [p=@da q=@da])
^- (quip move _+>)
~& %poked
=< ta-done
?~ a
(ta-create:ta ['a description' publ=& visi=& comm=& xeno=& ~])
?@ a
(ta-submit:ta a 'a topic' ~['with contents'])
(ta-comment:ta p.a q.a now-id ~['a comment' 'yo'])
::
++ writ
|= {wir/wire rit/riot:clay}
^- (quip move _+>)
[~ +>]
::TODO watch for file changes. create on new files, update on change, delete
:: on remove. we want to watch /web/collections recursively if possible,
:: or /web/collections/[col] for each collection and then
:: /web/collections/[col]/[top] for each topic as they get created.
::
++ ignore-action
|= act=action:api ^- ?
?- -.act
?($create $delete $delete-topic $delete-comment $resubmit)
?: (team:title our.bol src.bol) |
~|([%unauthorized -.act src.bol] !!) :: what about the authors?
::
?($submit $comment)
=/ col (~(get by cols) col.act)
?~ col &
?: (team:title our.bol src.bol) | ::REVIEW this is implicit yes?
?: publ.conf.u.col
(~(has in mems.conf.u.col) src.bol) :: not on blacklist
!(~(has in mems.conf.u.col) src.bol) :: is on whitelist
==
::
++ poke-collections-action
|= act=action:api
^- (quip move _+>)
?: (ignore-action act)
[~ +>]
=< ta-done
?- -.act
$create (ta-create:ta +.act)
$submit (ta-submit:ta +.act)
$resubmit (ta-resubmit:ta +.act)
$comment (ta-comment:ta +.act)
$delete (ta-delete:ta +.act)
$delete-topic (ta-delete-topic:ta +.act)
$delete-comment (ta-delete-comment:ta +.act)
==
::
++ ta
|_ moves/(list move)
++ ta-this .
++ ta-done [(flop moves) +>]
++ ta-emit |=(mov/move %_(+> moves [mov moves]))
++ ta-emil |=(mos/(list move) %_(+> moves (welp (flop mos) moves)))
++ ta-hall-action
|= act=action:hall
%- ta-emit
:^ ost.bol %poke / ::TODO wire, handle ++coup.
:+ [our.bol %hall] %hall-action
act
::
++ ta-hall-actions
|= act=(list ?(~ action:hall)) ^+ +>
?~ act +>
?~ i.act $(act t.act)
$(act t.act, +> (ta-hall-action i.act)) ::TODO group at all?
::
:: %performing-actions
::
++ ta-create
::|= {wat/kind:api cof/config}
|= cof/config
^+ +>
::XX unhandled kind
(ta-write /config now-id %collections-config !>(cof))
::
++ ta-submit
|= {col/time tit/cord wat/wain}
=/ top/topic [tit src.bol wat]
(ta-write /topic [col now-id] %collections-topic !>(top))
::
++ ta-resubmit
|= {col/time wen/@da tit/cord wat/wain}
?: (new-topic col wen) ta-this ::REVIEW error?
=/ top/topic [tit src.bol wat]
(ta-write /topic [col wen] %collections-topic !>(top))
::
++ ta-comment
|= {col/time top/@da com/?(~ @da) wat/wain}
^+ +>
?~ com $(com now-id) :: new comment
=; res/$@(~ _+>.$) ?^(res res +>.$)
%+ biff (ta-get-topic col top)
|= [^ cos=(map @da {@da comment}) ~]
=/ old/{@da comment}
(fall (~(get by cos) com) [now-id src.bol wat])
?. =(who.old src.bol) ..ta-comment ::REVIEW error?
%^ ta-write /comment
[col top com]
[%collections-comment !>(`comment`+.old(wat wat))]
::
++ ta-get-topic
|= {col/time top/@da} ^- (unit topicful)
%+ biff (~(get by cols) col)
|= [^ tos=(map @da topicful) ~]
(~(get by tos) top)
::
++ ta-get-comment
|= {col/time top/@da com/@da} ^- (unit [@da comment])
%+ biff (ta-get-topic col top)
|= [^ cos=(map @da {@da comment}) ~]
(~(get by cos) com)
::
++ ta-delete
|= col/time
^+ +>
=+ (~(get by cols) col)
?~ - ta-this ::REVIEW error?
=. ta-this (ta-remove /config col %collections-config)
=/ cyc (circle-for col)
=. ta-this (ta-hall-action %delete cyc `'Collection deleted')
=/ tops=(list [top=@da topicful]) ~(tap by tops.u)
|- ^+ ta-this
?~ tops ta-this
=. ta-this $(tops t.tops)
(ta-delete-topic-inf 'Collection deleted' col i.tops)
::
++ ta-delete-topic
|= {col/time top/@da} ^+ ta-this
=+ (ta-get-topic col top)
?~ - ta-this ::REVIEW error?
(ta-delete-topic-inf 'Topic deleted' col top u)
::
++ ta-delete-topic-inf ::REVIEW name
|= {inf/@t col/time top/@da tof/topicful}
=. ta-this (ta-remove /topic [col top] %collections-topic)
=/ cyt (circle-for-topic col top)
=. ta-this (ta-hall-action %delete cyt `inf)
=/ coms=(list [com=@da @ comment]) ~(tap by coms.tof)
|- ^+ ta-this
?~ coms ta-this
=. ta-this $(coms t.coms)
(ta-remove /comment [col top com.i.coms] %collections-comment)
::
++ ta-delete-comment
|= {col/time top/@da com/@da} ^+ +>
=+ (ta-get-comment col top com)
?~ - ta-this ::REVIEW error?
(ta-remove /comment [col top com] %collections-comment)
::
:: %writing-files
::
++ ta-full-path
|= $@(col=time [col=time $@(top=@da [top=@da com=@da])])
%+ weld base-path
?- +<
@ (weld (dray /[%da] col) /collections-config)
{@ @} (weld (dray /[%da]/[%da] col top) /collections-topic)
{@ @ @} (weld (dray /[%da]/[%da]/[%da] col top com) /collections-comment)
==
::
++ ta-write
|= [wir=[term ~] loc=?(@ {@ @} {@ @ @}) cay=cage] ^+ +>
=/ pax (ta-full-path loc)
:: if the wire is /config, we make a latest.hoon
%- ta-emil
?: =(wir /config)
=/ latest-pax
%+ weld
%+ scag
%- dec
%- lent
pax
pax
/latest/hoon
:~ :- ost.bol
[%info (weld wir pax) our.bol (foal pax cay)]
:- ost.bol
[%info latest-pax our.bol (foal latest-pax [%hoon !>(latest-post:colls)])]
==
:_ ~
:- ost.bol
[%info (weld wir pax) our.bol (foal pax cay)]
::
++ ta-remove
|= [wir=[term ~] loc=?(@ {@ @} {@ @ @}) mar=mark] ^+ +>
=/ pax (ta-full-path loc)
?> =(mar -:(flop pax))
%+ ta-emit ost.bol
[%info (weld wir pax) our.bol (fray pax)]
::
:: %applying-changes
::
++ ta-update
|= wen=@da
=. upd wen
=/ cos ~(tap by cols)
|- ^+ ta-this
?~ cos ta-this
=. ta-done $(cos t.cos)
=+ `[col=@da collection]`i.cos
=? ta-this (gth mod.conf upd)
(ta-change-config col conf)
=/ tos ~(tap by tops)
|- ^+ ta-this
?~ tos ta-this
=. ta-done $(tos t.tos)
=+ `[top=@da topicful]`i.tos
=? ta-this (gth mod.info upd)
(ta-change-topic col top info)
=/ mos ~(tap by coms)
|- ^+ ta-this
?~ mos ta-this
=. ta-done $(mos t.mos)
=+ `[com=@da cot=[mod=@da comment]]`i.mos
=? ta-this (gth mod.cot upd)
(ta-change-comment col top com cot)
ta-this
::
++ ta-change-config
|= {col/time @da new/config}
^+ +>
::
:: if we don't have it yet, add to hall.
=/ old !(new-config col) ::TODO keep old configs in state
?. old
(ta-hall-create col new)
:: update config in hall.
=/ nam (circle-for col)
%- ta-hall-actions :~
:: ?: =(desc.new desc.u.old) ~
[%depict nam desc.new]
::
:: ?: =(visi.new visi.u.old) ~
[%public visi.new our.bol nam]
::
:: (hall-permit nam & (~(dif in mems.new) mems.u.old))
:: (hall-permit nam | (~(dif in mems.u.old) mems.new))
==
::
++ ta-change-topic
|= {col/time wen/@da @da top/topic}
^+ +>
=/ new (new-topic col wen)
=? +>.$ new
=/ cos (~(got by cols) col)
(ta-hall-create-topic col wen +.conf.cos)
(ta-hall-notify col wen ~ new wat.top)
::
++ ta-change-comment
|= {col/time top/@da wen/@da @da com/comment}
^+ +>
=/ new (new-comment col top wen)
(ta-hall-notify col top `wen new wat.com)
::
:: %hall-changes
::
++ ta-hall-create
|= {col/time cof/config}
^+ +>
=+ nam=(circle-for col)
(ta-hall-configure nam cof)
::
++ ta-hall-create-topic
|= {col/time top/@da cof/config}
^+ +>
=+ nam=(circle-for-topic col top)
=. +>.$ (ta-hall-configure nam cof)
%- ta-hall-action
::NOTE %source also subs to local config & presence, but
:: that generally won't result in visible notifications.
:^ %source (circle-for col) &
(sy `source:hall`[our.bol nam]~ ~)
::
::
++ ta-hall-configure
|= [nam=term cof=config] ^+ +>
^+ +>
%- ta-hall-actions :~
[%create nam desc.cof ?:(publ.cof %journal %village)]
?.(visi.cof ~ [%public & our.bol nam])
[%source %inbox & (sy `source:hall`[our.bol nam]~ ~)]
(hall-permit nam & mems.cof)
==
::
::
++ ta-hall-notify
|= {col/time top/@da com/(unit @da) new/? wat/wain}
^+ +>
%- ta-hall-action
=- :+ %phrase [[our.bol tar] ~ ~]
[%fat [%text wat] [%lin | msg]]~
^- {tar/name:hall msg/cord}
::TODO
::
:: put post id and title in post message
=/ lin %- crip
;: weld
(scow %da top)
"|"
%- trip
=< tit.info
%- need
(ta-get-topic col top)
==
:: this can't be the best way to switch on top v com?
?~ com
[(circle-for col) lin]
[(circle-for-topic col top) lin]
--
::
++ hall-permit
|= [nam=term inv=? sis=(set ship)]
?~ sis ~
[%permit nam inv sis]
::
::
++ circle-for
|=(col/time (pack %collection (dray /[%da] col)))
::
++ circle-for-topic
|=({col/time top/time} (pack %collection (dray /[%da]/[%da] col top)))
::
++ base-path (en-beam:format byk.bol(r da+upd) /collections/web)
::
++ new-config
|= col/time
^- ?
=/ pax :(weld base-path (dray /[%da] col) /collections-config)
::
?=(~ [fil]:.^(arch %cy pax))
::
++ new-topic
|= {col/time top/@da}
^- ?
=/ pax :(weld base-path (dray /[%da]/[%da] col top) /collections-topic)
::
?=(~ [fil]:.^(arch %cy pax))
::
++ new-comment
|= {col/time top/@da com/@da}
^- ?
=/ pax
:(weld base-path (dray /[%da]/[%da]/[%da] col top com) /collections-comment)
::
?=(~ [fil]:.^(arch %cy pax))
--

View File

@ -2354,13 +2354,13 @@
=- (~(so-first-grams so:ta nom.qer ~ -) ran.qer) =- (~(so-first-grams so:ta nom.qer ~ -) ran.qer)
::TODO this can be done more efficiently. ::TODO this can be done more efficiently.
?~ wer.qer u.soy ?~ wer.qer u.soy
%_ u.soy =- u.soy(grams -, count (lent -))
grams ?. (~(has by sourced.u.soy) u.wer.qer) ~
?. (~(has by sourced.u.soy) u.wer.qer) ~ %+ turn
%+ turn (~(got by sourced.u.soy) u.wer.qer) %- flop
|= n/@ud (~(got by sourced.u.soy) u.wer.qer)
(snag n grams.u.soy) |= n/@ud
== (snag n grams.u.soy)
(cury gram-to-envelope nom.qer) (cury gram-to-envelope nom.qer)
:- shape.u.soy :- shape.u.soy
?. (~(has in wat.qer) %config-r) ~ ?. (~(has in wat.qer) %config-r) ~

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)}");
==
==
~
==
==
==
==
==
'''
--

View File

@ -79,8 +79,8 @@
^- (list well:gall) ^- (list well:gall)
=+ myr=(clan:title our) =+ myr=(clan:title our)
?: ?=($pawn myr) ?: ?=($pawn myr)
[[%base %hall] [%base %talk] [%base %dojo] ~] [[%base %collections] [%base %hall] [%base %talk] [%base %dojo] ~]
[[%home %hall] [%home %talk] [%home %dojo] ~] [[%home %collections] [%home %hall] [%home %talk] [%home %dojo] ~]
:: ::
++ deft-fish :: default connects ++ deft-fish :: default connects
|= our/ship |= our/ship

22
lib/nutalk.hoon Normal file
View File

@ -0,0 +1,22 @@
/- urb
|= [dep=@uvH inner=manx] ^- urb
:*
::;head;
:- 0v0 ::XX separate file?
;=
;title: Nutalk
;meta(charset "utf-8");
;meta(name "viewport", content "width=device-width, initial-scale=1, shrink-to-fit=no");
;link(rel "stylesheet", href "/~~/pages/nutalk/css/index.css");
==
::;body;
:- dep :: XX separate file?
;=
;div#root
;+ inner
==
;script@"/~~/pages/nutalk/js/index.js";
==
::
==

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)

69
mar/collections.hoon Normal file
View File

@ -0,0 +1,69 @@
:: /mar/collections/config/hoon
::
/- *collections
|_ cos=collections
::
::
:: ++ get-bump
:: |= col=collection ^- @da
:: =/ wen mod.conf.col
:: %- ~(rep by tops.col)
:: =< .(wen ^wen)
:: |= [[@da top=topicful] wen=@da]
:: %+ max mod.info.top
:: %- ~(rep by coms.top)
:: =< .(wen ^wen)
:: |= [[@da mod=@da ^] wen=@da]
:: (max mod wen)
::
++ grow
|%
++ elem :: web display
;div
;h1: Collections:
;ul
;* %+ turn (sort ~(tap by cos) dor)
|= [top=@da col=collection]
;li
;a/"{<top>}/":"{(trip desc.conf.col)}"
:: ;span: (updated {<(get-bump col)>})
==
==
;h2: Post new:
;script@"/lib/js/easy-form.js";
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "create");
::
;input(name "desc", placeholder "Description");
;br;
;select(name "kind"):(option:"blog" option:"fora" option:"note")
;input(name "visi", type "checkbox", checked ""): Visible
;input(name "publ", type "checkbox"): Public
;br;
;input(name "mems", placeholder "Exception list");
;br;
;input(type "submit");
==
==
++ json
=, enjs:format
%- pairs
%+ turn
~(tap by cos)
|= [a=@da b=collection]
:- (scot %da a)
%- pairs
:~
:- %description
[%s desc.conf.b]
:- %modified
[%s (scot %da mod.conf.b)]
==
--
::
++ grab
|%
++ noun collections
--
--

View File

@ -0,0 +1,70 @@
:: /action/collections/mar
::
/- collections
=, api:collections
|_ act=action
::
++ grow
|%
++ tank >act<
--
::
++ grab
|%
++ noun action
++ json
=, dejs:format
:: %+ cu |=(action +<)
=< action
|%
++ action
%- of :~
create+create
delete+(ot col+(se %da) ~)
submit+(ot col+(se %da) tit+so wat+wain ~)
comment+(ot col+(se %da) top+(se %da) com+null-or-da wat+wain ~)
resubmit+(ot col+(se %da) top+(se %da) tit+so wat+wain ~)
delete-topic+(ot col+(se %da) top+(se %da) ~)
delete-comment+(ot col+(se %da) top+(se %da) com+(se %da) ~)
==
::
++ null-or-da
%+ cu |=(a=dime ?+(a !! [%n ~] ~, [%da @da] q.a))
%+ cu |=(a=coin ?+(a !! [%$ ^] p.a))
(su nuck:so.hoon)
::
++ create
:: (ot wat+(cu (hard kind) so) des+so pub+bo vis+bo ses+(as (se %p)) ~)
|= a=json
~| a
::=+ ^- [wat=kind des=cord pub=? vis=? ses=(set @p)]
=+ ^- [desc=cord publ=? visi=? comm=? xeno=? ses=(set @p)]
%. a
:: change this to accept an array of @p
%- ot
:::~ wat+(cu (hard kind) so)
:~ desc+so
publ+bo
visi+bo
comm+bo
xeno+bo
ses+(su (cook sy (more ace fed:ag)))
==
[desc publ visi comm xeno ses]
::
++ wain (su (more newline (cook crip (star prn))))
:: ++ newline (just '\0a')
::XX getting sent \r by frontend
++ newline ;~(pfix (punt (just '\0d')) (just '\0a'))
::
::
++ as |*(a=fist (cu sy (ar a))) :: array as set
++ se :: string as aura
=, wired
|* a=term
%+ cu
|= b=cord ^- (odo:raid a)
(slav a b)
so
-- --
--

View File

@ -0,0 +1,76 @@
:: /mar/collections/config/hoon
::
/- *collections
|_ col=collection
::
++ grow
|%
++ elem :: web display
;div
;h1: {(trip desc.conf.col)}
;p: updated {<mod.conf.col>}
::TODO public, visible
::
;* ?~ tops.col ~
;= ;h2: Topics:
==
;ul
;* %+ turn (sort ~(tap by tops.col) dor)
|= [top=@da topicful]
;li
;a/"{<top>}/": {(trip tit.info)} ({<~(wyt by coms)>} comments)
==
==
::
;hr;
::
;h2: Post topic:
;script@"/lib/js/easy-form.js";
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "submit");
;input(type "hidden", name "easy_form:url_end", value "collections/:col");
::
;input(name "tit", placeholder "Title");
;br; ;textarea(name "wat", placeholder "Enter topic text");
;br; ;input(type "submit");
==
::
;hr;
::
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "delete");
;input(type "hidden", name "easy_form:url_end", value "collections/:col");
;input(type "hidden", name "easy_form:confirm");
::
;input.red(type "submit", value "Archive this collection");
==
==
++ json
=, enjs:format
%- pairs
:~ :- %config
%- pairs
:~ description+[%s desc.conf.col]
visible+[%b visi.conf.col]
==
:- %topics
:- %a
%+ turn
~(tap by tops.col)
|= [e=@da f=topicful]
%- pairs
:~ title+[%s tit.info.f]
who+[%s (scot %p who.info.f)]
id+[%s (scot %da e)]
modified+[%s (scot %da mod.info.f)]
==
==
--
::
++ grab
|%
++ noun collection
--
--

View File

@ -0,0 +1,28 @@
:: /mar/collections/comment/hoon
::
/- *collections
|_ com=comment
++ grow
|%
++ mime
:- /text/x-collections-comment
%- as-octs:mimes:html
(of-wain:format txt)
++ txt
^- (list @t)
:- (scot %p who.com)
wat.com
--
::
++ grab
|%
++ mime
|= {p/mite:eyre q/octs:eyre}
(txt (to-wain:format q.q))
++ txt
|= txs/(pole @t) ^+ com
?> ?=([who=@t wat=*] txs)
[(slav %p who.txs) wat.txs]
--
++ grad %txt
--

View File

@ -0,0 +1,73 @@
:: /mar/collections/config/hoon
::
/- *collections
|_ con=config
::
::
++ grow
|%
++ mime
:- /text/x-collections-config
%- as-octs:mimes:html
(of-wain:format txt)
++ txt
^- (list @t)
:* (cat 3 '> ' desc.con)
(cat 3 'public: ' ?:(publ.con 'y' 'n'))
(cat 3 'visible: ' ?:(visi.con 'y' 'n'))
(cat 3 'comments: ' ?:(comm.con 'y' 'n'))
(cat 3 'xenopost: ' ?:(xeno.con 'y' 'n'))
:- 'except:'
%+ turn (sort ~(tap in mems.con) aor)
|= a=@p
(cat 3 ' ' (scot %p a))
==
++ elem :: web display
;div
::;pre: {(trip (of-wain:format txt))}
;h1: {(trip desc.con)}
::;div
:: {(trip desc.con)}
::==
;list; :: show topics
==
++ json
=, enjs:format
%- pairs
:~ description+[%s desc.con]
public+[%b publ.con]
visible+[%b visi.con]
comments+[%b comm.con]
xenopost+[%b xeno.con]
:- %except
:- %a
%+ turn
~(tap in mems.con)
|= a/@p
[%s (scot %p a)]
==
++ front (my title+desc.con ~) :: title in lists
--
::
++ grab
|%
++ noun config :: validate over ames
++ mime
|= {p/mite:eyre q/octs:eyre}
(txt (to-wain:format q.q))
++ txt
|= txs/(pole @t)
~& %reading-config
?> ?=([desc=@t publ=@t visi=@t comm=@t xeno=@t %'except:' mem=*] txs)
:* (rash desc.txs ;~(pfix (jest '> ') (cook crip (star next))))
(rash publ.txs ;~(pfix (jest 'public: ') (flag %y %n)))
(rash visi.txs ;~(pfix (jest 'visible: ') (flag %y %n)))
(rash comm.txs ;~(pfix (jest 'comments: ') (flag %y %n)))
(rash xeno.txs ;~(pfix (jest 'xenopost: ') (flag %y %n)))
%- sy
%+ turn (skip mem.txs |=(a=@t =(a ''))) :: skip trailing blank
(curr rash ;~(pfix (jest ' ~') fed:ag))
==
--
++ grad %txt
--

21
mar/collections/edit.hoon Normal file
View File

@ -0,0 +1,21 @@
::
:::: /hoon/edit/collections/mar
::
/? 310
::
:::: compute
::
=, mimes:html
=, html
|_ man/manx
::
++ grow :: convert to
|%
::++ mime [/text/json (as-octt (en-json jon))] :: convert to %mime
++ elem man
--
++ grab
|% :: convert from
++ noun manx :: clam from %noun
--
--

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

@ -0,0 +1,20 @@
::
:::: /hoon/json/collections/mar
::
/? 310
::
:::: compute
::
=, mimes:html
=, html
|_ jon/json
::
++ grow :: convert to
|%
++ mime [/text/json (as-octt (en-json jon))] :: convert to %mime
--
++ grab
|% :: convert from
++ noun json :: clam from %noun
--
--

70
mar/collections/snip.hoon Normal file
View File

@ -0,0 +1,70 @@
::
:::: /hoon/snip/mar
::
/? 310
=, html
::
|%
++ 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]]
--
::
::
=, mimes:html
|_ {hed/marl tal/marl}
::
++ grow :: convert to
|%
++ 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 hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
--
++ grab |% :: convert from
++ noun {marl marl} :: clam from $noun
:: this will bork stuff with no title?
++ elem
|= a/manx
=/ ht (hedtal +.a)
:: if there is no title, just produce the first 5 manx
?~ hed.ht [~ (scag 5 c.a)]
ht
-- --

View File

@ -0,0 +1,134 @@
:: /mar/collections/topic-full/hoon
::
/- *collections
/+ time-to-id
::TODO factor out as lib/easy-form?
|%
++ form-edit
|= [tit=cord who=@p wat=tape]
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "resubmit");
;input(type "hidden", name "easy_form:url_end", value "collections/:col/:top");
::
;input(name "tit", value (trip tit));
;br; ;b: {<who>}
;br; ;textarea(name "wat"): {wat}
;br; ;input(type "submit");
==
++ form-archive
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "delete-topic");
;input(type "hidden", name "easy_form:url_end", value "collections/:col/:top");
;input(type "hidden", name "easy_form:confirm");
::
;input.red(type "submit", value "Archive this topic");
==
++ form-comment-edit
|= [com=@da txt=tape]
;form.edit-on(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "comment");
;input(type "hidden", name "easy_form:url_end", value "collections/:col/:top");
::
;input(type "hidden", name "com", value <com>);
::
;br; ;textarea(name "wat"): {txt}
;br; ;input(type "submit");
==
++ form-comment-x
|= com=@da
;form.inline(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "delete-comment");
;input(type "hidden", name "easy_form:url_end", value "collections/:col/:top");
;input(type "hidden", name "easy_form:confirm");
::
;input(type "hidden", name "com", value <com>);
;input.red(type "submit", value "X");
==
++ form-comment-post
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "comment");
;input(type "hidden", name "easy_form:url_end", value "collections/:col/:top");
::
;input(type "hidden", name "com", value "~");
::
;br; ;textarea(name "wat", placeholder "Enter comment");
;br; ;input(type "submit");
==
--
::
::::
::
|_ top=topicful
::
::
++ grow
|%
++ elem :: web display
=* info info.top
=/ wat-info (of-wall:format (turn wat.info trip))
::
;div
;input.edit-toggle(type "checkbox", id "edit-post");
;label(for "edit-post"): ✎
;div.edit-on: +{(form-edit tit.info who.info wat-info)}
;h1.edit-off: {(trip tit.info)}
;b.edit-off: {<who.info>}
;pre.edit-off: {wat-info}
::
;hr;
::
;script@"/lib/js/easy-form.js";
;+ form-archive
::
;hr;
::
;* ?: =(~ coms.top) ~
:- ;h2: Comments
%+ turn (sort ~(tap by coms.top) dor)
|= [wen=@da mod=@da com=comment]
=/ id (time-to-id wen)
=/ txt (of-wall:format (turn wat.com trip))
;div(id id)
;input.edit-toggle(type "checkbox", id "edit-{id}");
;label(for "edit-{id}"): ✎
;div.edit-on: +{(form-comment-edit wen txt)}
;pre.edit-off: {txt}
::
; ;{b -<who.com>}, at ;{a/"#{id}" -<wen>}
::
;+ (form-comment-x wen)
;hr;
==
;h2: Post comment:
;+ form-comment-post
==
++ json
=, enjs:format
%- pairs
:~ title+[%s tit.info.top]
who+[%s (scot %p who.info.top)]
what+[%s (of-wain:format wat.info.top)]
:- %comments
:- %a
%+ turn
~(tap by coms.top)
|= [a=@da b=[c=@da d=comment]]
%- pairs
:~ who+[%s (scot %p who.d.b)]
what+[%s (of-wain:format wat.d.b)]
id+[%s (scot %da a)]
modified+[%s (scot %da c.b)]
==
==
--
::
++ grab
|%
++ noun topicful
--
--

View File

@ -0,0 +1,55 @@
:: /mar/collections/topic/hoon
::
/- *collections
|%
++ titled
|= a/wain
^- wain
?: =((scag 2 (trip -.a)) "# ")
+.a
a
--
|_ top=topic
::
++ grow
|%
++ mime
:- /text/x-collections-comment
%- as-octs:mimes:html
(of-wain:format txt)
++ txt
^- (list @t)
:+ (cat 3 '> ' tit.top)
(scot %p who.top)
wat.top
::
++ md (of-wain:format (titled wat.top))
++ elem :: web display
;div
;pre: {(trip (of-wain:format (titled txt)))}
;hr;
;kids; :: show comments
==
++ front (my title+tit.top ~) :: title in lists
++ json
=, enjs:format
%- pairs
:~ title+[%s tit.top]
who+[%s (scot %p who.top)]
what+[%s (of-wain:format wat.top)]
==
--
::
++ grab
|%
++ mime
|= {p/mite:eyre q/octs:eyre}
(txt (to-wain:format q.q))
++ txt
|= txs/(pole @t) ^+ top
?> ?=([des=@t who=@t wat=*] txs)
=/ tit (rash des.txs ;~(pfix (jest '> ') (cook crip (star next))))
[tit (slav %p who.txs) wat.txs]
--
++ grad %txt
--

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
--

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
-- --

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

@ -0,0 +1,45 @@
::REVIEW duplicate of mar/urb, probably want to just get rid of that one
::
:::: /hoon/x-urb/mar
::
/? 310
/= urb-wasp-data-js /: /%%/urb/wasp-data /js/
=, format
=, mimes:html
=, html
::
|_ {{dep/@uvH hed/marl} {dep-bod/@uvH bod/marl}}
++ grow :: convert to
|%
++ mime [/text/html (as-octs html)] :: convert to %mime
++ 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))})
; }
==
==
==
==
--
++ grab
|% :: convert from
++ noun {@uvH manx} :: clam from %noun
--
--

BIN
ren/.urb.hoon.swo Executable file

Binary file not shown.

BIN
ren/.urb.hoon.swp Executable file

Binary file not shown.

6
ren/collections.hoon Normal file
View File

@ -0,0 +1,6 @@
/- collections
/+ rekey
/^ collections
/; (rekey %da)
/_ /collections-collection/
-.-

View File

@ -0,0 +1,10 @@
/- collections
/+ rekey
/^ collection:collections
/. /@ /collections-config/
/= tops
/; (rekey %da)
/^ (map knot topicful:collections)
/_ /collections-topic-full/
==
-.-

View File

@ -0,0 +1,5 @@
/= gas /$ fuel:html
/= content /% /collections-topic-full/
^- manx
;div#edit(urb-component "TopicCreatePage", urb-coll "{(trip +<:s.bem.gas)}", urb-top "{(trip -:s.bem.gas)}", urb-text "{(trip (of-wain:format wat.info.content))}");

106
ren/collections/index.hoon Normal file
View File

@ -0,0 +1,106 @@
/- collections
/+ rekey, old-zuse, colls
/= gas /$ fuel:html
/= config /collections-config/
/= tops /^ (map knot topicshow:collections)
/_ /. /collections-topic-full/
/= sni /& collections-snip
/& elem
/& md
:: this needs to be put into a mar
/; |= a/topic:collections
(of-wain:format wat.a)
/collections-topic/
==
^- manx
=, old-zuse
;div.container
;input(type "hidden", name "urb-header", value "collection-index", title "{(trip desc.config)}", id "{(trip -.s.bem.gas)}", ship "{(scow %p p.bem.gas)}");
;div.row
;div.col-sm-10.col-sm-offset-2
;div.collection-index.mt-12
:: ;* ?: (authed:colls gas)
:: ;=
:: ;div.row
:: ;a(href "/~~/pages/nutalk/collection/post?coll={(trip -.s.bem.gas)}")
:: ;button.btn.btn-secondary
:: ; Write →
:: ==
:: ==
:: ;a.ml-4.mt-2.text-600(href "")
:: ; Settings →
:: ==
:: ==
:: ==
:: ;=
:: ;div(urb-component "Subscribe", urb-circle "{(scow %p p.bem.gas)}/collection_~{(trip -:s.bem.gas)}");
:: ==
;ul
;* %+ turn
%+ sort
~(tap by tops)
|= [a=(pair knot topicshow:collections) b=(pair knot topicshow:collections)]
(dor:colls p.a p.b)
|= [t=knot topi=topicshow:collections]
;* ?: comm.config
;* ?: xeno.config
;li.collection-post.mt-6
;div.collection-date
; {(trip t)}
==
;h3
;a(href "{(trip -.s.bem.gas)}/{(trip t)}"): {(trip tit.info.top.topi)}
==
;div.who.text-mono.text-600
; {(trip (scot %p who.info.top.topi))}
==
;div.meta-cont
;div.da.text-mono(urb-component "Elapsed", urb-timestring "{(esoo:colls mod.info.top.topi)}");
;div.com-count.ml-12
; {(trip (scot %ud (lent ~(tap by coms.top.topi))))} comments
==
==
==
;li.collection-post.mt-6
;div.collection-date
; {(trip t)}
==
;h3
;a(href "{(trip -.s.bem.gas)}/{(trip t)}")
;span: *{hed.snip.topi}
==
==
;* ?~ hed.snip.topi
;=
;div.snippet
;a(href "{(trip -.s.bem.gas)}/{(trip t)}")
*{tal.snip.topi}
==
==
==
;=
;div.snippet
*{tal.snip.topi}
==
==
==
;li.notes.mb-8
;div.da.text-mono(urb-component "Elapsed", urb-timestring "{(esoo:colls mod.info.top.topi)}");
;div.h3.mt-0.text-mono.note-uuid
;a(href "{(trip -.s.bem.gas)}/{(trip t)}"): {(trip t)}
==
;div.snippet
;div.h3
; *{hed.snip.topi}
==
;div
; *{tal.snip.topi}
==
==
==
==
==
==
==
==

View File

@ -0,0 +1,7 @@
/= jon /| /&json&/collections-topic-full/
/&json&/collections-collection/
/&json&/collections/
==
^- json
jon

79
ren/collections/post.hoon Normal file
View File

@ -0,0 +1,79 @@
/- collections
/+ old-zuse, colls
/= gas /$ fuel:html
:: reach up and get config file?
/= configs /: /===/web/collections
/^ (map knot config:collections) /_ /collections-config/
:: this was a dumb way to do do this, clean up
/= content /&elem&md&/collections-topic/
/= metawcom /^ topicful:collections /collections-topic-full/
=/ config (~(get by configs) +<:s.bem.gas)
=, 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.metawcom)}");
;span: {(trip -:s.bem.gas)}
==
::
;div#show
;div.row.tit.mt-6.collection-title
;h3: {(trip tit.info.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: +{content}
==
;* ?: comm:(need config)
;=
;div
;div.mb-2
;span(urb-component "IconComment");
;span: {<~(wyt by coms.metawcom)>}
==
;ul
;* %+ turn
%+ sort
~(tap by coms.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)}");
==
==
~
==
==
==
==
==

View File

@ -0,0 +1,9 @@
/- collections
/+ rekey
/^ topicful:collections
/. /@ /collections-topic/
/= comt
/; (rekey %da)
/_ /@ /collections-comment/
==
-.-

14
ren/htm.hoon Normal file
View File

@ -0,0 +1,14 @@
:: For testing purposes
::
:::: /hoon/run/ren
::
/? 310
:: put try logic here /|(/collection-config/ /post/ /topic/ etc.)
/% /| /!hymn/
/collections-index/
/collections-post/
/hymn/
::
==
^- manx
-.-

View File

@ -2,11 +2,11 @@
:::: /hoon/comments/tree/ren :::: /hoon/comments/tree/ren
:: ::
/? 310 /? 310
/+ rekey
::
/: /%/comments /: /%/comments
/; |= a/(map knot {ship marl}) /; |= a/(map knot {ship marl})
=- (sort - dor) (sort ~(tap by ((rekey %da) a)) dor)
%+ turn ~(tap by a)
|=({b/knot c/{ship marl}} [(slav %da b) c])
/_ /_
/; |= a/manx ^- {ship marl} /; |= a/manx ^- {ship marl}
~| a ~| a

View File

@ -1,11 +1,21 @@
::
:::: /hoon/urb/ren :::: /hoon/urb/ren
:: ::
/? 310 /? 310
/+ urb-split :: for single-page apps /- urb
/+ urb-split, :: for single-page apps
nutalk ::FIXME write ren/urb/nutalk
/% /^ {hed/{@uvH marl} bod/{@uvH marl}} /% /^ {hed/{@uvH marl} bod/{@uvH marl}}
/, /web/pages /, /web/pages/nutalk
/; nutalk /# /!htm/
::
/web/pages
/; urb-split /# /!hymn/ /; urb-split /# /!hymn/
::
/web/collections
:: put collections through the same .htm
:: routing structure as nutalk
/; nutalk /# /htm/ ::a lot of stuff in here isn't .hoon files
::
/ /
/urb-tree/ /urb-tree/
== ==

14
ren/urb/collections.hoon Normal file
View File

@ -0,0 +1,14 @@
:: Combine /tree-head/ and /tree-body/
::
:::: /hoon/tree/urb/ren
::
/? 310
/= bod /# /& elem
/|(/collections-topic-full/ /collections-collection/ /collections/)
^- {hed/{@uvH marl} bod/{@uvH marl}}
::
:- :- -.bod ::REVIEW is head static?
;= ;title:"Collections"
;link/"/===/web/lib/css/collections.css"(rel "stylesheet");
==
[-.bod +.bod ~]

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

@ -0,0 +1 @@
/% /htm/ -.-

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

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

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

@ -0,0 +1,17 @@
::
:::: /hoon/elem/urb/ren
::
/? 310
/- urb
/+ urb-split, :: for single-page apps
nutalk ::FIXME write ren/urb/nutalk
/% /^ {@uvH inr/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
/ /# /tree-elem/
==
:: `manx`-.-
`manx`inr ::XX dropping dep

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

@ -0,0 +1,42 @@
:: Add tree chrome
::
:::: /hoon/wrap/urb/ren
::
/? 310
/- urb
/+ urb-split, :: for single-page apps
nutalk ::FIXME write ren/urb/nutalk
/% /^ $-(inr/{@uvH manx} {hed/{@uvH marl} bod/{@uvH marl}})
/~ :: XX don't have path information
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 !!)
:: ==
-.-
:: /= hed /# /% /tree-head/
:: /= bod /# /% /tree-body/
:: ^- {hed/{@uvH marl} bod/{@uvH marl}}
:: [hed bod]
:: |= [dep-bod=@uvH bod=manx]
:: ^- {hed/{@uvH marl} bod/{@uvH marl}}
:: :* :: head
:: :- 0v0
:: [;(title:"Wrapped!")] ::REVIEW ugly
:: :: body
:: :- dep-bod
:: ;=
:: ;h1: Wrapping
:: ;hr;
:: ;+ bod
:: ==
:: ==

60
sur/collections.hoon Normal file
View File

@ -0,0 +1,60 @@
=< |=(a=* %.(a (map time collection))) :: collections by name
|% ::
++ collection ::
$: conf/{mod/@da config} :: configuration
tops/(map @da topicful) ::
$~ :: /. compatibility
== ::
++ topicful ::
$: info/{mod/@da topic} ::
coms/(map @da {mod/@da comment}) ::
$~ :: /. compatibility
== ::
:: ::
++ topicshow
$: top/topicful
snip/{hed/marl tal/marl}
$~
==
++ config ::
$: desc/cord :: description
publ/? :: public or private
visi/? :: visible or hidden
comm/? :: comments
xeno/? :: foreign posters?
mems/(set ship) :: ships on list
== ::
++ topic ::
$: tit/cord :: title
who/ship :: author
wat/wain :: content
== ::
++ comment ::
$: who/ship :: author
wat/wain :: content
== ::
::
++ api
|%
++ kind ?($blog $fora $note) ::
++ action ::
$% $: $create :: create a collection
::wat/kind :: collection kind
desc/cord :: name
publ/? :: public or private
visi/? :: visible or hidden
comm/? :: others can comment
xeno/? :: others can post
ses/(set ship) :: black/whitelist
== ::
{$submit col/time tit/cord wat/wain} :: submit a post/note
{$resubmit col/time top/@da tit/cord wat/wain} :: edit a post/note
{$comment col/time top/@da com/?(~ @da) wat/wain} :: submit a comment
{$delete col/time} :: delete a collection
::
::REVIEW names? nest collection/topic/comment actions?
{$delete-topic col/time top/@da} :: delete a collection
{$delete-comment col/time top/@da com/@da} :: delete a collection
== ::
--
--

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

@ -1,3 +1,4 @@
!:
:: clay (4c), revision control :: clay (4c), revision control
:: ::
:: This is split in three top-level sections: structure definitions, main :: This is split in three top-level sections: structure definitions, main
@ -44,10 +45,9 @@
:: Type of request. :: Type of request.
:: ::
:: %d produces a set of desks, %p gets file permissions, %u checks for :: %d produces a set of desks, %p gets file permissions, %u checks for
:: existence, %v produces a ++dome of all desk data, %w with a time or label :: existence, %v produces a ++dome of all desk data, %w gets a revision
:: case gets the aeon at that case, %w with a number case is not recommended, :: number/date, %x gets file contents, %y gets a directory listing, and %z gets
:: %x gets file contents, %y gets a directory listing, and %z gets a recursive :: a recursive hash of the file contents and children.
:: hash of the file contents and children.
:: ::
:: ++ care ?($d $p $u $v $w $x $y $z) :: ++ care ?($d $p $u $v $w $x $y $z)
:: ::
@ -2356,41 +2356,6 @@
$delta (~(put in $(lob q.q.gar)) lob) $delta (~(put in $(lob q.q.gar)) lob)
== ==
:: ::
:: Should be refactored, is only called form `++read`, and even then it
:: can't be called with `$v` as the care, so it's really just a crash.
::
:: To be clear the refactoring should start at ++read-at-aeon and probably
:: eliminate ++read and ++query
::
++ query :: query:ze
|= ren/$?($p $u $v $x $y $z) :: endpoint query
^- (unit cage)
?- ren
$p !!
$u !! :: [~ %null [%atom %n] ~]
$v [~ %dome !>(dom)]
$x !! :: ?~(q.ank.dom ~ [~ q.u.q.ank.dom])
$y !! :: [~ %arch !>(as-arch)]
$z !! :: [~ %ankh !>(ank.dom)]
==
::
:: See ++query.
::
++ read :: read:ze
|= mun/mood :: read at point
^- (unit cage)
?: ?=($d p.mun)
~& %dead-d ~
?: ?=($v p.mun)
[~ %dome !>(dom)] :: dead code
?: &(?=($w p.mun) !?=($ud -.q.mun))
?^(r.mun ~ [~ %aeon !>(let.dom)]) :: dead code
?: ?=($w p.mun)
=+ ^= yak
%- aeon-to-yaki
let.dom
?^(r.mun ~ !!) :: [~ %w !>([t.yak (forge-nori yak)])])-all
(query(ank.dom ank:(descend-path:(zu ank.dom) r.mun)) p.mun) :: dead code
:: ::
:: Gets the permissions that apply to a particular node. :: Gets the permissions that apply to a particular node.
:: ::
@ -2399,7 +2364,7 @@
:: we default to fully private (empty whitelist). :: we default to fully private (empty whitelist).
:: ::
++ read-p ++ read-p
|= pax/path |= {aeon pax/path}
^- (unit (unit (each cage lobe))) ^- (unit (unit (each cage lobe)))
=- [~ ~ %& %noun !>(-)] =- [~ ~ %& %noun !>(-)]
:- (read-p-in pax per.red) :- (read-p-in pax per.red)
@ -2483,6 +2448,17 @@
~ ~
``[%dome -:!>(*dome) dom] ``[%dome -:!>(*dome) dom]
:: ::
:: Gets the modification date of a node
::
++ read-w
|= {yon/aeon pax/path}
^- (unit (unit {$time (hypo time)}))
?^ pax ~ ::TODO functionality other than %ud -> %da
?: =(0 yon) [~ ~]
%+ bind (~(get by hit.dom) yon)
|= tak=tako
[~ %time -:!>(*time) `time`t:(tako-to-yaki tak)]
::
:: Gets the data at a node. :: Gets the data at a node.
:: ::
:: If it's in our ankh (current state cache), we can just produce the :: If it's in our ankh (current state cache), we can just produce the
@ -2601,43 +2577,26 @@
^- (unit (unit (each cage lobe))) ^- (unit (unit (each cage lobe)))
?. |(?=($~ for) (may-read u.for p.mun yon r.mun)) ?. |(?=($~ for) (may-read u.for p.mun yon r.mun))
~ ~
?: &(?=($w p.mun) !?=($ud -.q.mun)) :: NB only her speed ?- p.mun
?^(r.mun [~ ~] [~ ~ %& %aeon !>(yon)]) $w
?: ?=($d p.mun) ?. ?=($ud -.q.mun) ?^(r.mun ~ [~ ~ %& %aeon !>(yon)])
(bind (read-w yon r.mun) (lift |=(a/cage [%& a])))
::
$d
=+ rom=(~(get by fat.ruf) her) =+ rom=(~(get by fat.ruf) her)
?~ rom ?~ rom
~&(%null-rom-cd [~ ~]) ~&(%null-rom-cd [~ ~])
?^ r.mun ?^ r.mun
~&(%no-cd-path [~ ~]) ~&(%no-cd-path [~ ~])
[~ ~ %& %noun !>(~(key by dos.u.rom))] [~ ~ %& %noun !>(~(key by dos.u.rom))]
?: ?=($p p.mun) ::
(read-p r.mun) $p (read-p yon r.mun)
?: ?=($u p.mun) $u (read-u yon r.mun)
(read-u yon r.mun) $v (bind (read-v yon r.mun) (lift |=(a/cage [%& a])))
?: ?=($v p.mun) $x (read-x yon r.mun)
(bind (read-v yon r.mun) (lift |=(a/cage [%& a]))) $y (bind (read-y yon r.mun) (lift |=(a/cage [%& a])))
?: ?=($x p.mun) $z (bind (read-z yon r.mun) (lift |=(a/cage [%& a])))
(read-x yon r.mun) ==
?: ?=($y p.mun)
:: =- ~& :* %dude-someones-getting-curious
:: mun=mun
:: yon=yon
:: our=our
:: her=her
:: syd=syd
:: hep=-
:: ==
:: -
(bind (read-y yon r.mun) (lift |=(a/cage [%& a])))
?: ?=($z p.mun)
(bind (read-z yon r.mun) (lift |=(a/cage [%& a])))
%+ bind
(rewind yon)
|= a/(unit _+>.$)
^- (unit (each cage lobe))
?~ a
~
`(unit (each cage lobe))`(bind (read:u.a mun) |=(a/cage [%& a]))
:: ::
:: Stubbed out, should be removed in the refactoring mentioned in ++query. :: Stubbed out, should be removed in the refactoring mentioned in ++query.
:: ::

View File

@ -149,7 +149,8 @@
{$poll p/{i/@uvH t/(list @uvH)}} {$poll p/{i/@uvH t/(list @uvH)}}
{$spur p/spur} {$spur p/spur}
{$subs p/?($put $delt) q/{dock $json wire path}} {$subs p/?($put $delt) q/{dock $json wire path}}
{$view p/ixor q/{$~ u/@ud}} ::{$view p/ixor q/{$~ u/@ud}}
{$view p/ixor q/{$~ u/@ud} r/(unit @dr)}
== ==
:: ::
++ perk-auth :: parsed auth ++ perk-auth :: parsed auth
@ -762,6 +763,37 @@
(ames-gram q.p.kyz aut+~ p.u.mez) (ames-gram q.p.kyz aut+~ p.u.mez)
=. sop (~(put by sop) p.u.mez q.p.kyz |) =. sop (~(put by sop) p.u.mez q.p.kyz |)
(ames-gram q.p.kyz hat+~ p.u.mez our-host) (ames-gram q.p.kyz hat+~ p.u.mez our-host)
::
$get-inner
%^ exec-live ay+(dray p+uv+~ q.p.kyz p.u.mez) -.q.u.mez
::
=/ ext r.u.mez
=/ fig/coin (fcgi ~ *cred) ::STUB fcgi params for /$
[%bake ext fig q.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
%^ exec-live ha+(en-beam bek ~) (norm-beak bek)
:+ %cast ext
:+ %call [%core (norm-beak bek) /wrap/[ext]/ren]
[[%$ deps+!>(dep)] [%vale res]]
==
== ==
:: ::
$wegh !! :: handled elsewhere $wegh !! :: handled elsewhere
@ -844,10 +876,18 @@
=| ses/(unit hole) =| ses/(unit hole)
|- ^+ ..axon |- ^+ ..axon
?- tee ?- tee
$@($~ {?($on $ay $ow) *}) ~|(e+ford+lost+tee !!) $@($~ {?($on $ow) *}) ~|(e+ford+lost+tee !!)
{$of @ $~} ~|(e+ford+lost+tee !!) {$of @ $~} ~|(e+ford+lost+tee !!)
{$si $~} (give-sigh q.sih) {$si $~} (give-sigh q.sih)
{$se ^} (get-made:(dom-vi q.tee) p.tee [p q]:sih) {$se ^} (get-made:(dom-vi q.tee) p.tee [p q]:sih)
{$ay ^}
=/ res/(each (cask) tang)
?- -.q.sih
%| [%| p.q.sih]
%& [%& [p q.q]:p.q.sih] :: strip type
==
(ames-gram (slav %p p.tee) got-inner+~ (slav %uv q.tee) res)
::
{$hi ^} {$hi ^}
?: ?=($| -.q.sih) ?: ?=($| -.q.sih)
(give-sigh q.sih) :: XX crash? (give-sigh q.sih) :: XX crash?
@ -1060,6 +1100,7 @@
++ teba |*(a/$-(* _..handle) |*(b/* %_(done ..handle (a b)))) ++ teba |*(a/$-(* _..handle) |*(b/* %_(done ..handle (a b))))
++ del-deps (teba ^del-deps) ++ del-deps (teba ^del-deps)
++ new-deps (teba ^new-deps) ++ new-deps (teba ^new-deps)
++ ames-gram (teba ^ames-gram)
++ exec-live (teba ^exec-live) ++ exec-live (teba ^exec-live)
++ give-html (teba ^give-html) ++ give-html (teba ^give-html)
++ give-thou (teba ^give-thou) ++ give-thou (teba ^give-thou)
@ -1243,9 +1284,15 @@
(turn dep |=({a/@tas $~} (slav %uv a))) (turn dep |=({a/@tas $~} (slav %uv a)))
:: ::
$of $of
:+ %view ?>(?=({@ $~} but) i.but) :^ %view
?> ?=({{$poll @} $~} quy) :: XX eventsource ?> ?=({@ $~} but)
i.but
?> ?=({{$poll @} *} quy) :: XX eventsource
[~ (rash q.i.quy dem)] [~ (rash q.i.quy dem)]
?: ?=({{$t @} $~} +.quy)
=/ s (rash q.i.t.quy dem)
`(yule [0 0 0 s ~])
~
:: ::
$to $to
=+ ^- dir/{p/ship q/term r/mark} =+ ^- dir/{p/ship q/term r/mark}
@ -1332,10 +1379,17 @@
$away [%& %html logout-page:xml] $away [%& %html logout-page:xml]
?($beam $spur) ?($beam $spur)
=^ payload mef process-payload =^ 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)]) =+ bem=?-(-.hem $beam p.hem, $spur [-.top (weld p.hem s.top)])
~| bad-beam+q.bem ~| bad-beam+q.bem
?< =([~ 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)
[%| (ames-gram p.bem [%get-inner ~] han bem ext)]
=+ wir=`whir`[%ha (en-beam -.bem ~)] =+ wir=`whir`[%ha (en-beam -.bem ~)]
=. wir ?+(mef !! $get wir, $head [%he wir]) =. wir ?+(mef !! $get wir, $head [%he wir])
=. r.bem ?+(r.bem r.bem {$ud $0} da+now) =. r.bem ?+(r.bem r.bem {$ud $0} da+now)
@ -1387,7 +1441,7 @@
:: ::
$view $view
~| lost-ixor+p.hem ~| lost-ixor+p.hem
[%| ((teba poll:(ire-ix p.hem)) u.q.hem)] [%| ((teba poll:(ire-ix p.hem)) u.q.hem r.hem)]
== ==
:: ::
++ process-auth ++ process-auth
@ -1741,12 +1795,15 @@
:: ::
++ pop-duct =^(ned med ~(get to med) abet(hen ned)) ++ pop-duct =^(ned med ~(get to med) abet(hen ned))
++ poll ++ poll
|= a/@u ^+ ..ix |= [a/@u t=(unit @dr)]
^+ ..ix
=< abet =< abet
=. ..poll refresh =. ..poll refresh
?: =(a p.eve) ?: =(a p.eve)
=. ..poll poll-rest =. ..poll poll-rest
=. era (add ~s30 now) =. era
?~ t (add ~s30 now)
(add u.t now)
=. lyv (~(put by lyv) hen [%poll ire]) =. lyv (~(put by lyv) hen [%poll ire])
pass-wait(ude [~ hen &]) pass-wait(ude [~ hen &])
?: (gth a p.eve) ~|(seq-high+cur=p.eve !!) ?: (gth a p.eve) ~|(seq-high+cur=p.eve !!)

View File

@ -829,6 +829,7 @@
(stag %fsbc ;~(pfix buc hoon:read)) :: /$ extra arguments (stag %fsbc ;~(pfix buc hoon:read)) :: /$ extra arguments
(stag %fsbr ;~(pfix bar alts:read)) :: /| or (options) (stag %fsbr ;~(pfix bar alts:read)) :: /| or (options)
(stag %fshx ;~(pfix hax horn:read)) :: /# insert dephash (stag %fshx ;~(pfix hax horn:read)) :: /# insert dephash
(stag %fspt ;~(pfix pat horn:read)) :: /@ insert dephash
(stag %fsts ;~(pfix tis name:read)) :: /= apply face (stag %fsts ;~(pfix tis name:read)) :: /= apply face
(stag %fsdt ;~(pfix dot list:read)) :: /. list (stag %fsdt ;~(pfix dot list:read)) :: /. list
(stag %fscm ;~(pfix com case:read)) :: /, switch by path (stag %fscm ;~(pfix com case:read)) :: /, switch by path
@ -1151,6 +1152,21 @@
(flaw cof leaf+"file not found" (smyt (en-beam bem)) ~) (flaw cof leaf+"file not found" (smyt (en-beam bem)) ~)
(fine cof u.u.von) (fine cof u.u.von)
:: ::
++ load-time
~/ %load-time
|= {cof/cafe bem/beam}
^- (bolt time)
?: =([%ud 0] r.bem)
(flaw cof [leaf+"ford: no data: {<(en-beam bem(s ~))>}"]~)
?. =(%ud -.r.bem)
~|(%beam-not-normalized !!) ::XX flaw?
=+ von=(syve [151 %noun] ~ %cw bem)
?~ von
[p=cof q=[%1 [[%c %w bem ~] ~ ~]]]
?. ?=([~ %time * @da] u.von)
(flaw cof leaf+"ford: bad-revision: {<(bind u.von head)>}" ~)
(fine cof q.q.u.u.von)
::
++ load-to-mark ++ load-to-mark
~/ %load-to-mark ~/ %load-to-mark
|= {cof/cafe for/mark bem/beam} |= {cof/cafe for/mark bem/beam}
@ -1620,6 +1636,30 @@
%- flux %- flux
|= {mark vax/vase} |= {mark vax/vase}
[%noun (slop [atom+['uvH' ~] dep] vax)] [%noun (slop [atom+['uvH' ~] dep] vax)]
::
$fspt
?. ?=([$fszy @] p.hon)
(flaw cof leaf+"ford: STUB /@ only implemented for /mark/" ~)
%+ cope $(cof cof, hon p.hon)
|= {cof/cafe mark vax/vase}
%+ cope (normalize-beak cof how(s [q.p.hon s.how]))
|= {cof/cafe bem/beam}
?> ?=(%ud -.r.bem)
%+ cope (load-arch cof bem)
|= {cof/cafe ark/arch}
?~ fil.ark (flaw cof leaf+"ford: no file {<(tope bem)>}" ~)
=; res
=. q.res ::XX prevent infinite dependency loop
?-(-.q.res $1 [!!], ?($0 $2) q.res(p ~))
res
::
|- ^- (bolt cage) ::TODO do this in clay
=/ bom bem(p.r (dec p.r.bem))
%+ cope (load-arch cof bom)
|= {cof/cafe ork/arch}
?: =(fil.ork fil.ark) ^$(cof cof, bem bom)
%+ cope (load-time cof bem(s ~))
(flux |=(wen/time [%noun (slop !>(wen) vax)]))
:: ::
$fsts $fsts
%+ cope $(hon q.hon) %+ cope $(hon q.hon)

View File

@ -717,6 +717,9 @@
[[%get ~] p=@uvH q=[? clip httq]] :: remote request [[%get ~] p=@uvH q=[? clip httq]] :: remote request
[[%got ~] p=@uvH q=httr] :: remote response [[%got ~] p=@uvH q=httr] :: remote response
[[%gib ~] p=@uvH] :: remote cancel [[%gib ~] p=@uvH] :: remote cancel
::
[[%get-inner ~] p=@uvH q=beam r=mark] ::TODO details?
[[%got-inner ~] p=@uvH q=(each (cask) tang)] ::TODO details?
== :: == ::
++ hart {p/? q/(unit @ud) r/host} :: http sec+port+host ++ hart {p/? q/(unit @ud) r/host} :: http sec+port+host
++ hate {p/purl q/@p r/moth} :: semi-cooked request ++ hate {p/purl q/@p r/moth} :: semi-cooked request
@ -829,6 +832,7 @@
{$fsbc p/hoon} :: /$ argument {$fsbc p/hoon} :: /$ argument
{$fsbr p/(list horn)} :: /| options {$fsbr p/(list horn)} :: /| options
{$fshx p/horn} :: /# insert dephash {$fshx p/horn} :: /# insert dephash
{$fspt p/horn} :: /@ insert mod-time
{$fsts p/term q/horn} :: /= apply face {$fsts p/term q/horn} :: /= apply face
{$fsdt p/(list horn)} :: /. list {$fsdt p/(list horn)} :: /. list
{$fscm p/(list (pair spur horn))} :: /, switch by path {$fscm p/(list (pair spur horn))} :: /, switch by path

View File

@ -0,0 +1,5 @@
# Collections
A thin layer for managing file-system-based content, like blogs, forums and notes. Sends notifications using `hall`.
Very much in development. Not even functional yet.

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
}
}

3
web/nutalk.hoon Normal file
View File

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

73
web/pages/elapsed.js Normal file
View File

@ -0,0 +1,73 @@
var secToString = function(secs) {
if (secs <= 0) {
return 'Completed';
}
secs = Math.floor(secs)
var min = 60;
var hour = 60 * min;
var day = 24 * hour;
var week = 7 * day;
var year = 52 * week;
var fy = function(s) {
if (s < year) {
return ['', s];
} else {
return [Math.floor(s / year) + 'y', s % year];
}
}
var fw = function(tup) {
var str = tup[0];
var sec = tup[1];
if (sec < week) {
return [str, sec];
} else {
return [str + ' ' + Math.floor(sec / week) + 'w', sec % week];
}
}
var fd = function(tup) {
var str = tup[0];
var sec = tup[1];
if (sec < day) {
return [str, sec];
} else {
return [str + ' ' + Math.floor(sec / day) + 'd', sec % day];
}
}
var fh = function(tup) {
var str = tup[0];
var sec = tup[1];
if (sec < hour) {
return [str, sec];
} else {
return [str + ' ' + Math.floor(sec / hour) + 'h', sec % hour];
}
}
var fm = function(tup) {
var str = tup[0];
var sec = tup[1];
if (sec < min) {
return [str, sec];
} else {
return [str + ' ' + Math.floor(sec / min) + 'm', sec % min];
}
}
var fs = function(tup) {
var str = tup[0];
var sec = tup[1];
return str + ' ' + sec + 's';
}
return fs(fm(fh(fd(fw(fy(secs)))))).trim();
}
window.onload = function() {
var das = document.querySelectorAll('[data-urb-elapsed]');
for (var i=0; i < das.length; i ++) {
var urbD = das[i].dataset.urbElapsed; // UTC
var serverTime = new Date(urbD);
var clientTime = new Date(); // local
var interval = secToString((clientTime - serverTime) / 1000).split(' ')[0];
document.querySelector("[data-urb-elapsed='" + urbD + "']").innerHTML = '-' + interval;
}
}

3
web/pages/nutalk.hoon Normal file
View File

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

View File

@ -0,0 +1,17 @@
^- manx
;div.container
;div.row
;div.col-sm-offset-1.col-sm-12.page-notes-index
;div.text-mono: ~2017.11.12..4.50;
;h1: Brighter than the sun notes
;div.notes-actions
;button.btn.btn-secondary: Write →
;a/"#": Settings →
==
;ul.notes-blurbs
;li: Stuff!;
==
==
==
==

View File

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

View File

@ -0,0 +1,34 @@
:: An index of all own collections
/- collections
/+ old-zuse
/= cols /: /===/web/collections
/^ (map knot config:collections) /_ /collections-config/
^- manx
=, old-zuse
;div(class "container")
;a(href "/~~/pages/nutalk/stream/create")
;button(class "btn btn-secondary", type "button")
Create Stream →
==
==
;a(href "/~~/pages/nutalk/collection/create")
;button(class "btn btn-tetiary", type "button")
Create Collection →
==
==
;* %+ turn
%+ sort
~(tap by cols)
|= [a=(pair knot config:collections) b=(pair knot config:collections)]
(gth (unt (slav %da p.a)) (unt (slav %da p.b)))
|= [t=knot con=config:collections]
;div(class "row")
;div(class "da row col-md-12")
;a(href "/~~/collections/{(trip t)}"): {(trip t)}
==
;div(class "collection-title row col-md-12")
;h1: {(trip desc.con)}
==
==
==

View File

@ -0,0 +1,17 @@
^- manx
;div.container
;div.row
;div.col-sm-offset-1.col-sm-12.page-notes-index
;div.text-mono: ~2017.11.12..4.50;
;h1: Brighter than the sun notes
;div.notes-actions
;button.btn.btn-secondary: Write →
;a/"#": Settings →
==
;ul.notes-blurbs
;li: Stuff!;
==
==
==
==

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
^- manx
;div.container
;div.row
;div.col-sm-offset-1.col-sm-10.page-notes-edit.pb-24
;h3.underline.inline.text-400: Brighter than the sun notes
;h3.inline.text-400.ml-2: /
;h3.text-mono: ~2017.11.12..4.50
# Giving people the opportunity to sit in a dark theater
;button.btn.btn-secondary
;a/"/~~/nutalk/pages/show": Save
==
;button.btn.btn-primary
;a/"/~~/nutalk/pages/preview": Preview
==
;div(urb-component "PostEditTextarea");
==
==
==

75462
web/pages/nutalk/js/index.js Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -0,0 +1,24 @@
^- manx
;div.container
;div.row
;div.col-sm-offset-1.col-sm-10.page-notes-show.pb-24
;h3.underline.inline.text-400: Brighter than the sun notes
;h3.inline.text-400.ml-2: /
;h3.text-mono: ~2017.11.12..4.50
# Giving people the opportunity to sit in a dark theater
;button.btn.btn-primary
;a/"/~~/nutalk/pages/edit": Edit
==
;p.mt-8: A daring escape under cover of darkness. The father shot by government guards as his wife clings to their young son—but all three making it to the water. Three days spent nearly bleeding out in a rickety boat. Pirate attacks. And then, the redemptive miracle of life: a new daughter, born in a Thai refugee camp, who years later would rise to great heights as a first-generation American.
;p: Its not a Hollywood plot, though its would-be hero admits that it could be. Perched on a couch in a downtown Manhattan hotel, wearing a floral blouse and mustard cords, Hong Chau recounts her familys journey among the Vietnamese boat people, refugees who escaped the postwar chaos of the late 70s, only to die by the hundreds of thousands at sea. “My mom always points to the silver lining,” the 38-year-old actress explains. “Shell say, Because your dad was so bloody, the pirates didnt check his pockets. So we still had some money at the camp to buy you baby formula.’”
;p: In the director Alexander Paynes new sci-fi satire Downsizing, Chau plays Ngoc Lan Tran, a Vietnamese dissident in a future where people can be shrink-rayed to only a few inches tall. Some of the shrunken are volunteers attempting to save a faltering eco-system, with the added bonus of lavish miniaturized lifestyles financed by their old full-sized dollars. Others, as in Trans case, are “downsized” out of political expedience. Chau had no idea what she was in for when she first received the script. “I knew it was sci-fi, so I thought, Oh, maybe I can play a lab technician or something,’” she says. “Usually, of course, its the male characters who are the most layered. This is the first time I read a script where the female character was the only role I wanted.”
;p: That doesnt mean that Chau, whose decade-long career includes turns in 2014s Inherent Vice and this years HBO hit Big Little Lies, hasnt tackled complicated characters before. On Treme, her first experience on a TV drama, she played the daughter of Vietnamese immigrants in the same racially complex New Orleans milieu in which she grew up. But the benefits of starring in this rare amalgam of an auteur-driven, big-budget Hollywood film—opposite Matt Damon, Christoph Waltz, and Kristen Wiig—has not been lost on the seasoned actress. “Giving people the opportunity to sit in a dark theater together and have emotions in public, whether theyre laughing or crying— thats what makes me happy.”
==
==
==

View File

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

View File

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

View File

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

BIN
web/pages/nutalk/talk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

18
web/pages/toggle.js Normal file
View File

@ -0,0 +1,18 @@
document.toggleDisplay = function(id1, id2) {
var id1 = 'show';
var id2 = 'edit';
var isDisplayed = function(id) {
return document.getElementById(id).style.display != 'none';
}
console.log(document.getElementById(id1));
console.log(document.getElementById(id2));
if (isDisplayed(id1)) {
document.getElementById(id1).style.display = 'none';
document.getElementById(id2).style.display = 'inherit';
} else {
document.getElementById(id1).style.display = 'inherit';
document.getElementById(id2).style.display = 'none';
}
};
document.getElementById('edit-btn').onclick = document.toggleDisplay;