2019-06-05 00:29:53 +03:00
|
|
|
/+ *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
|
2019-06-28 21:22:11 +03:00
|
|
|
$% [%launch-action [@tas path @t]]
|
2019-06-05 00:29:53 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ card
|
|
|
|
$% [%poke wire dock poke]
|
|
|
|
[%http-response =http-event:http]
|
2019-07-04 09:09:44 +03:00
|
|
|
[%connect wire binding:eyre term]
|
2019-06-05 00:29:53 +03:00
|
|
|
[%diff %json json]
|
|
|
|
[%wait wire @da]
|
|
|
|
[%rest wire @da]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
--
|
|
|
|
::
|
|
|
|
|_ [bol=bowl:gall tim=@da]
|
|
|
|
::
|
|
|
|
++ this .
|
|
|
|
::
|
|
|
|
++ bound
|
2019-07-04 09:09:44 +03:00
|
|
|
|= [wir=wire success=? binding=binding:eyre]
|
2019-06-05 00:29:53 +03:00
|
|
|
^- (quip move _this)
|
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ prep
|
|
|
|
|= old=(unit tim=@da)
|
|
|
|
^- (quip move _this)
|
2019-06-28 21:22:11 +03:00
|
|
|
=/ launcha [%launch-action [%timer /tile '/~timer/js/tile.js']]
|
2019-06-28 00:36:50 +03:00
|
|
|
:-
|
|
|
|
:~
|
|
|
|
[ost.bol %connect / [~ /'~timer'] %timer]
|
2019-06-28 21:22:11 +03:00
|
|
|
[ost.bol %poke /timer [our.bol %launch] launcha]
|
2019-06-28 00:36:50 +03:00
|
|
|
==
|
2019-06-05 00:29:53 +03:00
|
|
|
?~ 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 ~s10)
|
2019-06-28 00:36:50 +03:00
|
|
|
:_ this(tim data)
|
|
|
|
[[ost.bol %wait /timer data] (send-tile-diff [%s (scot %da data)])]
|
2019-06-05 00:29:53 +03:00
|
|
|
?: =(str 'stop')
|
2019-06-28 00:36:50 +03:00
|
|
|
:_ this(tim *@da)
|
|
|
|
[[ost.bol %rest /timer tim] (send-tile-diff [%s ''])]
|
2019-06-05 00:29:53 +03:00
|
|
|
[~ this]
|
|
|
|
::
|
|
|
|
++ poke-handle-http-request
|
|
|
|
%- (require-authorization:app ost.bol move this)
|
2019-07-04 09:09:44 +03:00
|
|
|
|= =inbound-request:eyre
|
2019-06-05 00:29:53 +03:00
|
|
|
^- (quip move _this)
|
2019-06-28 00:36:50 +03:00
|
|
|
=/ request-line (parse-request-line url.request.inbound-request)
|
|
|
|
=/ back-path (flop site.request-line)
|
2019-06-05 00:29:53 +03:00
|
|
|
=/ name=@t
|
2019-06-28 00:36:50 +03:00
|
|
|
=/ back-path (flop site.request-line)
|
2019-06-05 00:29:53 +03:00
|
|
|
?~ back-path
|
|
|
|
''
|
|
|
|
i.back-path
|
|
|
|
::
|
|
|
|
?+ site.request-line
|
|
|
|
[[ost.bol %http-response not-found:app]~ this]
|
|
|
|
::
|
|
|
|
:: tile
|
|
|
|
::
|
2019-06-21 21:35:28 +03:00
|
|
|
[%'~timer' %js %tile ~]
|
2019-06-05 00:29:53 +03:00
|
|
|
[[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)
|
2019-07-01 19:46:34 +03:00
|
|
|
?~ err
|
|
|
|
:- (send-tile-diff [%s 'alarm'])
|
|
|
|
this(tim *@da)
|
|
|
|
~& err
|
|
|
|
[~ this]
|
2019-06-05 00:29:53 +03:00
|
|
|
::
|
|
|
|
--
|