removed duplicate arvo files in interface pkg
@ -1,658 +0,0 @@
|
||||
/- hall
|
||||
/+ *server, chat, hall-json
|
||||
/= index
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/chat/index
|
||||
/| /html/
|
||||
/~ ~
|
||||
==
|
||||
/= tile-js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/chat/js/tile
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
/= script
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/chat/js/index
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
/= style
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/chat/css/index
|
||||
/| /css/
|
||||
/~ ~
|
||||
==
|
||||
/= style
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/chat/css/index
|
||||
/| /css/
|
||||
/~ ~
|
||||
==
|
||||
/= chat-png
|
||||
/^ (map knot @)
|
||||
/: /===/app/chat/img /_ /png/
|
||||
::
|
||||
=, chat
|
||||
::
|
||||
|_ [bol=bowl:gall sta=state]
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
:: +prep: set up the app, migrate the state once started
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit state)
|
||||
^- (quip move _this)
|
||||
=/ launcha/poke
|
||||
[%launch-action [%chat /chattile '/~chat/js/tile.js']]
|
||||
?~ old
|
||||
=/ inboxpat /circle/inbox/config/group
|
||||
=/ circlespat /circles/[(scot %p our.bol)]
|
||||
=/ inboxwir /circle/[(scot %p our.bol)]/inbox/config/group
|
||||
=/ inboxi/poke
|
||||
:- %hall-action
|
||||
[%source %inbox %.y (silt [[our.bol %i] ~]~)]
|
||||
=/ fakeannounce=poke
|
||||
:- %hall-action
|
||||
[%create %hall-internal-announcements '' %village]
|
||||
=/ announce=poke
|
||||
:- %hall-action
|
||||
[%create %announcements 'Announcements from Tlon' %journal]
|
||||
=/ help=poke
|
||||
:- %hall-action
|
||||
[%create %urbit-help 'Get help about Urbit' %channel]
|
||||
=/ dev=poke
|
||||
:- %hall-action
|
||||
[%create %urbit-dev 'Chat about developing on Urbit' %channel]
|
||||
=/ sourcefakeannounce/poke
|
||||
:- %hall-action
|
||||
[%source %inbox %.y (silt [[our.bol %hall-internal-announcements] ~]~)]
|
||||
=/ sourceannounce/poke
|
||||
:- %hall-action
|
||||
[%source %inbox %.y (silt [[~marzod %announcements] ~]~)]
|
||||
=/ hallactions=(list move)
|
||||
?: =((clan:title our.bol) %czar)
|
||||
~
|
||||
?: =(our.bol ~marzod)
|
||||
~& %marzod-chat
|
||||
:- [ost.bol %poke /announce [our.bol %hall] announce]
|
||||
[ost.bol %poke /announce [our.bol %hall] sourceannounce]~
|
||||
?: =(our.bol ~dopzod)
|
||||
~& %dopzod-chat
|
||||
:- [ost.bol %poke /announce [our.bol %hall] dev]
|
||||
[ost.bol %poke /announce [our.bol %hall] help]~
|
||||
:- [ost.bol %poke /announce [our.bol %hall] fakeannounce]
|
||||
:- [ost.bol %poke /announce [our.bol %hall] sourcefakeannounce]
|
||||
[ost.bol %poke /announce [our.bol %hall] sourceannounce]~
|
||||
=/ moves=(list move)
|
||||
:~ [ost.bol %peer inboxwir [our.bol %hall] inboxpat]
|
||||
[ost.bol %peer circlespat [our.bol %hall] circlespat]
|
||||
[ost.bol %connect / [~ /'~chat'] %chat]
|
||||
[ost.bol %poke /chat [our.bol %hall] inboxi]
|
||||
[ost.bol %poke /chat [our.bol %launch] launcha]
|
||||
==
|
||||
:_ this
|
||||
%+ weld moves hallactions
|
||||
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
|
||||
this(sta u.old)
|
||||
::
|
||||
++ construct-tile-json
|
||||
|= str=streams
|
||||
^- json
|
||||
=/ numbers/(list [circle:hall @ud])
|
||||
%+ turn ~(tap by messages.str)
|
||||
|= [cir=circle:hall lis=(list envelope:hall)]
|
||||
^- [circle:hall @ud]
|
||||
?~ lis
|
||||
[cir 0]
|
||||
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
|
||||
[cir (add num.last 1)]
|
||||
=/ maptjson=(map @t json)
|
||||
%- my
|
||||
:~ ['config' (config-to-json str)]
|
||||
['numbers' (numbers-to-json numbers)]
|
||||
==
|
||||
[%o maptjson]
|
||||
::
|
||||
++ peer-chattile
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
:_ this
|
||||
[ost.bol %diff %json (construct-tile-json str.sta)]~
|
||||
::
|
||||
:: +peer-messages: subscribe to subset of messages and updates
|
||||
::
|
||||
::
|
||||
++ peer-primary
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
=* messages messages.str.sta
|
||||
=/ lismov/(list move)
|
||||
%+ murn ~(tap by messages)
|
||||
|= [cir=circle:hall lis=(list envelope:hall)]
|
||||
^- (unit move)
|
||||
=/ envs/(unit (list envelope:hall)) (~(get by messages) cir)
|
||||
?~ envs
|
||||
~
|
||||
=/ length/@ (lent u.envs)
|
||||
=/ start/@
|
||||
?: (gte length 100)
|
||||
(sub length 100)
|
||||
0
|
||||
=/ end/@ length
|
||||
=/ offset/@ (sub end start)
|
||||
:- ~
|
||||
:* ost.bol
|
||||
%diff
|
||||
%chat-update
|
||||
[%messages cir start end (swag [start offset] u.envs)]
|
||||
==
|
||||
:_ this
|
||||
[[ost.bol %diff %chat-config str.sta] lismov]
|
||||
::
|
||||
:: +poke-chat: send us an action
|
||||
::
|
||||
++ poke-chat-action
|
||||
|= act=action:chat
|
||||
^- (quip move _this)
|
||||
:_ this
|
||||
%+ turn lis.act
|
||||
|= hac=action:hall
|
||||
^- move
|
||||
:* ost.bol
|
||||
%poke
|
||||
/p/[(scot %da now.bol)]
|
||||
[our.bol %hall]
|
||||
[%hall-action hac]
|
||||
==
|
||||
::
|
||||
:: +send-chat-update: utility func for sending updates to all our subscribers
|
||||
::
|
||||
++ send-chat-update
|
||||
|= [upd=update str=streams]
|
||||
^- (list move)
|
||||
=/ updates/(list move)
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %chat-update upd]
|
||||
::
|
||||
=/ jon/json (construct-tile-json str)
|
||||
=/ tile-updates/(list move)
|
||||
%+ turn (prey:pubsub:userlib /chattile bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %json jon]
|
||||
::
|
||||
%+ weld
|
||||
updates
|
||||
tile-updates
|
||||
::
|
||||
::
|
||||
:: +hall arms
|
||||
::
|
||||
::
|
||||
:: +diff-hall-prize: handle full state initially handed to us by hall
|
||||
::
|
||||
++ diff-hall-prize
|
||||
|= [wir=wire piz=prize:hall]
|
||||
^- (quip move _this)
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
:: %circles wire
|
||||
::
|
||||
%circles
|
||||
?> ?=(%circles -.piz)
|
||||
=/ str %= str.sta
|
||||
circles cis.piz
|
||||
==
|
||||
:- (send-chat-update [[%circles cis.piz] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
:: %circle wire
|
||||
::
|
||||
%circle
|
||||
:: ::
|
||||
:: :: %circle prize
|
||||
:: ::
|
||||
:: %circle
|
||||
?> ?=(%circle -.piz)
|
||||
=/ circle/circle:hall [our.bol &3:wir]
|
||||
?: =(circle [our.bol %inbox])
|
||||
::
|
||||
:: fill inbox config and remote configs with prize data
|
||||
::
|
||||
=/ configs
|
||||
%- ~(uni in configs.str.sta)
|
||||
^- (map circle:hall (unit config:hall))
|
||||
(~(run by rem.cos.piz) |=(a=config:hall `a))
|
||||
::
|
||||
=/ circles/(list circle:hall)
|
||||
%+ turn ~(tap in src.loc.cos.piz)
|
||||
|= src=source:hall
|
||||
^- circle:hall
|
||||
cir.src
|
||||
::
|
||||
=/ meslis/(list [circle:hall (list envelope:hall)])
|
||||
%+ turn circles
|
||||
|= cir=circle:hall
|
||||
^- [circle:hall (list envelope:hall)]
|
||||
[cir ~]
|
||||
::
|
||||
=/ localpeers/(set @p)
|
||||
%- silt %+ turn ~(tap by loc.pes.piz)
|
||||
|= [shp=@p stat=status:hall]
|
||||
shp
|
||||
::
|
||||
=/ peers/(map circle:hall (set @p))
|
||||
%- ~(rep by rem.pes.piz)
|
||||
|= [[cir=circle:hall grp=group:hall] acc=(map circle:hall (set @p))]
|
||||
^- (map circle:hall (set @p))
|
||||
=/ newset
|
||||
%- silt %+ turn ~(tap by grp)
|
||||
|= [shp=@p stat=status:hall]
|
||||
shp
|
||||
(~(put by acc) cir newset)
|
||||
::
|
||||
:-
|
||||
%+ turn ~(tap in (~(del in (silt circles)) [our.bol %inbox]))
|
||||
|= cir=circle:hall
|
||||
^- move
|
||||
=/ wir/wire /circle/[(scot %p our.bol)]/[nom.cir]/config/group
|
||||
=/ pat/path /circle/[nom.cir]/config/group
|
||||
[ost.bol %peer wir [our.bol %hall] pat]
|
||||
::
|
||||
%= this
|
||||
inbox.str.sta loc.cos.piz
|
||||
configs.str.sta configs
|
||||
messages.str.sta (molt meslis)
|
||||
peers.str.sta (~(put by peers) [our.bol %inbox] localpeers)
|
||||
==
|
||||
::
|
||||
:: fill remote configs with message data
|
||||
::
|
||||
=* messages messages.str.sta
|
||||
=/ circle/circle:hall [`@p`(slav %p &2:wir) &3:wir]
|
||||
=/ localpeers/(set @p)
|
||||
%- silt %+ turn ~(tap by loc.pes.piz)
|
||||
|= [shp=@p stat=status:hall]
|
||||
shp
|
||||
::
|
||||
=/ peers/(map circle:hall (set @p))
|
||||
%- ~(rep by rem.pes.piz)
|
||||
|= [[cir=circle:hall grp=group:hall] acc=(map circle:hall (set @p))]
|
||||
^- (map circle:hall (set @p))
|
||||
=/ newset
|
||||
%- silt %+ turn ~(tap by grp)
|
||||
|= [shp=@p stat=status:hall]
|
||||
shp
|
||||
(~(put by acc) cir newset)
|
||||
=/ str
|
||||
%= str.sta
|
||||
messages (~(put by messages) circle nes.piz)
|
||||
peers (~(uni by peers.str.sta) (~(put by peers) circle localpeers))
|
||||
==
|
||||
=/ messageupdate/update
|
||||
:* %messages
|
||||
circle
|
||||
0
|
||||
(lent messages)
|
||||
nes.piz
|
||||
==
|
||||
:- (send-chat-update [messageupdate str])
|
||||
this(str.sta str)
|
||||
==
|
||||
::
|
||||
:: +diff-hall-rumor: handle updates to hall state
|
||||
::
|
||||
++ diff-hall-rumor
|
||||
|= [wir=wire rum=rumor:hall]
|
||||
^- (quip move _this)
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
:: %circles
|
||||
%circles
|
||||
?> ?=(%circles -.rum)
|
||||
=/ cis
|
||||
?: add.rum
|
||||
(~(put in circles.str.sta) cir.rum)
|
||||
(~(del in circles.str.sta) cir.rum)
|
||||
=/ str
|
||||
%= str.sta
|
||||
circles cis
|
||||
peers
|
||||
?: add.rum
|
||||
(~(put by peers.str.sta) [our.bol cir.rum] ~)
|
||||
(~(del by peers.str.sta) [our.bol cir.rum])
|
||||
==
|
||||
:- (send-chat-update [[%circles cis] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
::
|
||||
:: %circle: fill remote configs with message data
|
||||
::
|
||||
%circle
|
||||
?> ?=(%circle -.rum)
|
||||
=* sto rum.rum
|
||||
?+ -.sto
|
||||
[~ this]
|
||||
::
|
||||
:: %gram:
|
||||
::
|
||||
%gram
|
||||
?> ?=(%gram -.sto)
|
||||
=* messages messages.str.sta
|
||||
=/ circle/circle:hall [`@p`(slav %p &2:wir) &3:wir]
|
||||
=/ unes/(unit (list envelope:hall)) (~(get by messages) circle)
|
||||
?~ unes
|
||||
[~ this]
|
||||
=/ nes u.unes
|
||||
=/ str
|
||||
%= str.sta
|
||||
messages (~(put by messages) circle (snoc nes nev.sto))
|
||||
==
|
||||
:- (send-chat-update [[%message circle nev.sto] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
:: %status:
|
||||
::
|
||||
%status
|
||||
?> ?=(%status -.sto)
|
||||
=/ upeers/(unit (set @p)) (~(get by peers.str.sta) cir.sto)
|
||||
?~ upeers
|
||||
[~ this]
|
||||
=/ peers/(set @p)
|
||||
?: =(%remove -.dif.sto)
|
||||
(~(del in u.upeers) who.sto)
|
||||
(~(put in u.upeers) who.sto)
|
||||
=/ str
|
||||
%= str.sta
|
||||
peers (~(put by peers.str.sta) cir.sto peers)
|
||||
==
|
||||
:- (send-chat-update [[%peers cir.sto peers] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
:: %config: config has changed
|
||||
::
|
||||
%config
|
||||
=* circ cir.sto
|
||||
::
|
||||
?+ -.dif.sto
|
||||
[~ this]
|
||||
::
|
||||
:: %full: set all of config without side effects
|
||||
::
|
||||
%full
|
||||
=* conf cof.dif.sto
|
||||
=/ str
|
||||
%= str.sta
|
||||
configs (~(put by configs.str.sta) circ `conf)
|
||||
==
|
||||
:- (send-chat-update [[%config circ conf] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
:: %read: the read count of one of our configs has changed
|
||||
::
|
||||
%read
|
||||
?: =(circ [our.bol %inbox])
|
||||
:: ignore when circ is inbox
|
||||
[~ this]
|
||||
=/ uconf/(unit config:hall) (~(got by configs.str.sta) circ)
|
||||
?~ uconf
|
||||
:: should we crash?
|
||||
[~ this]
|
||||
=/ conf/config:hall
|
||||
%= u.uconf
|
||||
red red.dif.sto
|
||||
==
|
||||
=/ str
|
||||
%= str.sta
|
||||
configs (~(put by configs.str.sta) circ `conf)
|
||||
==
|
||||
:- (send-chat-update [[%config circ conf] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
:: %source: the sources of our inbox have changed
|
||||
::
|
||||
%source
|
||||
?. =(circ [our.bol %inbox])
|
||||
:: ignore when circ is not inbox
|
||||
[~ this]
|
||||
=* affectedcir cir.src.dif.sto
|
||||
=/ newwir/wire
|
||||
/circle/[(scot %p hos.affectedcir)]/[nom.affectedcir]/grams/0/config/group
|
||||
=/ pat/path /circle/[nom.affectedcir]/grams/0/config/group
|
||||
:: we've added a source to our inbox
|
||||
::
|
||||
?: add.dif.sto
|
||||
=/ newinbox %= inbox.str.sta
|
||||
src (~(put in src.inbox.str.sta) src.dif.sto)
|
||||
==
|
||||
=/ str
|
||||
%= str.sta
|
||||
inbox newinbox
|
||||
::
|
||||
configs
|
||||
?: (~(has by configs.str.sta) affectedcir)
|
||||
configs.str.sta
|
||||
(~(put by configs.str.sta) affectedcir ~)
|
||||
==
|
||||
::
|
||||
:_ this(str.sta str)
|
||||
%+ weld
|
||||
[ost.bol %peer newwir [hos.affectedcir %hall] pat]~
|
||||
(send-chat-update [[%inbox newinbox] str])
|
||||
::
|
||||
=/ newinbox %= inbox.str.sta
|
||||
src (~(del in src.inbox.str.sta) src.dif.sto)
|
||||
==
|
||||
:: we've removed a source from our inbox
|
||||
::
|
||||
=/ str
|
||||
%= str.sta
|
||||
inbox newinbox
|
||||
::
|
||||
configs (~(del by configs.str.sta) affectedcir)
|
||||
messages (~(del by messages.str.sta) affectedcir)
|
||||
peers (~(del by peers.str.sta) affectedcir)
|
||||
==
|
||||
=/ fakecir/circle:hall
|
||||
:- our.bol
|
||||
%- crip
|
||||
%+ weld (trip 'hall-internal-') (trip nom.affectedcir)
|
||||
::
|
||||
?~ (~(get by configs.str) fakecir)
|
||||
:: just forward the delete to our clients
|
||||
::
|
||||
:_ this(str.sta str)
|
||||
%+ weld
|
||||
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
|
||||
%+ weld
|
||||
(send-chat-update [[%inbox newinbox] str])
|
||||
(send-chat-update [[%delete affectedcir] str])
|
||||
:: if we get a delete from another ship, delete our fake circle copy
|
||||
::
|
||||
=/ deletefake/poke
|
||||
:- %hall-action
|
||||
[%delete nom.fakecir ~]
|
||||
:_ this(str.sta str)
|
||||
%+ weld
|
||||
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
|
||||
%+ weld
|
||||
[ost.bol %poke /fake [our.bol %hall] deletefake]~
|
||||
%+ weld
|
||||
(send-chat-update [[%inbox newinbox] str])
|
||||
(send-chat-update [[%delete affectedcir] str])
|
||||
::
|
||||
:: %remove: remove a circle
|
||||
::
|
||||
%remove
|
||||
=/ str
|
||||
%= str.sta
|
||||
configs (~(del by configs.str.sta) circ)
|
||||
messages (~(del by messages.str.sta) circ)
|
||||
peers (~(del by peers.str.sta) circ)
|
||||
==
|
||||
:- (send-chat-update [[%delete circ] str])
|
||||
this(str.sta str)
|
||||
::
|
||||
==
|
||||
:: end of branching on dif.sto type
|
||||
==
|
||||
:: end of branching on sto type
|
||||
==
|
||||
:: end of i.wir branching
|
||||
::
|
||||
:: +lient arms
|
||||
::
|
||||
::
|
||||
:: +bound: lient tells us we successfully bound our server to the ~chat url
|
||||
::
|
||||
++ bound
|
||||
|= [wir=wire success=? binding=binding:eyre]
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
::
|
||||
:: +poke-handle-http-request: serve pages from file system based on URl path
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:eyre
|
||||
^- (quip move _this)
|
||||
::
|
||||
=+ request-line=(parse-request-line url.request.inbound-request)
|
||||
=/ name=@t
|
||||
=+ back-path=(flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
?: =(name 'tile')
|
||||
[[ost.bol %http-response (js-response:app tile-js)]~ this]
|
||||
?+ site.request-line
|
||||
:_ this
|
||||
[ost.bol %http-response not-found:app]~
|
||||
::
|
||||
:: styling
|
||||
::
|
||||
[%'~chat' %css %index ~]
|
||||
:_ this
|
||||
[ost.bol %http-response (css-response:app style)]~
|
||||
::
|
||||
:: javascript
|
||||
::
|
||||
[%'~chat' %js %index ~]
|
||||
:_ this
|
||||
[ost.bol %http-response (js-response:app script)]~
|
||||
::
|
||||
:: images
|
||||
::
|
||||
[%'~chat' %img *]
|
||||
=/ img (as-octs:mimes:html (~(got by chat-png) `@ta`name))
|
||||
:_ this
|
||||
[ost.bol %http-response (png-response:app img)]~
|
||||
::
|
||||
:: paginated message data
|
||||
::
|
||||
[%'~chat' %scroll @t @t @t @t ~]
|
||||
=/ cir/circle:hall [(slav %p &3:site.request-line) &4:site.request-line]
|
||||
=/ start/@ud (need (rush &5:site.request-line dem))
|
||||
=/ parsedend/@ud (need (rush &6:site.request-line dem))
|
||||
=* messages messages.str.sta
|
||||
=/ envs/(unit (list envelope:hall)) (~(get by messages) cir)
|
||||
?~ envs
|
||||
[~ this]
|
||||
?: (gte start (lent u.envs))
|
||||
[~ this]
|
||||
=/ end/@
|
||||
?: (gte parsedend (lent u.envs))
|
||||
(dec (lent u.envs))
|
||||
parsedend
|
||||
=/ offset (sub end start)
|
||||
=/ jon/json %- msg-to-json
|
||||
:* %messages
|
||||
cir
|
||||
start
|
||||
end
|
||||
(swag [start offset] u.envs)
|
||||
==
|
||||
:_ this
|
||||
[ost.bol %http-response (json-response:app (json-to-octs jon))]~
|
||||
::
|
||||
::
|
||||
:: inbox page
|
||||
::
|
||||
[%'~chat' *]
|
||||
:_ this
|
||||
[ost.bol %http-response (html-response:app index)]~
|
||||
==
|
||||
::
|
||||
::
|
||||
:: +subscription-retry arms
|
||||
::
|
||||
::
|
||||
:: +reap: recieve acknowledgement for peer, retry on failure
|
||||
::
|
||||
++ reap
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
?~ err
|
||||
[~ this]
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
%circle
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
::
|
||||
%circles
|
||||
:_ this
|
||||
[ost.bol %peer wir [our.bol %hall] wir]~
|
||||
==
|
||||
::
|
||||
:: +quit: subscription failed/quit at some point, retry
|
||||
::
|
||||
++ quit
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
?~ wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
?+ i.wir
|
||||
(mean [leaf+"invalid wire for diff: {(spud wir)}"]~)
|
||||
::
|
||||
%circle
|
||||
=/ shp/@p (slav %p &2:wir)
|
||||
=/ pat /circle/[&3:wir]/config/group
|
||||
?: =(&3:wir 'inbox')
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
?: (~(has in src.inbox.str.sta) [[shp &3:wir] ~])
|
||||
:_ this
|
||||
[ost.bol %peer wir [shp %hall] pat]~
|
||||
[~ this]
|
||||
::
|
||||
%circles
|
||||
:_ this
|
||||
[ost.bol %peer wir [our.bol %hall] wir]~
|
||||
==
|
||||
::
|
||||
--
|
Before Width: | Height: | Size: 1010 B |
Before Width: | Height: | Size: 1.7 KiB |
@ -1,17 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Chat</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<link rel="stylesheet" href="/~chat/css/index.css" />
|
||||
<link rel="icon" type="image/png" href="/~launch/img/Favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
<script src="/~/channel/channel.js"></script>
|
||||
<script src="/~modulo/session.js"></script>
|
||||
<script src="/~chat/js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,140 +0,0 @@
|
||||
/- hall
|
||||
/+ hall-json
|
||||
|%
|
||||
::
|
||||
+$ move [bone card]
|
||||
::
|
||||
+$ card
|
||||
$% [%http-response =http-event:http]
|
||||
[%connect wire binding:eyre term]
|
||||
[%peer wire dock path]
|
||||
[%quit ~]
|
||||
[%poke wire dock poke]
|
||||
[%peer wire dock path]
|
||||
[%pull wire dock ~]
|
||||
[%diff diff]
|
||||
==
|
||||
::
|
||||
+$ diff
|
||||
$% [%hall-rumor rumor:hall]
|
||||
[%chat-update update]
|
||||
[%chat-config streams]
|
||||
[%json json]
|
||||
==
|
||||
::
|
||||
+$ poke
|
||||
$% [%hall-action action:hall]
|
||||
[%launch-action [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ state
|
||||
$% [%0 str=streams]
|
||||
==
|
||||
::
|
||||
+$ streams
|
||||
$: :: inbox config
|
||||
::
|
||||
inbox=config:hall
|
||||
:: names and configs of all circles we know about
|
||||
::
|
||||
configs=(map circle:hall (unit config:hall))
|
||||
:: messages for all circles we know about
|
||||
::
|
||||
messages=(map circle:hall (list envelope:hall))
|
||||
::
|
||||
::
|
||||
circles=(set name:hall)
|
||||
::
|
||||
::
|
||||
peers=(map circle:hall (set @p))
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
$% [%inbox con=config:hall]
|
||||
[%message cir=circle:hall env=envelope:hall]
|
||||
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
|
||||
[%config cir=circle:hall con=config:hall]
|
||||
[%circles cir=(set name:hall)]
|
||||
[%peers cir=circle:hall per=(set @p)]
|
||||
[%delete cir=circle:hall]
|
||||
==
|
||||
::
|
||||
+$ action [%actions lis=(list action:hall)]
|
||||
::
|
||||
::
|
||||
:: +utilities
|
||||
::
|
||||
++ msg-to-json
|
||||
=, enjs:format
|
||||
|= upd=update
|
||||
^- json
|
||||
?> ?=(%messages -.upd)
|
||||
%+ frond %update
|
||||
%- pairs
|
||||
:~
|
||||
:- %messages
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
[%start (numb start.upd)]
|
||||
[%end (numb end.upd)]
|
||||
[%envelopes [%a (turn env.upd enve:enjs:hall-json)]]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ config-to-json
|
||||
|= str=streams
|
||||
=, enjs:format
|
||||
^- json
|
||||
%+ frond %chat
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
[%inbox (conf:enjs:hall-json inbox.str)]
|
||||
::
|
||||
:- %configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by configs.str)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
^- [@t json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
?~(con ~ (conf:enjs:hall-json u.con))
|
||||
::
|
||||
:- %circles :- %a
|
||||
%+ turn ~(tap in circles.str)
|
||||
|= nom=name:hall
|
||||
[%s nom]
|
||||
::
|
||||
:- %peers
|
||||
%- pairs
|
||||
%+ turn ~(tap by peers.str)
|
||||
|= [cir=circle:hall per=(set @p)]
|
||||
^- [@t json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
[%a (turn ~(tap in per) ship)]
|
||||
::
|
||||
==
|
||||
::
|
||||
++ numbers-to-json
|
||||
|= num=(list [circle:hall @ud])
|
||||
^- json
|
||||
=, enjs:format
|
||||
%+ frond %chat
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
:: %config
|
||||
:- %numbers
|
||||
:- %a
|
||||
%+ turn num
|
||||
|= [cir=circle:hall len=@ud]
|
||||
^- json
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir)]
|
||||
[%length (numb len)]
|
||||
==
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
@ -1,58 +0,0 @@
|
||||
::
|
||||
::
|
||||
/- hall
|
||||
/+ chat, hall-json
|
||||
::
|
||||
|_ act=action:chat
|
||||
++ grow
|
||||
|%
|
||||
++ tank !!
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:chat
|
||||
++ json
|
||||
|= jon=^json
|
||||
=< (parse-chat-action jon)
|
||||
|%
|
||||
::
|
||||
++ hall-action
|
||||
=, dejs:hall-json
|
||||
=, dejs-soft:format
|
||||
|= a=^json
|
||||
^- action:hall
|
||||
=- (need ((of -) a))
|
||||
:~ create+(ot nom+so des+so sec+secu ~)
|
||||
design+(ot nom+so cof+conf ~)
|
||||
delete+(ot nom+so why+(mu so) ~)
|
||||
depict+(ot nom+so des+so ~)
|
||||
filter+(ot nom+so fit+filt ~)
|
||||
permit+(ot nom+so inv+bo sis+(as (su fed:ag)) ~)
|
||||
source+(ot nom+so sub+bo srs+(as sorc) ~)
|
||||
read+(ot nom+so red+ni ~)
|
||||
usage+(ot nom+so add+bo tas+(as so) ~)
|
||||
newdm+(ot sis+(as (su fed:ag)) ~)
|
||||
::
|
||||
convey+(ar thot)
|
||||
phrase+(ot aud+audi ses+(ar spec:dejs:hall-json) ~)
|
||||
::
|
||||
notify+(ot aud+audi pes+(mu pres) ~)
|
||||
naming+(ot aud+audi man+huma ~)
|
||||
::
|
||||
glyph+(ot gyf+so aud+audi bin+bo ~)
|
||||
nick+(ot who+(su fed:ag) nic+so ~)
|
||||
::
|
||||
public+(ot add+bo cir+circ ~)
|
||||
==
|
||||
::
|
||||
++ parse-chat-action
|
||||
=, dejs:format
|
||||
%- of
|
||||
:~
|
||||
[%actions (ot lis+(ar hall-action) ~)]
|
||||
==
|
||||
::
|
||||
--
|
||||
--
|
||||
--
|
@ -1,48 +0,0 @@
|
||||
::
|
||||
::
|
||||
/? 309
|
||||
::
|
||||
/- hall
|
||||
/+ chat, hall-json
|
||||
::
|
||||
|_ str=streams:chat
|
||||
++ grow
|
||||
|%
|
||||
++ json
|
||||
=, enjs:format
|
||||
^- ^json
|
||||
%+ frond %chat
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
[%inbox (conf:enjs:hall-json inbox.str)]
|
||||
::
|
||||
:- %configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by configs.str)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
^- [@t ^json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
?~(con ~ (conf:enjs:hall-json u.con))
|
||||
::
|
||||
:- %circles :- %a
|
||||
%+ turn ~(tap in circles.str)
|
||||
|= nom=name:hall
|
||||
[%s nom]
|
||||
::
|
||||
:- %peers
|
||||
%- pairs
|
||||
%+ turn ~(tap by peers.str)
|
||||
|= [cir=circle:hall per=(set @p)]
|
||||
^- [@t ^json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
[%a (turn ~(tap in per) ship)]
|
||||
::
|
||||
==
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun streams:chat
|
||||
--
|
||||
--
|
@ -1,96 +0,0 @@
|
||||
::
|
||||
::
|
||||
/? 309
|
||||
::
|
||||
/- hall
|
||||
/+ chat, hall-json
|
||||
::
|
||||
|_ upd=update:chat
|
||||
++ grow
|
||||
|%
|
||||
++ json
|
||||
=, enjs:format
|
||||
^- ^json
|
||||
%+ frond %update
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
:: %inbox
|
||||
?: =(%inbox -.upd)
|
||||
?> ?=(%inbox -.upd)
|
||||
[%inbox (conf:enjs:hall-json con.upd)]
|
||||
::
|
||||
:: %message
|
||||
?: =(%message -.upd)
|
||||
?> ?=(%message -.upd)
|
||||
:- %message
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
[%envelope (enve:enjs:hall-json env.upd)]
|
||||
==
|
||||
::
|
||||
:: %messages
|
||||
?: =(%messages -.upd)
|
||||
?> ?=(%messages -.upd)
|
||||
:- %messages
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
[%start (numb start.upd)]
|
||||
[%end (numb end.upd)]
|
||||
[%envelopes [%a (turn env.upd enve:enjs:hall-json)]]
|
||||
==
|
||||
::
|
||||
:: %config
|
||||
?: =(%config -.upd)
|
||||
?> ?=(%config -.upd)
|
||||
:- %config
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
[%config (conf:enjs:hall-json con.upd)]
|
||||
==
|
||||
::
|
||||
:: %circles
|
||||
?: =(%circles -.upd)
|
||||
?> ?=(%circles -.upd)
|
||||
:- %circles
|
||||
%- pairs
|
||||
:~
|
||||
:- %circles
|
||||
:- %a
|
||||
%+ turn ~(tap in cir.upd)
|
||||
|= nom=name:hall
|
||||
[%s nom]
|
||||
==
|
||||
::
|
||||
:: %peers
|
||||
?: =(%peers -.upd)
|
||||
?> ?=(%peers -.upd)
|
||||
:- %peers
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
[%peers [%a (turn ~(tap in per.upd) ship:enjs:format)]]
|
||||
==
|
||||
::
|
||||
:: %delete
|
||||
?: =(%delete -.upd)
|
||||
?> ?=(%delete -.upd)
|
||||
:- %delete
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir.upd)]
|
||||
==
|
||||
::
|
||||
:: %noop
|
||||
[*@t *^json]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun update:chat
|
||||
--
|
||||
--
|
@ -1,80 +0,0 @@
|
||||
/+ *server
|
||||
/= tile-js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/clock/js/tile
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
=, format
|
||||
::
|
||||
|%
|
||||
:: +move: output effect
|
||||
::
|
||||
+$ move [bone card]
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ poke
|
||||
$% [%launch-action [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ card
|
||||
$% [%poke wire dock poke]
|
||||
[%http-response =http-event:http]
|
||||
[%connect wire binding:eyre term]
|
||||
[%diff %json json]
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
||||
|_ [bol=bowl:gall ~]
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
++ bound
|
||||
|= [wir=wire success=? binding=binding:eyre]
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit ~)
|
||||
^- (quip move _this)
|
||||
=/ launcha
|
||||
[%launch-action [%clock /tile '/~clock/js/tile.js']]
|
||||
:_ this
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~clock'] %clock]
|
||||
[ost.bol %poke /clock [our.bol %launch] launcha]
|
||||
==
|
||||
::
|
||||
++ peer-tile
|
||||
|= pax=path
|
||||
^- (quip move _this)
|
||||
[[ost.bol %diff %json *json]~ this]
|
||||
::
|
||||
++ send-tile-diff
|
||||
|= jon=json
|
||||
^- (list move)
|
||||
%+ turn (prey:pubsub:userlib /tile bol)
|
||||
|= [=bone ^]
|
||||
[bone %diff %json jon]
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:eyre
|
||||
^- (quip move _this)
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ back-path (flop site.request-line)
|
||||
=/ name=@t
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
::
|
||||
?~ back-path
|
||||
[[ost.bol %http-response not-found:app]~ this]
|
||||
?: =(name 'tile')
|
||||
[[ost.bol %http-response (js-response:app tile-js)]~ this]
|
||||
[[ost.bol %http-response not-found:app]~ this]
|
||||
::
|
||||
--
|
@ -1,133 +0,0 @@
|
||||
/+ *server, launch
|
||||
/= index
|
||||
/^ $-(marl manx)
|
||||
/: /===/app/launch/index /!noun/
|
||||
/= script
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/launch/js/index
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
/= style
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/launch/css/index
|
||||
/| /css/
|
||||
/~ ~
|
||||
==
|
||||
/= launch-png
|
||||
/^ (map knot @)
|
||||
/: /===/app/launch/img /_ /png/
|
||||
::
|
||||
=, launch
|
||||
::
|
||||
|_ [bol=bowl:gall sta=state]
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit state)
|
||||
^- (quip move _this)
|
||||
?~ old
|
||||
:_ this
|
||||
[ost.bol %connect / [~ /] %launch]~
|
||||
[~ this(sta u.old)]
|
||||
::
|
||||
++ poke-launch-action
|
||||
|= act=action:launch
|
||||
^- (quip move _this)
|
||||
=/ beforedata (~(get by data.sta) name.act)
|
||||
=/ newdata
|
||||
?~ beforedata
|
||||
(~(put by data.sta) name.act [*json url.act])
|
||||
(~(put by data.sta) name.act [jon.u.beforedata url.act])
|
||||
:- [ost.bol %peer subscribe.act [our.bol name.act] subscribe.act]~
|
||||
%= this
|
||||
tiles.sta (~(put in tiles.sta) [name.act subscribe.act])
|
||||
data.sta newdata
|
||||
path-to-tile.sta (~(put by path-to-tile.sta) subscribe.act name.act)
|
||||
==
|
||||
::
|
||||
++ peer-main
|
||||
|= [pax=path]
|
||||
^- (quip move _this)
|
||||
=/ data/json
|
||||
%- pairs:enjs:format
|
||||
%+ turn ~(tap by data.sta)
|
||||
|= [key=@tas [jon=json url=@t]]
|
||||
[key jon]
|
||||
:_ this
|
||||
[ost.bol %diff %json data]~
|
||||
::
|
||||
++ diff-json
|
||||
|= [pax=path jon=json]
|
||||
^- (quip move _this)
|
||||
=/ name/@tas (~(got by path-to-tile.sta) pax)
|
||||
=/ data/(unit [json url=@t]) (~(get by data.sta) name)
|
||||
?~ data
|
||||
[~ this]
|
||||
::
|
||||
:-
|
||||
%+ turn (prey:pubsub:userlib /main bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %json (frond:enjs:format name jon)]
|
||||
::
|
||||
%= this
|
||||
data.sta (~(put by data.sta) name [jon url.u.data])
|
||||
==
|
||||
::
|
||||
++ generate-script-marl
|
||||
|= data=tile-data
|
||||
^- marl
|
||||
%+ turn ~(tap by data)
|
||||
|= [key=@tas [jon=json url=@t]]
|
||||
^- manx
|
||||
;script@"{(trip url)}";
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:eyre
|
||||
^- (quip move _this)
|
||||
::
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ name=@t
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
=/ site (flop site.request-line)
|
||||
?~ site
|
||||
=/ hym=manx (index (generate-script-marl data.sta))
|
||||
:_ this
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
?+ site.request-line
|
||||
:_ this
|
||||
[ost.bol %http-response not-found:app]~
|
||||
::
|
||||
:: styling
|
||||
::
|
||||
[%'~launch' %css %index ~]
|
||||
:_ this
|
||||
[ost.bol %http-response (css-response:app style)]~
|
||||
::
|
||||
:: javascript
|
||||
::
|
||||
[%'~launch' %js %index ~]
|
||||
:_ this
|
||||
[ost.bol %http-response (js-response:app script)]~
|
||||
::
|
||||
:: images
|
||||
::
|
||||
[%'~launch' %img *]
|
||||
=/ img (as-octs:mimes:html (~(got by launch-png) `@ta`name))
|
||||
:_ this
|
||||
[ost.bol %http-response (png-response:app img)]~
|
||||
==
|
||||
::
|
||||
++ bound
|
||||
|= [wir=wire success=? binding=binding:eyre]
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
::
|
||||
--
|
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 255 B |
@ -1,18 +0,0 @@
|
||||
|= scripts=marl
|
||||
;html
|
||||
;head
|
||||
;title: Home
|
||||
;meta(charset "utf-8");
|
||||
;meta
|
||||
=name "viewport"
|
||||
=content "width=device-width, initial-scale=1, shrink-to-fit=no";
|
||||
;link(rel "stylesheet", href "/~launch/css/index.css");
|
||||
==
|
||||
;body
|
||||
;div#root;
|
||||
;script@"/~/channel/channel.js";
|
||||
;script@"/~modulo/session.js";
|
||||
;* scripts
|
||||
;script@"/~launch/js/index.js";
|
||||
==
|
||||
==
|
@ -1,24 +0,0 @@
|
||||
::
|
||||
|%
|
||||
::
|
||||
+$ move [bone card]
|
||||
::
|
||||
+$ card
|
||||
$% [%http-response =http-event:http]
|
||||
[%connect wire binding:eyre term]
|
||||
[%peer wire dock path]
|
||||
[%diff %json json]
|
||||
==
|
||||
::
|
||||
+$ tile [name=@tas subscribe=path]
|
||||
::
|
||||
+$ tile-data (map @tas [jon=json url=@t])
|
||||
::
|
||||
+$ action [name=@tas subscribe=path url=@t]
|
||||
::
|
||||
+$ state
|
||||
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::
|
||||
/+ launch
|
||||
::
|
||||
|_ act=action:launch
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:launch
|
||||
--
|
||||
--
|
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 1.1 KiB |
@ -1,22 +0,0 @@
|
||||
|= inject=json
|
||||
^- manx
|
||||
;html
|
||||
::
|
||||
;head
|
||||
;title: Publish
|
||||
;meta(charset "utf-8");
|
||||
;meta
|
||||
=name "viewport"
|
||||
=content "width=device-width, initial-scale=1, shrink-to-fit=no";
|
||||
;link(rel "stylesheet", href "/~publish/index.css");
|
||||
;link(rel "icon", type "image/png", href "/~launch/img/Favicon.png");
|
||||
;script@"/~/channel/channel.js";
|
||||
;script@"/~modulo/session.js";
|
||||
;script: window.injectedState = {(en-json:html inject)}
|
||||
==
|
||||
::
|
||||
;body
|
||||
;div#root;
|
||||
;script@"/~publish/index.js";
|
||||
==
|
||||
==
|
@ -1,232 +0,0 @@
|
||||
/- *publish
|
||||
/+ elem-to-react-json
|
||||
|%
|
||||
::
|
||||
++ front-to-post-info
|
||||
|= fro=(map knot cord)
|
||||
^- post-info
|
||||
=/ got ~(got by fro)
|
||||
~| %invalid-frontmatter
|
||||
:* (slav %p (got %creator))
|
||||
(got %title)
|
||||
(got %collection)
|
||||
(got %filename)
|
||||
(comment-config (got %comments))
|
||||
(slav %da (got %date-created))
|
||||
(slav %da (got %last-modified))
|
||||
(rash (got %pinned) (fuss %true %false))
|
||||
==
|
||||
::
|
||||
++ front-to-comment-info
|
||||
|= fro=(map knot cord)
|
||||
^- comment-info
|
||||
=/ got ~(got by fro)
|
||||
~| %invalid-frontmatter
|
||||
:* (slav %p (got %creator))
|
||||
(got %collection)
|
||||
(got %post)
|
||||
(slav %da (got %date-created))
|
||||
(slav %da (got %last-modified))
|
||||
==
|
||||
::
|
||||
++ collection-info-to-json
|
||||
|= con=collection-info
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ :- %owner [%s (scot %p owner.con)]
|
||||
:- %title [%s title.con]
|
||||
:- %comments [%s comments.con]
|
||||
:- %allow-edit [%s allow-edit.con]
|
||||
:- %date-created (time:enjs:format date-created.con)
|
||||
:- %last-modified (time:enjs:format last-modified.con)
|
||||
:- %filename [%s filename.con]
|
||||
==
|
||||
::
|
||||
++ post-info-to-json
|
||||
|= info=post-info
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ :- %creator [%s (scot %p creator.info)]
|
||||
:- %title [%s title.info]
|
||||
:- %comments [%s comments.info]
|
||||
:- %date-created (time:enjs:format date-created.info)
|
||||
:- %last-modified (time:enjs:format last-modified.info)
|
||||
:- %pinned [%b pinned.info]
|
||||
:- %filename [%s filename.info]
|
||||
:- %collection [%s collection.info]
|
||||
==
|
||||
::
|
||||
++ comment-info-to-json
|
||||
|= info=comment-info
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ :- %creator [%s (scot %p creator.info)]
|
||||
:- %date-created (time:enjs:format date-created.info)
|
||||
:- %last-modified (time:enjs:format last-modified.info)
|
||||
:- %post [%s post.info]
|
||||
:- %collection [%s collection.info]
|
||||
==
|
||||
::
|
||||
++ tang-to-json
|
||||
|= tan=tang
|
||||
%- wall:enjs:format
|
||||
%- zing
|
||||
%+ turn tan
|
||||
|= a=tank
|
||||
(wash [0 80] a)
|
||||
::
|
||||
++ string-to-symbol
|
||||
|= tap=tape
|
||||
^- @tas
|
||||
%- crip
|
||||
%+ turn tap
|
||||
|= a=@
|
||||
?: ?| &((gte a 'a') (lte a 'z'))
|
||||
&((gte a '0') (lte a '9'))
|
||||
==
|
||||
a
|
||||
?: &((gte a 'A') (lte a 'Z'))
|
||||
(add 32 a)
|
||||
'-'
|
||||
::
|
||||
++ collection-build-to-json
|
||||
|= bud=(each collection-info tang)
|
||||
^- json
|
||||
?: ?=(%.y -.bud)
|
||||
(collection-info-to-json +.bud)
|
||||
(tang-to-json +.bud)
|
||||
::
|
||||
++ post-build-to-json
|
||||
|= bud=(each [post-info manx @t] tang)
|
||||
^- json
|
||||
?: ?=(%.y -.bud)
|
||||
%- pairs:enjs:format
|
||||
:~ info+(post-info-to-json +<.bud)
|
||||
body+(elem-to-react-json +>-.bud)
|
||||
raw+[%s +>+.bud]
|
||||
==
|
||||
(tang-to-json +.bud)
|
||||
::
|
||||
++ comment-build-to-json
|
||||
|= bud=(each (list [comment-info @t]) tang)
|
||||
^- json
|
||||
?: ?=(%.y -.bud)
|
||||
:- %a
|
||||
%+ turn p.bud
|
||||
|= [com=comment-info bod=@t]
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ info+(comment-info-to-json com)
|
||||
body+s+bod
|
||||
==
|
||||
(tang-to-json +.bud)
|
||||
::
|
||||
++ total-build-to-json
|
||||
|= col=collection
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ info+(collection-build-to-json dat.col.col)
|
||||
::
|
||||
:+ %posts
|
||||
%o
|
||||
%+ roll ~(tap in ~(key by pos.col))
|
||||
|= [post=@tas out=(map @t json)]
|
||||
=/ post-build (~(got by pos.col) post)
|
||||
=/ comm-build (~(got by com.col) post)
|
||||
|
||||
%+ ~(put by out)
|
||||
post
|
||||
%- pairs:enjs:format
|
||||
:~ post+(post-build-to-json dat.post-build)
|
||||
comments+(comment-build-to-json dat.comm-build)
|
||||
==
|
||||
::
|
||||
:- %order
|
||||
%- pairs:enjs:format
|
||||
:~ pin+a+(turn pin.order.col |=(s=@tas [%s s]))
|
||||
unpin+a+(turn unpin.order.col |=(s=@tas [%s s]))
|
||||
==
|
||||
::
|
||||
:- %contributors
|
||||
%- pairs:enjs:format
|
||||
:~ mod+s+mod.contributors.col
|
||||
:+ %who
|
||||
%a
|
||||
%+ turn ~(tap in who.contributors.col)
|
||||
|= who=@p
|
||||
(ship:enjs:format who)
|
||||
==
|
||||
::
|
||||
:+ %subscribers
|
||||
%a
|
||||
%+ turn ~(tap in subscribers.col)
|
||||
|= who=@p
|
||||
^- json
|
||||
(ship:enjs:format who)
|
||||
::
|
||||
[%last-update (time:enjs:format last-update.col)]
|
||||
==
|
||||
::
|
||||
++ state-to-json
|
||||
|= sat=state
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ :+ %pubs
|
||||
%o
|
||||
%+ roll ~(tap by pubs.sat)
|
||||
|= [[nom=@tas col=collection] out=(map @t json)]
|
||||
%+ ~(put by out)
|
||||
nom
|
||||
(total-build-to-json col)
|
||||
::
|
||||
:+ %subs
|
||||
%o
|
||||
%- ~(rep by subs.sat)
|
||||
|= $: [[who=@p nom=@tas] col=collection]
|
||||
out=(map @t [%o (map @t json)])
|
||||
==
|
||||
=/ shp=@t (rsh 3 1 (scot %p who))
|
||||
?: (~(has by out) shp)
|
||||
%+ ~(put by out)
|
||||
shp
|
||||
:- %o
|
||||
%+ ~(put by +:(~(got by out) shp))
|
||||
nom
|
||||
(total-build-to-json col)
|
||||
%+ ~(put by out)
|
||||
shp
|
||||
:- %o
|
||||
(my [nom (total-build-to-json col)] ~)
|
||||
::
|
||||
:+ %latest
|
||||
%a
|
||||
%+ turn latest.sat
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
%- pairs:enjs:format
|
||||
:~ who+(ship:enjs:format who)
|
||||
coll+s+coll
|
||||
post+s+post
|
||||
==
|
||||
::
|
||||
:+ %unread
|
||||
%a
|
||||
%+ turn ~(tap in unread.sat)
|
||||
|= [who=@p coll=@tas post=@tas]
|
||||
%- pairs:enjs:format
|
||||
:~ who+(ship:enjs:format who)
|
||||
coll+s+coll
|
||||
post+s+post
|
||||
==
|
||||
::
|
||||
:+ %invites
|
||||
%a
|
||||
%+ turn ~(tap in invites.sat)
|
||||
|= [[who=@p coll=@tas] title=@t]
|
||||
%- pairs:enjs:format
|
||||
:~ who+(ship:enjs:format who)
|
||||
coll+s+coll
|
||||
title+s+title
|
||||
==
|
||||
==
|
||||
::
|
||||
--
|
@ -1,192 +0,0 @@
|
||||
::
|
||||
:::: /hoon/action/publish/mar
|
||||
::
|
||||
/? 309
|
||||
/- publish
|
||||
=, format
|
||||
::
|
||||
|_ act=action:publish
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ tank >act<
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:publish
|
||||
++ json
|
||||
|= jon=^json
|
||||
%- action:publish
|
||||
=< (action jon)
|
||||
|%
|
||||
++ action
|
||||
%- of:dejs
|
||||
:~ new-collection+new-collection
|
||||
new-post+new-post
|
||||
new-comment+new-comment
|
||||
::
|
||||
delete-collection+delete-collection
|
||||
delete-post+delete-post
|
||||
delete-comment+delete-comment
|
||||
::
|
||||
edit-collection+edit-collection
|
||||
edit-post+edit-post
|
||||
::
|
||||
invite+invite
|
||||
reject-invite+reject-invite
|
||||
::
|
||||
serve+serve
|
||||
unserve+unserve
|
||||
::
|
||||
subscribe+subscribe
|
||||
unsubscribe+unsubscribe
|
||||
::
|
||||
read+read
|
||||
==
|
||||
::
|
||||
++ new-collection
|
||||
%- ot:dejs
|
||||
:~ name+(su:dejs sym)
|
||||
title+so:dejs
|
||||
comments+comment-config
|
||||
allow-edit+edit-config
|
||||
perm+perm-config
|
||||
==
|
||||
::
|
||||
++ new-post
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
name+(su:dejs sym)
|
||||
title+so:dejs
|
||||
comments+comment-config
|
||||
perm+perm-config
|
||||
content+so:dejs
|
||||
==
|
||||
::
|
||||
++ new-comment
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
name+(su:dejs sym)
|
||||
content+so:dejs
|
||||
==
|
||||
::
|
||||
++ delete-collection
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ delete-post
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
post+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ delete-comment
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
post+(su:dejs sym)
|
||||
comment+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ edit-collection
|
||||
%- ot:dejs
|
||||
:~ name+(su:dejs sym)
|
||||
title+so:dejs
|
||||
==
|
||||
::
|
||||
++ edit-post
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
name+(su:dejs sym)
|
||||
title+so:dejs
|
||||
comments+comment-config
|
||||
perm+perm-config
|
||||
content+so:dejs
|
||||
==
|
||||
::
|
||||
++ edit-comment
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
name+(su:dejs sym)
|
||||
id+(su:dejs sym)
|
||||
content+so:dejs
|
||||
==
|
||||
::
|
||||
++ comment-config
|
||||
%- su:dejs
|
||||
;~(pose (jest %open) (jest %closed) (jest %none))
|
||||
::
|
||||
++ edit-config
|
||||
%- su:dejs
|
||||
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
|
||||
::
|
||||
++ perm-config
|
||||
%- ot:dejs
|
||||
:~ :- %read
|
||||
%- ot:dejs
|
||||
:~ mod+(su:dejs ;~(pose (jest %black) (jest %white)))
|
||||
who+whoms
|
||||
==
|
||||
:- %write
|
||||
%- ot:dejs
|
||||
:~ mod+(su:dejs ;~(pose (jest %black) (jest %white)))
|
||||
who+whoms
|
||||
== ==
|
||||
::
|
||||
++ whoms
|
||||
|= jon=^json
|
||||
^- (set whom:clay)
|
||||
=/ x ((ar:dejs (su:dejs fed:ag)) jon)
|
||||
%- (set whom:clay)
|
||||
%- ~(run in (sy x))
|
||||
|=(w=@ [& w])
|
||||
::
|
||||
++ invite
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
title+so:dejs
|
||||
who+(ar:dejs (su:dejs fed:ag))
|
||||
==
|
||||
::
|
||||
++ reject-invite
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ serve
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ unserve
|
||||
%- ot:dejs
|
||||
:~ coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ subscribe
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ unsubscribe
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
++ read
|
||||
%- ot:dejs
|
||||
:~ who+(su:dejs fed:ag)
|
||||
coll+(su:dejs sym)
|
||||
post+(su:dejs sym)
|
||||
==
|
||||
::
|
||||
--
|
||||
--
|
||||
--
|
@ -1,68 +0,0 @@
|
||||
/- publish
|
||||
!:
|
||||
|_ com=comment:publish
|
||||
::
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
:- /text/x-publish-comments
|
||||
(as-octs:mimes:html (of-wain:format txt))
|
||||
++ txt
|
||||
^- wain
|
||||
:* (cat 3 'creator: ' (scot %p creator.info.com))
|
||||
(cat 3 'collection: ' collection.info.com)
|
||||
(cat 3 'post: ' post.info.com)
|
||||
(cat 3 'date-created: ' (scot %da date-created.info.com))
|
||||
(cat 3 'last-modified: ' (scot %da last-modified.info.com))
|
||||
'-----'
|
||||
(to-wain:format body.com)
|
||||
==
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ mime
|
||||
|= [mite:eyre p=octs:eyre]
|
||||
(txt (to-wain:format q.p))
|
||||
++ txt
|
||||
|= txs=(pole @t)
|
||||
^- comment:publish
|
||||
:: TODO: putting ~ instead of * breaks this but shouldn't
|
||||
::
|
||||
?> ?= $: creator=@t
|
||||
collection=@t
|
||||
post=@t
|
||||
date-created=@t
|
||||
last-modified=@t
|
||||
line=@t
|
||||
body=*
|
||||
==
|
||||
txs
|
||||
:_ (of-wain:format (wain body.txs))
|
||||
::
|
||||
:* %+ rash creator.txs
|
||||
;~(pfix (jest 'creator: ~') fed:ag)
|
||||
::
|
||||
%+ rash collection.txs
|
||||
;~(pfix (jest 'collection: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash post.txs
|
||||
;~(pfix (jest 'post: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash date-created.txs
|
||||
;~ pfix
|
||||
(jest 'date-created: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
::
|
||||
%+ rash last-modified.txs
|
||||
;~ pfix
|
||||
(jest 'last-modified: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
::
|
||||
==
|
||||
++ noun comment:publish
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,84 +0,0 @@
|
||||
::
|
||||
:::: /hoon/info/publish/mar
|
||||
::
|
||||
/- publish
|
||||
!:
|
||||
|_ con=collection-info:publish
|
||||
::
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
:- /text/x-publish-info
|
||||
(as-octs:mimes:html (of-wain:format txt))
|
||||
++ txt
|
||||
^- wain
|
||||
:~ (cat 3 'owner: ' (scot %p owner.con))
|
||||
(cat 3 'title: ' title.con)
|
||||
(cat 3 'filename: ' filename.con)
|
||||
(cat 3 'comments: ' comments.con)
|
||||
(cat 3 'allow-edit: ' allow-edit.con)
|
||||
(cat 3 'date-created: ' (scot %da date-created.con))
|
||||
(cat 3 'last-modified: ' (scot %da last-modified.con))
|
||||
==
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ mime
|
||||
|= [mite:eyre p=octs:eyre]
|
||||
(txt (to-wain:format q.p))
|
||||
++ txt
|
||||
|= txs=(pole @t)
|
||||
^- collection-info:publish
|
||||
:: TODO: putting ~ instead of * breaks this but shouldn't
|
||||
::
|
||||
?> ?= $: owner=@t
|
||||
title=@t
|
||||
filename=@t
|
||||
comments=@t
|
||||
allow-edit=@t
|
||||
date-created=@t
|
||||
last-modified=@t
|
||||
*
|
||||
==
|
||||
txs
|
||||
::
|
||||
:* %+ rash owner.txs
|
||||
;~(pfix (jest 'owner: ~') fed:ag)
|
||||
::
|
||||
%+ rash title.txs
|
||||
;~(pfix (jest 'title: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash filename.txs
|
||||
;~(pfix (jest 'filename: ') (cook crip (star next)))
|
||||
::
|
||||
%+ rash comments.txs
|
||||
;~ pfix
|
||||
(jest 'comments: ')
|
||||
%+ cook comment-config:publish
|
||||
;~(pose (jest %open) (jest %closed) (jest %none))
|
||||
==
|
||||
::
|
||||
%+ rash allow-edit.txs
|
||||
;~ pfix
|
||||
(jest 'allow-edit: ')
|
||||
%+ cook edit-config:publish
|
||||
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
|
||||
==
|
||||
::
|
||||
%+ rash date-created.txs
|
||||
;~ pfix
|
||||
(jest 'date-created: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
::
|
||||
%+ rash last-modified.txs
|
||||
;~ pfix
|
||||
(jest 'last-modified: ~')
|
||||
(cook year when:so)
|
||||
==
|
||||
==
|
||||
++ noun collection-info:publish
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,55 +0,0 @@
|
||||
/- *publish
|
||||
/+ *publish
|
||||
|_ rum=rumor
|
||||
++ grab
|
||||
|%
|
||||
++ noun rumor
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ noun rum
|
||||
++ json
|
||||
=, enjs:format
|
||||
%+ frond -.rum
|
||||
?- -.rum
|
||||
%collection
|
||||
%- pairs
|
||||
:~ [%coll s+col.rum]
|
||||
[%who (ship who.rum)]
|
||||
[%data (collection-build-to-json dat.rum)]
|
||||
==
|
||||
::
|
||||
%post
|
||||
%- pairs
|
||||
:~ [%coll s+col.rum]
|
||||
[%post s+pos.rum]
|
||||
[%who (ship who.rum)]
|
||||
[%data (post-build-to-json dat.rum)]
|
||||
==
|
||||
::
|
||||
%comments
|
||||
%- pairs
|
||||
:~ [%coll s+col.rum]
|
||||
[%post s+pos.rum]
|
||||
[%who (ship who.rum)]
|
||||
[%data (comment-build-to-json dat.rum)]
|
||||
==
|
||||
::
|
||||
%total
|
||||
%- pairs
|
||||
:~ [%coll s+col.rum]
|
||||
[%who (ship who.rum)]
|
||||
[%data (total-build-to-json dat.rum)]
|
||||
==
|
||||
::
|
||||
%remove
|
||||
%- pairs
|
||||
:~ [%who (ship who.rum)]
|
||||
[%coll s+col.rum]
|
||||
[%post ?~(pos.rum ~ s+u.pos.rum)]
|
||||
==
|
||||
::
|
||||
==
|
||||
::
|
||||
--
|
||||
--
|
@ -1,26 +0,0 @@
|
||||
/- *publish
|
||||
|_ upd=update
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
++ json
|
||||
=, enjs:format
|
||||
%+ frond -.upd
|
||||
::
|
||||
?- -.upd
|
||||
%invite
|
||||
%- pairs
|
||||
:~ [%who (ship who.upd)]
|
||||
[%add b+add.upd]
|
||||
[%coll s+col.upd]
|
||||
[%title s+title.upd]
|
||||
==
|
||||
::
|
||||
==
|
||||
::
|
||||
--
|
||||
--
|
@ -1,14 +0,0 @@
|
||||
/- publish
|
||||
/+ publish
|
||||
/= result
|
||||
/^ (list comment:publish)
|
||||
/;
|
||||
|= comments=(map knot comment:publish)
|
||||
^- (list [comment-info:publish @t])
|
||||
%+ sort ~(val by comments)
|
||||
|= [a=comment:publish b=comment:publish]
|
||||
^- ?
|
||||
(gte date-created.info.a date-created.info.b)
|
||||
::
|
||||
/_ /publish-comment/
|
||||
result
|
@ -1,20 +0,0 @@
|
||||
/- publish
|
||||
/+ publish, cram, elem-to-react-json
|
||||
/= args /$ ,[beam *]
|
||||
/= result
|
||||
/^ [post-info:publish manx @t]
|
||||
/;
|
||||
|= $: post-front=(map knot cord)
|
||||
post-content=manx
|
||||
post-raw=wain
|
||||
~
|
||||
==
|
||||
:+ (front-to-post-info:publish post-front)
|
||||
post-content
|
||||
(of-wain:format (slag 11 post-raw))
|
||||
::
|
||||
/. /&front&/udon/
|
||||
/&elem&/udon/
|
||||
/&txt&/udon/
|
||||
==
|
||||
result
|
@ -1,122 +0,0 @@
|
||||
|%
|
||||
::
|
||||
+$ action
|
||||
$% $: %new-collection
|
||||
name=@tas
|
||||
title=@t
|
||||
com=comment-config
|
||||
edit=edit-config
|
||||
perm=perm-config
|
||||
==
|
||||
::
|
||||
$: %new-post
|
||||
who=@p
|
||||
coll=@tas
|
||||
name=@tas
|
||||
title=@t
|
||||
com=comment-config
|
||||
perm=perm-config
|
||||
content=@t
|
||||
==
|
||||
::
|
||||
[%new-comment who=@p coll=@tas post=@tas content=@t]
|
||||
::
|
||||
[%delete-collection coll=@tas]
|
||||
[%delete-post coll=@tas post=@tas]
|
||||
[%delete-comment coll=@tas post=@tas comment=@tas]
|
||||
::
|
||||
[%edit-collection name=@tas title=@t]
|
||||
::
|
||||
$: %edit-post
|
||||
who=@p
|
||||
coll=@tas
|
||||
name=@tas
|
||||
title=@t
|
||||
com=comment-config
|
||||
perm=perm-config
|
||||
content=@t
|
||||
==
|
||||
::
|
||||
[%invite coll=@tas title=@t who=(list ship)]
|
||||
[%reject-invite who=@p coll=@tas]
|
||||
::
|
||||
[%serve coll=@tas]
|
||||
[%unserve coll=@tas]
|
||||
::
|
||||
[%subscribe who=@p coll=@tas]
|
||||
[%unsubscribe who=@p coll=@tas]
|
||||
::
|
||||
[%read who=@p coll=@tas post=@tas]
|
||||
==
|
||||
::
|
||||
+$ collection-info
|
||||
$: owner=@p
|
||||
title=@t
|
||||
filename=@tas
|
||||
comments=comment-config
|
||||
allow-edit=edit-config
|
||||
date-created=@da
|
||||
last-modified=@da
|
||||
==
|
||||
::
|
||||
+$ post-info
|
||||
$: creator=@p
|
||||
title=@t
|
||||
collection=@tas
|
||||
filename=@tas
|
||||
comments=comment-config
|
||||
date-created=@da
|
||||
last-modified=@da
|
||||
pinned=?
|
||||
==
|
||||
::
|
||||
+$ comment-info
|
||||
$: creator=@p
|
||||
collection=@tas
|
||||
post=@tas
|
||||
date-created=@da
|
||||
last-modified=@da
|
||||
==
|
||||
::
|
||||
+$ comment [info=comment-info body=@t]
|
||||
::
|
||||
+$ perm-config [read=rule:clay write=rule:clay]
|
||||
::
|
||||
+$ comment-config $?(%open %closed %none)
|
||||
::
|
||||
+$ edit-config $?(%post %comment %all %none)
|
||||
::
|
||||
+$ rumor delta
|
||||
::
|
||||
+$ collection
|
||||
$: col=[=bone dat=(each collection-info tang)]
|
||||
pos=(map @tas [=bone dat=(each [post-info manx @t] tang)])
|
||||
com=(map @tas [=bone dat=(each (list [comment-info @t]) tang)])
|
||||
order=[pin=(list @tas) unpin=(list @tas)]
|
||||
contributors=[mod=?(%white %black) who=(set @p)]
|
||||
subscribers=(set @p)
|
||||
last-update=@da
|
||||
==
|
||||
::
|
||||
+$ state
|
||||
$: pubs=(map @tas collection)
|
||||
subs=(map [ship @tas] collection)
|
||||
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
|
||||
latest=(list [who=ship coll=@tas post=@tas])
|
||||
unread=(set [who=ship coll=@tas post=@tas])
|
||||
invites=(map [who=ship coll=@tas] title=@t)
|
||||
outgoing=(map path bone)
|
||||
==
|
||||
::
|
||||
+$ delta
|
||||
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
|
||||
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]
|
||||
[%comments who=@p col=@tas pos=@tas dat=(each (list comment) tang)]
|
||||
[%total who=@p col=@tas dat=collection]
|
||||
[%remove who=@p col=@tas pos=(unit @tas)]
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
$% [%invite add=? who=@p col=@tas title=@t]
|
||||
==
|
||||
--
|
@ -1,125 +0,0 @@
|
||||
/+ *server
|
||||
/= tile-js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/timer/js/tile
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
/= timer-png
|
||||
/^ (map knot @)
|
||||
/: /===/app/timer/img /_ /png/
|
||||
=, format
|
||||
::
|
||||
|%
|
||||
:: +move: output effect
|
||||
::
|
||||
+$ move [bone card]
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ poke
|
||||
$% [%launch-action [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ card
|
||||
$% [%poke wire dock poke]
|
||||
[%http-response =http-event:http]
|
||||
[%connect wire binding:eyre term]
|
||||
[%diff %json json]
|
||||
[%wait wire @da]
|
||||
[%rest wire @da]
|
||||
==
|
||||
::
|
||||
--
|
||||
::
|
||||
|_ [bol=bowl:gall tim=@da]
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
++ bound
|
||||
|= [wir=wire success=? binding=binding:eyre]
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit tim=@da)
|
||||
^- (quip move _this)
|
||||
=/ launcha [%launch-action [%timer /tile '/~timer/js/tile.js']]
|
||||
:-
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~timer'] %timer]
|
||||
[ost.bol %poke /timer [our.bol %launch] launcha]
|
||||
==
|
||||
?~ old
|
||||
this
|
||||
%= this
|
||||
tim tim.u.old
|
||||
==
|
||||
::
|
||||
++ peer-tile
|
||||
|= pax=path
|
||||
^- (quip move _this)
|
||||
?: =(tim *@da)
|
||||
[[ost.bol %diff %json [%s '']]~ this]
|
||||
[[ost.bol %diff %json [%s (scot %da tim)]]~ this]
|
||||
::
|
||||
++ send-tile-diff
|
||||
|= jon=json
|
||||
^- (list move)
|
||||
%+ turn (prey:pubsub:userlib /tile bol)
|
||||
|= [=bone ^]
|
||||
[bone %diff %json jon]
|
||||
::
|
||||
++ poke-json
|
||||
|= jon=json
|
||||
^- (quip move _this)
|
||||
?. ?=(%s -.jon)
|
||||
[~ this]
|
||||
=/ str/@t +.jon
|
||||
?: =(str 'start')
|
||||
=/ data/@da (add now.bol ~m20)
|
||||
:_ this(tim data)
|
||||
[[ost.bol %wait /timer data] (send-tile-diff [%s (scot %da data)])]
|
||||
?: =(str 'stop')
|
||||
:_ this(tim *@da)
|
||||
[[ost.bol %rest /timer tim] (send-tile-diff [%s ''])]
|
||||
[~ this]
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:eyre
|
||||
^- (quip move _this)
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ back-path (flop site.request-line)
|
||||
=/ name=@t
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
::
|
||||
?+ site.request-line
|
||||
[[ost.bol %http-response not-found:app]~ this]
|
||||
::
|
||||
:: tile
|
||||
::
|
||||
[%'~timer' %js %tile ~]
|
||||
[[ost.bol %http-response (js-response:app tile-js)]~ this]
|
||||
::
|
||||
:: images
|
||||
::
|
||||
[%'~timer' %img *]
|
||||
=/ img (as-octs:mimes:html (~(got by timer-png) `@ta`name))
|
||||
:_ this
|
||||
[ost.bol %http-response (png-response:app img)]~
|
||||
==
|
||||
::
|
||||
++ wake
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
?~ err
|
||||
:- (send-tile-diff [%s 'alarm'])
|
||||
this(tim *@da)
|
||||
~& err
|
||||
[~ this]
|
||||
::
|
||||
--
|
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB |
@ -1,170 +0,0 @@
|
||||
/+ *server
|
||||
/= tile-js
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/weather/js/tile
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
/= weather-png
|
||||
/^ (map knot @)
|
||||
/: /===/app/weather/img /_ /png/
|
||||
=, format
|
||||
::
|
||||
|%
|
||||
:: +move: output effect
|
||||
::
|
||||
+$ move [bone card]
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ card
|
||||
$% [%poke wire dock poke]
|
||||
[%http-response =http-event:http]
|
||||
[%diff %json json]
|
||||
[%connect wire binding:eyre term]
|
||||
[%request wire request:http outbound-config:iris]
|
||||
[%wait wire @da]
|
||||
==
|
||||
+$ poke
|
||||
$% [%launch-action [@tas path @t]]
|
||||
==
|
||||
+$ state
|
||||
$% [%0 data=json time=@da location=@t timer=(unit @da)]
|
||||
==
|
||||
--
|
||||
::
|
||||
|_ [bol=bowl:gall state]
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
++ bound
|
||||
|= [wir=wire success=? binding=binding:eyre]
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit state)
|
||||
^- (quip move _this)
|
||||
=/ launcha
|
||||
[%launch-action [%weather /weathertile '/~weather/js/tile.js']]
|
||||
:-
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~weather'] %weather]
|
||||
[ost.bol %poke /weather [our.bol %launch] launcha]
|
||||
==
|
||||
?~ old
|
||||
this
|
||||
%= this
|
||||
data data.u.old
|
||||
time time.u.old
|
||||
==
|
||||
::
|
||||
++ peer-weathertile
|
||||
|= pax=path
|
||||
^- (quip move _this)
|
||||
[[ost.bol %diff %json data]~ this]
|
||||
::
|
||||
++ poke-json
|
||||
|= jon=json
|
||||
^- (quip move _this)
|
||||
?. ?=(%s -.jon)
|
||||
[~ this]
|
||||
=/ str/@t +.jon
|
||||
=/ req/request:http (request-darksky str)
|
||||
=/ out *outbound-config:iris
|
||||
=/ lismov [ost.bol %request /[(scot %da now.bol)] req out]~
|
||||
?~ timer
|
||||
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
|
||||
%= this
|
||||
location str
|
||||
timer `(add now.bol ~h3)
|
||||
==
|
||||
:- lismov
|
||||
%= this
|
||||
location str
|
||||
==
|
||||
::
|
||||
++ request-darksky
|
||||
|= location=@t
|
||||
^- request:http
|
||||
=/ url/@t
|
||||
%- crip %+ weld
|
||||
(trip 'https://api.darksky.net/forecast/634639c10670c7376dc66b6692fe57ca/')
|
||||
(trip location)
|
||||
=/ hed [['Accept' 'application/json']]~
|
||||
[%'GET' url hed *(unit octs)]
|
||||
::
|
||||
++ send-tile-diff
|
||||
|= jon=json
|
||||
^- (list move)
|
||||
%+ turn (prey:pubsub:userlib /weathertile bol)
|
||||
|= [=bone ^]
|
||||
[bone %diff %json jon]
|
||||
::
|
||||
++ http-response
|
||||
|= [=wire response=client-response:iris]
|
||||
^- (quip move _this)
|
||||
:: ignore all but %finished
|
||||
?. ?=(%finished -.response)
|
||||
[~ this]
|
||||
=/ data/(unit mime-data:iris) full-file.response
|
||||
?~ data
|
||||
:: data is null
|
||||
[~ this]
|
||||
=/ ujon/(unit json) (de-json:html q.data.u.data)
|
||||
?~ ujon
|
||||
[~ this]
|
||||
?> ?=(%o -.u.ujon)
|
||||
?: (gth 200 status-code.response-header.response)
|
||||
~& weather+u.ujon
|
||||
~& weather+location
|
||||
[~ this]
|
||||
=/ jon/json %- pairs:enjs:format :~
|
||||
currently+(~(got by p.u.ujon) 'currently')
|
||||
daily+(~(got by p.u.ujon) 'daily')
|
||||
==
|
||||
:- (send-tile-diff jon)
|
||||
%= this
|
||||
data jon
|
||||
time now.bol
|
||||
==
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:eyre
|
||||
^- (quip move _this)
|
||||
=/ request-line (parse-request-line url.request.inbound-request)
|
||||
=/ back-path (flop site.request-line)
|
||||
=/ name=@t
|
||||
=/ back-path (flop site.request-line)
|
||||
?~ back-path
|
||||
''
|
||||
i.back-path
|
||||
::
|
||||
?~ back-path
|
||||
:_ this ~
|
||||
?: =(name 'tile')
|
||||
[[ost.bol %http-response (js-response:app tile-js)]~ this]
|
||||
?: (lte (lent back-path) 1)
|
||||
[[ost.bol %http-response not-found:app]~ this]
|
||||
?: =(&2:site.request-line 'img')
|
||||
=/ img (as-octs:mimes:html (~(got by weather-png) `@ta`name))
|
||||
[[ost.bol %http-response (png-response:app img)]~ this]
|
||||
[~ this]
|
||||
::
|
||||
++ wake
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
?~ err
|
||||
=/ req/request:http (request-darksky location)
|
||||
=/ out *outbound-config:iris
|
||||
=/ lismov/(list move)
|
||||
[ost.bol %request /[(scot %da now.bol)] req out]~
|
||||
?~ timer
|
||||
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
|
||||
this(timer `(add now.bol ~h3))
|
||||
[lismov this]
|
||||
~& err
|
||||
[~ this]
|
||||
::
|
||||
--
|
Before Width: | Height: | Size: 549 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 521 B |