Merge branch 'master' of github.com:urbit/urbit

is merge is necessary,
This commit is contained in:
C. Guy Yarvin 2014-04-25 10:37:54 -07:00
commit da0dcfc636
4 changed files with 315 additions and 79 deletions

View File

@ -380,7 +380,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(5 vez)
?> =(6 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -400,7 +400,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 5]
:~ [3 6]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -979,7 +979,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(5 (end 0 3 pac)) [~ fox]
?. =(6 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)

View File

@ -5,8 +5,7 @@
^- vane :: kernel instrument
=> =~
|% :: structures
::
++ ju :: XX lose after reset
++ ju :: jug engine
|/ a=(jug)
+- get
|* b=*
@ -18,7 +17,7 @@
^- ?
(~(has in (get(+< a) b)) c)
::
+- put :: XX slow
+- put
|* [b=* c=*]
^+ a
=+ d=(get(+< a) b)
@ -60,6 +59,7 @@
[%fin p=love] :: ready to send
[%haz p=riot] :: clay responded
[%raw p=hiss] :: wild url
[%who p=@tas q=@ta] :: awaiting auth
== ::
++ pimp :: traced request
$: ful=? :: | === HEAD
@ -245,12 +245,13 @@
(hajj (need (slaw %p i.tea)) t.tea p.fav)
::
%wart :: remote request
?> ?=(^ wru)
?+ q.fav
~& [%strange-wart p.fav q.fav]
+.$
::
%pr
(hare r.fav p.fav s.fav)
%pr (hare r.fav p.fav s.fav)
%pc (here q.u.wru p.fav s.fav)
==
::
%waft
@ -319,6 +320,11 @@
?~ cuz +>.$
abet:work:(~(iota ya [our ses] u.suf u.cuz) num rot)
::
++ haji :: send %pc login
|= [him=ship ses=hole]
^+ +>
+>.$(mow :_(mow [wru [/a /e hen] [%want him [%r %pc ~] ses]]))
::
++ hajj :: send %pr response
|= [him=ship tus=path har=httr]
^+ +>
@ -334,6 +340,12 @@
[wru [/e [%e (scot %p him) tus] hen] ?~(hux [%thud ~] [%this u.hux])]
==
::
++ here :: receive auth
|= [our=ship him=ship hez=*]
^+ +>
=+ boy=(myth our (need ((sand %ta) ((hard ,@) hez))))
?~(boy +>.$ abet:(auth:u.boy him))
::
++ hell :: request, no ship
|= [pul=purl hyx=httx moh=moth]
^+ +>
@ -553,6 +565,170 @@
?~ 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
; var seal = {
; who: goal,
; url: burl,
; pas: null
; }
; $(
; function() {
; $input = $('#input .line')
; $prompt = $('#input .prompt')
; $prompt.addClass('prefix')
; $output = $('#output')
; $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) {
; if(data.ok == true) {
; document.location = "/goc/0"
; } 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
==
::
++ ya :: session engine
=| [[our=ship ses=hole] serf cyst]
=* sef ->-
@ -565,6 +741,10 @@
(~(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)))
::
++ dodo :: console s->c
|= [con=@ud fav=card]
^+ +>
@ -605,6 +785,17 @@
?> ?=(%way pez.u.pup)
$(yov t.yov, q.rey (~(put by q.rey) i.yov u.pup(pez noz)))
::
++ fake
^- (unit seam)
:+ ~ %app
;html
;head ;title: not an application
==
;body
;p: Not an application, on {<our>}, with {<aut.ced>}
==
==
::
++ flea :: permissive decimal
|= txt=@t
^- (unit ,@ud)
@ -621,34 +812,38 @@
?~ uru ~
(rush u.uru auri:epur)
::
++ folk :: seal from query
|= quy=quay
^- (unit seal)
=+ 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]))
?~ pyl ~
?: &(wit |(=(~ whu) =(~ ses))) ~
~& [%folk-quay whu u.pyl wit foy pus]
[~ whu u.pyl wit foy pus]
::
++ fool :: domestic login get
|= quy=quay
^- (unit seam)
=+ yaq=(~(gas by *(map ,@t ,@t)) quy)
=+ pyl=(foal %url yaq)
?~ pyl ~
=+ wuh=(~(get by yaq) %who)
[~ %lon ?~(wuh ~ (rush u.wuh fed:ag)) u.pyl]
(bind (folk quy) |=(a=seal [%lon a]))
::
++ foom :: domestic login post
|= moh=moth
^- (unit seam)
?. ?& ?=(^ r.moh)
.= [~ 'application/x-www-form-urlencoded' ~]
(~(get by q.moh) 'content-type')
:: .= [~ 'application/x-www-form-urlencoded' ~]
:: (~(get by q.moh) 'content-type')
== ~
=+ yuq=(rush q.u.r.moh yquy:epur)
?~ yuq ~
=+ yaq=(~(gas by *(map ,@t ,@t)) u.yuq)
=+ pas=(~(get by yaq) %pas)
?~ pas ~
=+ pyl=(foal %url yaq)
?~ pyl ~
=+ ^= whu ^- (unit ,@p)
=+ sip=(~(get by yaq) %who)
?~(sip ~ (rush u.sip fed:ag))
?~ whu ~
[~ %log u.whu u.pyl u.pas]
?~(yuq ~ (fool u.yuq))
::
++ flub :: console request
|= [paw=(list ,@t) muh=(unit moth)]
@ -802,10 +997,8 @@
?+ two |
%e & :: stranger
%u p.p.pul :: guest
::%u &
%i p.p.pul :: neighbor
%o p.p.pul :: identified
::%o &
==
::
?= $? %p :: application
@ -833,6 +1026,7 @@
%v (foin p.q.pul paw r.pul)
%c (flub paw ~)
%l (fool r.pul)
%p fake
==
::
%p
@ -1182,6 +1376,9 @@
%way [[~ pip] +>.$]
%new
?- -.som.pip
%app :: XX a mere stub
:_(+>.$ [~ pip(pez [%fin %ham p.som.pip])])
::
%con
:_ +>.$
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
@ -1396,36 +1593,38 @@
==
==
::
%lof !!
%lon
:_ +>.$
=+ rul=(earn q.som.pip)
=+ ruf=(earn (earl our q.som.pip(q.q /pul, r ~)))
=+ ^= ham
;html
;body
;form(method "post", action ruf)
;* ?^ p.som.pip
=+ nam=(trip (rsh 3 1 (scot %p u.p.som.pip)))
;= ;input(type "hidden", name "who", value nam);
==
;= ; vessel: ;{input(type "text", name "who")}
==
; password: ;{input(type "password", name "pas")}
;input(type "hidden", name "url", value rul);
;input(type "submit", value "submit");
==
==
?^ pus.p.som.pip
~& [%pass lass u.pus.p.som.pip]
?. =(lass u.pus.p.som.pip)
$(pus.p.som.pip ~)
=. aut.ced (~(put ju aut.ced) %$ (scot %p (need whu.p.som.pip)))
?~ foy.p.som.pip
~& [%redirect pul.p.som.pip]
$(som.pip [%red pul.p.som.pip])
=. ..ya (haji u.foy.p.som.pip)
%= $
som.pip
:- %red
^- 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]
==
==
:_ +>.$
?: 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)
[~ pip(pez [%fin %ham ham])]
::
%log
?. =(lass r.som.pip)
$(som.pip [%lon [~ p.som.pip] q.som.pip])
%= $
som.pip [%red q.som.pip]
aut.ced (~(put ju aut.ced) %$ (scot %p p.som.pip))
==
::
%red
:_ +>.$
@ -1460,6 +1659,10 @@
?~ hoy
pip(pez [%err 404 [[%leaf "invalid request"] ~]])
pip(som u.hoy, pez %new)
::
[%who *]
:_ +>.$
?.((~(has ju aut.ced) p.pez.pip q.pez.pip) [~ pip] [~ pip(pez %new)])
==
::
++ work

