2023-10-11 21:23:23 +03:00
|
|
|
/+ default-agent, verb, dbug, server
|
|
|
|
|%
|
|
|
|
++ give-payload
|
|
|
|
|= [id=@ta =simple-payload:http]
|
|
|
|
(give-simple-payload:app:server id simple-payload)
|
2023-10-13 18:12:46 +03:00
|
|
|
:: without removing the dots, there are intermittent mismatches when reading
|
|
|
|
:: the secret from the URL
|
|
|
|
++ serialize
|
|
|
|
|= eny=@uvJ
|
|
|
|
%- crip
|
|
|
|
%+ skip (trip (scot %uw eny))
|
|
|
|
|= =cord
|
|
|
|
=(cord '.')
|
2023-10-11 21:23:23 +03:00
|
|
|
+$ card card:agent:gall
|
|
|
|
+$ versioned-state
|
|
|
|
$% state-0
|
|
|
|
==
|
|
|
|
+$ state-0
|
|
|
|
$: %0
|
2023-10-11 22:52:40 +03:00
|
|
|
secret=@uvJ
|
2023-10-11 21:23:23 +03:00
|
|
|
==
|
|
|
|
--
|
2023-10-11 22:08:09 +03:00
|
|
|
::
|
2023-10-11 21:23:23 +03:00
|
|
|
=| state-0
|
|
|
|
=* state -
|
|
|
|
%- agent:dbug
|
|
|
|
%+ verb |
|
|
|
|
^- agent:gall
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %.n) bowl)
|
|
|
|
::
|
|
|
|
++ on-init
|
2023-10-11 22:52:40 +03:00
|
|
|
:_ this(secret eny.bowl)
|
2023-10-11 21:23:23 +03:00
|
|
|
~[[%pass /eyre/connect %arvo %e %connect [~ /genuine] dap.bowl]]
|
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ mark (on-poke:def mark vase)
|
|
|
|
%rotate
|
|
|
|
?> =(src.bowl our.bowl)
|
2023-10-11 22:52:40 +03:00
|
|
|
`this(secret eny.bowl)
|
2023-10-11 21:23:23 +03:00
|
|
|
%handle-http-request
|
|
|
|
=+ !<([id=@ta inbound-request:eyre] vase)
|
|
|
|
:_ this
|
|
|
|
=/ full-line=request-line:server (parse-request-line:server url.request)
|
|
|
|
?. ?=([%genuine @ ~] site.full-line)
|
|
|
|
(give-payload id not-found:gen:server)
|
|
|
|
=/ line i.t.site.full-line
|
|
|
|
?+ method.request (give-payload id not-found:gen:server)
|
2023-10-11 22:52:40 +03:00
|
|
|
%'GET'
|
2023-10-13 18:12:46 +03:00
|
|
|
(give-payload id (json-response:gen:server b+=(line (serialize secret))))
|
2023-10-11 21:23:23 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-agent on-agent:def
|
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ path (on-watch:def path)
|
|
|
|
[%http-response *] `this
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-fail
|
|
|
|
|= [=term =tang]
|
2023-10-11 22:49:01 +03:00
|
|
|
(mean ':genuine +on-fail' term tang)
|
2023-10-11 21:23:23 +03:00
|
|
|
::
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-save !>(state)
|
2023-10-11 22:08:09 +03:00
|
|
|
::
|
2023-10-11 21:23:23 +03:00
|
|
|
++ on-load
|
|
|
|
|= old-state=vase
|
|
|
|
^- (quip card _this)
|
|
|
|
=/ old !<(versioned-state old-state)
|
|
|
|
`this(state old)
|
2023-10-11 22:08:09 +03:00
|
|
|
::
|
2023-10-11 21:23:23 +03:00
|
|
|
++ on-arvo
|
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card _this)
|
|
|
|
?+ sign-arvo (on-arvo:def wire sign-arvo)
|
|
|
|
[%eyre %bound *]
|
|
|
|
~? !accepted.sign-arvo
|
|
|
|
[dap.bowl 'eyre bind rejected!' binding.sign-arvo]
|
|
|
|
[~ this]
|
|
|
|
==
|
2023-10-11 22:08:09 +03:00
|
|
|
::
|
2023-10-11 21:23:23 +03:00
|
|
|
++ on-peek
|
|
|
|
|= =path
|
|
|
|
^- (unit (unit cage))
|
|
|
|
?+ path [~ ~]
|
2023-10-13 18:12:46 +03:00
|
|
|
[%x %secret ~] ``json+!>([%s (serialize secret)])
|
2023-10-11 21:23:23 +03:00
|
|
|
==
|
|
|
|
--
|