mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 18:12:47 +03:00
We now have an application path rendering
This commit is contained in:
parent
3048166697
commit
c733dba149
@ -424,6 +424,7 @@
|
||||
+>.$
|
||||
(dump:(crud %reap u.p.p.+>.sih) %logo ~)
|
||||
$diff pump:(from ((hard dill-blit) q:`vase`+>+>.sih))
|
||||
$http-response !!
|
||||
==
|
||||
::
|
||||
{$c $note *}
|
||||
|
@ -943,6 +943,8 @@
|
||||
(get-rush:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
|
||||
::
|
||||
$quit ~&(quit+tee (get-quit:(ire-ix p.tee) q.tee))
|
||||
:: ironically, old eyre will never get an http-response.
|
||||
$http-response !!
|
||||
==
|
||||
::
|
||||
$wake
|
||||
|
@ -399,6 +399,9 @@
|
||||
$quit %+ mo-pass [%sys pax]
|
||||
[%a %want [our him] [%g %gh dap ~] [num %x ~]]
|
||||
$reap (mo-give %mack p.cuf)
|
||||
:: we send http-responses, we don't receive them.
|
||||
::
|
||||
$http-response !!
|
||||
==
|
||||
::
|
||||
%val :: inbound validate
|
||||
@ -609,7 +612,12 @@
|
||||
$hiss `note-arvo`[%e %hiss +.q.q.cov]
|
||||
$send `note-arvo`[%g %deal [our p.q.q.cov] q.q.q.cov]
|
||||
$meta `note-arvo`[`@tas`p.q.q.cov %meta `vase`q.q.q.cov]
|
||||
:: $response `note-arvo`[%l %response raw-http-response.q.q.cov]
|
||||
==
|
||||
::
|
||||
:: I'm sort of stumped on how to get a %give out of the above; it's
|
||||
:: just turning %cove into a %pass instead.
|
||||
::
|
||||
==
|
||||
::
|
||||
++ ap-avid :: onto results
|
||||
@ -793,6 +801,7 @@
|
||||
$poke (ap-move-poke -.q.vax cav)
|
||||
$send (ap-move-send -.q.vax cav)
|
||||
$quit (ap-move-quit -.q.vax cav)
|
||||
$http-response (ap-move-http-response -.q.vax cav)
|
||||
==
|
||||
::
|
||||
++ ap-move-quit :: give quit move
|
||||
@ -811,6 +820,15 @@
|
||||
=^ tel vel (~(slot wa vel) 3 pec)
|
||||
:_(+>.$ [%& sto %give %diff `cage`[-.q.pec tel]])
|
||||
::
|
||||
++ ap-move-http-response
|
||||
|= [sto=bone vax=vase]
|
||||
^- [(each cove tang) _+>]
|
||||
::
|
||||
:: TODO: Magic vase validation. I have no idea how malformed checking works.
|
||||
::
|
||||
:_ +>.$
|
||||
[%& sto %give %http-response ((hard raw-http-response:light) q.vax)]
|
||||
::
|
||||
++ ap-move-hiss :: pass %hiss
|
||||
|= {sto/bone vax/vase}
|
||||
^- {(each cove tang) _+>}
|
||||
@ -1072,6 +1090,8 @@
|
||||
$diff (ap-diff q.q.pry pax p.cuf)
|
||||
$quit (ap-take q.q.pry %quit +.pax ~)
|
||||
$reap (ap-take q.q.pry %reap +.pax `!>(p.cuf))
|
||||
:: ???
|
||||
$http-response !!
|
||||
==
|
||||
::
|
||||
++ ap-prep :: install
|
||||
@ -1247,6 +1267,7 @@
|
||||
$well `%e
|
||||
$well `%e
|
||||
$wipe `%f
|
||||
%connect `%l
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -44,8 +44,11 @@
|
||||
$: %g
|
||||
:: %response: http-response from a gall app
|
||||
::
|
||||
[%response =raw-http-response]
|
||||
== ==
|
||||
$% [%response =raw-http-response]
|
||||
::
|
||||
::
|
||||
[%unto p=cuft:gall]
|
||||
== == ==
|
||||
--
|
||||
:: more structures
|
||||
::
|
||||
@ -199,7 +202,6 @@
|
||||
++ request
|
||||
|= [secure=? =address =http-request]
|
||||
^- [(list move) server-state]
|
||||
~& [%request secure address http-request]
|
||||
::
|
||||
=+ host=(get-header 'host' header-list.http-request)
|
||||
=+ action=(get-action-for-binding host url.http-request)
|
||||
@ -511,6 +513,19 @@
|
||||
^- ?
|
||||
&(=(item-binding binding) =(item-duct duct))
|
||||
==
|
||||
:: +simplified-url-parser: returns [(each @if @t) (unit port=@ud)]
|
||||
::
|
||||
++ simplified-url-parser
|
||||
;~ plug
|
||||
;~ pose
|
||||
(stag %site (cook crip (star ;~(pose dot dit))))
|
||||
(stag %ip (cook crip (star ;~(pose dot alp))))
|
||||
==
|
||||
;~ pose
|
||||
(stag ~ ;~(pfix col dim:ag))
|
||||
(easy ~)
|
||||
==
|
||||
==
|
||||
:: +get-action-for-binding: finds an action for an incoming web request
|
||||
::
|
||||
++ get-action-for-binding
|
||||
@ -527,19 +542,25 @@
|
||||
=/ host=(unit @t)
|
||||
?~ raw-host
|
||||
~
|
||||
:: TODO: Check IP addresses. I can't just check the
|
||||
:: `\d{0-3}\.\d{0-3}...` regex here.
|
||||
::
|
||||
:: TODO: Check for localhost
|
||||
::
|
||||
:: render our as a tape, and cut off the sig in front.
|
||||
::
|
||||
=/ with-sig=tape (scow %p our)
|
||||
?> ?=(^ with-sig)
|
||||
?: =(u.raw-host (crip t.with-sig))
|
||||
:: [our].urbit.org is the default site
|
||||
:: Parse the raw-host so that we can ignore ports, usernames, etc.
|
||||
::
|
||||
?~ parsed=(rush u.raw-host simplified-url-parser)
|
||||
~& [%doesnt-parse u.raw-host]
|
||||
~
|
||||
:: if the url is a raw IP, assume default site.
|
||||
::
|
||||
:: ?: ?=([%ip *] u.parsed)
|
||||
:: ~
|
||||
:: :: TODO: Check for localhost
|
||||
:: ::
|
||||
:: :: render our as a tape, and cut off the sig in front.
|
||||
:: ::
|
||||
:: =/ with-sig=tape (scow %p our)
|
||||
:: ?> ?=(^ with-sig)
|
||||
:: ?: =(u.raw-host (crip t.with-sig))
|
||||
:: :: [our].urbit.org is the default site
|
||||
:: ::
|
||||
:: ~
|
||||
::
|
||||
raw-host
|
||||
:: url is the raw thing passed over the 'Request-Line'.
|
||||
@ -681,11 +702,18 @@
|
||||
~|([%bad-take-wire wire] !!)
|
||||
::
|
||||
++ run-app
|
||||
?> ?=([%g %response *] sign)
|
||||
?. ?=([%g %unto *] sign)
|
||||
~|([%bad-take-app wire sign] !!)
|
||||
::
|
||||
?. ?=([%g %unto %http-response *] sign)
|
||||
:: entirely normal to get things other than http-response calls, but we
|
||||
:: don't care.
|
||||
::
|
||||
[~ light-gate]
|
||||
::
|
||||
=/ event-args [[(need ship.ax) eny duct now scry-gate] server-state.ax]
|
||||
=/ handle-response handle-response:(per-server-event event-args)
|
||||
=^ moves server-state.ax (handle-response raw-http-response.sign)
|
||||
=^ moves server-state.ax (handle-response raw-http-response.p.sign)
|
||||
[moves light-gate]
|
||||
--
|
||||
::
|
||||
|
@ -1,4 +1,3 @@
|
||||
!:
|
||||
:: :: /van/zuse
|
||||
:: :: %reference/1
|
||||
:: %zuse: arvo library.
|
||||
@ -1927,6 +1926,7 @@
|
||||
{$diff p/cage} :: subscription output
|
||||
{$quit ~} :: close subscription
|
||||
{$reap p/(unit tang)} :: peer result
|
||||
[%http-response =raw-http-response:light] :: serve http result
|
||||
== ::
|
||||
++ culm :: config action
|
||||
$% {$load p/scup} :: load+reload
|
||||
@ -7354,6 +7354,7 @@
|
||||
{$f task:able:ford}
|
||||
{$g task:able:gall}
|
||||
{$j task:able:jael}
|
||||
{$l task:able:light}
|
||||
{@tas $meta vase}
|
||||
==
|
||||
++ sign-arvo :: in result $<-
|
||||
@ -7365,6 +7366,7 @@
|
||||
{$f gift:able:ford}
|
||||
{$g gift:able:gall}
|
||||
{$j gift:able:jael}
|
||||
{%l gift:able:light}
|
||||
==
|
||||
::
|
||||
++ unix-task :: input from unix
|
||||
|
Loading…
Reference in New Issue
Block a user