View File

@ -6,7 +6,7 @@
=> =~
|% :: structures
++ axle :: all %ford state
$: wad=(map duct task) :: tasks by duct
$: tad=(map duct task) :: tasks by duct
== ::
++ bone ,@ud :: abstract duct
++ claw :: startup chain
@ -20,12 +20,7 @@
== ::
++ crab :: ascending card
$% [%halt ~] :: interrupt
[%ride p=(list skit) q=(each path twig)] :: start/restart
== ::
++ crib :: execution thread
$: kit=(map ,@ud kite) :: dependencies
eve=(qeu ,[p=wire q=card]) :: pending cards
war=(each claw (unit vial)) :: execution
[%ride p=(list silk)] :: start/restart task
== ::
++ croc ,* :: descending card
++ hawk :: untyped effect
@ -41,7 +36,10 @@
now=@da :: date
== == ::
++ hive :: typed engine
|* [cud=,_* wad=,_* bag=_,*] :: condensed state
|* $: cud=,_* :: events (++card)
wad=,_* :: actions (++hawk)
bag=_,* :: condensed state
== ::
$_ ^? ::
|_ hide ::
++ pack *bag :: save as bag
@ -52,7 +50,7 @@
== ::
[*(list wad) +>] :: effects
++ poll :: current subchange
|+ tea=path ::
|+ tea=wire ::
_@ud ::
++ peek :: view
|+ $: kyl=keel :: inspecting agent
@ -62,7 +60,7 @@
== ::
[*?(%view %diff) *vase] ::
++ prep :: restore from bag
|= bux=bag ::
|+ bux=bag ::
+> ::
== ::
++ keel (unit ship khan) :: general identity
@ -73,13 +71,41 @@
lac=(each path twig) :: indirect/direct
== ::
++ logo ,@tas :: logical type
++ skit ,[p=(unit ,@ta) q=(list ,@ta) r=(list ,@ta)] :: tracking path
++ silk :: construction layer
$% [%a p=vase] :: nominal
[%b p=twig] :: direct
[%c p=path] :: indirect
[%d p=(list silk) q=(list silk)] :: functional
== ::
++ task :: execution
$: lam=lamp :: task definition
nah=crib :: task state
$: kyl=keel :: logical owner
lam=(list silk) :: task definition
kit=(map ,@ud kite) :: dependencies
eve=(qeu ,[p=wire q=card]) :: pending cards
vax=(unit vase) :: current state
== ::
++ vial ,* :: untyped vase
--
|%
++ ye :: per event
=| $: $: $: kul=(unit keel) :: event authority
tea=wire :: event place
hen=duct :: event floor
fav=card :: event data
== ::
$: now=@da :: event date
eny=@ :: unique entropy
sky=$+(* (unit)) :: system namespace
== ::
mow=(list move) :: pending actions
== ::
bolo :: all vane state
== ::
=* bol ->
|%
++ abet
^- [(list move) bolo]
[(flop mow) bol]
. ==
=| axle
=* lex -
@ -89,13 +115,11 @@
++ beat :: process move
|= [wru=(unit writ) tea=wire hen=duct fav=curd]
=> .(fav ((hard card) fav))
=. ney (shax :(mix (shax now) +(eny) ney)) :: XX!! shd not need
?: ?=(%crud -.fav)
[[[wru [/d hen] %flog fav] ~] ..^$]
^- [p=(list move) q=vane]
=. gub ?.(=(0 gub) gub (cat 3 (rsh 3 1 (scot %p (end 6 1 eny))) '-'))
=+ ^= kul ^- (unit keel)
?: |(?=(%
=^ mos bol
abet:apex:~(adit ye [[wru tea hen fav] [now eny sky] ~] bol)
abet:apex:~(adit ye [[wru tea hen fav] [now eny sky] ~] lex)
[mos ..^$]
::
++ come

View File

@ -1538,7 +1538,9 @@
::
++ epur :: url/header parser
|%
++ apat (cook deft ;~(pfix fas (more fas smeg))) :: 2396 abs_path
++ apat :: 2396 abs_path
%+ cook deft
(ifix [fas ;~(pose fas (easy ~))] (more fas smeg))
++ auri
%+ cook
|= a=purl
@ -1564,6 +1566,7 @@
;~(plug aln (star alp))
::
++ fque (cook crip (plus pquo)) :: normal query field
++ fquu (cook crip (star pquo)) :: optional field
++ pcar ;~(pose pure pesc psub col pat) :: 2396 path char
++ pcok ;~ pose :: cookie char
(just `@`0x21)
@ -1626,7 +1629,7 @@
;~ pose :: proper query
%+ more
;~(pose pam sem)
;~(plug fque ;~(pfix tis fque))
;~(plug fque ;~(pfix tis fquu))
::
%+ cook :: funky query
|=(a=tape [[%$ (crip a)] ~])
@ -2663,15 +2666,21 @@
hoc=(map ship door) :: neighborhood
== ::
++ salt ,@uv :: entropy
++ seal :: auth conversation
$: whu=(unit ship) :: client identity
pul=purl :: destination url
wit=? :: wait for partner
foy=(unit ,[p=ship q=hole]) :: partner to notify
pus=(unit ,@ta) :: password
== ::
++ seam :: logical request
$% [%cog p=@ud q=@ud] :: console get
$% [%app p=manx] :: (fake) app
[%cog p=@ud q=@ud] :: console get
[%con p=@ud] :: console face
[%cop p=@ud q=@ud r=json] :: console put
[%det p=disc q=moat] :: load changes
[%fun p=term q=tube r=(list manx)] :: functional
[%lof p=ship q=hole] :: foreign auth
[%lon p=(unit ship) q=purl] :: domestic auth as/to
[%log p=ship q=purl r=@ta] :: password
[%lon p=seal] :: authentication flow
[%red p=purl] :: redirect
== ::
++ seat :: functional path