urbit/arvo/eyre.hoon

2368 lines
82 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-10-04 02:32:10 +04:00
[%veer p=@ta q=path r=@t] :: drop-through
[%vega p=path] :: drop-through
2014-07-10 01:43:30 +04:00
== ::
2014-09-11 03:35:03 +04:00
++ hasp ,[p=ship q=term] :: don't see %gall
++ hapt ,[p=ship q=path] :: do 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=*] ::
== == ::
$: %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
2014-09-11 03:35:03 +04:00
$% [%mess p=hapt q=ship r=cage] ::
[%nuke p=hapt q=ship] ::
[%show p=hapt q=ship r=path] ::
2014-10-16 02:05:48 +04:00
== == ::
$: %t :: to %temp
$% [%wait p=@da] ::
[%rest p=@da] ::
2014-06-22 06:51:12 +04:00
== == == ::
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] ::
2014-07-27 14:26:17 +04:00
[%cast p=mark q=silk] ::
2014-07-12 22:24:52 +04:00
[%done p=(set beam) q=cage] ::
== ::
2014-10-04 02:32:10 +04:00
++ sine ::
$? sign ::
$: %g ::
$% [%veer p=@ta q=path r=@t] ::
[%vega p=path] ::
== == == ::
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-10-16 02:05:48 +04:00
== == ::
$: %t :: by %time
$% [%wake ~] :: timer activate
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
++ 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
sip=marl :: injected scripts
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-10-24 01:09:39 +04:00
[%apm p=ship q=@ud r=@ud s=hasp for=mark t=json] :: message send
[%app p=ship q=(unit ,@ud)] :: script by port
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
2014-10-16 02:05:48 +04:00
$: bet=[wig=swig num=@ud tim=@da hen=duct] :: 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 :: subscription
$: hap=hasp ::
pax=path ::
hen=duct ::
num=(unit (each ,@ud ,@ud)) ::
== ::
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)
2014-08-11 08:43:43 +04:00
:: ~& [%ecca jun]
2014-07-17 06:10:13 +04:00
?~ jun ~
2014-10-28 23:15:44 +03:00
=+ ^- (unit ,[his=ship app=term pax=term])
2014-07-17 06:10:13 +04:00
%. u.jun
%- ot:jo
2014-10-28 23:15:44 +03:00
~[[%ship (su:jo fed:ag)] [%appl so:jo] [%path so:jo]]
2014-07-17 06:10:13 +04:00
?~ - ~
=+ ^= pax
%+ rush pax.u
2014-12-17 04:19:06 +03:00
;~(pfix fas (more fas ;~(simu next urs:ab)))
2014-07-17 06:10:13 +04:00
?~ pax ~
2014-10-28 23:15:44 +03:00
`[[his.u app.u] u.pax]
2014-07-17 06:10:13 +04:00
::
2014-06-10 00:09:14 +04:00
++ ecce :: JS from moth
|= moh=moth
^- (unit json)
=+ ten=(~(get by q.moh) 'content-type')
?~ ten ~
?~ u.ten ~
2014-08-19 00:28:26 +04:00
?. =('text/json' (end 3 9 i.u.ten))
~| %ecce-content-type ~
2014-06-10 00:09:14 +04:00
?~ 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) ~
2014-08-12 04:12:51 +04:00
:: ?. =([~ %s orx] (~((get by p.u.jun) %oryx))
:: ~& [%oryx-sent ~(get by p.u.jun) %oryx)]
:: ~& [%oryx-good orx]
:: ~
~? !=([~ %s orx] (~(get by p.u.jun) %oryx))
[%oryx [%sent (~(get by p.u.jun) %oryx)] [%good orx]]
2014-06-25 02:00:07 +04:00
=+ 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]
2014-10-24 01:09:39 +04:00
^- (unit ,[hasp mark json])
2014-07-17 06:10:13 +04:00
=+ jun=(ecci orx moh)
?~ jun ~& %no-ecci ~
2014-10-24 01:09:39 +04:00
=+ ^- (unit ,[his=term app=term for=mark jon=json])
2014-07-17 06:10:13 +04:00
%. u.jun
%- ot:jo
2014-10-24 01:09:39 +04:00
:~ [%ship so:jo]
[%appl so:jo]
[%mark so:jo]
[%data |=(json (some +<))]
==
?~ - ~& %no-json ~
2014-07-17 06:10:13 +04:00
=+ his=(slaw %p (cat 3 '~' his.u))
?~ his ~& %no-ship ~
2014-10-24 01:09:39 +04:00
`[[u.his app.u] for.u jon.u]
2014-07-17 06:10:13 +04:00
::
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
2014-08-06 02:09:19 +04:00
?. =('<html' (end 3 5 q.q.luv)) luv
2014-10-30 23:33:15 +03:00
=+ scr=(many:poxo mog "")
2014-08-06 02:09:19 +04:00
=+ ^= hed
|- ;~ pose
(cook trip (jest '<head>'))
;~(plug next (knee *tape ..$))
2014-08-06 02:09:19 +04:00
(easy ~)
==
=+ hop=(need q:(hed *hair (trip q.q.luv)))
?~ q.q.hop luv
=+ rep=:(welp p.hop scr q.q.hop)
2014-06-13 02:10:32 +04:00
[%mid p.luv (tact rep)]
==
2014-04-10 05:01:46 +04:00
::
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-10-30 23:33:15 +03:00
%ham [200 ~[content-type/'text/html'] [~ (tact (poxo 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']
2014-10-30 23:33:15 +03:00
[~ (tact (poxo (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-10-24 01:09:39 +04:00
?> ?=([%hoop @ @ @ ?([%mess @ @ ~] [%show @ ~])] tea)
2014-10-23 07:13:10 +04:00
=+ our=(slav %p i.t.tea)
=* ses i.t.t.tea
=+ nap=(slav %ud i.t.t.t.tea)
=+ ouy=(yolk:(gale our ses) nap)
2014-06-17 05:33:31 +04:00
?~ 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
?- -.+.sih
%dumb
2014-10-23 07:13:10 +04:00
abet:work:abet:dumb:woy
::
2014-07-08 03:36:35 +04:00
%nice
2014-10-23 07:13:10 +04:00
=< abet =< work =< abet
2014-08-12 04:12:51 +04:00
?. ?=(%mess i.mab)
u.ouy
2014-07-08 03:36:35 +04:00
(hear:woy ~ %& %json !>((joba %ok %b &)))
2014-10-23 07:13:10 +04:00
::
%mean
=< abet =< work =< abet
=+ jon=(rong p.+.sih)
2014-10-24 01:09:39 +04:00
?: ?=(%mess i.mab)
2014-10-23 07:13:10 +04:00
(hear:woy ~ %& %json !>(jon))
=+ can=(slav %ud i.t.mab)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) can))
(soon %& sem u.ouy can %show ?.(?=(%show i.mab) jon (wrap sem jon)))
::
2014-07-08 03:36:35 +04:00
?(%rust %rush)
2014-10-24 01:09:39 +04:00
?> ?=(%show i.mab)
2014-10-23 07:13:10 +04:00
=+ can=(slav %ud i.t.mab)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) can))
?: =(0 can)
=< abet =< work =< abet
?~ num.sem
(hear:woy ~ %& %json !>((joba %reload %b %&)))
?> -.u.num.sem
=+ huq=``[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
=+ yoo=abet:(busk:(yule:u.ouy %nil) p.u.num.sem 0 huq)
2014-10-23 07:13:10 +04:00
yoo(can.sub.siq (~(put by can.sub.siq.yoo) can sem(num ~)))
?. ?=(%json p.+.sih)
%^ hooj our ses :^ nap can ?=(%rust -.+.sih)
:+ %cast %json
:+ %done ~
[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
=< abet =< work =< abet
(soon ?=(%rust -.+.sih) sem u.ouy can %show (wrap sem (json q.+.sih)))
2014-07-08 03:36:35 +04:00
==
2014-06-04 14:40:09 +04:00
::
%made
2014-10-24 01:09:39 +04:00
?+ tea +>.$
[%honk @ @ @ ~]
%- galt
[(slav %p i.t.tea) i.t.t.tea (slav %ud i.t.t.t.tea) p.+.sih]
::
[%hooj @ @ @ @ @ ~]
2014-10-23 07:13:10 +04:00
=+ ^= ouy
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
(slav %ud i.t.t.t.tea)
?~ ouy
2014-10-24 01:09:39 +04:00
~& %hooj-made-no-ouy +>.$
2014-10-23 07:13:10 +04:00
=+ can=(slav %ud i.t.t.t.t.tea)
=+ ful=(slav %f i.t.t.t.t.t.tea)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) can))
=< abet =< work =< abet
%^ soon (,? ful) sem :^ u.ouy can %show
%+ wrap sem
?: ?=(%& -.p.+.sih)
(json q.q.q.p.p.+.sih)
2014-10-24 01:09:39 +04:00
(rong ~ %to-json-fail p.p.+.sih)
::
[%hoop @ @ @ %mess @ @ ~]
=+ ^= ouy
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
(slav %ud i.t.t.t.tea)
?~ ouy
~& %hoop-made-no-ouy +>.$
?- -.p.+.sih
%&
=* mab t.t.t.t.tea
%= +>.$
mow
:_ mow
:* hen %pass tea %g
%mess [(slav %p i.t.mab) i.t.t.mab ~]
you:beat:u.ouy q.p.p.sih
==
==
::
%|
=< abet =< work =< abet
%^ hear:(yule:u.ouy %meg) ~ %&
[%json !>((rong ~ %from-json-fail p.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-10-16 02:05:48 +04:00
::
%wake
?> ?=([%leep @ @ @ @ ~] tea)
=+ ^= ouy
%- yolk:(gale (slav %p i.t.tea) i.t.t.tea)
(slav %ud i.t.t.t.tea)
?~ ouy
+>.$
?: (lth ~m2 (sub now tim.bet.siq:beat:u.ouy)) :: XX unnecessary
abet:work:amok:u.ouy
~& %bad-timer
+>.$
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]
==
2015-01-15 04:47:51 +03:00
=. p.p.pul |(p.p.pul ?=(hoke 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)
::
++ 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]
^+ +>
2015-01-15 04:47:51 +03:00
+>.$(mow :_(mow [hen %pass ~ %a [%want [our him] [%r %pc %e ~] 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
^+ +>
2015-01-15 04:47:51 +03:00
+>.$(mow :_(mow [hen %pass ~ %a [%want [our him] [%r %pr %e 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
==
::
2014-10-23 07:13:10 +04:00
++ hooj :: ford json request
|= [our=ship ses=hole nap=@ud can=@ud ful=? kas=silk]
%_ +>
mow
:_ mow
:^ hen %pass
~[%hooj (scot %p our) ses (scot %ud nap) (scot %ud can) (scot %f ful)]
[%f [%exec our `kas]]
==
::
++ 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-10-22 06:04:27 +04:00
%- role
2014-03-23 01:42:25 +04:00
:~ 'User-agent: *'
'Disallow: /'
==
::
^= fac
2014-09-17 04:29:12 +04:00
0w89wg.GV4jA.l9000.00dPb.YzBT6.giO00.o100d.wZcqc.a9tg-.VTG0b.
AUIvE.HBM3g.cK4SE.0aagi.l090p.I1P5g.Y-80r.y1YS9.1xE~Y.qgpFY.
vKN1V.905y0.2UwvL.43TUw.uL406.0-31h.xwoJF.Ul454.ilk00.00Yps.
BNumh.xpl9B.pS5Ji.i1BoC.ZAgg1.BsC5T.t6pLk.Thohn.gp000.0ov~P.
7M000.0o840.00010.0001i.h4x93.g0000.Eq2wR.7jB29
2014-03-23 01:42:25 +04:00
==
::
++ 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
2015-01-14 03:23:44 +03:00
|= [our=ship ses=hole whu=(unit ship) rul=tape ruf=tape]
^- manx
=+ ^= sic ^- manx
;script:'''
var seal = {
who: goal,
url: burl,
2015-01-15 04:47:51 +03:00
pas: null,
ses: sesh
}
var hist = []
var hind = 0
$(
function() {
$input = $('#input .line')
$prompt = $('#input .prompt')
$prompt.addClass('prefix')
$output = $('#output')
$input.focus()
$('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) {
2015-01-15 04:47:51 +03:00
var all = $.extend({}, seal, {oth:host});
delete all.pas;
console.log('redirect')
2015-01-15 04:47:51 +03:00
window.location= // "http://"+seal.who+".urbit.org/gul?"
"http://0:8445/gul?"
2015-01-14 03:23:44 +03:00
+ $.param(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()
2015-01-15 04:47:51 +03:00
var oth = /[&?]oth=[^&]*/.exec(location.search)
if(oth && oth.length)
seal.oth = oth[0].slice(5)
output = $output.html()
console.log($output.html())
2015-01-15 04:47:51 +03:00
$output.html(output.replace(
'sorry. please try again.<br>',''))
$.post(form, seal, function(data,xhr,status) {
console.log(data);
if(data.ok == true) {
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}';
2015-01-15 04:47:51 +03:00
; var sesh = '{(trip ses)}';
==
=> .(+.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-10-23 07:13:10 +04:00
++ rong
|= are=ares
%- jobe
:- [%ok %b |]
?~ are ~
:+ [%err %s p.u.are]
:+ %res %s
%- crip
%+ slag 2
^- tape
%+ roll q.u.are
|= [p=tank q=tape]
:(weld q "\\n" ~(ram re p))
~
::
++ soon
|= [ful=? sem=stem ouy=_yo:ya can=@ud mab=?(%mess %show) jon=json]
^+ yo:ya
=+ huq=``[%json !>(jon)]
?~ num.sem
=+ woy=(yule:ouy ?-(mab %mess %meg, %show %sub))
(hear:woy huq)
?- -.u.num.sem
%&
=+ yoo=abet:(busk:(yule:ouy %nil) p.u.num.sem 0 huq)
yoo(can.sub.siq (~(put by can.sub.siq.yoo) can sem(num ~)))
%|
=+ ^= yoo
=< abet
%^ busk:(yule:(hear:(yule:ouy %sub) huq) %nil)
p.u.num.sem
0
`[%& %json !>((joba %ok %b &))]
yoo(can.sub.siq (~(put by can.sub.siq.yoo) can sem(num ~)))
==
::
++ wrap
|= [sem=stem jon=json]
%- jobe
:~ [%ship %s (rsh 3 1 (scot %p p.hap.sem))]
[%appl %s q.hap.sem]
[%path %s (crip <pax.sem>)]
[%data `json`jon]
==
::
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-09-09 23:46:42 +04:00
++ duty |= [nap=@ud you=ship] :: interface script
^- cord
%^ cat 3
%- crip
=- "window.urb = {(pojo (jobe -))}\0a"
:~
[%ship (jape |1:<our>)]
[%port (jone nap)]
2014-09-09 23:46:42 +04:00
[%oryx %s orx.ced]
[%auto %b %&]
[%user (jape |1:<you>)]
==
2014-07-11 06:40:58 +04:00
'''
2014-08-01 03:57:35 +04:00
window.urb.seqn_u = 0
window.urb.seqn_h = 0
2014-08-01 03:57:35 +04:00
window.urb.dely = 0
window.urb.puls = 0
2014-08-20 05:11:41 +04:00
window.urb.cabs = {}
2014-08-01 03:57:35 +04:00
window.urb.perms = {
pol:"gie",
sub:"tis",
uns:"tiu",
mes:"tim",
heb:"tih"
}
2014-07-11 06:40:58 +04:00
2014-08-01 03:57:35 +04:00
window.urb.req = function(method,url,params,json,cb) {
var xhr = new XMLHttpRequest()
xhr.open(method.toUpperCase(), url)
if(json)
xhr.setRequestHeader("content-type", "text/json")
2014-07-11 06:40:58 +04:00
2014-08-01 03:57:35 +04:00
_data = {}
if(params.data) { _data.data = params.data; }
if(params.ship) { _data.ship = params.ship; }
if(params.path) { _data.path = params.path; }
if(params.appl) { _data.appl = params.appl; }
2014-10-24 01:09:39 +04:00
if(params.mark) { _data.mark = params.mark; }
2014-08-01 03:57:35 +04:00
__data = {oryx: window.urb.oryx, xyro: _data}
2014-07-11 06:40:58 +04:00
2014-08-01 03:57:35 +04:00
if(cb) {
xhr.onload = function() {
2014-08-11 23:57:25 +04:00
try {
err = null
res = {
status:this.status,
data: JSON.parse(this.responseText)
}
2014-10-11 03:34:29 +04:00
if(res.data.reload)
res.reload = res.data.reload
2014-08-11 23:57:25 +04:00
} catch(e) {
err = {
message:"Failed to parse JSON",
raw:this.responseText
}
res = null
}
cb(err,res)
2014-07-11 06:40:58 +04:00
}
xhr.onerror = function() {
2014-08-01 03:57:35 +04:00
cb({
status:this.status,
data:this.responseText
})
2014-07-11 06:40:58 +04:00
}
}
2014-08-01 22:21:28 +04:00
xhr.send(JSON.stringify(__data))
2014-07-11 06:40:58 +04:00
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
window.urb.reqq = []
window.urb.qreq = function(method,url,params,json,cb) {
walk = function() {
2014-08-01 22:21:28 +04:00
qobj = {}
2014-08-14 02:50:49 +04:00
qobj.oargs = window.urb.reqq[0]
2014-08-01 22:21:28 +04:00
qobj.nargs = [].slice.apply(qobj.oargs,[0,4])
qobj.nargs.push(function(){
if(this.oargs[4])
this.oargs[4].apply(window.urb,arguments)
2014-08-14 02:50:49 +04:00
window.urb.reqq.shift()
2014-08-01 03:57:35 +04:00
if(window.urb.reqq.length > 0)
walk()
2014-08-01 22:21:28 +04:00
}.bind(qobj))
window.urb.req.apply(this,qobj.nargs)
2014-07-29 03:17:59 +04:00
}
2014-08-01 03:57:35 +04:00
l = window.urb.reqq.length
window.urb.reqq.push(arguments);
if(l == 0) { walk() }
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
window.urb.gsig = function(params) {
2014-08-19 00:30:33 +04:00
path = params.path
if(!path)
path = ""
2014-08-01 03:57:35 +04:00
return params.appl+","+
2014-08-19 00:30:33 +04:00
path.replace(/[^\x00-\x7F]/g, "")+","+
2014-08-01 03:57:35 +04:00
params.ship
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
window.urb.poll = function(params,cb) {
if(!params)
throw new Error("You must supply params to urb.poll.")
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
var method, perm, url, $this
method = "get"
perm = params.type ? this.perms[params.type] : "gie"
2014-08-19 00:30:33 +04:00
json = false
if(perm[0] == "t") {
method = "put"
json = true
}
2014-08-19 01:20:51 +04:00
seqn = this.seqn_u
if(params.seqn)
seqn = params.seqn()
url = [perm,this.user,this.port,seqn]
2014-08-01 03:57:35 +04:00
url = "/"+url.join("/")
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
this.puls = 1
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
$this = this
2014-08-19 00:30:33 +04:00
this.req(method,url,params,json,function(err,data) {
2014-10-11 02:17:28 +04:00
if(data){
if (data.reload) {
return document.location.reload()
} else {
fn = $this.gsig(data.data)
if($this.cabs[fn]) {
$this.cabs[fn].call(this,err,
{status: data.status, data: data.data.data})
}
2014-08-01 03:57:35 +04:00
}
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
dely = params.dely ? params.dely : $this.dely
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
if(err)
dely = dely+Math.ceil(dely*.02)
else {
$this.dely = 0
if(params.incs)
params.incs()
else
$this.seqn_u++
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
setTimeout(function() {
$this.poll(params,cb)
},dely)
})
}
2014-08-01 22:21:28 +04:00
2014-08-01 03:57:35 +04:00
if (window.urb.auto) {
var tries = 0
var cnt = 0
var param = {
type:"pol"
2014-07-29 03:17:59 +04:00
}
2014-08-01 03:57:35 +04:00
window.urb.poll(param)
2014-07-29 03:17:59 +04:00
}
window.urb.heartbeat = function() {
this.poll({
type:"heb",
ship:this.ship,
dely:30000,
seqn:function() {
return window.urb.seqn_h
},
incs:function() {
window.urb.seqn_h = window.urb.seqn_h+1
}
},function() {
console.log('heartbeat.')
})
}
window.urb.heartbeat()
2014-07-29 03:17:59 +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
==
::
++ fapp
|= [fur=(unit term) you=@p paw=path]
?> ?=([~ %js] fur)
?> ?=(?([%hart ~] [@ %hart ~]) paw)
:- ~
:* %app
you
?~ t.paw
~
(some (slav %ui (cat 3 '0i' i.paw)))
==
::
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)
(biff (~(get by yaq) %url) epur)
2014-04-21 21:02:09 +04:00
::
++ 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
2014-09-03 22:41:25 +04:00
|= [fur=(unit term) you=@p paw=(list ,@t) quy=quay]
2014-04-09 02:26:01 +04:00
^- (unit seam)
2014-09-03 22:41:25 +04:00
=. aut.ced (~(put ju aut.ced) %$ (scot %p you)) :: XX backwards
2014-04-09 02:26:01 +04:00
?. ?& ?=(~ 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) @]
[~ (case p.u.soy) (case p.u.soy) /]
2014-04-09 02:26:01 +04:00
::
[%many [%$ ?(%da %ud %tas) @] [%$ ?(%da %ud %tas) @] ~]
[~ (case i.p.u.soy) (case i.t.p.u.soy) /]
2014-04-09 02:26:01 +04:00
==
|= mot=moat
`seam`[%det i.t.paw mot]
::
2014-03-12 23:50:39 +04:00
++ funk :: functional request
2014-09-03 22:41:25 +04:00
|= [nep=@tas fur=(unit term) you=@p paw=(list ,@t) quy=quay]
2014-03-12 23:50:39 +04:00
^- (unit seam)
2014-09-03 22:41:25 +04:00
=. aut.ced (~(put ju aut.ced) %$ (scot %p you)) :: XX backwards
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-10-16 23:53:38 +04:00
=+ nyp=?.(=(%i (cut 3 [1 1] nep)) /[nep] /[nep]/(rsh 3 1 (scot %p you)))
2014-04-10 03:51:19 +04:00
:^ %fun for
2014-10-16 23:53:38 +04:00
toe(s (weld s.toe `path`[~(rent co (flux nyp quy)) %web ~]))
2014-04-10 03:51:19 +04:00
?. won ~
:_ ~
2014-09-03 22:41:25 +04:00
=- =+ pey="{(scag 2 (trip nep))}v"
=. pey %+ weld pey
?. =(%i (snag 1 pey))
""
"/{(slag 1 (scow %p you))}"
2014-04-10 03:51:19 +04:00
=+ ven=+((,@ (need (sky %cw p.toe q.toe r.toe ~))))
=+ ^= cal :/
"path='".
2014-09-03 22:41:25 +04:00
"/{pey}".
2014-04-10 03:51:19 +04:00
"/{(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
2015-01-14 03:23:44 +03:00
:: :+ [p.p.pul q.p.pul r.p.pul]
:+ [| q.p.pul r.p.pul] :: XX https
2014-04-21 21:02:09 +04:00
[~ /gul]
2015-01-14 03:23:44 +03:00
:- [%url (crip (earn pul(p.p |)))]
2014-04-21 21:02:09 +04:00
?~ 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)
?~ 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
%p :: app script by port
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))
==
?: &(=(%get p.moh) ?=([~ [@ ~]] q.pul)) :: app shortcut
2015-01-15 06:07:26 +03:00
=- $(q.pul [`%html -])
=+ ato=(~(tap in (~(get ju aut.ced) %$)))
=+ att=`(list ship)`(murn ato |=(a=span (slaw %p a)))
?~ att [%geg i.q.q.pul ~]
?: (~(has in (sa att)) our)
[%gog i.q.q.pul ~]
:+ %gig
(rsh 3 1 (scot %p (snag 0 (sort att lth))))
/[i.q.q.pul]
2014-03-12 23:50:39 +04:00
~
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]
==
2015-01-15 06:07:26 +03:00
?: &(=(%i two) !(lash yun) !=(yun (shaf %fake ses)))
2015-01-14 03:23:44 +03:00
(holt [~ yun] pul)
2015-01-15 06:07:26 +03:00
?: &(=(%o two) !(lash our))
2015-01-14 03:23:44 +03:00
(holt [~ our] pul)
2014-04-21 21:02:09 +04:00
?+ one ~
%g
?+ tri ~
2014-09-03 22:41:25 +04:00
?(%f %n) (funk nep p.q.pul yun paw r.pul)
%v (foin p.q.pul yun paw r.pul)
2014-04-21 21:02:09 +04:00
%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)
%p (fapp 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
==
::
2015-01-15 04:47:51 +03:00
++ erle :: url localize
2015-01-15 06:07:26 +03:00
|= [his=ship pul=purl] ^- purl
=+ pod=(mo (turn (~(tap by dop)) |=([p=host q=ship] [q p])))
?: (~(has by pod) his)
pul(p [& ~ (~(got by pod) his)])
?: ?=(hoke r.p.pul)
~| %no-port
pul(q.p [~ ?+(his !! %~zod 8.443)]) :: XX
pul(p [& ~ [~ /org/urbit/(rsh 3 1 (scot %p his))]])
2015-01-15 04:47:51 +03: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-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
=+ pax=/(scot %p our)/code/(scot %da now)/(scot %p our)
2014-04-23 23:26:22 +04:00
%^ rsh 3 1
(scot %p (,@ (need (sky %a pax))))
2014-04-23 23:26:22 +04:00
::
2015-01-15 06:07:26 +03:00
++ lash :: user is authorized
|=(a=ship (~(has ju aut.ced) %$ (scot %p a)))
2014-04-23 23:26:22 +04:00
::
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) _+>]
2015-01-14 03:23:44 +03:00
:: ~& wink-do/[?@(pez.pip pez.pip -.pez.pip) -.som.pip]
2014-03-12 23:50:39 +04:00
?- 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)
::
%app :: script by port
:: ~& [%wink-app +.som.pip]
(yokp num +.som.pip)
2014-06-10 00:09:14 +04:00
::
%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-16 23:47:41 +04:00
::
%cog
!!
2014-04-16 23:47:41 +04:00
::
%cop
!!
2014-04-16 23:47:41 +04:00
::
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-07-27 14:26:17 +04:00
=+ kas=`silk`[%cast %mime `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
2015-01-15 04:47:51 +03:00
^- [(unit pimp) _+>.$]
2015-01-14 03:23:44 +03:00
?~ pus.p.som.pip
:_ +>.$
2015-01-15 04:47:51 +03:00
?: ?~ whu.p.som.pip |
2015-01-15 06:07:26 +03:00
(lash u.whu.p.som.pip)
2015-01-15 04:47:51 +03:00
[~ pip(som [%red pul.p.som.pip])]
2015-01-14 03:23:44 +03:00
?: wit.p.som.pip
[~ pip(pez [%who %$ (scot %p (need whu.p.som.pip))])]
=+ rul=(earn pul.p.som.pip)
2015-01-15 04:47:51 +03:00
=+ ruf=(earn (erle our pul.p.som.pip(q.q /pul, r ~)))
=+ sus=?~(foy.p.som.pip ses q.u.foy.p.som.pip)
~& auth-request/secret=`cord`lass
2015-01-15 04:47:51 +03:00
=+ ham=(noon our sus whu.p.som.pip rul ruf)
2015-01-14 03:23:44 +03:00
[~ pip(pez [%fin %ham ham])]
?. =(lass u.pus.p.som.pip)
:_ +>.$
:- ~
%= 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
=+ ^= jon
%- jobe
:~ [%ok [%b &]]
[%next (jape (earn pul.p.som.pip))]
2014-04-21 21:02:09 +04:00
==
2014-04-26 00:49:52 +04:00
:_(+>.$ [~ pip(pez [%fin %mid /text/json (tact (pojo jon))])])
2015-01-14 03:23:44 +03:00
=. ..ya (haji our u.foy.p.som.pip)
=+ ^= lup ^- purl
2015-01-15 04:47:51 +03:00
%+ erle p.u.foy.p.som.pip
:+ `hart`p.pul.p.som.pip
2015-01-14 03:23:44 +03:00
^- pork
[~ /gul]
^- quay
:~ [%who (rsh 3 1 (scot %p (need whu.p.som.pip)))]
[%url (crip (earn pul.p.som.pip))]
[%wit %yes]
==
=+ jon=(jobe ~[[%ok [%b &]] [%next (jape (earn lup))]])
:_(+>.$ [~ pip(pez [%fin %mid /text/json (tact (pojo jon))])])
2014-04-21 21:02:09 +04:00
::
%red
:_ +>.$
:- ~
%= pip
pez
:- %fin
:- %raw
2015-01-14 03:23:44 +03:00
:+ 307
2014-04-21 21:02:09 +04:00
[%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']
2014-10-30 23:33:15 +03:00
[~ (tact (poxo mad))]
& [%fin (lofa 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-29 03:17:59 +04:00
abet:(~(self yo num you *sink) 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-10-24 01:09:39 +04:00
|= [num=@ud you=ship nap=@ud cnt=@ud hap=hasp for=mark 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-10-24 01:09:39 +04:00
abet:(post:u.yon cnt num hap for jon)
2014-06-10 00:09:14 +04:00
::
++ yokp :: script by port
|= [num=@ud you=ship nup=(unit ,@ud)]
^- [(unit pimp) _+>]
?~ nup
$(nup [~ num], +> ~(harp yo num you *sink))
=+ yon=(yolk u.nup)
?~ yon
=+ err=(bust 204 num)
[`(need (~(get by q.rey.err) num)) err]
[- abet:+]:(hark:u.yon num)
::
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
2014-10-16 02:05:48 +04:00
sok (~(del by sok) nap)
2014-06-12 21:19:36 +04:00
==
2014-07-12 06:02:11 +04:00
%= $
wuh t.wuh
..amok
2014-10-08 05:00:55 +04:00
(pass(hen hen.q.i.wuh) `p.i.wuh [%g %nuke [- + ~]:hap.q.i.wuh you])
2014-07-12 06:02:11 +04:00
==
2014-07-11 06:40:58 +04:00
::
++ beat
2014-07-11 06:40:58 +04:00
|= [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-10-16 02:05:48 +04:00
=. +>.$ hast
=. bet.siq bet.siq(num +(num.bet.siq), tim now, hen hen)
=. +>.$ hawa
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
::
++ hark
|= num=@ud
^- [(unit pimp) _+>]
2014-10-31 06:13:40 +03:00
=. +>.$ abet:(busk:(yule %nil) num *@ ~ %& %js !>((duty nap you)))
[`(need (~(get by q.rey) num)) +>.$]
::
++ harp
2014-10-16 02:05:48 +04:00
%* abet hawa
tim.bet.siq now
num.sub.siq 1
==
::
2014-10-16 02:05:48 +04:00
++ hast
%_ .
mow
:_ mow
:- hen.bet.siq
:^ %pass
[%leep (scot %p our) ses (scot %ud nap) (scot %ud num.bet.siq) ~]
%t
:- %rest (add ~m2 tim.bet.siq)
==
::
++ hawa
%_ .
mow
:_ mow
^- move
:- hen.bet.siq
:^ %pass
[%leep (scot %p our) ses (scot %ud nap) (scot %ud num.bet.siq) ~]
%t
:- %wait (add ~m2 now)
==
::
2014-06-10 00:09:14 +04:00
++ hoop :: request path
2014-10-24 01:09:39 +04:00
|= can=(each ,@ud hasp)
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-10-24 01:09:39 +04:00
?- -.can
%& [%show (scot %ud p.can) ~]
%| [%mess (scot %p p.p.can) q.p.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-10-24 01:09:39 +04:00
|= [can=(each ,@ud hasp) 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-10-24 01:09:39 +04:00
|= [cnt=@ud num=@ud hap=hasp for=mark jon=json]
2014-06-13 02:10:32 +04:00
^+ +>
2014-07-16 06:30:29 +04:00
=. +>.$
?. =(cnt num.meg.siq) +>.$
2014-10-24 01:09:39 +04:00
%+ pass(num.meg.siq +(num.meg.siq)) [%| hap]
2014-12-10 04:39:51 +03:00
`note`[%f %exec our ~ %cast for %done ~ %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) _+>]
=. +>.$
2015-01-09 02:56:48 +03:00
%- ~(rep by can.sub.siq)
2014-07-18 23:23:35 +04:00
|= [p=[p=@ud q=stem] q=_+>.$]
?. =([hap pax] [hap.q.p pax.q.p]) q
2014-07-18 23:23:35 +04:00
=. q q(can.sub.siq (~(del by can.sub.siq:q) p.p))
2014-09-11 03:35:03 +04:00
([-(hen +)]:[pass:q hen.q.p] `p.p %g %nuke [- + ~]:hap you)
2014-07-18 23:23:35 +04:00
=+ 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
2014-08-05 02:49:34 +04:00
(~(put by can.sub.siq) num.sub.siq [hap pax hen `[%| num]])
2014-09-11 03:35:03 +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
^+ +>
2014-07-29 03:17:59 +04:00
=. tim.bet.siq now
=. 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)
2014-10-16 02:05:48 +04:00
=. hen.bet.siq hen
=. +>.$ hawa
2014-09-11 03:35:03 +04:00
(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
=* his q.som.pip
2014-10-11 03:52:20 +04:00
=+ mef=?:(=(our his) "gop" "gip/{|1:<his>}") :: e.g. "gip/zod"
=+ hat="/{mef}/{(pojo (jone nap))}/hart.js"
[;script(src hat); ;meta(charset "utf-8"); 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
%= pip
pez %new
sip sip
som ^- seam
:+ %sil
2014-06-17 05:33:31 +04:00
?:(-.u.huq 200 203)
=+ don=`silk`[%done ~ `cage`p.u.huq]
2014-06-12 07:47:57 +04:00
^- silk
2014-07-27 14:26:17 +04:00
:+ %cast %mime
2014-06-12 21:19:36 +04:00
?~ fur.pip don
2014-07-27 14:26:17 +04:00
`silk`[%cast u.fur.pip 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-10-04 02:32:10 +04:00
|= [tea=wire hen=duct hin=(hypo sine)]
2014-06-04 14:40:09 +04:00
^- [p=(list move) q=_..^$]
2014-10-04 02:32:10 +04:00
?: ?=(%veer +<.q.hin) :: vomit
[[hen %give +.q.hin]~ ..^$]
?: ?=(%vega +<.q.hin) :: vomit
[[hen %give +.q.hin]~ ..^$]
2014-06-04 14:40:09 +04:00
=+ 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
--