urbit/arvo/eyre.hoon

2328 lines
83 KiB
Plaintext
Raw Normal View History

:: :: %eyre, http servant
2014-03-12 23:50:39 +04:00
!? 164
::::
2013-12-15 09:42:27 +04:00
|= pit=vase
2013-09-29 00:21:18 +04:00
=> =~
2014-06-07 22:36:31 +04:00
|% :: interfaces
2014-06-17 05:33:31 +04:00
++ bead ,[p=(set beam) q=cage] :: computed result
2014-06-08 06:45:00 +04:00
++ chop ,[p=@ud q=@da] :: see
2014-06-03 09:07:32 +04:00
++ gift :: out result <-$
2014-07-15 06:45:04 +04:00
$% [%thou p=httr] :: raw http response
2014-06-04 14:40:09 +04:00
[%thus p=@ud q=(unit hiss)] :: http request/cancel
2014-07-10 01:43:30 +04:00
== ::
2014-06-08 06:45:00 +04:00
++ hasp ,[p=ship q=term] :: see %gall
2014-06-03 09:07:32 +04:00
++ kiss :: in request ->$
2014-06-04 14:40:09 +04:00
$% [%born ~] :: new unix process
[%crud p=@tas q=(list tank)] :: XX rethink
2014-06-04 14:40:09 +04:00
[%init p=@p] :: report install
[%them p=(unit hiss)] :: outbound request
[%they p=@ud q=httr] :: inbound response
[%this p=? q=clip r=httq] :: inbound request
[%thud ~] :: inbound cancel
[%wart p=sock q=@tas r=path s=*] :: urbit message
== ::
2014-06-22 09:49:10 +04:00
++ move ,[p=duct q=(mold note gift)] :: local move
2014-06-03 09:07:32 +04:00
++ note :: out request $->
2014-06-22 06:51:12 +04:00
$% $: %a :: to %ames
$% [%want p=sock q=path r=*] ::
== == ::
$: %b :: to %batz
$% [%hail ~] ::
[%line p=@t] ::
[%ling ~] ::
== == ::
$: %c :: to %clay
$% [%warp p=sock q=riff] ::
== == ::
$: %d :: to %dill
$% [%flog p=[%crud p=@tas q=(list tank)]] ::
== == ::
$: %e :: to %eyre
$% [%this p=? q=clip r=httq] ::
[%thud ~] ::
== == ::
$: %f :: to %ford
$% [%exec p=@p q=(unit silk)] ::
== == ::
$: %g :: to %gall
$% [%mess p=hasp q=ship r=cage] ::
2014-07-11 06:40:58 +04:00
[%nuke p=hasp q=ship] ::
2014-06-22 06:51:12 +04:00
[%show p=hasp q=ship r=path] ::
== == == ::
2014-06-11 18:06:36 +04:00
++ rave :: see %clay
2014-06-22 06:51:12 +04:00
$% [| p=moat] ::
2014-06-11 18:06:36 +04:00
== ::
++ riff ,[p=desk q=(unit rave)] :: see %clay
2014-07-12 22:24:52 +04:00
++ silk :: see %ford
$& [p=silk q=silk] ::
$% [%boil p=mark q=beam r=path] ::
[%cast p=mark q=beak r=silk] ::
2014-07-12 22:24:52 +04:00
[%done p=(set beam) q=cage] ::
== ::
2014-06-22 09:49:10 +04:00
++ sign :: in result $<-
2014-06-22 06:51:12 +04:00
$? $: %a :: by %ames
2014-07-15 06:45:04 +04:00
$% [%waft p=sock q=*] ::
2014-06-22 06:51:12 +04:00
[%went p=ship q=cape] ::
== == ::
$: %b :: by %batz
$% [%helo p=path q=prod] ::
[%talk p=tank] ::
[%tell p=(list ,@t)] ::
[%text p=tape] ::
[%warn p=tape] ::
== == ::
$: %c :: by %clay
$% [%writ p=riot] ::
== == ::
$: %e :: by %eyre
$% [%thou p=httr] ::
== == ::
$: %f :: by %ford
$% [%made p=(each bead (list tank))] ::
== == ::
$: %g :: by %gall
$% [%dumb ~] ::
2014-07-24 06:02:50 +04:00
[%mean p=ares] ::
2014-07-08 03:36:35 +04:00
[%nice ~] ::
[%rush p=mark q=*] ::
[%rust p=mark q=*] ::
2014-06-22 06:51:12 +04:00
== == ::
$: @tas :: by any
$% [%crud p=@tas q=(list tank)] ::
== == == ::
-- ::
2014-06-07 22:36:31 +04:00
|% :: models
2013-09-29 00:21:18 +04:00
++ bolo :: eyre state
2014-05-31 02:10:39 +04:00
$: %0 :: version
gub=@t :: random identity
2014-06-10 00:09:14 +04:00
hov=(unit ship) :: master for remote
2014-03-12 23:50:39 +04:00
ged=duct :: client interface
ney=@uvI :: rolling entropy
dop=(map host ship) :: host aliasing
own=(map ship serf) :: domestic servers
fon=(map ship rote) :: foreign servers
2014-03-12 23:50:39 +04:00
ask=[p=@ud q=(map ,@ud ,[p=duct q=hiss])] :: outgoing by number
kes=(map duct ,@ud) :: outgoing by duct
lor=(map duct dual) :: incoming by duct
2014-03-12 23:50:39 +04:00
== ::
2014-04-21 21:02:09 +04:00
++ clue :: console
2014-04-16 05:35:25 +04:00
$: ino=@ud :: input sequence
ono=@ud :: (lent out)
voy=(map ,@ud (list ,@ud)) :: waiters (q.rey)
out=(list json) :: output commands
== ::
2014-03-12 23:50:39 +04:00
++ cyst :: client session
$: ced=cred :: credential
2014-04-21 21:02:09 +04:00
cow=(map ,@ud clue) :: consoles
2014-03-12 23:50:39 +04:00
cug=(list ,@t) :: unacked cookies
lax=@da :: last used
2014-07-16 06:30:29 +04:00
sok=(map ,@ud (pair ship sink)) :: live apps by reqno
2014-03-12 23:50:39 +04:00
rey=[p=@ud q=(map ,@ud pimp)] :: live requests
== ::
++ dual ,[p=@ud q=(each ,[p=ship q=hole] ship)] :: request handle
2014-03-12 23:50:39 +04:00
++ dude ,[p=@tas q=@] :: client identity
2014-03-13 05:04:58 +04:00
++ loco ,[p=? q=(unit ,@tas) r=path] :: logical construct
2014-03-12 23:50:39 +04:00
++ pest :: request in progress
$| $? %new :: virgin
2014-04-16 05:35:25 +04:00
%way :: waiting
== ::
2014-04-16 23:47:41 +04:00
$% [%err p=@ud q=(list tank)] :: error report
2014-03-12 23:50:39 +04:00
[%fin p=love] :: ready to send
2014-06-07 22:36:31 +04:00
[%fud p=(each bead (list tank))] :: function finished
2014-04-09 02:26:01 +04:00
[%haz p=riot] :: clay responded
2014-03-12 23:50:39 +04:00
[%raw p=hiss] :: wild url
[%who p=@tas q=@ta] :: awaiting auth
2014-03-12 23:50:39 +04:00
== ::
++ pimp :: traced request
$: ful=? :: | === HEAD
fur=(unit mark) :: type goal
2014-03-12 23:50:39 +04:00
hen=duct :: event trace
2014-03-26 04:48:22 +04:00
som=seam :: logical request
2014-03-12 23:50:39 +04:00
pez=pest :: request state
2014-06-13 02:10:32 +04:00
vaz=(list ,[p=cord q=tape]) :: variables
2014-06-08 06:45:00 +04:00
sip=(list manx) :: scripts in result
2014-03-12 23:50:39 +04:00
== ::
++ rote :: remote server
2014-03-23 01:42:25 +04:00
$: cnt=@ud :: number served
2014-03-23 23:42:18 +04:00
sor=@p :: home sponsor
2014-03-23 01:42:25 +04:00
rem=[p=@ud q=(map ,@ud duct)] :: active requests
== ::
2014-06-07 22:36:31 +04:00
++ seam :: logical request
2014-07-16 06:30:29 +04:00
$% [%ape p=ship q=@ud r=@ud] :: subscribe pull
[%aph p=ship q=@ud r=@ud s=json] :: app heartbeat
[%apg p=term q=ship r=mark s=path] :: app get/start
2014-07-17 06:10:13 +04:00
[%apm p=ship q=@ud r=@ud s=hasp t=json] :: message send
2014-07-18 23:23:35 +04:00
[%aps p=ship q=@ud s=hasp t=path] :: subscribe
[%apu p=ship q=@ud s=hasp t=path] :: unsubscribe
2014-06-07 22:36:31 +04:00
[%cog p=@ud q=@ud] :: console get
[%con p=@ud] :: console face
[%cop p=@ud q=@ud r=json] :: console put
[%det p=desk q=moat] :: load changes
[%fun p=term q=tube r=(list manx)] :: functional
[%lon p=seal] :: authentication flow
[%red p=purl] :: redirect
2014-06-10 00:09:14 +04:00
[%sil p=@ud q=silk] :: status and silk
2014-06-07 22:36:31 +04:00
== ::
++ serf :: local server
2014-03-12 23:50:39 +04:00
$: pef=@t :: server prefix
2014-03-20 05:05:42 +04:00
wup=(map hole cyst) :: secure sessions
cah=(map cash vase) :: compilation cache
2014-03-12 23:50:39 +04:00
== ::
2014-06-10 00:09:14 +04:00
++ sink :: page push system
$: bet=[wig=swig num=@ud tim=@da] :: heartbeat
meg=[wig=swig num=@ud] :: messages
2014-07-16 06:30:29 +04:00
sub=[wig=swig num=@ud can=(map ,@ud stem)] :: subscriptions
2014-06-10 00:09:14 +04:00
== ::
++ stem ,[p=hasp q=path r=duct s=(unit ,@ud)] :: subscription
2014-06-10 00:09:14 +04:00
++ swig :: update channel
2014-07-16 06:30:29 +04:00
$: cnt=@ud :: updates produced
2014-06-10 10:20:41 +04:00
toy=@ud :: updates sent
wan=(map ,@ud ,@ud) :: upno to reqno
2014-06-17 05:33:31 +04:00
red=(map ,@ud (unit (each cage cage))) :: ready for pickup
2014-06-10 00:09:14 +04:00
== ::
2014-03-12 23:50:39 +04:00
-- ::
|%
++ coss :: cookie search
|= [nam=@t mah=math]
2014-03-20 05:05:42 +04:00
^- (unit hole)
2014-03-12 23:50:39 +04:00
=+ ^= cok ^- (list ,@t)
=+ cok=(~(get by mah) 'cookie')
?~(cok ~ u.cok)
2014-03-20 05:05:42 +04:00
|- ^- (unit hole)
2014-03-12 23:50:39 +04:00
?~ cok ~
=+ mar=`(unit (list ,[p=@t q=@t]))`(rush i.cok cock:epur)
?~ mar $(cok t.cok)
2014-03-20 05:05:42 +04:00
|- ^- (unit hole)
2014-03-12 23:50:39 +04:00
?~ u.mar ^$(cok t.cok)
?:(=(nam p.i.u.mar) [~ q.i.u.mar] $(u.mar t.u.mar))
2013-09-29 00:21:18 +04:00
::
2014-07-17 06:10:13 +04:00
++ ecca :: [hasp path]
|= [orx=oryx moh=moth]
^- (unit ,[hasp path])
=+ jun=(ecci orx moh)
?~ jun ~
=+ ^- (unit ,[his=term app=term pax=term])
%. u.jun
%- ot:jo
~[[%ship so:jo] [%appl so:jo] [%path so:jo]]
?~ - ~
=+ his=(slaw %p (cat 3 '~' his.u))
?~ his ~
=+ ^= pax
%+ rush pax.u
;~(pfix fas (more fas (cook crip (plus ;~(pose low nud hep)))))
?~ pax ~
`[[u.his app.u] u.pax]
::
2014-06-10 00:09:14 +04:00
++ ecce :: JS from moth
|= moh=moth
^- (unit json)
?. =([~ 'text/json' ~] (~(get by q.moh) 'content-type')) ~
?~ r.moh ~
`(unit json)`(rush q.u.r.moh apex:poja)
::
2014-06-25 02:00:07 +04:00
++ ecci :: ecce w/oryx
|= [orx=oryx moh=moth]
^- (unit json)
=+ jun=(ecce moh)
?~ jun ~
?. ?=(%o -.u.jun) ~
?. =([~ %s orx] (~(get by p.u.jun) %oryx))
~& [%ecci-oryx u.jun]
~
=+ nuj=(~(get by p.u.jun) %xyro)
?~(nuj [~ ~] [~ u.nuj])
::
2013-09-29 00:21:18 +04:00
++ ecco :: eat headers
2013-12-15 09:42:27 +04:00
|= hed=(list ,[p=@t q=@t])
2013-09-29 00:21:18 +04:00
=+ mah=*math
|- ^- math
?~ hed mah
=+ cus=(cass (rip 3 p.i.hed))
=+ zeb=(~(get by mah) cus)
$(hed t.hed, mah (~(put by mah) cus ?~(zeb [q.i.hed ~] [q.i.hed u.zeb])))
::
2014-07-17 06:10:13 +04:00
++ eccu :: [hasp json]
|= [orx=oryx moh=moth]
^- (unit ,[hasp json])
=+ jun=(ecci orx moh)
?~ jun ~
=+ ^- (unit ,[his=term app=term jon=json])
%. u.jun
%- ot:jo
~[[%ship so:jo] [%appl so:jo] [%data |=(json (some +<))]]
?~ - ~
=+ his=(slaw %p (cat 3 '~' his.u))
?~ his ~
`[[u.his app.u] jon.u]
::
2014-05-10 11:10:46 +04:00
++ lopo :: cage to love
|= cay=cage
^- love
?> ?=(%mime p.cay)
((hard love) [%mid q.q.cay])
::
2014-04-25 23:27:48 +04:00
++ loga :: tanks to manx
|= [til=tape mog=(list manx) tac=(list tank)]
^- manx
=+ ^= wol
|- ^- wall
?~ tac ~
(weld `wall`[~(ram re i.tac) ~] $(tac t.tac))
2014-04-25 23:27:48 +04:00
=+ ^= tax
|- ^- (list manx)
(turn wol |=(a=tape [/p ;"{a}"]))
;html
;head
;title: {til}
==
;body
;code
;* (weld tax mog)
==
==
==
::
2014-06-13 02:10:32 +04:00
++ lofa :: scripts in head
|= [mog=(list manx) luv=love]
^- love
?: =(~ mog) luv
?+ -.luv luv
%mid
=+ str=(trip q.q.luv)
2014-06-18 04:34:20 +04:00
=+ scr=|-(^-(tape ?~(mog ~ (xmlt & i.mog $(mog t.mog)))))
=+ rep=(need (repg "<head>" str (weld "<head>" scr)))
2014-06-13 02:10:32 +04:00
[%mid p.luv (tact rep)]
==
++ lofe :: variables in head
|= [vaz=(list ,[p=cord q=tape]) luv=love]
%- lofa
:_ luv
:_ ~
^- manx
2014-07-07 02:16:20 +04:00
:- [%script ~]
2014-06-13 02:10:32 +04:00
(turn vaz |=([a=cord b=tape] :/("var {(trip a)}={b};")))
::
++ lofi :: insert in body
2014-04-10 05:01:46 +04:00
|= [mog=(list manx) luv=love]
^- love
?: =(~ mog) luv
?+ -.luv luv
%mid
=+ str=(trip q.q.luv)
=+ scr=|-(^-(tape ?~(mog "</body>" (xmlt & i.mog $(mog t.mog)))))
=+ rep=(need (repg "</body>" str scr))
[%mid p.luv (tact rep)]
==
::
2014-03-12 23:50:39 +04:00
++ loft :: love to response
|= luv=love
^- httr
?- -.luv
%mid [200 ~[content-type/(moon p.luv)] [~ q.luv]]
2014-04-03 05:06:45 +04:00
%ham [200 ~[content-type/'text/html'] [~ (tact (xmlt | p.luv ~))]]
2014-03-12 23:50:39 +04:00
%raw p.luv
%wan :+ 200
2014-04-09 02:26:01 +04:00
~[content-type/'text/plain']
:- ~
%- taco
%+ rap 3
|- ^- (list ,@)
?~(p.luv ~ [i.p.luv 10 $(p.luv t.p.luv)])
%zap :+ p.luv
2014-04-25 23:27:48 +04:00
~[content-type/'text/html']
[~ (tact (xmlt | (loga "server error" ~ q.luv) ~))]
2013-09-29 00:21:18 +04:00
==
--
2014-03-12 23:50:39 +04:00
|% :: functions
++ ye :: per event
2014-06-04 14:40:09 +04:00
=| $: $: hen=duct :: event floor
2014-03-12 23:50:39 +04:00
$: now=@da :: event date
eny=@ :: unique entropy
sky=$+(* (unit)) :: system namespace
== ::
2014-03-12 23:50:39 +04:00
mow=(list move) :: pending actions
== ::
bolo :: all vane state
== ::
=* bol ->
|%
++ abet
^- [(list move) bolo]
[(flop mow) bol]
2013-09-29 00:21:18 +04:00
::
2014-03-12 23:50:39 +04:00
++ adit
.(ney (mix eny ney))
2013-09-29 00:21:18 +04:00
::
2014-06-04 14:40:09 +04:00
++ axon
2014-06-22 09:49:10 +04:00
|= [tea=wire typ=type sih=sign]
2014-06-04 14:40:09 +04:00
^+ +>
2014-06-22 06:51:12 +04:00
?- -.+.sih
2014-06-04 14:40:09 +04:00
%crud
2014-06-22 06:51:12 +04:00
+>.$(mow [[hen %slip %d %flog +.sih] mow])
2014-06-17 05:33:31 +04:00
::
2014-07-11 00:10:41 +04:00
?(%dumb %mean %nice %rush %rust)
2014-07-16 06:30:29 +04:00
?> ?=([%hoop @ @ @ ?([%mess ~] [%show @ ~])] tea)
2014-06-17 05:33:31 +04:00
=+ ^= ouy
2014-06-25 23:13:15 +04:00
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
(slav %ud i.t.t.t.tea)
2014-06-17 05:33:31 +04:00
?~ ouy
+>.$
2014-07-12 06:02:11 +04:00
?: (lth ~m2 (sub now tim.bet.siq:beat:u.ouy))
2014-07-11 06:40:58 +04:00
abet:work:amok:u.ouy
2014-07-16 06:30:29 +04:00
=* mab t.t.t.t.tea
=+ woy=(yule:u.ouy ?+(i.mab !! %mess %meg, %show %sub))
2014-07-08 03:36:35 +04:00
=< abet =< work =< abet
?- -.+.sih
%dumb
dumb:woy
%mean
=+ ^= jon
2014-07-08 03:36:35 +04:00
%- jobe
2014-07-11 00:10:41 +04:00
:- [%ok %b |]
?~ p.+.sih ~
:+ [%err %s p.u.p.+.sih]
2014-07-08 03:36:35 +04:00
:+ %res %s
%- crip
%+ slag 2
^- tape
2014-07-11 00:10:41 +04:00
%+ roll q.u.p.+.sih
2014-07-08 03:36:35 +04:00
|= [p=tank q=tape]
:(weld q "\\n" ~(ram re p))
~
?~ t.mab
(hear:woy ~ %& %json !>(jon))
=+ nap=(slav %ud i.t.mab)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
=. jon
?. ?=(%show i.t.t.t.t.tea) jon
2014-07-16 06:30:29 +04:00
%- jobe
:~ [%ship %s (rsh 3 1 (scot %p p.p.sem))]
[%appl %s q.p.sem]
[%path %s (crip <q.sem>)]
[%data `json`jon]
2014-07-16 06:30:29 +04:00
==
=+ huq=``[%json !>(jon)]
?~ s.sem (hear:woy huq)
=+ yoo=abet:(busk:(yule:u.ouy %nil) u.s.sem 0 huq)
yoo(can.sub.siq (~(put by can.sub.siq.yoo) nap sem(s ~)))
2014-07-08 03:36:35 +04:00
%nice
2014-07-16 06:30:29 +04:00
?> ?=(%mess i.mab)
2014-07-08 03:36:35 +04:00
(hear:woy ~ %& %json !>((joba %ok %b &)))
?(%rust %rush)
?< ?=(~ t.mab)
=+ nap=(slav %ud i.t.mab)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
2014-07-16 06:30:29 +04:00
=+ ^= cay ^- cage
?. ?=(%json p.+.sih)
[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
:- %json
!> ^- json
%- jobe
:~ [%ship %s (rsh 3 1 (scot %p p.p.sem))]
[%appl %s q.p.sem]
[%path %s (crip <q.sem>)]
[%data (json q.+.sih)]
==
=+ huq=`?:(?=(%rust -.+.sih) [%& cay] [%| cay])
?~ s.sem (hear:woy huq)
=+ yoo=abet:(busk:(yule:u.ouy %nil) u.s.sem 0 huq)
yoo(can.sub.siq (~(put by can.sub.siq.yoo) nap sem(s ~)))
2014-07-08 03:36:35 +04:00
==
2014-06-04 14:40:09 +04:00
::
%made
?. ?=([%honk @ @ @ ~] tea)
+>.$
%- galt
2014-06-25 23:13:15 +04:00
[(slav %p i.t.tea) i.t.t.tea (slav %ud i.t.t.t.tea) p.+.sih]
2014-06-04 14:40:09 +04:00
::
%thou :: remote return
?> ?=([@ @ *] tea)
2014-06-25 23:13:15 +04:00
(hajj (slav %p i.tea) (slav %p i.t.tea) t.t.tea p.+.sih)
2014-06-04 14:40:09 +04:00
::
%waft
?. ?=([%hork @ ~] tea)
+>.$
2014-06-25 23:13:15 +04:00
(gosh q.p.+.sih (slav %ud i.t.tea) ((hard httr) q.+.sih))
2014-03-12 23:50:39 +04:00
::
2014-06-04 14:40:09 +04:00
%went
+>.$
::
%writ
?. ?=([%hoot @ @ @ ~] tea)
+>.$
%- gout
2014-06-25 23:13:15 +04:00
[(slav %p i.t.tea) i.t.t.tea (slav %ud i.t.t.t.tea) p.+.sih]
2014-06-04 14:40:09 +04:00
::
?(%helo %tell %text %talk %warn)
?. ?=([%cons @ @ @ ~] tea)
+>.$
%- goat
2014-06-25 23:13:15 +04:00
[(slav %p i.t.tea) i.t.t.tea (slav %ud i.t.t.t.tea) sih]
2014-06-04 14:40:09 +04:00
==
::
++ apex
|= kyz=kiss
^+ +>
?- -.kyz
%born +>.$(ged hen) :: register external
%crud
+>.$(mow [[hen %slip %d %flog kyz] mow])
2014-03-23 23:42:18 +04:00
%init :: register ownership
2014-06-04 14:40:09 +04:00
%_ +>.$
hov ?~(hov [~ p.kyz] [~ (min u.hov p.kyz)])
2014-03-23 23:42:18 +04:00
own
%+ ~(put by own)
2014-06-04 14:40:09 +04:00
p.kyz
2014-03-23 23:42:18 +04:00
^- serf
2014-06-04 14:40:09 +04:00
:* (cat 3 gub (rsh 3 1 (scot %p p.kyz)))
2014-03-23 23:42:18 +04:00
~
~
==
==
2014-03-12 23:50:39 +04:00
::
%them :: outbound request
2014-06-04 14:40:09 +04:00
?~ p.kyz
2014-03-12 23:50:39 +04:00
=+ sud=(need (~(get by kes) hen))
2014-06-04 14:40:09 +04:00
%= +>.$
2014-05-24 00:46:43 +04:00
mow :_(mow [ged [%give %thus sud ~]])
2014-03-12 23:50:39 +04:00
q.ask (~(del by q.ask) sud)
kes (~(del by kes) hen)
==
2014-06-04 14:40:09 +04:00
%= +>.$
mow :_(mow [ged [%give %thus p.ask p.kyz]])
2014-03-12 23:50:39 +04:00
p.ask +(p.ask)
2014-06-04 14:40:09 +04:00
q.ask (~(put by q.ask) p.ask hen u.p.kyz)
2014-03-12 23:50:39 +04:00
kes (~(put by kes) hen p.ask)
==
::
%they :: inbound response
2014-06-04 14:40:09 +04:00
=+ kas=(need (~(get by q.ask) p.kyz))
%= +>.$
mow :_(mow [p.kas [%give %thou q.kyz]])
2014-03-12 23:50:39 +04:00
q.ask (~(del by q.ask) p.kas)
==
::
%this :: inbound request
2014-06-04 14:40:09 +04:00
=* sec p.kyz :: ? :: https bit
=* heq r.kyz :: httq :: request content
2014-03-12 23:50:39 +04:00
=+ ryp=`quri`(rash q.heq zest:epur)
=+ mah=(ecco r.heq)
=+ ^= pul ^- purl
?- -.ryp
& ?>(=(sec p.p.p.ryp) p.ryp)
| =+ hot=(~(get by mah) %host)
?> ?=([~ @ ~] hot)
[[sec (rash i.u.hot thor:epur)] p.ryp q.ryp]
==
2014-04-23 21:02:36 +04:00
=. p.p.pul |(p.p.pul =([& /localhost] r.p.pul))
2014-06-04 14:40:09 +04:00
(hell pul +.kyz [p.heq mah s.heq])
::
%thud :: cancel request
=+ dul=(~(get by lor) hen)
2014-06-04 14:40:09 +04:00
?~ dul +>.$
=. lor (~(del by lor) hen)
?- -.q.u.dul
& =+ boy=(myth p.p.q.u.dul q.p.q.u.dul)
2014-06-04 14:40:09 +04:00
?~(boy +>.$ abet:(idle:u.boy p.u.dul))
| (hops p.q.u.dul p.u.dul)
==
2014-03-23 01:42:25 +04:00
::
%wart :: remote request
2014-06-04 14:40:09 +04:00
?+ q.kyz
~& [%strange-wart p.kyz q.kyz]
+>.$
2014-03-23 01:42:25 +04:00
::
2014-06-04 14:40:09 +04:00
%pr (hare p.p.kyz r.kyz q.p.kyz s.kyz)
%pc (here p.p.kyz q.p.kyz s.kyz)
2014-03-23 01:42:25 +04:00
==
2014-03-12 23:50:39 +04:00
==
2013-09-29 00:21:18 +04:00
::
2014-03-12 23:50:39 +04:00
++ doss :: host to ship
|= hot=host
^- (unit ship)
=+ gow=(~(get by dop) hot)
?^ gow gow
?. &(?=(& -.hot) ?=(^ p.hot)) ~
2014-03-27 21:39:17 +04:00
(rush -:(flop p.hot) fed:ag)
2013-09-29 00:21:18 +04:00
::
2014-03-12 23:50:39 +04:00
++ fail :: request failed
|= [sas=@ud str=tape]
^+ +>
%- muff
2013-09-29 00:21:18 +04:00
:- %thou
^- httr
2014-03-12 23:50:39 +04:00
[sas ~[content-type/'text/plain'] [~ (tact str)]]
2013-09-29 00:21:18 +04:00
::
2014-06-10 04:22:54 +04:00
++ gale :: ya from response
|= [our=ship ses=hole]
=+ sef=(need (~(get by own) our))
=+ cyz=(need (~(get by wup.sef) ses))
~(. ya [our ses] sef cyz)
::
2014-05-10 11:10:46 +04:00
++ galt
2014-06-07 22:36:31 +04:00
|= [our=ship ses=hole num=@ud mez=(each bead (list tank))]
2014-05-10 11:10:46 +04:00
^+ +>
=+ suf=(~(get by own) our)
?~ suf +>.$
=+ cuz=(~(get by wup.u.suf) ses)
?~ cuz +>.$
abet:work:(~(inch ya [our ses] u.suf u.cuz) num mez)
::
2014-06-04 21:56:30 +04:00
++ goat :: console response
2014-06-22 09:49:10 +04:00
|= [our=ship ses=hole num=@ud sih=sign]
2014-04-17 04:49:41 +04:00
=+ suf=(~(get by own) our)
?~ suf +>.$
=+ cuz=(~(get by wup.u.suf) ses)
?~ cuz +>.$
2014-06-22 06:51:12 +04:00
abet:work:(~(dodo ya [our ses] u.suf u.cuz) num sih)
2014-04-17 04:49:41 +04:00
::
2014-03-23 01:42:25 +04:00
++ gosh :: receive %pr response
|= [him=ship num=@ud har=httr]
^+ +>
=+ ryt=(~(get by fon) him)
?~ ryt +>.$
=+ zur=(~(get by q.rem.u.ryt) num)
?~ zur +>.$
2014-03-23 01:42:25 +04:00
%_ +>.$
2014-05-24 00:46:43 +04:00
mow :_(mow [u.zur [%give %thou har]])
fon (~(put by fon) him u.ryt(q.rem (~(del by q.rem.u.ryt) num)))
2014-03-23 01:42:25 +04:00
==
::
2014-05-10 11:10:46 +04:00
++ gout :: receive %clay
2014-04-09 02:26:01 +04:00
|= [our=ship ses=hole num=@ud rot=riot]
^+ +>
=+ suf=(~(get by own) our)
?~ suf +>.$
=+ cuz=(~(get by wup.u.suf) ses)
?~ cuz +>.$
abet:work:(~(iota ya [our ses] u.suf u.cuz) num rot)
2014-04-09 02:26:01 +04:00
::
++ haji :: send %pc login
2014-05-23 01:48:47 +04:00
|= [our=ship him=ship ses=hole]
^+ +>
2014-06-24 21:32:59 +04:00
+>.$(mow :_(mow [hen %pass ~ %a [%want [our him] [%r %pc ~] ses]]))
::
2014-03-23 01:42:25 +04:00
++ hajj :: send %pr response
2014-05-23 01:48:47 +04:00
|= [our=ship him=ship tus=path har=httr]
2014-03-23 01:42:25 +04:00
^+ +>
2014-06-24 21:32:59 +04:00
+>.$(mow :_(mow [hen %pass ~ %a [%want [our him] [%r %pr tus] har]]))
2014-03-23 01:42:25 +04:00
::
++ hare :: receive request
2014-05-23 01:48:47 +04:00
|= [our=ship tus=path him=ship hor=*]
2014-03-23 01:42:25 +04:00
^+ +>
=+ hux=((hard (unit httx)) hor)
%_ +>.$
mow
:_ mow
2014-05-29 02:06:52 +04:00
:- hen
2014-06-24 21:32:59 +04:00
:^ %pass [(scot %p our) (scot %p him) tus]
2014-06-21 22:42:34 +04:00
%e
2014-05-29 02:06:52 +04:00
?~(hux [%thud ~] [%this u.hux])
==
2014-03-23 01:42:25 +04:00
::
++ here :: receive auth
|= [our=ship him=ship hez=*]
^+ +>
=+ boy=(myth our (need ((sand %ta) ((hard ,@) hez))))
?~(boy +>.$ abet:(auth:u.boy him))
::
2014-03-12 23:50:39 +04:00
++ hell :: request, no ship
|= [pul=purl hyx=httx moh=moth]
2014-03-12 23:50:39 +04:00
^+ +>
2014-06-24 23:13:26 +04:00
=+ hon=(horn pul q.hyx moh)
?^ hon (muff u.hon)
:: =^ wiq q.q.pul
:: ?~ q.q.pul [~ ~]
:: =+ nam=(cat 3 '~' i.q.q.pul)
:: =+ gow=(rush i.q.q.pul fed:ag)
:: ^- [(unit ship) (list ,@t)]
:: ?~(gow [~ q.q.pul] [gow t.q.q.pul])
:: =+ oar=`(unit ship)`?^(wiq wiq (doss r.p.pul))
=+ oar=(fall (doss r.p.pul) (need hov))
?. (home oar)
(hork oar hyx)
(huff oar q.hyx pul moh)
2013-09-29 00:21:18 +04:00
::
++ home :: do we own?
|= who=ship
^- ?
2014-03-23 22:44:23 +04:00
?: (~(has by own) who) &
?: (~(has by fon) who) |
!=(~ (sky /a/(scot %p who)/buck/(scot %da now)))
::
2014-04-09 02:26:01 +04:00
++ hoot :: clay request
|= [our=ship num=@ud ses=hole rif=riff]
%_ +>
mow
:_ mow
2014-06-24 21:32:59 +04:00
:+ hen %pass
2014-06-21 22:42:34 +04:00
[[%hoot (scot %p our) ses (scot %ud num) ~] %c [%warp [our our] rif]]
2014-04-09 02:26:01 +04:00
==
::
2014-05-16 04:46:48 +04:00
++ hone :: kill ford
|= [our=ship num=@ud ses=hole]
%_ +>
mow
:_ mow
2014-06-24 21:32:59 +04:00
[hen %pass [%honk (scot %p our) ses (scot %ud num) ~] %f [%exec our ~]]
2014-05-16 04:46:48 +04:00
==
::
2014-05-10 11:10:46 +04:00
++ honk :: ford request
|= [our=ship num=@ud ses=hole kas=silk]
2014-07-15 06:45:04 +04:00
:: ~& [%honk our num ses -.kas]
2014-05-10 11:10:46 +04:00
%_ +>
mow
:_ mow
2014-06-24 21:32:59 +04:00
[hen %pass [%honk (scot %p our) ses (scot %ud num) ~] %f [%exec our `kas]]
2014-04-09 02:26:01 +04:00
==
::
++ hops :: cancel remote
|= [him=ship num=@]
^+ +>
=+ mun=(scot %ud num)
=+ rot=(need (~(get by fon) him))
%_ +>.$
mow
:_ mow
2014-05-24 00:46:43 +04:00
:- hen
2014-06-24 21:32:59 +04:00
:^ %pass [%hork (scot %p sor.rot) mun ~]
2014-06-21 22:42:34 +04:00
%a
2014-05-16 22:49:15 +04:00
[%want [sor.rot him] [%q %pr %e %hork mun ~] ~]
==
::
++ hork :: remote request
|= [him=ship hyx=httx]
^+ +>
2014-03-23 23:42:18 +04:00
=+ ^= sur ^- (unit ship)
?^ hov hov
?^ own [~ p.n.own]
~
?~ sur (fail 500 "no vessel available to proxy {<him>}")
?. (gth (met 3 him) (met 3 u.sur)) :: very permissive
2014-05-14 04:04:23 +04:00
(fail 500 "{<u.sur>} cannot proxy for {<him>}")
2014-03-23 01:42:25 +04:00
=+ ^= rot ^- rote
=+ rut=(~(get by fon) him)
2014-03-23 23:42:18 +04:00
?^ rut u.rut
[0 u.sur [0 ~]]
2014-03-23 01:42:25 +04:00
=+ num=p.rem.rot
2014-03-24 01:18:05 +04:00
=+ mun=(scot %ud num)
2014-03-23 23:42:18 +04:00
%_ +>.$
lor (~(put by lor) hen num [%| him])
2014-03-23 23:42:18 +04:00
mow
:_ mow
2014-05-24 00:46:43 +04:00
:- hen
2014-06-24 21:32:59 +04:00
:^ %pass [%hork (scot %p sor.rot) mun ~]
2014-06-21 22:42:34 +04:00
%a
2014-05-16 22:49:15 +04:00
[%want [sor.rot him] [%q %pr %e %hork mun ~] [~ hyx]]
2014-03-23 23:42:18 +04:00
::
fon
%+ ~(put by fon) him
2014-03-23 23:42:18 +04:00
%_ rot
cnt +(cnt.rot)
p.rem +(p.rem.rot)
q.rem (~(put by q.rem.rot) num hen)
2014-03-23 01:42:25 +04:00
==
2014-03-23 23:42:18 +04:00
==
::
++ horn :: irregular request
|= [pul=purl cip=clip moh=moth]
2014-06-24 23:13:26 +04:00
^- (unit gift)
2014-03-23 01:42:25 +04:00
=- ?: &(=(/favicon q.q.pul) ?=([~ ?(%ico %png)] p.q.pul))
2014-06-24 23:13:26 +04:00
:- ~
2014-03-23 01:42:25 +04:00
:- %thou
^- httr
[200 ~[content-type/'image/png'] [~ (taco fac)]]
?: &(=(/robots q.q.pul) ?=([~ %txt] p.q.pul))
2014-06-24 23:13:26 +04:00
:- ~
2014-03-23 01:42:25 +04:00
:- %thou
^- httr
[200 ~[content-type/'text/plain'] [~ (taco rob)]]
2014-06-24 23:13:26 +04:00
~
:*
2014-03-23 01:42:25 +04:00
^= rob
2014-06-24 21:32:59 +04:00
%- roly
2014-03-23 01:42:25 +04:00
:~ 'User-agent: *'
'Disallow: /'
==
::
^= fac
0w89.wgGV4.jAl90.00003.sV4OG.IJjfa.1vYpi.gRxB9.3m6kA.dopig.
RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.igRxB.93m6k.
Adopi.gRxBf.vGSfy.m8hQj.T-DiD.7kqvH.vEpA3.3vH-C.in~Tq.l8U0n.
1FVhj.w9E1A.NIF6w.4j9v~.VZ0~B.9flkB.IY90B.-ieSV.Ky8Q~.4~07s.
JcXFC.DtI-1.GGz-1.V-olV.g3wsv.ZCQM1.BJbVj.Vwiv0.uo7Gh.4qsxA.
92ZYU.tJ5uH.yiIzV.FwvJR.UUq6z.cpKIG.Hck9v.qGDm1.PY2rM.itxLB.
fn0Bo.5DO8x.oO7KE.kYh-P.NiKp1.HT88j.Mu3ZK.ciKsU.TnlkV.0Zo77.
12ciy.nY3dM.7nDnY.GVgGh.ZllpO.SFHFb.p1Ae0.uUpXV.eqFvS.pkBRl.
jv0MP.ilRHP.1HwtK.GFptt.2KdpP.RsYqI.wRHEG.j~LZQ.I06qJ.fP0Pp.
77qjo.s0PU0.rGGg6.lgNvc.~CZE~.bSp9j.EGHF~.UqYB6.l4Y~Z.P~GGE.
LwrJs.ZvYV-.U4Wh4.04dws.6HeuZ.2ZF7A.y4MN5.3vsCj.QHzjW.4lflk.
WU6X0.AmMws.vbMfB.3e1s~.aeE7W.0hQPH.ODvMf.cvgzb.Y15Ah.01384.
YwVPT.KzILB.PlaqN.pNlvw.fdQ79.~mPpo.YaHqw.fnWGB.QYM4F.w3E0b.
0o~n-.faydD.zlllI.0nU3D.w5rlI.4nrSG.VkhPM.NTkpa.eoXzw.9AEYN.
auZGt.99gxL.8RlsI.aXMXX.tFVhX.V4kj8.yczjh.faRI3.JTg1H.-0uZM.
JA6rR.z0~pO.uXiSg.rvU27.A58MU.TBijQ.23F1J.CCIYE.IO8w-.cMlMA.
hvKh4.zY16M.gjRlk.v--9h.TNNRR.HhIGo.8kZXk.Wb74j.faHlk.6V-Vw.
jMan8.yb37R.Q2h42.Or3Nw.Pp39w.jZ--3.-jwZH.U~3Za.Uu0u6.bNAOP.
U2jux.Jqo2R.O8x1~.ecZvL.30ug~.qpoFw.vwtqD.Vb6EI.cZQyO.EN-xl.
nlsLC.dT099.apOh5.SEeDz.07-GE.xFzZk.KcmCl.SJWF5.v3u1x.Uq1Cj.
tV~hG.YuGGb.SgpdR.xHaBh.S3eEv.q0mSg.RZh8s.wxhnk.EcNvW.GccZQ.
yO0Jb.n18hs.BLFx2.iigqf.AhsKS.LWqby.TUEmv.gmmhR.6DW3w.uLR0Y.
QQBC8.YoQ63.g8m8i.iq3B-.SxwLn.jLbh3.l7cq3.eVQmV.5O2df.SXBkv.
Y3LLb.denQq.GvR0R.P3Gh4.2iiq2.h-srW.o0ZZ-.HIrdj.npm5n.pnv07.
vyT77.43WGP.Bciiq.zt1cI.7A4xB.zK9xm.-tV6x.ZdA6P.pheXQ.aSz4X.
Zj2bS.C1UPx.~c1dS.xwF3b.6jZ-M.WI2eQ.e69Qw.DGFly.tTze-.GGbZU.
qJ-m-.fD8yI.Adktz.oqTsF.F7ltA.6no6T.~fWJU.0gRsp.-P88x.a9I9b.
Adkvz.ory8J.Ouhfu.H8c-U.2HLgE.Wi4xH.3AEGK.VjkS-.Z5hMx.UN5o~.
Y~EWp.7LGox.IQxpt.cgONH.CEyKJ.jjTdM.GJ9HL.RloJZ.xuRtL.JZ7jg.
ZZj6w.2AOoM.CENdS.xxegZ.RzTdh.i-1hZ.N1HPF.EqHU0.XzN6K.mBedG.
uvBiL.HqpmY.Bl9z2.qzqA8.WzKqz.h~S1J.K2QHQ.Dy-CM.7RO0l.QksW3.
mpFnx.fy-Pa.p7xhW.SboOd.fOBon.mCgSX.Z38Qe.dMHUC.79wje.wziG5.
6Xtn7.ksEHO.xkBrO.e7yFe.vNaYx.FgDsI.BS9y8.AELs-.C9-DB.FAZI-.
wKt2N.8qQhA.Apxm7.O5yIB.X51l9.Kduxm.SRA5N.UYi6I.MrySX.RZXrT.
8UcY2.zUAfu.SOcUK.vZrDL.vBAHb.eOo~N.7J3sR.eJhSo.4~YE1.5k0h5.
51RqS.b0jyR.RfhON.4Dt07.idahL.5isLK.eeBv3.znQxC.9LXkE.xKghP.
Ia-R0.AgmB5.pGGIA.slCGu.CtR5q.NrzHh.1bscz.8CsWC.KH4it.LLrWm.
UlRdr.lUGji.W76xr.kVAmO.6oAYS.7nXX~.kfeM2.TSS2m.JOCAb.sFFWg.
4xH3C.MDKh4.FZso1.tXwUJ.Taq5K.8yS24.xHr4M.Kvu~E.HTpka.-Zg3f.
KEXFS.qCKwh.l1KRN.c9H8A.HFcSw.rePCF.Iy93m.njkMZ.IEyiq.lFq3y.
gRFzg.uL9tz.zP8du.Y1ZWP.PtQ6G.gzIt5.K8hNz.UAdpM.Q43L6.IMHx5.
N8qPh.EfX8G.UC~68.S93ms.d18Vh.adkOx.GLkTI.khFcL.ZWG5G.Adoeh.
hx~As.hci6I.Uq2pG.ykqHO.yUAdq.gQ7FD.4sOjn.IwGGw.UAdqo.Q4jVN.
eJP8c.xQlm~.8nJ1y.gRF3g.oSPAM.fuqE0.M~23y.gRHyo.gngjF.ceM3n.
V~uQy.93m-9.xa-3N.T80~v.GzR-g.HqBGA.mi4xH.3AMOL.mCjT5.Blqab.
60ruw.HDV~k.Tj~fX.Swx8u.ZFOoi.m1GUF.Gs4-q.0kfxh.H8yjt.OCXGL.
PYGTY.23LgI.Wl4x6.8bI3e.MXeVb.h6rL9.DXWyt.8wJ8W.HalWR.itqp3.
pkrSC.8bQSM.HLV2J.G7sCj.QtGEi.AkSwI.A4P0J.gJ85j.MuMUY.nkT45.
-rkqv.BFBFU.KGd98.qRs~A.iblOv.mVKWx.Z19cs.AxHc6.UIKJc.NIHW8.
EnOEy.fygRG.29bbR.FBDVL.Ter6T.SBKat.MFBPE.AfuO9.kBHV~.QstE-.
VaYNV.qpfhL.sFHj0.eFphG.U6Hw6.EsVox.7kpks.N6bRk.GMLY~.HWBVj.
Snx6X.0GY2b.GhzmW.udfRF.jTgLC.uPWGL.fIwM6.16Ah4.NFZjz.Ftln7.
KQ-k-.0SO8H.xrqcw.MXZG9.6BZsJ.zULJU.NPDy3.aewMa.3auiA.Ysei3.
YQJGB.PlCAQ.S5YPU.uGEtI.wQrw1.cy8Sd.bFYuX.GGWZS.DSq1Y.O8ELq.
cR6kA.dopig.RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.
igRxB.93m6k.Adopi.gRxB9.3m6kA.doSsI.1Tves.7Fb5l.hneus.VDLsZ.
~P3DD.D~CpI.BALPA.rxSTT.fuXa4.gP3Yv.sPKOY.KSMKP.balqk.xjbEH.
idkbq.Elo0N.dHjkM.vEBiq.BC-Rb.IKMiB.JiaoS.x3mLy.Jr6P5.ToiS2.
gAz4y.qNHiI.k7WIl.9EJGb.iJ2Tp.NQ5H5.VpSni.By-OX.TfvYs.plRic.
rpPJD.7xkgk.h9BMw.001EY.XFJDs.CYKpn.1xoTd.HrCAK.tTtT0.6lOon.
tQpCZ.jt5x5.t1A00.01UCO.x20ts.d003n.3g00s.RB8s0.A0002.8p0xY.
20w82.5h9gD.c4000.0l9ny.s0000.0o8p0.0006g.0001i.h4x93.g0000.
Eq2wR.7jB29
==
::
++ huff :: request by ship
2014-06-24 23:13:26 +04:00
|= [our=ship cip=clip pul=purl moh=moth]
2014-03-12 23:50:39 +04:00
=* sec p.p.pul
=+ ^= sef ^- serf
=+ suf=(~(get by own) our)
2014-03-12 23:50:39 +04:00
?^ suf u.suf
=+ sef=*serf
2014-03-23 23:42:18 +04:00
sef(pef (cat 3 gub (rsh 3 1 (scot %p our)))) :: XX transitional
2014-03-20 05:05:42 +04:00
=+ ^= saw ^- [p=hole q=cyst]
2014-03-12 23:50:39 +04:00
=+ lig=(coss pef.sef q.moh)
?^ lig
2014-03-12 23:50:39 +04:00
=+ cyz=(need (~(get by wup.sef) u.lig))
[u.lig cyz(cug ~)]
2014-03-20 05:05:42 +04:00
=+ ses=(rsh 3 1 (scot %p (end 6 1 ney)))
2014-03-12 23:50:39 +04:00
:- ses
^- cyst
:* ^- cred
2014-06-24 23:13:26 +04:00
:* [sec q.p.pul r.p.pul]
2014-03-20 05:05:42 +04:00
~
(rsh 3 1 (scot %p (end 6 1 (shaf %oryx ses))))
::
=+ lag=(~(get by q.moh) %accept-language)
?~(lag ~ ?~(u.lag ~ [~ i.u.lag]))
::
cip
~
2014-03-12 23:50:39 +04:00
==
2014-04-16 05:35:25 +04:00
::
~
2014-03-12 23:50:39 +04:00
::
:_ ~
%^ cat 3
(cat 3 (cat 3 pef.sef '=') ses)
2014-03-20 05:05:42 +04:00
:: (cat 3 '; HttpOnly' ?.(sec '' '; Secure'))
'; Path=/; HttpOnly'
2014-03-12 23:50:39 +04:00
::
now
2014-06-10 00:09:14 +04:00
~
2014-03-12 23:50:39 +04:00
[1 ~]
==
abet:work:(~(into ya [our p.saw] sef q.saw) pul moh)
2014-03-12 23:50:39 +04:00
::
++ muff :: return card
2014-06-04 14:40:09 +04:00
|= gef=gift
+>(mow :_(mow [hen %give gef]))
2013-09-29 00:21:18 +04:00
::
++ myth :: load session
|= [our=ship ses=hole]
=+ suf=(~(get by own) our)
?~ suf ~
=+ cuz=(~(get by wup.u.suf) ses)
?~ cuz ~
[~ u=~(. ya [our ses] u.suf u.cuz)]
::
++ noon :: login page
|= [our=ship whu=(unit ship) rul=tape ruf=tape]
^- manx
=+ ^= sic ^- manx
;script
2014-04-25 21:56:34 +04:00
;
; var seal = {
; who: goal,
; url: burl,
; pas: null
; }
2014-04-25 21:56:34 +04:00
; var hist = []
; var hind = 0
; $(
; function() {
; $input = $('#input .line')
; $prompt = $('#input .prompt')
; $prompt.addClass('prefix')
; $output = $('#output')
; $input.focus()
2014-04-25 21:56:34 +04:00
; $('body').click(function() { $input.focus() })
; ctrl = false;
;
; start = function(ship) {
; $prompt.text('vessel: ~')
; $input.attr('placeholder', 'ship-name')
; if(ship) {
; $input.val(ship)
; }
; }
;
; ident = function() {
; seal.who = $input.val()
;
; if( (seal.who.length != 13) &&
; (seal.who.length != 6) &&
; (seal.who.length != 3) )
; {
; $output.text('not a ship name - try again.');
; return false;
; }
;
; if(seal.who !== host) {
; var foreign = {oth: host, ses: session};
; var all = $.extend({}, seal, foreign);
;
; console.log('redirect')
; window.location="http://"+seal.who+".urbit.org/gul"
; + $.params(all);
; return false;
; }
;
; $output.text($prompt.text() + " " + seal.who)
; $input.val('')
; $input.attr('placeholder', 'ronber-bacnub-hanmev-labnyd')
; $prompt.text('secret: ~')
;
; return true;
; }
;
; login = function() {
; seal.pas = $input.val()
;
; output = $output.html()
; console.log($output.html())
; $output.html(output.replace('sorry. please try again.<br>',''))
;
; $.post(form, seal, function(data,xhr,status) {
2014-04-26 00:49:52 +04:00
; console.log(data);
; if(data.ok == true) {
2014-04-26 00:49:52 +04:00
; document.location = data.next;
; } else {
; $output.prepend('sorry. please try again.<br>')
; }
; })
; }
;
; steps = [ident,login]
; step = 0
; start(seal.who)
; if(seal.who) {
; ident()
; step++
; }
;
; $input.on('keydown', function(e) {
; if(e.keyCode == 17) {
; ctrl = true
; return;
; }
;
; if(e.keyCode == 68 &&
; ctrl == true &&
; step == 1) {
; $output.text('')
; step = 0
; start(null)
; return;
; }
;
; if(e.keyCode == 13) {
; if(steps[step]() && step < steps.length-1)
; step++
; return;
; }
; });
;
; $input.on('keyup', function(e) {
; if(e.keyCode == 17) {
; ctrl = false
; }
; });
; })
==
=+ ^= cof
;=
; var host = '{(trip (rsh 3 1 (scot %p our)))}';
; var goal = '{?~(whu ~ (trip (rsh 3 1 (scot %p u.whu))))}';
; var burl = '{rul}';
; var form = '{ruf}';
==
=> .(+.sic (weld `marl`cof `marl`+.sic))
=+ jqu="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
=+ ^= hed
;head
;title: urbit login
;script(type "text/javascript", src jqu);
;style
; body {
; margin: 60px 120px;
; font: normal 12px "Menlo" monospace;
; background-color: #000;
; color: #fff;
; }
;
; #output {
;
; }
;
; #input .prompt {
; display: inline-block;
; margin-right: 12px;
; }
;
; #input .line {
; outline: none;
; width: 80%;
; border: 0;
; background-color: transparent;
; color: #fff;
; font: normal 12px "Menlo" monospace;
; }
==
==
=+ ^= bod ^- manx
;body
;div#output;
;div#input
;div.prompt;
;input.line(type "text");
==
==
=. +.bod (weld `marl`+.bod `marl`~[sic])
;html
;+ hed
;+ bod
==
::
2014-03-12 23:50:39 +04:00
++ ya :: session engine
2014-03-20 05:05:42 +04:00
=| [[our=ship ses=hole] serf cyst]
2014-03-12 23:50:39 +04:00
=* sef ->-
=* cyz ->+
|%
++ abet :: resolve engine
^+ ..ya
%= ..ya
own
(~(put by own) our sef(wup (~(put by wup) ses cyz)))
==
::
++ auth :: remote authorize
|= him=ship
%_(+> aut.ced (~(put ju aut.ced) %$ (scot %p him)))
::
2014-04-16 05:35:25 +04:00
++ dodo :: console s->c
2014-06-22 09:49:10 +04:00
|= [con=@ud sih=sign]
2014-04-16 05:35:25 +04:00
^+ +>
=+ cal=(need (~(get by cow) con))
=+ ^= jon ^- json
2014-06-22 06:51:12 +04:00
?: ?=(%helo -.+.sih)
2014-04-16 05:35:25 +04:00
%+ joba %helo
%- jobe
2014-07-12 22:24:52 +04:00
:~ [%path [%a `(list json)`(turn p.+.sih |=(a=@ta [%s a]))]]
2014-06-22 06:51:12 +04:00
[%prod ~[%a [%s p.q.+.sih] (jape q.q.+.sih) (jape r.q.+.sih)]]
2014-04-16 05:35:25 +04:00
==
%+ joba %text
2014-07-12 22:24:52 +04:00
:- %a ^- (list json)
2014-06-22 06:51:12 +04:00
?+ -.+.sih ~|(-.+.sih !!)
%tell (turn p.+.sih |=(a=@t [%s a]))
%text [%s (crip p.+.sih)]~
%talk (turn (~(win re p.+.sih) [0 80]) |=(a=tape [%s (crip a)]))
%warn [%s (crip '!' p.+.sih)]~
2014-04-16 05:35:25 +04:00
==
=+ ^= yov ^- (list ,@ud)
=+ yov=(~(get by voy.cal) ono.cal)
?~(yov ~ u.yov)
=: voy.cal (~(del by voy.cal) ono.cal)
ono.cal +(ono.cal)
out.cal [jon out.cal]
==
=. cow (~(put by cow) con cal)
?~(yov +>.$ (dove ~[%a (jone ono.cal) (jone ino.cal) jon] yov))
::
2014-06-08 06:45:00 +04:00
++ iota :: fun change response
2014-06-04 21:56:30 +04:00
|= [num=@ud rot=riot]
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup
~& [%iota-lost ses num rot]
+>.$
?> ?=(%way pez.u.pup)
+>.$(q.rey (~(put by q.rey) num u.pup(pez [%haz rot])))
::
2014-04-17 04:49:41 +04:00
++ dove :: console waiting
2014-04-16 05:35:25 +04:00
|= [jon=json yov=(list ,@ud)]
^+ +>
=+ noz=`pest`[%fin %mid /text/json (tact (pojo jon))]
|- ^+ +>.^$
?~ yov +>.^$
=+ pup=(~(get by q.rey) i.yov)
?~ pup $(yov t.yov)
?> ?=(%way pez.u.pup)
$(yov t.yov, q.rey (~(put by q.rey) i.yov u.pup(pez noz)))
::
2014-07-11 06:40:58 +04:00
++ duti :: heartbeat script
;script:'''
var heart = {
seqn: 0,
trys: 0,
2014-07-12 06:02:11 +04:00
dely: 30000,
2014-07-11 06:40:58 +04:00
beat: function() {
var method, perm, url, $this
method = "put"
perm = "tih"
2014-07-17 06:10:13 +04:00
url = [perm,user,port,heart.seqn]
2014-07-11 06:40:58 +04:00
url = "/"+url.join("/")
$this = this
var xhr = new XMLHttpRequest()
xhr.open(method.toUpperCase(), url)
xhr.setRequestHeader("content-type", "text/json")
xhr.send(JSON.stringify({oryx:oryx, xyro: {heart:"beat"}}))
xhr.onload = function () {
2014-07-12 03:44:33 +04:00
heart.seqn++
heart.trys = 0
setTimeout(heart.beat,heart.dely)
2014-07-11 06:40:58 +04:00
}
xhr.onerror = function() {
2014-07-12 03:44:33 +04:00
heart.trys++
setTimeout(heart.beat,heart.dely*heart.trys)
2014-07-11 06:40:58 +04:00
}
}
}
heart.beat()
'''
2014-06-08 06:45:00 +04:00
::
2014-06-10 00:09:14 +04:00
++ fape :: dispatch %ape
|= [fur=(unit term) you=@p paw=path]
2014-06-08 06:45:00 +04:00
^- (unit seam)
?> ?=(~ fur)
2014-07-17 06:10:13 +04:00
?> ?=([@ @ ~] paw)
2014-06-10 00:09:14 +04:00
:- ~
:* %ape
you
2014-07-17 06:10:13 +04:00
(slav %ui (cat 3 '0i' i.paw))
2014-06-25 23:13:15 +04:00
(slav %ui (cat 3 '0i' i.t.paw))
2014-06-10 00:09:14 +04:00
==
2014-06-08 06:45:00 +04:00
::
2014-06-10 00:09:14 +04:00
++ fapg :: dispatch %apg
|= [fur=(unit term) you=@p paw=path]
^- (unit seam)
2014-06-17 05:33:31 +04:00
=+ for=?^(fur u.fur %html)
2014-05-30 02:00:13 +04:00
?> ?=(^ paw)
2014-06-10 00:09:14 +04:00
:- ~
:* %apg
(need ((sand %tas) i.paw))
you
2014-06-17 05:33:31 +04:00
for
2014-06-10 00:09:14 +04:00
(turn t.paw |=(a=@ `@ta`(need ((sand %ta) a))))
==
::
2014-07-11 06:40:58 +04:00
++ faph :: dispatch %aph
|= [fur=(unit term) you=@p paw=path moh=moth]
^- (unit seam)
?> ?=(~ fur)
2014-07-17 06:10:13 +04:00
?> ?=([@ @ ~] paw)
2014-07-11 06:40:58 +04:00
:- ~
:* %aph
you
2014-07-17 06:10:13 +04:00
(slav %ui (cat 3 '0i' i.paw))
2014-07-11 06:40:58 +04:00
(slav %ui (cat 3 '0i' i.t.paw))
(need (ecci orx.ced moh))
==
::
2014-06-10 00:09:14 +04:00
++ fapm :: dispatch %apm
|= [fur=(unit term) you=@p paw=path moh=moth]
^- (unit seam)
?> ?=(~ fur)
2014-07-17 06:10:13 +04:00
?> ?=([@ @ ~] paw)
2014-06-10 00:09:14 +04:00
:- ~
:* %apm
you
2014-07-17 06:10:13 +04:00
(slav %ui (cat 3 '0i' i.paw))
2014-06-25 23:13:15 +04:00
(slav %ui (cat 3 '0i' i.t.paw))
2014-07-17 06:10:13 +04:00
(need (eccu orx.ced moh))
2014-06-10 00:09:14 +04:00
==
::
++ faps :: dispatch %aps
2014-06-25 02:00:07 +04:00
|= [fur=(unit term) you=@p paw=path moh=moth]
2014-06-10 00:09:14 +04:00
^- (unit seam)
?> ?=(~ fur)
2014-07-18 23:23:35 +04:00
?> ?=([@ ~] paw)
2014-06-10 00:09:14 +04:00
:- ~
:* %aps
you
2014-07-17 06:10:13 +04:00
(slav %ui (cat 3 '0i' i.paw))
(need (ecca orx.ced moh))
==
2014-06-10 00:09:14 +04:00
::
++ fapu :: dispatch %apu
2014-07-17 06:10:13 +04:00
|= [fur=(unit term) you=@p paw=path moh=moth]
2014-06-10 00:09:14 +04:00
^- (unit seam)
?> ?=(~ fur)
2014-07-18 23:23:35 +04:00
?> ?=([@ ~] paw)
2014-06-10 00:09:14 +04:00
:- ~
:* %apu
you
2014-07-18 23:23:35 +04:00
(slav %ui (cat 3 '0i' i.paw))
2014-07-17 06:10:13 +04:00
(need (ecca orx.ced moh))
2014-06-10 00:09:14 +04:00
==
::
2014-04-16 23:47:41 +04:00
++ flea :: permissive decimal
|= txt=@t
^- (unit ,@ud)
=+ zac=(slay txt)
?: ?=([~ %$ %ud @] zac)
[~ q.p.u.zac]
=+ soc=(rush txt dim:ag)
?~(soc ~ [~ u.soc])
::
2014-04-21 21:02:09 +04:00
++ foal :: url from query
|= [nam=@t yaq=(map ,@t ,@t)]
^- (unit purl)
=+ uru=(~(get by yaq) %url)
?~ uru ~
(rush u.uru auri:epur)
::
++ folk :: seal from query
2014-04-21 21:02:09 +04:00
|= quy=quay
^- (unit seal)
2014-04-21 21:02:09 +04:00
=+ yaq=(~(gas by *(map ,@t ,@t)) quy)
=+ pyl=(foal %url yaq)
=+ wit==(%yes (fall (~(get by yaq) %wit) %no))
=+ huw=(~(get by yaq) %who)
=+ whu=?~(huw ~ (rush u.huw fed:ag))
=+ pus=(~(get by yaq) %pas)
=+ tuh=(~(get by yaq) %oth)
=+ thu=?~(tuh ~ (rush u.tuh fed:ag))
=+ sus=(~(get by yaq) %ses)
=+ foy=?~(sus ~ ?~(thu ~ [~ u.thu u.sus]))
2014-04-21 21:02:09 +04:00
?~ pyl ~
?: &(wit |(=(~ whu) =(~ ses))) ~
2014-04-26 00:49:52 +04:00
:: ~& [%folk-quay whu u.pyl wit foy pus]
[~ whu u.pyl wit foy pus]
::
++ fool :: domestic login get
|= quy=quay
^- (unit seam)
(bind (folk quy) |=(a=seal [%lon a]))
2014-04-21 21:02:09 +04:00
::
++ foom :: domestic login post
|= moh=moth
^- (unit seam)
?. ?& ?=(^ r.moh)
:: .= [~ 'application/x-www-form-urlencoded' ~]
:: (~(get by q.moh) 'content-type')
2014-04-21 21:02:09 +04:00
== ~
=+ yuq=(rush q.u.r.moh yquy:epur)
?~(yuq ~ (fool u.yuq))
2014-04-21 21:02:09 +04:00
::
2014-04-16 23:47:41 +04:00
++ flub :: console request
|= [paw=(list ,@t) muh=(unit moth)]
^- (unit seam)
?: ?=([@ ~] paw)
?^ muh ~
=+ fee=(flea i.paw)
?~ fee ~
[~ %con u.fee]
?. ?=([@ @ ~] paw) ~
=+ [fee=(flea i.paw) fum=(flea i.t.paw)]
?. &(?=(^ fee) ?=(^ fum)) ~
?: |(?=(~ muh) ?=(~ r.u.muh))
[~ %cog u.fee u.fum]
2014-04-17 04:49:41 +04:00
?. =([~ 'text/json' ~] (~(get by q.u.muh) 'content-type'))
2014-04-16 23:47:41 +04:00
~
=+ jun=`(unit json)`(rush q.u.r.u.muh apex:poja)
?~ jun
~
[~ %cop u.fee u.fum u.jun]
::
2014-03-20 05:05:42 +04:00
++ flux :: credential caboose
2014-07-09 13:40:49 +04:00
|= [nyp=path quy=quay]
2014-03-20 05:05:42 +04:00
^- coin
:* %many
2014-07-09 13:40:49 +04:00
[%many (turn nyp |=(a=span [%$ %ta a]))]
2014-03-20 05:05:42 +04:00
[%blob ced]
|- ^- (list coin)
?~ quy ~
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
==
2014-03-20 05:05:42 +04:00
::
2014-04-09 02:26:01 +04:00
++ foin :: version request
|= [fur=(unit term) paw=(list ,@t) quy=quay]
^- (unit seam)
?. ?& ?=(~ fur)
?=(~ quy)
?=([@ @ ~] paw)
((sane %tas) i.t.paw)
== ~
%+ bind
^- (unit moat)
=+ soy=(slay i.paw)
?~ soy ~
?+ u.soy
2014-04-09 02:26:01 +04:00
~
::
[%$ ?(%da %ud %tas) @]
2014-04-09 02:26:01 +04:00
[~ (case p.u.soy) (case p.u.soy)]
::
[%many [%$ ?(%da %ud %tas) @] [%$ ?(%da %ud %tas) @] ~]
[~ (case i.p.u.soy) (case i.t.p.u.soy)]
==
|= mot=moat
`seam`[%det i.t.paw mot]
::
2014-03-12 23:50:39 +04:00
++ funk :: functional request
2014-03-26 04:48:22 +04:00
|= [nep=@tas fur=(unit term) paw=(list ,@t) quy=quay]
2014-03-12 23:50:39 +04:00
^- (unit seam)
2014-04-10 03:51:19 +04:00
=+ won==(%n (rsh 3 2 nep))
2014-03-20 05:05:42 +04:00
%+ bind
^- (unit ,[mark tube])
2014-03-20 05:05:42 +04:00
=+ ^= zac ^- (unit ,[p=@ta q=path])
2014-04-10 03:51:19 +04:00
?: won
2014-03-20 05:05:42 +04:00
[~ (scot %da now) paw]
?~ paw ~
=+ zac=(slay i.paw)
?. ?=([~ %$ ?(%ud %da %tas) *] zac) ~
[~ i.paw t.paw]
?: ?| ?=(~ zac)
2014-04-09 02:26:01 +04:00
?=(~ q.u.zac)
2014-03-20 05:05:42 +04:00
!(levy t.q.u.zac (sane %ta))
== ~
:+ ~ ?~(fur %html u.fur)
^- tube
:* (scot %p our)
i.q.u.zac
p.u.zac
2014-03-20 05:05:42 +04:00
t.q.u.zac
==
|= [for=mark toe=tube]
2014-03-20 05:05:42 +04:00
^- seam
2014-04-10 03:51:19 +04:00
:^ %fun for
2014-07-11 03:13:42 +04:00
toe(s (weld s.toe `path`[~(rent co (flux [nep ~] quy)) %web ~]))
2014-04-10 03:51:19 +04:00
?. won ~
:_ ~
=- =+ pey=(cat 3 (end 3 2 nep) %v)
=+ ven=+((,@ (need (sky %cw p.toe q.toe r.toe ~))))
=+ ^= cal :/
"path='".
2014-04-10 03:51:19 +04:00
"/{(trip pey)}".
"/{(scow %ud ven)}".
"/{(trip q.toe)}';"
[-.sac [cal +.sac]]
2014-04-10 03:51:19 +04:00
^= sac
;script
2014-04-14 22:22:36 +04:00
;
2014-04-10 03:51:19 +04:00
; tries = 0;
; call = function() {
2014-04-10 03:51:19 +04:00
; xhr = new XMLHttpRequest();
; xhr.open('GET', path, true);
; xhr.addEventListener('load', function() {
; if(this.status !== 200) {
; return keep();
; }
; document.location.reload();
; });
; xhr.addEventListener('error', keep);
; xhr.addEventListener('abort', keep);
; xhr.send();
; }
; keep = function() {
; setTimeout(call,1000*tries);
; tries++;
; }
; call();
2014-04-10 03:51:19 +04:00
==
2014-03-12 23:50:39 +04:00
::
2014-04-21 21:02:09 +04:00
++ holt :: login redirect
|= [whu=(unit ship) pul=purl]
^- (unit seam)
:+ ~
%red
:: :+ [& q.p.pul r.p.pul]
%+ earl our
:+ [p.p.pul q.p.pul r.p.pul]
[~ /gul]
:- [%url (crip (urle (earn (earl our pul))))]
?~ whu ~
[%who (rsh 3 1 (scot %p u.whu))]~
::
2014-03-12 23:50:39 +04:00
++ holy :: structured request
|= [pul=purl moh=moth]
^- (unit seam)
2014-06-24 21:32:59 +04:00
?: &(=(%get p.moh) ?=([~ [@ ~]] q.pul)) :: app shortcut
:: XX use credential to figure out gog/gig
$(q.pul [`%html [%gog i.q.q.pul ~]])
2014-03-12 23:50:39 +04:00
?~ q.q.pul ~
=* nep i.q.q.pul
2014-06-10 00:09:14 +04:00
=+ paw=t.q.q.pul
2014-03-12 23:50:39 +04:00
=+ [one=(end 3 1 nep) two=(cut 3 [1 1] nep) tri=(cut 3 [2 1] nep)]
?. ?& ?- p.moh
2014-03-20 05:05:42 +04:00
%conn | :: connect
%delt | :: delete
%get =(%g one) :: get
%head =(%g one) :: head
%opts | :: options
%post =(%p one) :: post
%put =(%t one) :: put
%trac | :: trace
2014-03-12 23:50:39 +04:00
==
2014-04-21 21:02:09 +04:00
::
?+ two |
2014-03-12 23:50:39 +04:00
%e & :: stranger
2014-04-23 21:02:36 +04:00
%u p.p.pul :: guest
2014-04-21 21:02:09 +04:00
%i p.p.pul :: neighbor
2014-04-23 21:02:36 +04:00
%o p.p.pul :: identified
2014-03-12 23:50:39 +04:00
==
2014-04-21 21:02:09 +04:00
::
2014-06-10 00:09:14 +04:00
?= $? %g :: app get
2014-03-12 23:50:39 +04:00
%c :: console
2014-06-10 00:09:14 +04:00
%e :: app update
2014-03-12 23:50:39 +04:00
%f :: functional
2014-06-08 06:45:00 +04:00
%v :: functional version
2014-04-21 21:02:09 +04:00
%l :: local login
2014-06-10 00:09:14 +04:00
%m :: app message
%r :: app response
%s :: app subscribe
2014-07-11 06:40:58 +04:00
%h :: app heartbeat
2014-03-12 23:50:39 +04:00
%n :: now
2014-06-10 00:09:14 +04:00
%u :: app unsubscribe
2014-06-08 06:45:00 +04:00
%z :: app version
2014-03-12 23:50:39 +04:00
==
tri
2014-04-21 21:02:09 +04:00
::
!&(=(%c tri) !=(%o two))
2014-03-12 23:50:39 +04:00
=(3 (met 3 nep))
==
~
2014-06-10 00:09:14 +04:00
=^ yun paw
?+ two ~
?(%e %u) [`@`(shaf %fake ses) paw]
%i ?~ paw ~
2014-06-25 23:13:15 +04:00
[(slav %p (cat 3 '~' i.paw)) t.paw]
2014-06-10 00:09:14 +04:00
%o [our paw]
==
:: ?: &(=(%i two) =(~ aut.ced))
:: (holt ~ pul)
:: ?: &(=(%o two) !(~(has ju aut.ced) %$ (scot %p our)))
:: (holt [~ our] pul)
2014-04-21 21:02:09 +04:00
?+ one ~
%g
?+ tri ~
?(%f %n) (funk nep p.q.pul paw r.pul)
%v (foin p.q.pul paw r.pul)
%c (flub paw ~)
%l (fool r.pul)
2014-06-10 00:09:14 +04:00
%g (fapg p.q.pul yun paw)
%e (fape p.q.pul yun paw)
2014-04-21 21:02:09 +04:00
==
::
%p
?+ tri ~
%l (foom moh)
2014-06-10 00:09:14 +04:00
%m (fapm p.q.pul yun paw moh)
2014-06-25 02:00:07 +04:00
%s (faps p.q.pul yun paw moh)
2014-07-17 06:10:13 +04:00
%u (fapu p.q.pul yun paw moh)
2014-04-21 21:02:09 +04:00
==
::
%t
?+ tri ~
%c (flub paw [~ moh])
2014-07-11 06:40:58 +04:00
%h (faph p.q.pul yun paw moh)
%m (fapm p.q.pul yun paw moh)
%s (faps p.q.pul yun paw moh)
2014-07-17 06:10:13 +04:00
%u (fapu p.q.pul yun paw moh)
2014-04-21 21:02:09 +04:00
==
2014-03-12 23:50:39 +04:00
==
::
++ idle :: cancel request
|= num=@ud
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup +>.$
=. q.rey (~(del by q.rey) num)
?. ?=(%way pez.u.pup) +>.$
2014-05-16 04:46:48 +04:00
?: ?=(%det -.som.u.pup)
+>.$(..ya (hoot our num ses `riff`[p.som.u.pup ~]))
?: ?=(%fun -.som.u.pup)
+>.$(..ya (hone our num ses))
+>.$
::
2014-06-17 05:33:31 +04:00
++ bush :: error response
|= [cod=@ud msg=@t num=@ud]
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup +>.$
%= +>.$
q.rey
%+ ~(put by q.rey) num
%= u.pup
pez
`pest`[%fin %raw cod ~[content-type/'text/plain'] `(taco msg)]
==
==
2014-06-10 00:09:14 +04:00
::
2014-06-17 05:33:31 +04:00
++ bust :: no-content response
|= [cod=@ud num=@ud]
2014-06-12 07:47:57 +04:00
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup +>.$
2014-06-12 21:54:45 +04:00
:: ?> ?=(%way pez.u.pup)
2014-06-10 00:09:14 +04:00
%= +>.$
q.rey
%+ ~(put by q.rey) num
2014-06-17 05:33:31 +04:00
u.pup(pez [%fin %raw cod *mess `*octs])
2014-06-10 00:09:14 +04:00
==
::
2014-05-10 11:10:46 +04:00
++ inch :: function built
2014-06-07 22:36:31 +04:00
|= [num=@ud mez=(each bead (list tank))]
2014-05-10 11:10:46 +04:00
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup
~& [%inch-lost ses num mez]
+>.$
?> ?=(%way pez.u.pup)
+>.$(q.rey (~(put by q.rey) num u.pup(pez [%fud mez])))
::
++ into :: introduce
|= [pul=purl moh=moth]
2014-04-09 02:26:01 +04:00
^+ +>
=+ num=p.rey
%= +>.$
lor (~(put by lor) hen num [%& our ses])
2014-04-09 02:26:01 +04:00
p.rey +(num)
q.rey
%+ ~(put by q.rey) num
^- pimp
:* !?=(%head p.moh)
2014-06-12 21:19:36 +04:00
p.q.pul
2014-04-09 02:26:01 +04:00
hen
*seam
`pest`[%raw pul moh]
2014-06-08 06:45:00 +04:00
~
2014-06-13 02:10:32 +04:00
~
2014-04-09 02:26:01 +04:00
==
==
::
++ iota :: change response
|= [num=@ud rot=riot]
^+ +>
=+ pup=(~(get by q.rey) num)
?~ pup
~& [%iota-lost ses num rot]
+>.$
?> ?=(%way pez.u.pup)
+>.$(q.rey (~(put by q.rey) num u.pup(pez [%haz rot])))
2014-04-09 02:26:01 +04:00
::
2014-04-23 23:26:22 +04:00
++ lass :: load secret
^- @ta
%^ rsh 3 1
(scot %p (,@ (need (sky %a (scot %p our) %code (scot %da now) ~))))
::
2014-03-12 23:50:39 +04:00
++ step :: step in work
|- ^+ +
=^ zib +.$
=+ yub=q.rey
|- ^- [(list ,[p=@ud q=pimp]) _+.^$]
?~ yub [~ +.^$]
2014-06-04 14:40:09 +04:00
=^ sid +.^$ $(yub l.yub)
=^ dex +.^$ $(yub r.yub)
2014-04-09 02:26:01 +04:00
=^ top +.^$ (wink n.yub)
2014-03-12 23:50:39 +04:00
=+ pot=`(list ,[p=@ud q=pimp])`?~(top ~ [[p.n.yub u.top] ~])
2014-06-04 14:40:09 +04:00
[:(weld pot dex sid) +.^$]
2014-03-12 23:50:39 +04:00
+.$(q.rey (~(gas by `_q.rey`~) zib))
::
++ wink :: advance request
2014-04-09 02:26:01 +04:00
|= [num=@ud pip=pimp]
2014-03-12 23:50:39 +04:00
^- [(unit pimp) _+>]
?- pez.pip
2014-04-09 02:26:01 +04:00
%way [[~ pip] +>.$]
2014-03-12 23:50:39 +04:00
%new
2014-03-26 04:48:22 +04:00
?- -.som.pip
2014-06-10 00:09:14 +04:00
%ape :: stream update
2014-06-12 21:19:36 +04:00
:: ~& :~ %eyre-ape
:: [%owner our]
:: [%requester num]
:: [%app p.som.pip]
:: [%user q.som.pip]
:: [%instance r.som.pip]
:: [%stream s.som.pip]
:: [%request t.som.pip]
:: ==
[`(fall +< -(pez %way)) +>]:[pip (yoke num +.som.pip)]
2014-06-08 06:45:00 +04:00
::
2014-06-04 21:56:30 +04:00
%apg :: simple get
2014-06-12 21:19:36 +04:00
:: ~& :~ %eyre-apg
:: [%owner our]
:: [%requester num]
:: [%app p.som.pip]
:: [%user q.som.pip]
:: [%logo r.som.pip]
:: [%path s.som.pip]
:: ==
2014-05-30 02:00:13 +04:00
:- [~ pip(pez %way)]
2014-06-10 00:09:14 +04:00
(yokg num p.som.pip q.som.pip s.som.pip)
2014-07-11 06:40:58 +04:00
::
%aph :: heartbeat
2014-07-12 06:02:11 +04:00
:: ~& [%wink-aph +.som.pip]
2014-07-11 06:40:58 +04:00
(yokh num +.som.pip)
2014-06-02 01:07:13 +04:00
::
2014-06-10 00:09:14 +04:00
%apm :: message
2014-06-25 02:00:07 +04:00
:: ~& [%wink-apm +.som.pip]
2014-06-10 00:09:14 +04:00
:- [~ pip(pez %way)]
(yokm num +.som.pip)
::
%aps :: subscribe
2014-06-25 02:00:07 +04:00
:: ~& [%wink-aps +.som.pip]
2014-06-10 00:09:14 +04:00
:- [~ pip(pez %way)]
(yoks num +.som.pip)
::
%apu :: unsubscribe
2014-06-25 02:00:07 +04:00
:: ~& [%wink-apu +.som.pip]
2014-06-10 00:09:14 +04:00
(yoku num +.som.pip)
::
2014-04-16 23:47:41 +04:00
%con
:_ +>.$
2014-04-21 21:02:09 +04:00
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
2014-04-17 04:49:41 +04:00
=+ ^= obj
%- jobe
:~ sent/(jone ino.cal)
recv/(jone ono.cal)
ownr/[%s (rsh 3 1 (scot %p our))]
==
2014-04-16 23:47:41 +04:00
=+ sez=:/("seq={(pojo obj)}")
=+ jqu="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
=+ ^= sac
;script
2014-04-25 21:56:34 +04:00
;
; var hist = []
; var hind = 0
2014-04-16 23:47:41 +04:00
; $(
; function() {
; $input = $('#input .line')
; $prompt = $('#input .prompt')
; $output = $('#output')
; $input.focus()
;
2014-05-30 05:53:23 +04:00
; path = document.location.pathname
; if(path.slice(-1) == "/")
; path = path.slice(0,-1)
; seq.prom = path.split("/").pop()
;
2014-04-25 21:56:34 +04:00
; $('body').click(function() {
; $input.focus()
; })
;
2014-04-16 23:47:41 +04:00
; send = function(com) {
; if(com.line !== undefined &&
; com.line.indexOf('error') != -1) {
; com = {error:true}
; }
; console.log('sending')
; console.log(com)
2014-05-30 05:53:23 +04:00
; $.ajax('/'+seq.ownr+'/toc/'+seq.prom+'/'+seq.sent, {
2014-04-16 23:47:41 +04:00
; type: 'PUT',
2014-04-17 04:49:41 +04:00
; contentType: 'text/json',
; data: JSON.stringify(com),
2014-04-16 23:47:41 +04:00
; success: function(data,status,xhr) {
; seq.sent++
; },
; error: function(data,status,xhr) {
; if(data.responseJSON.lines !== undefined)
; addLines(data.responseJSON.lines)
; seq.sent++
; }
; })
; }
;
; recv = function() {
2014-05-30 05:53:23 +04:00
; $.ajax('/'+seq.ownr+'/goc/'+seq.prom+'/'+seq.recv, {
2014-04-16 23:47:41 +04:00
; type:'GET',
; success: function(data,status,xhr) {
2014-04-17 04:49:41 +04:00
; console.log(data);
; seq.recv = data[0];
; seq.send = data[1];
; msg = data[2];
2014-05-30 05:53:23 +04:00
; if(msg.text !== undefined) {
2014-04-17 04:49:41 +04:00
; addLines(msg.text)
2014-05-30 05:53:23 +04:00
; $('body').scrollTop($('.line').position().top)
; }
2014-04-17 04:49:41 +04:00
; if(msg.helo !== undefined)
; changePrompt(msg.helo)
2014-04-16 23:47:41 +04:00
; recv()
; },
; error: function(data,status,xhr) {
; console.log('error')
; seq.recv++
; }
; })
; }
;
; recv()
;
; send({hail:true})
;
; addLines = function(lines) {
; $output.append(lines.join("<br />")+"<br />")
; }
;
; changePrompt = function(helo) {
2014-04-17 04:49:41 +04:00
; $prompt.text(helo.prod[1]);
2014-04-16 23:47:41 +04:00
; }
;
; ctrl = false
;
; $input.on('keydown', function(e) {
; console.log('keydown')
; console.log(e.keyCode)
; if(e.keyCode == 17) {
; ctrl = true
; return;
; }
; if(e.keyCode == 88 && ctrl == true) {
; console.log('ling')
; send({ling:true})
; return;
; }
2014-04-25 21:56:34 +04:00
;
; if(e.keyCode == 69 && ctrl == true) {
; console.log('^e')
2014-06-02 01:07:13 +04:00
; $input[0].selectionStart =
; $input[0].selectionEnd =
; $input.val().length;
2014-04-25 21:56:34 +04:00
; return
; }
; if(e.keyCode == 65 && ctrl == true) {
; console.log('^a')
; $input[0].selectionStart = $input[0].selectionEnd = 0
; return
; }
;
;
; if(e.keyCode == 40) {
; if(hist.length > 1) {
; hind++
; if(hind > hist.length-1) {
; hind = hist.length-1
; }
; }
; }
; if(e.keyCode == 38) {
; if(hist.length > 1) {
; hind--
; if(hind < 0) {
; hind = 0
; }
; }
; }
; if(e.keyCode == 38 ||
; e.keyCode == 40) {
; console.log('set from hist')
; $input.val(hist[hind])
2014-05-30 05:53:23 +04:00
; setTimeout(function() {
; console.log(hist[hind].length)
2014-06-02 01:07:13 +04:00
; $input[0].setSelectionRange
; (hist[hind].length,hist[hind].length)
2014-05-30 05:53:23 +04:00
; }, 0)
2014-04-25 21:56:34 +04:00
; return;
; }
;
2014-04-16 23:47:41 +04:00
; if(e.keyCode == 13) {
2014-04-25 21:56:34 +04:00
; val = $input.val()
; send({line:val})
; $output.append($('.prompt').text()+" "+val+"<br>")
; hind = hist.length-1
; if(hind<0)
; hind = 0
; hist[hind] = val
; hist.push('')
; hind = hist.length-1
2014-04-16 23:47:41 +04:00
; $input.val('')
2014-05-30 05:53:23 +04:00
; $('body').scrollTop($('.line').position().top)
2014-04-16 23:47:41 +04:00
; return;
; }
2014-04-25 21:56:34 +04:00
; if(hind == hist.length-1)
; hist[hind] = $input.val()
2014-04-16 23:47:41 +04:00
; });
;
; $input.on('keyup', function(e) {
; if(e.keyCode == 17) {
; ctrl = false
; }
; });
; }
; )
==
=+ ^= ham
;html
;head
2014-04-17 04:49:41 +04:00
;title: urbit {<our>}/{<p.som.pip>}
2014-04-16 23:47:41 +04:00
;script(type "text/javascript", src jqu);
2014-04-17 04:49:41 +04:00
;style
; body {
; margin: 60px 120px;
; font: normal 12px "Menlo" monospace;
; background-color: #000;
; color: #fff;
; }
;
; #output {
2014-04-25 21:56:34 +04:00
; line-height: 18px;
2014-05-30 05:53:23 +04:00
; white-space: pre;
2014-04-17 04:49:41 +04:00
; }
;
; #input .prompt {
; display: inline-block;
; margin-right: 12px;
; }
;
; #input .line {
; outline: none;
; width: 80%;
; border: 0;
; background-color: transparent;
; color: #fff;
; font: normal 12px "Menlo" monospace;
; }
==
2014-04-16 23:47:41 +04:00
==
;body
;div#output;
;div#input
;div.prompt;
;input.line(type "text");
2014-04-17 04:49:41 +04:00
==
2014-04-16 23:47:41 +04:00
;+ [-.sac `marl`[sez +.sac]]
==
==
[~ pip(pez [%fin %ham ham])]
::
%cog
2014-04-21 21:02:09 +04:00
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
2014-04-16 23:47:41 +04:00
?. (lth q.som.pip ono.cal)
2014-04-17 04:49:41 +04:00
:- [~ pip(pez %way)]
%= +>.$ cow
%+ ~(put by cow)
p.som.pip
=+ val=(~(get by voy.cal) q.som.pip)
cal(voy (~(put by voy.cal) q.som.pip ?~(val [num ~] [num u.val])))
==
:_ +>.$
2014-04-16 23:47:41 +04:00
=+ ^= jon ^- json
:~ %a
(jone ono.cal)
(jone ino.cal)
(snag (sub ono.cal q.som.pip) out.cal)
==
[~ pip(pez [%fin %mid /text/json (tact (pojo jon))])]
::
%cop
2014-04-21 21:02:09 +04:00
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
2014-04-16 23:47:41 +04:00
?. =(q.som.pip ino.cal)
=. cow (~(put by cow) p.som.pip cal)
:_ +>.$
[~ pip(pez [%err 500 [%leaf "cop: {<q.som.pip>}, {<ino.cal>}."]~])]
2014-06-04 14:40:09 +04:00
=+ ^= fuv ^- (unit note)
2014-04-16 23:47:41 +04:00
?. ?=(%o -.r.som.pip) ~
=+ lin=(~(get by p.r.som.pip) %line)
2014-06-22 06:51:12 +04:00
?^ lin ?.(?=(%s -.u.lin) ~ [~ %b %line p.u.lin])
2014-04-17 04:49:41 +04:00
=+ syc=(~(get by p.r.som.pip) %hail)
2014-06-22 06:51:12 +04:00
?^ syc [~ %b %hail ~]
2014-04-16 23:47:41 +04:00
=+ lig=(~(get by p.r.som.pip) %ling)
2014-06-22 06:51:12 +04:00
?^ lig [~ %b %ling ~]
2014-04-16 23:47:41 +04:00
~
:_ %_ +>.$
2014-04-17 04:49:41 +04:00
cow (~(put by cow) p.som.pip cal(ino +(ino.cal)))
2014-04-16 23:47:41 +04:00
mow
?~ fuv mow
:_ mow
2014-05-24 00:46:43 +04:00
:- hen
2014-06-24 21:32:59 +04:00
:+ %pass [%cons (scot %p our) ses (scot %ud p.som.pip) ~]
2014-04-16 23:47:41 +04:00
u.fuv
==
[~ `pimp`pip(pez `pest`[%fin %raw 200 ~ ~])]
::
2014-04-09 02:26:01 +04:00
%det
:- [~ pip(pez %way)]
2014-05-10 11:10:46 +04:00
+>.$(..ya (hoot our num ses [p.som.pip ~ [%| q.som.pip]]))
2014-04-09 02:26:01 +04:00
::
2014-03-12 23:50:39 +04:00
%fun
2014-05-10 11:10:46 +04:00
:- [~ pip(pez %way)]
2014-06-07 22:36:31 +04:00
=+ bem=`beam`(need (tome q.som.pip))
2014-05-10 11:10:46 +04:00
=+ bek=`beak`[p.bem q.bem r.bem]
2014-07-09 07:00:30 +04:00
=+ kas=`silk`[%cast %mime bek `silk`[%boil p.som.pip bem ~]]
2014-05-10 11:10:46 +04:00
+>.$(..ya (honk our num ses kas))
2014-04-21 21:02:09 +04:00
::
%lon
?^ pus.p.som.pip
?. =(lass u.pus.p.som.pip)
2014-04-26 00:49:52 +04:00
:_ +>.$
:- ~
%= pip
pez
[%fin %mid /text/json (tact (pojo (jobe [%ok [%b |]]~)))]
==
=. aut.ced (~(put ju aut.ced) %$ (scot %p (need whu.p.som.pip)))
?~ foy.p.som.pip
2014-04-26 00:49:52 +04:00
=+ ^= jon
%- jobe
:~ [%ok [%b &]]
[%next (jape (earn pul.p.som.pip))]
==
:_(+>.$ [~ pip(pez [%fin %mid /text/json (tact (pojo jon))])])
2014-05-23 01:48:47 +04:00
=. ..ya (haji our u.foy.p.som.pip)
2014-04-26 00:49:52 +04:00
=+ ^= lup ^- purl
:+ ^- hart
:+ & ~
[%& ~[%org %urbit (rsh 3 1 (scot %p p.u.foy.p.som.pip))]]
^- pork
[~ /gul]
^- quay
:~ [%who (rsh 3 1 (scot %p (need whu.p.som.pip)))]
[%url (crip (earn pul.p.som.pip))]
[%wit %yes]
2014-04-21 21:02:09 +04:00
==
2014-04-26 00:49:52 +04:00
=+ jon=(jobe ~[[%ok [%b &]] [%next (jape (earn lup))]])
:_(+>.$ [~ pip(pez [%fin %mid /text/json (tact (pojo jon))])])
:_ +>.$
?: wit.p.som.pip
[~ pip(pez [%who %$ (scot %p (need whu.p.som.pip))])]
=+ rul=(earn pul.p.som.pip)
=+ ruf=(earn (earl our pul.p.som.pip(q.q /pul, r ~)))
=+ ham=(noon our whu.p.som.pip rul ruf)
2014-04-21 21:02:09 +04:00
[~ pip(pez [%fin %ham ham])]
::
%red
:_ +>.$
:- ~
%= pip
pez
:- %fin
:- %raw
:+ 301
[%location (crip (earn p.som.pip))]~
~
==
2014-06-10 00:09:14 +04:00
::
%sil
:- [~ pip(pez %way)]
+>.$(..ya (honk our num ses q.som.pip))
2013-09-29 00:21:18 +04:00
==
2014-03-12 23:50:39 +04:00
::
[%err *]
2014-04-17 04:49:41 +04:00
[~ +>.$(..ya (muff(hen hen.pip) [%thou (loft `love`[%zap +.pez.pip])]))]
2014-03-12 23:50:39 +04:00
::
[%fin *]
=+ har=(loft p.pez.pip)
=. q.har (weld (turn cug |=(a=@t ['set-cookie' a])) q.har)
2014-04-17 04:49:41 +04:00
[~ +>.$(..ya (muff(hen hen.pip) [%thou har]))]
2014-04-09 02:26:01 +04:00
::
[%haz *]
:_ +>.$
[~ pip(pez [%fin %wan 'Hello, world' ~])]
2014-05-10 11:10:46 +04:00
::
[%fud *]
2014-06-08 06:45:00 +04:00
=+ ^= mog ^- (list manx)
?: ?=(%fun -.som.pip)
(weld r.som.pip sip.pip)
sip.pip
2014-05-10 11:10:46 +04:00
:_ +>.$
:- ~
%= pip
pez
^- pest
?- -.p.pez.pip
| =+ mad=(loga "server error" mog p.p.pez.pip)
2014-05-10 11:10:46 +04:00
:- %fin
:- %raw
^- httr
:+ 500
~[content-type/'text/html']
[~ (tact (xmlt | mad ~))]
2014-06-13 02:10:32 +04:00
& [%fin (lofe vaz.pip (lofi mog (lopo q.p.p.pez.pip)))]
2014-05-10 11:10:46 +04:00
==
==
2014-03-12 23:50:39 +04:00
::
[%raw *]
:_ +>.$
^- (unit pimp)
:- ~
=+ hoy=(holy p.pez.pip)
?~ hoy
pip(pez [%err 404 [[%leaf "invalid request"] ~]])
2014-03-26 04:48:22 +04:00
pip(som u.hoy, pez %new)
::
[%who *]
:_ +>.$
?.((~(has ju aut.ced) p.pez.pip q.pez.pip) [~ pip] [~ pip(pez %new)])
2014-03-12 23:50:39 +04:00
==
::
++ work
|- ^+ +
=+ sez=step
?: =(rey.sez rey) sez
$(+ sez)
2014-06-10 00:09:14 +04:00
::
++ yoke :: long poll
2014-07-16 06:30:29 +04:00
|= [num=@ud you=ship nap=@ud cnt=@ud]
^- [(unit pimp) _+>]
2014-07-16 06:30:29 +04:00
=+ yon=(yolk nap)
?~ yon `(bust 204 num)
=. +>.$ abet:(hire:(yule %sub):u.yon cnt num)
:_ +>.$
=+ pup=(~(get by q.rey) num)
?~ pup ~
?. ?=(%sil -.som.u.pup) ~
`u.pup
2014-06-10 00:09:14 +04:00
::
++ yokg :: main call
|= [num=@ud app=term you=ship pax=path]
^+ +>
2014-06-14 01:47:08 +04:00
?< (~(has by sok) num)
2014-07-16 06:30:29 +04:00
abet:(~(self yo num you [-(tim.bet +)]:[*sink now]) app pax)
2014-07-11 06:40:58 +04:00
::
++ yokh :: heartbeat
2014-07-16 06:30:29 +04:00
|= [num=@ud you=ship nap=@ud cnt=@ud jon=json]
2014-07-15 06:45:04 +04:00
^- [(unit pimp) _+>]
2014-07-11 06:40:58 +04:00
=+ yon=(yolk nap)
2014-07-15 06:45:04 +04:00
?~ yon [~ (bust 204 num)]
[- abet:+]:(beat:u.yon cnt num jon)
2014-06-10 00:09:14 +04:00
::
++ yokm :: message
2014-07-17 06:10:13 +04:00
|= [num=@ud you=ship nap=@ud cnt=@ud hap=hasp jon=json]
2014-06-13 02:10:32 +04:00
^+ +>
=+ yon=(yolk nap)
2014-06-17 05:33:31 +04:00
?~ yon (bust 204 num)
2014-07-17 06:10:13 +04:00
abet:(post:u.yon cnt num hap jon)
2014-06-10 00:09:14 +04:00
::
++ yoks :: subscribe
2014-07-18 23:23:35 +04:00
|= [num=@ud you=ship nap=@ud hap=hasp pax=path]
2014-06-15 04:02:11 +04:00
=+ yon=(yolk nap)
2014-06-17 05:33:31 +04:00
?~ yon (bust 204 num)
2014-07-17 06:10:13 +04:00
abet:(scud:u.yon num hap pax)
2014-06-10 00:09:14 +04:00
::
++ yoku :: unsubscribe
2014-07-18 23:23:35 +04:00
|= [num=@ud you=ship nap=@ud hap=hasp pax=path]
^- [(unit pimp) _+>]
=+ yon=(yolk nap)
?~ yon [~ (bust 204 num)]
[- abet:+]:(scad:u.yon num hap pax)
2014-06-10 00:09:14 +04:00
::
++ yolk :: yo by instance
2014-06-10 04:22:54 +04:00
|= nap=@ud
2014-06-10 00:09:14 +04:00
=+ suy=(~(get by sok) nap)
?~ suy ~
(some ~(. yo nap u.suy))
::
++ yo :: app instance
|_ $: nap=@ud :: instance number
you=ship :: client identity
siq=sink :: instance state
==
++ abet :: resolve
%_ ..yo
2014-07-16 06:30:29 +04:00
sok (~(put by sok) nap [you siq])
2014-06-10 00:09:14 +04:00
==
::
2014-06-12 21:19:36 +04:00
++ amok :: demolish
^+ ..yo
2014-07-16 06:30:29 +04:00
=+ wuh=(~(tap by can.sub.siq))
2014-06-12 21:19:36 +04:00
|- ^+ ..yo
?~ wuh
%= ..yo
sok (~(del by sok) nap)
==
2014-07-12 06:02:11 +04:00
%= $
wuh t.wuh
..amok
2014-07-17 06:10:13 +04:00
(pass(hen r.q.i.wuh) `p.i.wuh `note`[%g %nuke p.q.i.wuh you])
2014-07-12 06:02:11 +04:00
==
2014-07-11 06:40:58 +04:00
::
++ beat
|= [cnt=@ud num=@ud jon=json]
2014-07-15 06:45:04 +04:00
^- [(unit pimp) _+>]
2014-07-11 06:40:58 +04:00
?. =(cnt num.bet.siq)
2014-07-15 06:45:04 +04:00
[~ +>.$(..yo (bust 204 num))]
2014-07-17 06:10:13 +04:00
=. bet.siq bet.siq(num +(num.bet.siq), tim now)
2014-07-16 06:30:29 +04:00
=. +>.$ (hire:(yule %bet) cnt num)
=. +>.$ (hear:(yule %bet) ~ %& %json !>((joba %a-ok %b %&)))
2014-07-15 06:45:04 +04:00
[`(need (~(get by q.rey) num)) +>.$]
2014-06-10 00:09:14 +04:00
::
++ hoop :: request path
2014-07-16 06:30:29 +04:00
|= can=(unit ,@ud)
2014-06-10 00:09:14 +04:00
^- path
2014-07-16 06:30:29 +04:00
:* %hoop
2014-06-10 04:22:54 +04:00
(scot %p our)
ses
2014-06-12 07:47:57 +04:00
(scot %ud nap)
2014-07-16 06:30:29 +04:00
?~ can
[%mess ~]
[%show (scot %ud u.can) ~]
2014-06-10 04:22:54 +04:00
==
2014-06-10 00:09:14 +04:00
::
2014-06-24 21:32:59 +04:00
++ pass :: pass
2014-07-16 06:30:29 +04:00
|= [can=(unit ,@ud) noh=note]
2014-06-24 21:32:59 +04:00
^+ +>
2014-07-16 06:30:29 +04:00
+>(mow [[hen %pass (hoop can) noh] mow])
2014-06-24 21:32:59 +04:00
::
2014-06-14 09:47:17 +04:00
++ post :: transmit
2014-07-17 06:10:13 +04:00
|= [cnt=@ud num=@ud hap=hasp jon=json]
2014-06-13 02:10:32 +04:00
^+ +>
2014-07-16 06:30:29 +04:00
=. +>.$
?. =(cnt num.meg.siq) +>.$
%+ pass(num.meg.siq +(num.meg.siq)) ~
2014-07-17 06:10:13 +04:00
`note`[%g %mess hap you [%json !>(jon)]]
2014-07-16 06:30:29 +04:00
?. =(+(cnt) num.meg.siq)
2014-06-17 05:33:31 +04:00
+>.$(..yo (bust 204 num))
2014-07-16 06:30:29 +04:00
(hire:(yule %meg) cnt num)
2014-06-13 02:10:32 +04:00
::
2014-07-18 23:23:35 +04:00
++ scad
|= [num=@ud hap=hasp pax=path]
^- [(unit pimp) _+>]
=. +>.$
%+ ~(rep by can.sub.siq) +>.$
|= [p=[p=@ud q=stem] q=_+>.$]
?. =([hap pax] [p.q.p q.q.p]) q
=. q q(can.sub.siq (~(del by can.sub.siq:q) p.p))
([-(hen +)]:[pass:q r.q.p] `p.p %g %nuke hap you)
=+ huq=[~ %& %json !>((joba %ok %b %&))]
=. +>.$ abet:(busk:(yule %nil) num 0 huq)
[`(need (~(get by q.rey) num)) +>.$]
::
2014-06-15 04:02:11 +04:00
++ scud :: subscribe
2014-07-16 06:30:29 +04:00
|= [num=@ud hap=hasp pax=path]
=. can.sub.siq (~(put by can.sub.siq) num.sub.siq [hap pax hen `num])
2014-07-17 06:10:13 +04:00
=. +>.$ (pass `num.sub.siq `note`[%g %show hap you pax])
2014-07-16 06:30:29 +04:00
=. num.sub.siq +(num.sub.siq)
+>.$
2014-06-15 04:02:11 +04:00
::
2014-06-10 00:09:14 +04:00
++ self :: request main
2014-07-16 06:30:29 +04:00
|= [app=term pax=path]
2014-06-10 00:09:14 +04:00
^+ +>
=. can.sub.siq (~(put by can.sub.siq) 0 [[our app] pax hen `nap])
2014-07-16 06:30:29 +04:00
=. num.sub.siq +(num.sub.siq)
(pass `0 [%g %show [our app] you pax])
2014-06-10 00:09:14 +04:00
::
2014-07-16 06:30:29 +04:00
++ yule
|= pla=?(%bet %meg %sub %nil)
%~ . yu :- pla
=< wig
?-(pla %bet bet.siq, %meg meg.siq, %sub sub.siq, %nil [wig=*swig ~])
2014-06-10 00:09:14 +04:00
::
++ yu :: swig state
|_ [pla=?(%bet %meg %sub %nil) wig=swig]
2014-07-16 06:30:29 +04:00
++ abet
^+ ..yu
?- pla
2014-07-17 06:10:13 +04:00
%bet %_(..yu wig.bet.siq wig)
%meg %_(..yu wig.meg.siq wig)
%sub %_(..yu wig.sub.siq wig)
%nil ..yu
2014-07-16 06:30:29 +04:00
==
2014-06-12 21:19:36 +04:00
::
2014-06-12 07:47:57 +04:00
++ busk :: seam result
|= $: num=@ud
cnt=@ud
2014-06-17 05:33:31 +04:00
huq=(unit (each cage cage))
2014-06-12 07:47:57 +04:00
==
^+ +>
2014-06-12 22:18:24 +04:00
=+ pup=(~(get by q.rey) num)
?~ pup +>.$ :: XX a hack
=. wig ?: ?=(%nil pla) wig
?. =(toy.wig cnt)
2014-06-12 07:47:57 +04:00
?>(=(toy.wig +(cnt)) wig)
%= wig
toy +(toy.wig)
red
?: =(0 toy.wig) red.wig
2014-06-12 21:19:36 +04:00
:: ~& [%busk [%sent cnt] [%lost (dec toy.wig)]]
2014-06-12 07:47:57 +04:00
(~(del by red.wig) (dec toy.wig))
==
2014-06-12 22:18:24 +04:00
=+ pip=u.pup
2014-06-12 07:47:57 +04:00
=+ ^= sip
?. =(%apg -.som.pip) sip.pip
2014-07-17 06:10:13 +04:00
[duti sip.pip]
2014-06-17 05:33:31 +04:00
?~ huq +>.$(..yo (bust 404 num))
2014-06-12 07:47:57 +04:00
%= +>.$
q.rey
%+ ~(put by q.rey) num
^- pimp
2014-06-19 07:27:36 +04:00
=+ quo=|=(a=cord :(weld "\"" (trip a) "\""))
2014-06-12 07:47:57 +04:00
%= pip
pez %new
2014-06-19 07:27:36 +04:00
vaz :~ [%ship (quo (rsh 3 1 (scot %p our)))]
2014-06-18 04:34:20 +04:00
[%port (trip (rsh 3 2 (scot %ui nap)))]
[%auto "true"]
2014-06-19 07:27:36 +04:00
[%oryx (quo orx.ced)]
2014-07-22 00:38:46 +04:00
[%user (quo (rsh 3 1 (scot %p you)))]
2014-06-18 04:34:20 +04:00
==
2014-06-12 07:47:57 +04:00
sip sip
som ^- seam
:+ %sil
2014-06-17 05:33:31 +04:00
?:(-.u.huq 200 203)
2014-06-12 07:47:57 +04:00
=+ bek=`beak`[our %main [%da now]]
2014-06-17 05:33:31 +04:00
=+ don=`silk`[%done ~ `cage`p.u.huq]
2014-06-12 07:47:57 +04:00
^- silk
:^ %cast %mime bek
2014-06-12 21:19:36 +04:00
?~ fur.pip don
`silk`[%cast u.fur.pip bek don]
2014-06-12 07:47:57 +04:00
==
==
::
2014-06-17 05:33:31 +04:00
++ dumb :: reset
^+ ..yu
=+ dum=(~(tap by wan.wig) ~)
|- ^+ ..yu
2014-07-17 06:10:13 +04:00
?~ dum ..yu :: XX drop stream
2014-06-17 05:33:31 +04:00
$(dum t.dum, ..yo (bust 404 q.i.dum))
::
2014-06-10 10:20:41 +04:00
++ hear :: produce
2014-06-17 05:33:31 +04:00
|= huq=(unit (each cage cage))
^+ ..yu
2014-07-16 06:30:29 +04:00
=< abet
2014-06-12 07:47:57 +04:00
=+ cnt=cnt.wig
=+ dul=(~(get by wan.wig) cnt)
2014-06-12 21:19:36 +04:00
:: ~& :~ %yu-hear
:: [%instance nap]
:: [%produced cnt]
:: ?~(dul %unrequested [%requester u.dul])
:: ==
2014-06-12 07:47:57 +04:00
=: cnt.wig +(cnt.wig)
wan.wig ?~(dul wan.wig (~(del by wan.wig) cnt.wig))
2014-06-17 05:33:31 +04:00
red.wig (~(put by red.wig) cnt.wig huq)
2014-06-12 07:47:57 +04:00
==
2014-06-17 05:33:31 +04:00
?~(dul +>.$ (busk u.dul cnt huq))
2014-06-10 04:22:54 +04:00
::
2014-06-10 10:20:41 +04:00
++ hire :: consume
2014-06-10 00:09:14 +04:00
|= [cnt=@ud num=@ud]
2014-06-17 05:33:31 +04:00
^+ ..yu
=< abet
2014-06-12 21:19:36 +04:00
:: ~& :~ %yu-hire
:: [%instance nap]
:: [%produced cnt.wig]
:: [%request cnt]
:: [%dispatched toy.wig]
:: [%requester num]
:: ==
2014-06-12 07:47:57 +04:00
?: |((lth +(cnt) toy.wig) (gth cnt toy.wig))
~& [%hire-improper [%request cnt] [%dispatched toy.wig]]
2014-06-17 05:33:31 +04:00
+>.$(..yo (bust 204 num))
2014-06-10 10:20:41 +04:00
?: (gte cnt cnt.wig)
2014-06-12 21:19:36 +04:00
:: ~& %hire-wait
2014-06-10 10:20:41 +04:00
=+ old=(~(get by wan.wig) cnt)
=. wan.wig (~(put by wan.wig) cnt num)
2014-06-17 05:33:31 +04:00
+>.$(..yo ?~(old ..yo (bust 204 u.old)))
2014-06-10 00:09:14 +04:00
=+ rud=(~(get by red.wig) cnt)
2014-07-11 06:40:58 +04:00
?~ rud
2014-06-12 21:19:36 +04:00
:: ~& %hire-bust
2014-06-17 05:33:31 +04:00
+>.$(..yo (bust 204 num))
2014-06-12 21:19:36 +04:00
:: ~& %hire-send
2014-06-12 07:47:57 +04:00
(busk num cnt u.rud)
2014-06-10 00:09:14 +04:00
--
--
2014-03-12 23:50:39 +04:00
--
--
--
. ==
=| bolo
=* bol -
2014-05-31 23:40:02 +04:00
|= [now=@da eny=@ ski=sled] :: activate
2014-03-12 23:50:39 +04:00
^? :: opaque core
|% ::
2014-06-04 14:40:09 +04:00
++ call :: handle request
|= $: hen=duct
2014-06-04 21:56:30 +04:00
hic=(hypo (hobo kiss))
2014-06-04 14:40:09 +04:00
==
2014-06-06 03:00:19 +04:00
=> %= . :: XX temporary
q.hic
^- kiss
?: ?=(%soft -.q.hic)
((hard kiss) p.q.hic)
?: (~(nest ut -:!>(*kiss)) | p.hic) q.hic
~& [%eyre-call-flub (,@tas `*`-.q.hic)]
((hard kiss) q.hic)
==
2014-05-31 23:40:02 +04:00
^- [p=(list move) q=_..^$]
=+ ska=(slod ski)
2014-05-02 03:33:15 +04:00
=+ sky=|=(* `(unit)`=+(a=(ska +<) ?~(a ~ ?~(u.a ~ [~ u.u.a]))))
=. ney (shax :(mix (shax now) +(eny) ney)) :: XX!! shd not need
2014-05-31 23:40:02 +04:00
^- [p=(list move) q=_..^$]
2014-03-20 05:05:42 +04:00
=. gub ?.(=(0 gub) gub (cat 3 (rsh 3 1 (scot %p (end 6 1 eny))) '-'))
=^ mos bol
2014-06-04 14:40:09 +04:00
abet:(apex:~(adit ye [hen [now eny sky] ~] bol) q.hic)
2014-03-12 23:50:39 +04:00
[mos ..^$]
2013-09-29 00:21:18 +04:00
::
++ doze
2013-12-15 09:42:27 +04:00
|= [now=@da hen=duct]
2013-09-29 00:21:18 +04:00
^- (unit ,@da)
~
::
++ load
2014-05-31 23:40:02 +04:00
|= old=bolo
^+ ..^$
..^$(+>- old)
2013-09-29 00:21:18 +04:00
::
++ scry
2014-05-27 00:43:40 +04:00
|= [our=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
^- (unit (unit (pair mark ,*)))
2013-09-29 00:21:18 +04:00
~
::
2014-05-31 23:40:02 +04:00
++ stay `bolo`+>-.$
2014-06-04 14:40:09 +04:00
++ take :: accept response
2014-06-22 09:49:10 +04:00
|= [tea=wire hen=duct hin=(hypo sign)]
2014-06-04 14:40:09 +04:00
^- [p=(list move) q=_..^$]
=+ ska=(slod ski)
=+ sky=|=(* `(unit)`=+(a=(ska +<) ?~(a ~ ?~(u.a ~ [~ u.u.a]))))
=. ney (shax :(mix (shax now) +(eny) ney)) :: XX!! shd not need
^- [p=(list move) q=_..^$]
=. gub ?.(=(0 gub) gub (cat 3 (rsh 3 1 (scot %p (end 6 1 eny))) '-'))
=^ mos bol
=< abet
%^ axon:~(adit ye [hen [now eny sky] ~] bol) tea
2014-06-24 21:32:59 +04:00
(~(peek ut p.hin) %free 3)
2014-06-22 06:51:12 +04:00
q.hin
2014-06-04 14:40:09 +04:00
[mos ..^$]
2013-09-29 00:21:18 +04:00
--