2019-07-04 09:09:44 +03:00
|
|
|
=, eyre
|
2019-03-12 03:05:24 +03:00
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: +parse-request-line: take a cord and parse out a url
|
|
|
|
::
|
|
|
|
++ parse-request-line
|
|
|
|
|= url=@t
|
2019-03-29 20:44:37 +03:00
|
|
|
^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])]
|
2019-03-12 03:05:24 +03:00
|
|
|
(fall (rush url ;~(plug apat:de-purl:html yque:de-purl:html)) [[~ ~] ~])
|
|
|
|
::
|
2019-03-19 23:47:19 +03:00
|
|
|
++ manx-to-octs
|
|
|
|
|= man=manx
|
|
|
|
^- octs
|
2019-03-30 02:04:34 +03:00
|
|
|
(as-octt:mimes:html (en-xml:html man))
|
2019-03-19 23:47:19 +03:00
|
|
|
::
|
2019-03-29 20:44:37 +03:00
|
|
|
++ json-to-octs
|
|
|
|
|= jon=json
|
|
|
|
^- octs
|
2019-03-30 02:04:34 +03:00
|
|
|
(as-octt:mimes:html (en-json:html jon))
|
2019-03-29 20:44:37 +03:00
|
|
|
::
|
2019-03-22 03:14:20 +03:00
|
|
|
++ app
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: +require-authorization: redirect to the login page when unauthenticated
|
|
|
|
::
|
|
|
|
++ require-authorization
|
|
|
|
|* [=bone move=mold this=*]
|
2019-07-04 09:09:44 +03:00
|
|
|
|= handler=$-(inbound-request:eyre (quip move _this))
|
|
|
|
|= =inbound-request:eyre
|
2019-03-22 03:14:20 +03:00
|
|
|
^- (quip move _this)
|
|
|
|
::
|
|
|
|
?: authenticated.inbound-request
|
|
|
|
(handler inbound-request)
|
|
|
|
::
|
|
|
|
:_ this
|
|
|
|
^- (list move)
|
|
|
|
=/ redirect=cord
|
|
|
|
%- crip
|
|
|
|
"/~/login?redirect={(trip url.request.inbound-request)}"
|
|
|
|
[bone [%http-response %start [307 ['location' redirect]~] ~ %.y]]~
|
|
|
|
::
|
|
|
|
++ html-response
|
|
|
|
|= oct-html=octs
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'text/html']~] [~ oct-html] %.y]
|
|
|
|
::
|
|
|
|
++ js-response
|
|
|
|
|= oct-js=octs
|
|
|
|
^- http-event:http
|
2019-07-12 21:04:47 +03:00
|
|
|
[%start [200 ['content-type' 'text/javascript']~] [~ oct-js] %.y]
|
2019-03-22 03:14:20 +03:00
|
|
|
::
|
2019-03-29 20:44:37 +03:00
|
|
|
++ json-response
|
|
|
|
|= oct-js=octs
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'application/json']~] [~ oct-js] %.y]
|
|
|
|
::
|
2019-03-22 03:14:20 +03:00
|
|
|
++ css-response
|
|
|
|
|= oct-css=octs
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'text/css']~] [~ oct-css] %.y]
|
|
|
|
::
|
2019-06-05 00:29:53 +03:00
|
|
|
++ manx-response
|
|
|
|
|= man=manx
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'text/html']~] [~ (manx-to-octs man)] %.y]
|
|
|
|
::
|
2019-05-08 02:01:28 +03:00
|
|
|
++ png-response
|
|
|
|
|= oct-png=octs
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'image/png']~] [~ oct-png] %.y]
|
|
|
|
::
|
|
|
|
++ woff2-response
|
|
|
|
|= oct-woff=octs
|
|
|
|
^- http-event:http
|
|
|
|
[%start [200 ['content-type' 'font/woff2']~] [~ oct-woff] %.y]
|
|
|
|
::
|
2019-03-29 20:44:37 +03:00
|
|
|
++ not-found
|
|
|
|
^- http-event:http
|
|
|
|
[%start [404 ~] ~ %.y]
|
|
|
|
::
|
2019-03-22 03:14:20 +03:00
|
|
|
++ login-redirect
|
2019-07-04 09:09:44 +03:00
|
|
|
|= =inbound-request:eyre
|
2019-03-22 03:14:20 +03:00
|
|
|
^- http-event:http
|
|
|
|
=/ redirect=cord
|
|
|
|
%- crip
|
|
|
|
"/~/login?redirect={(trip url.request.inbound-request)}"
|
|
|
|
[%start [307 ['location' redirect]~] ~ %.y]
|
|
|
|
::
|
|
|
|
++ redirect
|
|
|
|
|= redirect=cord
|
|
|
|
^- http-event:http
|
|
|
|
[%start [307 ['location' redirect]~] ~ %.y]
|
|
|
|
::
|
|
|
|
--
|
|
|
|
++ gen
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ html-response
|
|
|
|
|= =octs
|
|
|
|
^- simple-payload:http
|
|
|
|
[[200 ['content-type' 'text/html']~] `octs]
|
|
|
|
::
|
|
|
|
++ js-response
|
|
|
|
|= =octs
|
|
|
|
^- simple-payload:http
|
2019-07-12 21:04:47 +03:00
|
|
|
[[200 ['content-type' 'text/javascript']~] `octs]
|
2019-03-22 03:14:20 +03:00
|
|
|
::
|
2019-03-29 20:44:37 +03:00
|
|
|
++ json-response
|
|
|
|
|= =octs
|
|
|
|
^- simple-payload:http
|
|
|
|
[[200 ['content-type' 'application/json']~] `octs]
|
|
|
|
::
|
2019-03-22 03:14:20 +03:00
|
|
|
++ css-response
|
|
|
|
|= =octs
|
|
|
|
^- simple-payload:http
|
|
|
|
[[200 ['content-type' 'text/css']~] `octs]
|
|
|
|
::
|
|
|
|
++ not-found
|
|
|
|
^- simple-payload:http
|
|
|
|
[[404 ~] ~]
|
|
|
|
::
|
|
|
|
++ login-redirect
|
|
|
|
|= =request:http
|
|
|
|
^- simple-payload:http
|
|
|
|
=/ redirect=cord
|
|
|
|
%- crip
|
|
|
|
"/~/login?redirect={(trip url.request)}"
|
|
|
|
[[307 ['location' redirect]~] ~]
|
|
|
|
::
|
|
|
|
++ redirect
|
|
|
|
|= redirect=cord
|
|
|
|
^- simple-payload:http
|
|
|
|
[[307 ['location' redirect]~] ~]
|
|
|
|
::
|
|
|
|
--
|
2019-03-12 03:05:24 +03:00
|
|
|
--
|