mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
Merge branch 'test' into livetest
Conflicts: urb/urbit.pill
This commit is contained in:
commit
3511088d74
@ -184,9 +184,11 @@
|
||||
hit(q (weld cuh q.hit))
|
||||
::
|
||||
++ add-poll :: inject dependency
|
||||
|= [dep=@uvH max=[[%html ~] [[%head ~] hed=marl] [[%body ~] manx marl] ~]]
|
||||
|= [dep=@uvH max=[[%html ~] [[%head ~] hed=marl] [[%body ~] tal=marl] ~]]
|
||||
^- manx
|
||||
=. hed.max :_(hed.max ;meta(charset "utf-8", urb_injected "");)
|
||||
=: hed.max :_(hed.max ;meta(charset "utf-8", urb_injected "");)
|
||||
tal.max (welp tal.max ;script(urb_injected ""):"{(trip etag:js)}" ~)
|
||||
==
|
||||
?~ dep max
|
||||
max(hed :_(hed.max ;script@"/~/on/{<dep>}.js"(urb_injected "");))
|
||||
::
|
||||
@ -294,30 +296,46 @@
|
||||
function(){document.getElementById("c").innerHTML = "<p>Goodbye.</p>" }
|
||||
)}
|
||||
'''
|
||||
++ etag
|
||||
'''
|
||||
if(!window.urb) window.urb = {}
|
||||
urb.fetchTag = function(){
|
||||
var tag = JSON.parse(this.getResponseHeader("etag"))
|
||||
if(tag) urb.wasp(tag)
|
||||
}
|
||||
urb.headReq = function(url){
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open("HEAD", url)
|
||||
xhr.onload = urb.fetchTag
|
||||
xhr.send()
|
||||
}
|
||||
Array.prototype.map.call(document.querySelectorAll('script'), function(ele){
|
||||
if((new URL(ele.src)).host == document.location.host)
|
||||
urb.headReq(ele.src)
|
||||
})
|
||||
Array.prototype.map.call(document.querySelectorAll('link'), function(ele){
|
||||
if((new URL(ele.href)).host == document.location.host)
|
||||
urb.headReq(ele.href)
|
||||
})
|
||||
'''
|
||||
--
|
||||
++ xml
|
||||
|%
|
||||
++ login-page
|
||||
%+ titl 'Log in'
|
||||
;= ;div#c
|
||||
;p: Please log in.
|
||||
;p.mono: ~;{span#ship(contenteditable "")}
|
||||
;input#pass(onchange "urb.submit()");
|
||||
;pre:code#err;
|
||||
;script@"/~/at/~/auth.js";
|
||||
==
|
||||
;link(rel "stylesheet", href "/home/lib/base.css");
|
||||
;= ;p: Please log in.
|
||||
;p.mono: ~;{span#ship(contenteditable "")}
|
||||
;input#pass(onchange "urb.submit()");
|
||||
;pre:code#err;
|
||||
;script@"/~/at/~/auth.js";
|
||||
==
|
||||
::
|
||||
++ logout-page
|
||||
%+ titl 'Log out'
|
||||
;= ;div#c
|
||||
;p: Goodbye ~;{span#ship}.
|
||||
;button#act(onclick "urb.away()"): Log out
|
||||
;pre:code#err;
|
||||
;script@"/~/at/~/auth.js";
|
||||
==
|
||||
;link(rel "stylesheet", href "/home/lib/base.css");
|
||||
;= ;p: Goodbye ~;{span#ship}.
|
||||
;button#act(onclick "urb.away()"): Log out
|
||||
;pre:code#err;
|
||||
;script@"/~/at/~/auth.js";
|
||||
==
|
||||
::
|
||||
++ poke-test
|
||||
@ -333,7 +351,15 @@
|
||||
}
|
||||
'''
|
||||
==
|
||||
++ titl |=([a=cord b=marl] ;html:(head:title:"{(trip a)}" body:"*{b}"))
|
||||
++ titl
|
||||
|= [a=cord b=marl]
|
||||
;html
|
||||
;head
|
||||
;title:"{(trip a)}"
|
||||
;link(rel "stylesheet", href "/home/lib/base.css");
|
||||
==
|
||||
;body:div#c:"*{b}"
|
||||
==
|
||||
--
|
||||
--
|
||||
|% :: functions
|
||||
@ -385,7 +411,7 @@
|
||||
=. p.p.pul |(p.p.pul ?=(hoke r.p.pul))
|
||||
=+ her=(host-to-ship r.p.pul)
|
||||
?: |(?=(~ her) =(our u.her))
|
||||
(handle pul [q.+.kyz anon] [p.heq maf s.heq])
|
||||
(handle pul [q.+.kyz |] [p.heq maf s.heq])
|
||||
=+ han=(sham hen)
|
||||
=. pox (~(put by pox) han hen)
|
||||
(ames-gram u.her [%get ~] han +.kyz)
|
||||
@ -582,7 +608,7 @@
|
||||
(~(has in aut.u.cyz) our)
|
||||
::
|
||||
++ ses-ya |=(ses=hole ~(. ya ses (~(got by wup) ses)))
|
||||
++ our-host `hart`[& ~ `/com/urbit/(rsh 3 1 (scot %p our))]
|
||||
++ our-host `hart`[& ~ `/org/urbit/(rsh 3 1 (scot %p our))]
|
||||
:: [| [~ 8.445] `/localhost] :: XX testing
|
||||
::
|
||||
++ ames-gram
|
||||
@ -590,7 +616,8 @@
|
||||
::
|
||||
++ back :: %ford bounce
|
||||
|= [tea=whir dep=@uvH mar=mark cay=cage]
|
||||
(pass-note tea (ford-req root-beak [%cast mar %done ~ cay])) :: XX deps
|
||||
=+ sil=`silk`[%cast mar %flag dep %done ~ cay]
|
||||
(pass-note tea (ford-req root-beak sil))
|
||||
::
|
||||
++ ford-kill (pass-note ~ %f [%exec our *beak ~]) :: XX unused
|
||||
++ ford-req |=([bek=beak kas=silk] [%f [%exec our bek `kas]])
|
||||
@ -626,8 +653,8 @@
|
||||
++ host-to-ship :: host to ship
|
||||
|= hot=host
|
||||
^- (unit ship)
|
||||
=+ gow=(~(get by dop) hot)
|
||||
?^ gow gow
|
||||
:: =+ gow=(~(get by dop) hot) :: XX trust
|
||||
:: ?^ gow gow
|
||||
?. ?=(& -.hot) ~
|
||||
=+ dom=(flop p.hot) :: domain name
|
||||
?~ dom ~
|
||||
@ -642,7 +669,7 @@
|
||||
::
|
||||
++ handle
|
||||
|= $: [hat=hart pok=pork quy=quay] :: purl, parsed url
|
||||
[cip=clip him=ship] :: client ip, ship
|
||||
[cip=clip aut=?] :: client ip, nonymous?
|
||||
[mef=meth maf=math bod=(unit octs)] :: method/headers/body
|
||||
==
|
||||
=< apex
|
||||
@ -658,7 +685,9 @@
|
||||
::
|
||||
++ ford-get-beam
|
||||
|= [bem=beam ext=term]
|
||||
=: s.bem [%web ~(rent co (fcgi quy fcgi-cred:for-client)) s.bem]
|
||||
=+ yac=for-client
|
||||
=. him.yac ?.(aut anon him.yac)
|
||||
=: s.bem [%web ~(rent co (fcgi quy fcgi-cred.yac)) s.bem]
|
||||
r.bem ?+(r.bem r.bem [%ud %0] da/now)
|
||||
==
|
||||
(ford-req -.bem [%boil ext bem ~])
|
||||
@ -881,7 +910,8 @@
|
||||
=+ ext=(fall p.pok %urb)
|
||||
=+ bem=?-(-.hem %beam p.hem, %spur [root-beak p.hem])
|
||||
=+ wir=?+(mef !! %get ~, %head [%he ~])
|
||||
[%& %| wir (ford-get-beam bem ext)]
|
||||
=- ?.(aut [%& %| -] [%| (pass-note -)]) :: XX properly
|
||||
[wir (ford-get-beam bem ext)]
|
||||
::
|
||||
%bugs
|
||||
?- p.hem
|
||||
@ -959,7 +989,10 @@
|
||||
%get
|
||||
~| aute/ham
|
||||
?: |(=(anon him.ham) (~(has in aut.yac) him.ham))
|
||||
process(him him.ham, pok rem.ham)
|
||||
=. ..ya abet.yac(him him.ham)
|
||||
=+ pez=process(pok rem.ham, aut &)
|
||||
?: ?=(%| -.pez) pez
|
||||
[%| (resolve ~ p.pez)]
|
||||
?. =(our him.ham)
|
||||
[%| ((teba foreign-auth.yac) him.ham hat rem.ham quy)]
|
||||
(show-login-page ~)
|
||||
@ -1000,7 +1033,7 @@
|
||||
?~ cyz
|
||||
~& bad-cookie/u.lig
|
||||
(new-ya (rsh 3 1 (scot %p (end 6 1 ney))))
|
||||
~(. ya u.lig u.cyz(him him, cug ~))
|
||||
~(. ya u.lig u.cyz(cug ~))
|
||||
::
|
||||
++ new-ya |=(ses=hole ~(. ya ses (new-cyst ses)))
|
||||
++ new-cyst
|
||||
@ -1133,7 +1166,6 @@
|
||||
::
|
||||
++ del-subs :: XX per path?
|
||||
|= [a=dock %json b=wire c=path] ^+ ..ix
|
||||
~& [%eyre-del-subs +< hen]
|
||||
=. ..ix (hurl-note [a b] [%g %deal [him -.a] +.a %pull ~])
|
||||
(nice-json:pop-duct:(ire-ix ire)) :: XX gall ack
|
||||
::
|
||||
|
@ -1111,9 +1111,17 @@
|
||||
$(kas [%done p.kas u.q.kas])
|
||||
::
|
||||
%file
|
||||
|
||||
%+ cool |.(leaf/"ford: file {<p.kas>}")
|
||||
(lear cof p.kas)
|
||||
::
|
||||
%flag
|
||||
?~ p.kas $(kas q.kas)
|
||||
=+ dap=(~(get by deh.bay) p.kas)
|
||||
?~ dap ~&(flag-missed/p.kas $(kas q.kas))
|
||||
=+ dep=?-(-.u.dap %init p.u.dap, %sent q.u.dap, %done [[bek ~] ~ ~])
|
||||
=+ rez=$(kas q.kas) :: XX revisit ^ during dependency review
|
||||
?: ?=(%1 -.q.rez) rez
|
||||
rez(p.q (~(uni in p.q.rez) `(set beam)`dep))
|
||||
::
|
||||
%join
|
||||
%+ cool
|
||||
|
@ -2475,6 +2475,7 @@
|
||||
[%dude p=tank q=silk] :: error wrap
|
||||
[%dune p=(set beam) q=(unit gage)] :: unit literal
|
||||
[%file p=beam] :: from clay
|
||||
[%flag p=@uvH q=silk] :: re-apply user deps
|
||||
[%join p=mark q=silk r=silk] :: merge
|
||||
[%mash p=mark q=milk r=milk] :: annotate
|
||||
[%mute p=silk q=(list (pair wing silk))] :: mutant
|
||||
|
@ -52,6 +52,17 @@ window.urb.req = function(method,url,params,json,cb) {
|
||||
xhr.send(JSON.stringify(_data))
|
||||
}
|
||||
|
||||
// window.urb.getJSON = function(url,cb){ window.urb.reqJSON("GET",url, null, cb)}
|
||||
// window.urb.reqJSON = function(method, url, data, cb){
|
||||
// var xhr = new XMLHttpRequest()
|
||||
// xhr.open(method, url)
|
||||
// xhr.onload = function(){
|
||||
// urb.fetchTag.call(xhr)
|
||||
// if(cb) cb(JSON.parse(xhr.responseText))
|
||||
// }
|
||||
// xhr.send(data === null ? null : JSON.stringify(data))
|
||||
// }
|
||||
|
||||
window.urb.reqq = []
|
||||
window.urb.qreq = function(method,url,params,json,cb) {
|
||||
walk = function() {
|
||||
|
Loading…
Reference in New Issue
Block a user