mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 05:22:27 +03:00
Merge pull request #1319 from urbit/rc-modulo
Updated parts of interface and rver
This commit is contained in:
commit
fb700523ce
@ -50,7 +50,8 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit state)
|
|= old=(unit state)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=/ launchnoun [%noun [%chat /chattile '/~chat/js/tile.js']]
|
=/ launcha/poke
|
||||||
|
[%launch-action [%chat /chattile '/~chat/js/tile.js']]
|
||||||
?~ old
|
?~ old
|
||||||
=/ inboxpat /circle/inbox/config/group
|
=/ inboxpat /circle/inbox/config/group
|
||||||
=/ circlespat /circles/[(scot %p our.bol)]
|
=/ circlespat /circles/[(scot %p our.bol)]
|
||||||
@ -63,9 +64,9 @@
|
|||||||
[ost.bol %peer circlespat [our.bol %hall] circlespat]
|
[ost.bol %peer circlespat [our.bol %hall] circlespat]
|
||||||
[ost.bol %connect / [~ /'~chat'] %chat]
|
[ost.bol %connect / [~ /'~chat'] %chat]
|
||||||
[ost.bol %poke /chat [our.bol %hall] inboxi]
|
[ost.bol %poke /chat [our.bol %hall] inboxi]
|
||||||
[ost.bol %poke /chat [our.bol %launch] launchnoun]
|
[ost.bol %poke /chat [our.bol %launch] launcha]
|
||||||
==
|
==
|
||||||
:- [ost.bol %poke /chat [our.bol %launch] launchnoun]~
|
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
|
||||||
this(sta u.old)
|
this(sta u.old)
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@
|
|||||||
:: +card: output effect payload
|
:: +card: output effect payload
|
||||||
::
|
::
|
||||||
+$ poke
|
+$ poke
|
||||||
$% [%noun [@tas path @t]]
|
$% [%launch-action [@tas path @t]]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ card
|
+$ card
|
||||||
@ -39,11 +39,12 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit ~)
|
|= old=(unit ~)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=/ launchnoun [%noun [%clock /tile '/~clock/js/tile.js']]
|
=/ launcha
|
||||||
|
[%launch-action [%clock /tile '/~clock/js/tile.js']]
|
||||||
:_ this
|
:_ this
|
||||||
:~
|
:~
|
||||||
[ost.bol %connect / [~ /'~clock'] %clock]
|
[ost.bol %connect / [~ /'~clock'] %clock]
|
||||||
[ost.bol %poke /clock [our.bol %launch] launchnoun]
|
[ost.bol %poke /clock [our.bol %launch] launcha]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ peer-tile
|
++ peer-tile
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,4 @@
|
|||||||
|
/+ *server, launch
|
||||||
/+ *server, collections
|
|
||||||
/= index
|
/= index
|
||||||
/^ $-(marl manx)
|
/^ $-(marl manx)
|
||||||
/: /===/app/launch/index /!noun/
|
/: /===/app/launch/index /!noun/
|
||||||
@ -21,23 +20,7 @@
|
|||||||
/^ (map knot @)
|
/^ (map knot @)
|
||||||
/: /===/app/launch/img /_ /png/
|
/: /===/app/launch/img /_ /png/
|
||||||
::
|
::
|
||||||
|%
|
=, launch
|
||||||
::
|
|
||||||
+$ 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])
|
|
||||||
+$ state
|
|
||||||
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
--
|
|
||||||
::
|
::
|
||||||
|_ [bol=bowl:gall sta=state]
|
|_ [bol=bowl:gall sta=state]
|
||||||
::
|
::
|
||||||
@ -46,32 +29,37 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit state)
|
|= old=(unit state)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
~& 'launch prep'
|
|
||||||
?~ old
|
?~ old
|
||||||
:_ this
|
:_ this
|
||||||
[ost.bol %connect / [~ /] %launch]~
|
[ost.bol %connect / [~ /] %launch]~
|
||||||
[~ this(sta u.old)]
|
[~ this(sta u.old)]
|
||||||
::
|
::
|
||||||
++ bound
|
++ poke-launch-action
|
||||||
|= [wir=wire success=? binding=binding:eyre]
|
|= act=action:launch
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
[~ this]
|
=/ beforedata (~(get by data.sta) name.act)
|
||||||
::
|
|
||||||
++ poke-noun
|
|
||||||
|= [name=@tas subscribe=path url=@t]
|
|
||||||
^- (quip move _this)
|
|
||||||
=/ beforedata (~(get by data.sta) name)
|
|
||||||
=/ newdata
|
=/ newdata
|
||||||
?~ beforedata
|
?~ beforedata
|
||||||
(~(put by data.sta) name [*json url])
|
(~(put by data.sta) name.act [*json url.act])
|
||||||
(~(put by data.sta) name [jon.u.beforedata url])
|
(~(put by data.sta) name.act [jon.u.beforedata url.act])
|
||||||
:- [ost.bol %peer subscribe [our.bol name] subscribe]~
|
:- [ost.bol %peer subscribe.act [our.bol name.act] subscribe.act]~
|
||||||
%= this
|
%= this
|
||||||
tiles.sta (~(put in tiles.sta) [name subscribe])
|
tiles.sta (~(put in tiles.sta) [name.act subscribe.act])
|
||||||
data.sta newdata
|
data.sta newdata
|
||||||
path-to-tile.sta (~(put by path-to-tile.sta) subscribe name)
|
path-to-tile.sta (~(put by path-to-tile.sta) subscribe.act name.act)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ peer-main
|
||||||
|
|= [pax=path]
|
||||||
|
^- (quip move _this)
|
||||||
|
=/ data/json
|
||||||
|
%- pairs:enjs:format
|
||||||
|
%+ turn ~(tap by data.sta)
|
||||||
|
|= [key=@tas [jon=json url=@t]]
|
||||||
|
[key jon]
|
||||||
|
:_ this
|
||||||
|
[ost.bol %diff %json data]~
|
||||||
|
::
|
||||||
++ diff-json
|
++ diff-json
|
||||||
|= [pax=path jon=json]
|
|= [pax=path jon=json]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
@ -89,17 +77,6 @@
|
|||||||
data.sta (~(put by data.sta) name [jon url.u.data])
|
data.sta (~(put by data.sta) name [jon url.u.data])
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ peer-main
|
|
||||||
|= [pax=path]
|
|
||||||
^- (quip move _this)
|
|
||||||
=/ data/json
|
|
||||||
%- pairs:enjs:format
|
|
||||||
%+ turn ~(tap by data.sta)
|
|
||||||
|= [key=@tas [jon=json url=@t]]
|
|
||||||
[key jon]
|
|
||||||
:_ this
|
|
||||||
[ost.bol %diff %json data]~
|
|
||||||
::
|
|
||||||
++ generate-script-marl
|
++ generate-script-marl
|
||||||
|= data=tile-data
|
|= data=tile-data
|
||||||
^- marl
|
^- marl
|
||||||
@ -113,9 +90,9 @@
|
|||||||
|= =inbound-request:eyre
|
|= =inbound-request:eyre
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
::
|
::
|
||||||
=+ request-line=(parse-request-line url.request.inbound-request)
|
=/ request-line (parse-request-line url.request.inbound-request)
|
||||||
=/ name=@t
|
=/ name=@t
|
||||||
=+ back-path=(flop site.request-line)
|
=/ back-path (flop site.request-line)
|
||||||
?~ back-path
|
?~ back-path
|
||||||
''
|
''
|
||||||
i.back-path
|
i.back-path
|
||||||
@ -148,4 +125,9 @@
|
|||||||
[ost.bol %http-response (png-response:app img)]~
|
[ost.bol %http-response (png-response:app img)]~
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ bound
|
||||||
|
|= [wir=wire success=? binding=binding:eyre]
|
||||||
|
^- (quip move _this)
|
||||||
|
[~ this]
|
||||||
|
::
|
||||||
--
|
--
|
||||||
|
File diff suppressed because one or more lines are too long
@ -18,7 +18,7 @@
|
|||||||
:: +card: output effect payload
|
:: +card: output effect payload
|
||||||
::
|
::
|
||||||
+$ poke
|
+$ poke
|
||||||
$% [%noun [@tas path @t]]
|
$% [%launch-action [@tas path @t]]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ card
|
+$ card
|
||||||
@ -44,11 +44,11 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit tim=@da)
|
|= old=(unit tim=@da)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=/ launchnoun [%noun [%timer /tile '/~timer/js/tile.js']]
|
=/ launcha [%launch-action [%timer /tile '/~timer/js/tile.js']]
|
||||||
:-
|
:-
|
||||||
:~
|
:~
|
||||||
[ost.bol %connect / [~ /'~timer'] %timer]
|
[ost.bol %connect / [~ /'~timer'] %timer]
|
||||||
[ost.bol %poke /timer [our.bol %launch] launchnoun]
|
[ost.bol %poke /timer [our.bol %launch] launcha]
|
||||||
==
|
==
|
||||||
?~ old
|
?~ old
|
||||||
this
|
this
|
||||||
@ -116,7 +116,10 @@
|
|||||||
++ wake
|
++ wake
|
||||||
|= [wir=wire err=(unit tang)]
|
|= [wir=wire err=(unit tang)]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
:- (send-tile-diff [%s 'alarm'])
|
?~ err
|
||||||
this(tim *@da)
|
:- (send-tile-diff [%s 'alarm'])
|
||||||
|
this(tim *@da)
|
||||||
|
~& err
|
||||||
|
[~ this]
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
|
File diff suppressed because one or more lines are too long
@ -26,7 +26,7 @@
|
|||||||
[%wait wire @da]
|
[%wait wire @da]
|
||||||
==
|
==
|
||||||
+$ poke
|
+$ poke
|
||||||
$% [%noun [@tas path @t]]
|
$% [%launch-action [@tas path @t]]
|
||||||
==
|
==
|
||||||
+$ state
|
+$ state
|
||||||
$% [%0 data=json time=@da location=@t timer=(unit @da)]
|
$% [%0 data=json time=@da location=@t timer=(unit @da)]
|
||||||
@ -45,10 +45,12 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit state)
|
|= old=(unit state)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
|
=/ launcha
|
||||||
|
[%launch-action [%weather /weathertile '/~weather/js/tile.js']]
|
||||||
:-
|
:-
|
||||||
:~
|
:~
|
||||||
[ost.bol %connect / [~ /'~weather'] %weather]
|
[ost.bol %connect / [~ /'~weather'] %weather]
|
||||||
[ost.bol %poke /weather [our.bol %launch] [%noun [%weather /weathertile '/~weather/js/tile.js']]]
|
[ost.bol %poke /weather [our.bol %launch] launcha]
|
||||||
==
|
==
|
||||||
?~ old
|
?~ old
|
||||||
this
|
this
|
||||||
@ -70,15 +72,14 @@
|
|||||||
=/ str/@t +.jon
|
=/ str/@t +.jon
|
||||||
=/ req/request:http (request-darksky str)
|
=/ req/request:http (request-darksky str)
|
||||||
=/ out *outbound-config:iris
|
=/ out *outbound-config:iris
|
||||||
|
=/ lismov [ost.bol %request /[(scot %da now.bol)] req out]~
|
||||||
?~ timer
|
?~ timer
|
||||||
:- %+ weld
|
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
|
||||||
`(list move)`[ost.bol %wait /timer (add now.bol ~d1)]~
|
|
||||||
`(list move)`[ost.bol %request /[(scot %da now.bol)] req out]~
|
|
||||||
%= this
|
%= this
|
||||||
location str
|
location str
|
||||||
timer `(add now.bol ~d1)
|
timer `(add now.bol ~h3)
|
||||||
==
|
==
|
||||||
:- [ost.bol %request /[(scot %da now.bol)] req out]~
|
:- lismov
|
||||||
%= this
|
%= this
|
||||||
location str
|
location str
|
||||||
==
|
==
|
||||||
@ -110,17 +111,21 @@
|
|||||||
?~ data
|
?~ data
|
||||||
:: data is null
|
:: data is null
|
||||||
[~ this]
|
[~ this]
|
||||||
=/ jon/(unit json) (de-json:html q.data.u.data)
|
=/ ujon/(unit json) (de-json:html q.data.u.data)
|
||||||
?~ jon
|
?~ ujon
|
||||||
[~ this]
|
[~ this]
|
||||||
?> ?=(%o -.u.jon)
|
?> ?=(%o -.u.ujon)
|
||||||
=/ ayyy/json %- pairs:enjs:format :~
|
?: (gth 200 status-code.response-header.response)
|
||||||
currently+(~(got by p.u.jon) 'currently')
|
~& weather+u.ujon
|
||||||
daily+(~(got by p.u.jon) 'daily')
|
~& weather+location
|
||||||
|
[~ this]
|
||||||
|
=/ jon/json %- pairs:enjs:format :~
|
||||||
|
currently+(~(got by p.u.ujon) 'currently')
|
||||||
|
daily+(~(got by p.u.ujon) 'daily')
|
||||||
==
|
==
|
||||||
:- (send-tile-diff ayyy)
|
:- (send-tile-diff jon)
|
||||||
%= this
|
%= this
|
||||||
data ayyy
|
data jon
|
||||||
time now.bol
|
time now.bol
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -128,10 +133,10 @@
|
|||||||
%- (require-authorization:app ost.bol move this)
|
%- (require-authorization:app ost.bol move this)
|
||||||
|= =inbound-request:eyre
|
|= =inbound-request:eyre
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=+ request-line=(parse-request-line url.request.inbound-request)
|
=/ request-line (parse-request-line url.request.inbound-request)
|
||||||
=+ back-path=(flop site.request-line)
|
=/ back-path (flop site.request-line)
|
||||||
=/ name=@t
|
=/ name=@t
|
||||||
=+ back-path=(flop site.request-line)
|
=/ back-path (flop site.request-line)
|
||||||
?~ back-path
|
?~ back-path
|
||||||
''
|
''
|
||||||
i.back-path
|
i.back-path
|
||||||
@ -150,12 +155,16 @@
|
|||||||
++ wake
|
++ wake
|
||||||
|= [wir=wire err=(unit tang)]
|
|= [wir=wire err=(unit tang)]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=/ req/request:http (request-darksky location)
|
?~ err
|
||||||
=/ lismov/(list move)
|
=/ req/request:http (request-darksky location)
|
||||||
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:iris]~
|
=/ out *outbound-config:iris
|
||||||
?~ timer
|
=/ lismov/(list move)
|
||||||
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~h3)]~)
|
[ost.bol %request /[(scot %da now.bol)] req out]~
|
||||||
this(timer `(add now.bol ~h3))
|
?~ timer
|
||||||
[lismov this]
|
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov]
|
||||||
|
this(timer `(add now.bol ~h3))
|
||||||
|
[lismov this]
|
||||||
|
~& err
|
||||||
|
[~ this]
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
|
File diff suppressed because one or more lines are too long
@ -55,7 +55,7 @@
|
|||||||
+$ poke
|
+$ poke
|
||||||
$% [%hall-action action:hall]
|
$% [%hall-action action:hall]
|
||||||
[%write-action action]
|
[%write-action action]
|
||||||
[%noun @tas path @t]
|
[%launch-action @tas path @t]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ diff
|
+$ diff
|
||||||
@ -188,7 +188,7 @@
|
|||||||
:_ this(sat *state)
|
:_ this(sat *state)
|
||||||
:~ [ost.bol %connect / [~ /'~publish'] %write]
|
:~ [ost.bol %connect / [~ /'~publish'] %write]
|
||||||
:* ost.bol %poke /publish [our.bol %launch]
|
:* ost.bol %poke /publish [our.bol %launch]
|
||||||
%noun %write /publishtile '/~publish/tile.js'
|
%launch-action %write /publishtile '/~publish/tile.js'
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@
|
|||||||
::
|
::
|
||||||
+$ poke
|
+$ poke
|
||||||
$% [%hall-action action:hall]
|
$% [%hall-action action:hall]
|
||||||
[%noun [@tas path @t]]
|
[%launch-action [@tas path @t]]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ state
|
+$ state
|
||||||
|
24
pkg/arvo/lib/launch.hoon
Normal file
24
pkg/arvo/lib/launch.hoon
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
::
|
||||||
|
|%
|
||||||
|
::
|
||||||
|
+$ move [bone card]
|
||||||
|
::
|
||||||
|
+$ card
|
||||||
|
$% [%http-response =http-event:http]
|
||||||
|
[%connect wire binding:eyre term]
|
||||||
|
[%peer wire dock path]
|
||||||
|
[%diff %json json]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ tile [name=@tas subscribe=path]
|
||||||
|
::
|
||||||
|
+$ tile-data (map @tas [jon=json url=@t])
|
||||||
|
::
|
||||||
|
+$ action [name=@tas subscribe=path url=@t]
|
||||||
|
::
|
||||||
|
+$ state
|
||||||
|
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
--
|
||||||
|
::
|
11
pkg/arvo/mar/launch/action.hoon
Normal file
11
pkg/arvo/mar/launch/action.hoon
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
::
|
||||||
|
::
|
||||||
|
/+ launch
|
||||||
|
::
|
||||||
|
|_ act=action:launch
|
||||||
|
::
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ noun action:launch
|
||||||
|
--
|
||||||
|
--
|
@ -339,7 +339,7 @@
|
|||||||
:: +login-page: internal page to login to an Urbit
|
:: +login-page: internal page to login to an Urbit
|
||||||
::
|
::
|
||||||
++ login-page
|
++ login-page
|
||||||
|= redirect-url=(unit @t)
|
|= [redirect-url=(unit @t) our=@p]
|
||||||
^- octs
|
^- octs
|
||||||
=+ redirect-str=?~(redirect-url "" (trip u.redirect-url))
|
=+ redirect-str=?~(redirect-url "" (trip u.redirect-url))
|
||||||
%- as-octs:mimes:html
|
%- as-octs:mimes:html
|
||||||
@ -347,14 +347,91 @@
|
|||||||
%- en-xml:html
|
%- en-xml:html
|
||||||
;html
|
;html
|
||||||
;head
|
;head
|
||||||
|
;meta(charset "utf-8");
|
||||||
;title:"Sign in"
|
;title:"Sign in"
|
||||||
|
;style:'''
|
||||||
|
@import url("https://rsms.me/inter/inter.css");
|
||||||
|
@font-face {
|
||||||
|
font-family: "Source Code Pro";
|
||||||
|
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-medium.woff");
|
||||||
|
font-weight: 500
|
||||||
|
}
|
||||||
|
html, body {
|
||||||
|
font-family: Inter, sans-serif;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 !important;
|
||||||
|
width: 100%;
|
||||||
|
background: #000;
|
||||||
|
color: #fff;
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
margin: 0 !important;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
#topborder {
|
||||||
|
border-top: 3px #fff solid;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
line-height: 77px;
|
||||||
|
font-size: 64px;
|
||||||
|
-webkit-margin-before: 0;
|
||||||
|
-webkit-margin-after: 0;
|
||||||
|
-webkit-margin-start: 0;
|
||||||
|
-webkit-margin-end: 0;
|
||||||
|
font-weight: 500;
|
||||||
|
flex: 1;
|
||||||
|
padding-top: 22px;
|
||||||
|
margin-bottom: 66px;
|
||||||
|
}
|
||||||
|
#main {
|
||||||
|
vertical-align: middle;
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 64px;
|
||||||
|
line-height: 77px;
|
||||||
|
color: #fff;
|
||||||
|
background: #000;
|
||||||
|
border: none;
|
||||||
|
flex: 1;
|
||||||
|
margin-bottom: 66px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: 'Source Code Pro', monospace, sans-serif;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background: #000;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 77px;
|
||||||
|
font-size: 64px;
|
||||||
|
text-align: left;
|
||||||
|
flex: 1;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
#inner {
|
||||||
|
width: 75%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
'''
|
||||||
==
|
==
|
||||||
;body
|
;body
|
||||||
;h1:"Sign in"
|
;div#main
|
||||||
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
|
;div#inner
|
||||||
;input(type "password", name "password", placeholder "passcode");
|
;h1#topborder:"Modulo"
|
||||||
;input(type "hidden", name "redirect", value redirect-str);
|
;h1:"{(scow %p our)}"
|
||||||
;button(type "submit"):"Login"
|
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
|
||||||
|
;input(type "password", name "password", placeholder "passcode", autofocus "true");
|
||||||
|
;input(type "hidden", name "redirect", value redirect-str);
|
||||||
|
;button(type "submit"):"→ Authenticate"
|
||||||
|
==
|
||||||
|
==
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
@ -546,10 +623,10 @@
|
|||||||
//
|
//
|
||||||
delete() {
|
delete() {
|
||||||
var id = this.nextId();
|
var id = this.nextId();
|
||||||
this.sendJSONToChannel({
|
navigator.sendBeacon(this.channelURL(), JSON.stringify([{
|
||||||
"id": id,
|
"id": id,
|
||||||
"action": "delete"
|
"action": "delete"
|
||||||
}, false);
|
}]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsubscribe to a specific subscription
|
// unsubscribe to a specific subscription
|
||||||
@ -565,7 +642,7 @@
|
|||||||
|
|
||||||
// sends a JSON command command to the server.
|
// sends a JSON command command to the server.
|
||||||
//
|
//
|
||||||
sendJSONToChannel(j, connectAgain = true) {
|
sendJSONToChannel(j) {
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open("PUT", this.channelURL());
|
req.open("PUT", this.channelURL());
|
||||||
req.setRequestHeader("Content-Type", "application/json");
|
req.setRequestHeader("Content-Type", "application/json");
|
||||||
@ -586,9 +663,7 @@
|
|||||||
this.lastEventId = this.lastAcknowledgedEventId;
|
this.lastEventId = this.lastAcknowledgedEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectAgain) {
|
this.connectIfDisconnected();
|
||||||
this.connectIfDisconnected();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// connects to the EventSource if we are not currently connected
|
// connects to the EventSource if we are not currently connected
|
||||||
@ -879,27 +954,27 @@
|
|||||||
::
|
::
|
||||||
=+ request-line=(parse-request-line url.request)
|
=+ request-line=(parse-request-line url.request)
|
||||||
%^ return-static-data-on-duct 200 'text/html'
|
%^ return-static-data-on-duct 200 'text/html'
|
||||||
(login-page (get-header:http 'redirect' args.request-line))
|
(login-page (get-header:http 'redirect' args.request-line) our)
|
||||||
:: if we are not a post, return an error
|
:: if we are not a post, return an error
|
||||||
::
|
::
|
||||||
?. =('POST' method.request)
|
?. =('POST' method.request)
|
||||||
(return-static-data-on-duct 400 'text/html' (login-page ~))
|
(return-static-data-on-duct 400 'text/html' (login-page ~ our))
|
||||||
:: we are a post, and must process the body type as form data
|
:: we are a post, and must process the body type as form data
|
||||||
::
|
::
|
||||||
?~ body.request
|
?~ body.request
|
||||||
(return-static-data-on-duct 400 'text/html' (login-page ~))
|
(return-static-data-on-duct 400 'text/html' (login-page ~ our))
|
||||||
::
|
::
|
||||||
=/ parsed=(unit (list [key=@t value=@t]))
|
=/ parsed=(unit (list [key=@t value=@t]))
|
||||||
(rush q.u.body.request yquy:de-purl:html)
|
(rush q.u.body.request yquy:de-purl:html)
|
||||||
?~ parsed
|
?~ parsed
|
||||||
(return-static-data-on-duct 400 'text/html' (login-page ~))
|
(return-static-data-on-duct 400 'text/html' (login-page ~ our))
|
||||||
::
|
::
|
||||||
?~ password=(get-header:http 'password' u.parsed)
|
?~ password=(get-header:http 'password' u.parsed)
|
||||||
(return-static-data-on-duct 400 'text/html' (login-page ~))
|
(return-static-data-on-duct 400 'text/html' (login-page ~ our))
|
||||||
:: check that the password is correct
|
:: check that the password is correct
|
||||||
::
|
::
|
||||||
?. =(u.password code)
|
?. =(u.password code)
|
||||||
(return-static-data-on-duct 400 'text/html' (login-page ~))
|
(return-static-data-on-duct 400 'text/html' (login-page ~ our))
|
||||||
:: mint a unique session cookie
|
:: mint a unique session cookie
|
||||||
::
|
::
|
||||||
=/ session=@uv
|
=/ session=@uv
|
||||||
@ -1032,6 +1107,9 @@
|
|||||||
::
|
::
|
||||||
?: =('GET' method.request)
|
?: =('GET' method.request)
|
||||||
(on-get-request channel-id request)
|
(on-get-request channel-id request)
|
||||||
|
?: =('POST' method.request)
|
||||||
|
:: POST methods are used solely for deleting channels
|
||||||
|
(on-put-request channel-id request)
|
||||||
::
|
::
|
||||||
~& %session-not-a-put
|
~& %session-not-a-put
|
||||||
[~ state]
|
[~ state]
|
||||||
|
@ -2033,9 +2033,9 @@
|
|||||||
%start
|
%start
|
||||||
:- 200
|
:- 200
|
||||||
:~ ['content-type' 'text/html']
|
:~ ['content-type' 'text/html']
|
||||||
['content-length' '348']
|
['content-length' '1751']
|
||||||
==
|
==
|
||||||
[~ (login-page:http-server-gate `'/~landscape/inner-path')]
|
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
|
||||||
complete=%.y
|
complete=%.y
|
||||||
== ==
|
== ==
|
||||||
==
|
==
|
||||||
|
Loading…
Reference in New Issue
Block a user