Merge remote-tracking branch 'origin/test' into newunix

Conflicts:
	urb/urbit.pill
	urb/zod/base/ape/hood.hoon
	urb/zod/base/arvo/zuse.hoon
	v/unix.c
This commit is contained in:
Philip C Monk 2015-06-19 15:37:20 -04:00
commit 618974e493
63 changed files with 943 additions and 434 deletions

View File

@ -170,7 +170,7 @@
;~(pfix lus (stag %ge dp-model-cat))
;~(pfix wut (stag %di dp-model-dog))
;~(pfix buc (stag %va sym))
;~(pfix pam (stag %ec ;~(plug sym ;~(pfix dot dp-twig))))
;~(pfix pam (stag %ec ;~(plug ;~(sfix sym dot) dp-twig)))
(stag %ex dp-twig)
(ifix [sel ser] (stag %tu (most ace dp-source)))
==

View File

@ -56,6 +56,7 @@
[~ +>]
::
++ coup-drum-phat (wrap take-coup-phat):from-drum
++ coup-helm-hi (wrap coup-hi):from-helm
++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum
++ from-lib
|* _[%helm ..$ ,_abet]:(helm-work)
@ -72,13 +73,15 @@
::
++ poke-dill-belt (wrap poke-dill-belt):from-drum
++ poke-helm-init (wrap poke-init):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-hi (wrap poke-hi):from-helm
++ poke-hood-link (wrap poke-link):from-drum
++ poke-hood-mass (wrap poke-mass):from-helm
++ poke-hood-mount (wrap poke-mount):from-kiln
++ poke-hood-unmount (wrap poke-unmount):from-kiln
++ poke-hood-sync (wrap poke-sync):from-kiln
++ poke-hood-unsync (wrap poke-unsync):from-kiln
++ poke-hood-verb (wrap poke-verb):from-helm
++ poke-hood-begin (wrap poke-begin):from-helm
++ poke-hood-invite (wrap poke-invite):from-helm
++ poke-hood-merge (wrap poke-merge):from-kiln
@ -89,6 +92,7 @@
++ poke-kiln-cp (wrap poke-cp):from-kiln
++ poke-kiln-rm (wrap poke-rm):from-kiln
++ poke-kiln-mv (wrap poke-mv):from-kiln
++ poke-kiln-schedule (wrap poke-schedule):from-kiln
++ poke-will (wrap poke-will):from-helm
++ mere-kiln (wrap take-mere):from-kiln
++ mere-kiln-sync (wrap take-mere-sync):from-kiln

View File

@ -4,6 +4,7 @@
/? 314
/- *talk, *sole
/+ talk, sole
/= seed /~ !>(.)
/= talk-doc
/; |=(a=wain (turn a |=(b=cord [%txt "? {(trip b)}"])))
/: /===/pub/doc/talk/help /txt/
@ -80,6 +81,7 @@
[%help ~] :: print usage info
[%join p=(set partner)] ::
[%say p=speech] ::
[%eval p=twig q=cord] ::
[%invite p=span q=(list partner)] ::
[%banish p=span q=(list partner)] ::
[%target p=(set partner)] :: set active targets
@ -108,8 +110,9 @@
|_ $: coz=(list command) :: talk actions
she=shell
==
++ sh-expr wide:(vang & [&1:% &2:% (scot %da now.hid) |3:%])
::
++ sh-scad :: command parser
=+ vag=(vang | [&1:% &2:% '0' |3:%])
=< work
|%
++ dare :: @dr
@ -128,7 +131,7 @@
++ pasp :: passport
;~ pfix pat
;~ pose
(stag %twitter ;~(pfix ;~(plug (jest 't') col) urs:ab))
(stag %twitter ;~(pfix (jest 't') col urs:ab))
==
==
::
@ -727,6 +730,8 @@
?: =(& -:(rose txt aurf:urlp)) ~
?: =(';' -.txt)
((sh-sane-rule sh-scad) inv +.txt)
?: =('#' -.txt)
((sh-sane-rule sh-expr) inv +.txt)
?: =('@' -.txt)
(sh-sane-chat +.buf)
(sh-sane-chat buf)
@ -756,6 +761,8 @@
?^ rou `[%say %url u.rou]
?: =(';' -.txt)
(rust +.txt sh-scad)
?: =('#' -.txt)
(bind (rust +.txt sh-expr) |=(a=twig [%eval a (crip +.txt)]))
?: =('@' -.txt)
`[%say %lin | (crip +.txt)]
`[%say %lin & (crip txt)]
@ -774,6 +781,9 @@
|= cod=command
%_(+> coz [cod coz])
::
++ sh-twig-head ^- vase :: eval data
:(slop !>(`our=@p`our.hid) !>(`tym=@da`now.hid) !>(`eny=@uvI`eny.hid))
::
++ sh-work :: do work
|= job=work
^+ +>
@ -784,6 +794,7 @@
?- -.job
%number (number +.job)
%join (join +.job)
%eval (eval +.job)
%invite (invite +.job)
%banish (banish +.job)
%create (create +.job)
@ -861,6 +872,12 @@
~& [%probe cuz]
..sh-work
::
++ eval :: run
|= [exe=twig txt=cord]
%^ say %fat
tank/[(sell (slap (slop sh-twig-head seed) exe))]~
[%exp txt]
::
++ say :: publish
|= sep=speech
^+ ..sh-work
@ -1631,13 +1648,24 @@
%- ~(gas in *(set partner))
(turn (~(tap by aud)) |=([a=partner *] a))
::
++ trim
|= [len=@u txt=tape]
?: (gth len (lent txt)) txt
(weld (scag (dec len) txt) "…")
::
++ tr-text
|= oug=?
^- tape
?+ -.sep ""
%url
[':' ' ' (earf p.sep)]
?+ -.sep ~&(tr-lost/sep "")
%fat
=+ rem=$(sep q.sep)
=- "{rem} {(trim (sub 60 (lent rem)) -)}"
?+ -.p.sep "..."
%tank ~(ram re %rose [" " `~] +.p.sep)
==
::
%url ['/' ' ' (earf p.sep)]
%exp ['#' ' ' (trip p.sep)]
%lin
=+ txt=(trip q.sep)
?: p.sep

7
base/ape/twif.hoon Normal file
View File

@ -0,0 +1,7 @@
/- *twitter
!:
|_ [bowl ~]
++ poke-noun |=(span (onwards [%peer / [our %twit] /user/[+<]]))
++ onwards |*([mark *] [[ost +<]~ +>.$])
++ diff-twit-feed |=([* a=(list twit-stat)] ?~(a `+>.$ ~&(i.a $(a t.a))))
--

218
base/ape/twit.hoon Normal file
View File

@ -0,0 +1,218 @@
:: Twitter daemon
::
:::: /hook/core/twit/app
::
/- *twitter
/+ twitter, talk
::
:::: ~fyr
::
|%
++ twit-path :: valid peer path
$% :: [%home ~] :: home timeline
[%user p=@t ~] :: user's tweets
[%post p=span:,@uv ~] :: status of status
==
::
++ axle :: app state
$: %0
kes=(map span keys:twit-do) :: auth
out=(map ,@uvI (each ,[span cord] stat)) :: sent tweets
ran=(map path ,[p=@ud q=@da]) :: polls active
fed=(jar path stat) :: feed cache
==
::
++ gift :: subscription action
$% [%quit ~] :: terminate
[%diff gilt] :: send data
==
++ gilt
$% [%twit-feed p=(list stat)] :: posts in feed
[%twit-stat p=stat] :: tweet accepted
[%ares term (list tank)]
==
::
++ move ,[bone card]
++ card :: arvo request
$? gift
$% [%them path ~ u=hiss] :: HTTP request
[%poke wire dock %talk-command command:talk] ::
[%wait path p=@da] :: timeout
== ==
::
++ sign :: arvo response
$% [%e %thou p=httr] :: HTTP result
[%t %wake ~] :: timeout ping
==
::
++ stat twit-stat :: recieved tweet
--
!:
::::
::
|_ [bowl axle]
++ any-auth ?~(kes (auth) (auth p.n.kes)) :: use any keys
++ auth :: build API door
|= a=span
~| [%no-auth a]
~(. twit (~(got by kes) a) now `@`eny)
::
++ cull :: remove seen tweets
|= [pax=path rep=(list stat)] ^+ rep
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id)))
(skip rep |=(stat (~(has in pev) id)))
::
++ done [*(list move) .]
++ dely :: next polling timeout
|= pax=path
^- [(unit time) _ran]
=+ cur=(~(get by ran) pax)
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
:: ~& dely/`@dr`(sub tym now)
?: &(?=(^ cur) (gte tym q.u.cur) (gth q.u.cur now))
[~ ran]
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
::
++ wait :: ensure poll by path
|= [pax=path mof=(list move)]
=^ tym ran (dely pax)
:_ +>.$
?~ tym
:: ~& no-wait/ran
mof
:: ~& will-wait/u.tym
:- [ost %wait pax u.tym]
mof
::
++ poke-twit-do :: recieve request
|= act=twit-do
^+ [*(list move) +>]
?- -.q.act
%auth
:- [(print "authed @{(trip p.act)}")]~
+>.$(kes (~(put by kes) p.act p.q.act)) :: XX verify key
%post
=: out (~(put by out) p.q.act %& p.act q.q.act)
ran (~(del by ran) /peer/home)
==
%+ wait /peer/home
=+ mez=(stat-upda:(auth p.act) [%status q.q.act]~ ~)
[ost %them /post/(scot %uv p.q.act) ~ mez]~
==
::
++ wake-peer
|= [pax=path ~] ^+ done
~& twit-wake/peer/pax
:_ +>.$
?. (~(has by ran) peer/pax) :: ignore if retracted
~
=+ => |=([a=bone @ b=path] [b a])
pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .))
?~ (~(get ju pus) pax)
~
~& peer-again/[pax ran]
(pear | our pax)
::
++ thou
|= [pax=path hit=httr] ^+ done
?+ p.hit ~|([%unknown-code p.hit] !!)
429 :: Rate-limit
=. ran (~(put by ran) pax 6 now)
=+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo))
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
~& retrying-in/`@dr`(sub tym now)
:_(+>.$ [ost %wait pax tym]~)
::
200 :: OK
=+ jon=(need (poja q:(need r.hit)))
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir)))
?+ pax ~|([%http-missed pax] !!)
[%post @ ~] :: post acknowledged
=+ ^= rep
~| [%bad-post jon]
(need %.(jon stat:twir))
=. out (~(put by out) (slav %uv i.t.pax) %| rep)
:_ +>.$
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
:- (print (earn [& ~ `/com/twitter] `pax ~))
(spam pax (tweet-good rep))
[%peer *] :: feed data
=+ ^= rep
~| [%bad-feed jon]
(need %.(jon (ar:jo stat:twir)))
:: ~& got-feed/[(scag 5 (turn rep |=(stat id))) fed]
=+ ren=(cull t.pax rep) :: new messages
?~ ren
(wait pax ~) :: pump polling
:: ~& spam-feed/ren
=: ran (~(del by ran) pax) :: clear poll delay
fed (~(put by fed) t.pax rep) :: saw last message
==
(wait pax (spam t.pax [%diff twit-feed/(flop ren)] ~))
==
::
?(400 401 403 404) :: Err
=+ ^- git=gift
=+ err=%.(q:(need r.hit) ;~(biff poja mean:twir))
:^ %diff %ares %bad-http
[leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:twip)]
?+ pax [[ost git]~ +>.$]
[%post @ ~]
[(spam pax git ~) +>.$]
==
==
++ tweet-good |=(rep=stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]])
++ peer |=(pax=path :_(+> (pear & src pax))) :: accept subscription
++ pear :: poll, possibly returning current data
|= [ver=? @ pax=path]
^- (list move)
?. ?=(twit-path pax)
~|([%missed-path pax] !!)
=> .(pax `twit-path`pax)
?: ?=(%post -.pax)
?. ver ~
=+ sta=(~(get by out) (slav %uv p.pax))
?. ?=([~ %| ^] sta) :: post not received
~
~[[ost %diff %twit-stat p.u.sta] [ost %quit ~]]
=+ ole=(~(get ja fed) pax)
:_ ^- (list move)
?. ver ~
?~ ole ~
[ost %diff %twit-feed (flop ole)]~
=- `move`[ost %them peer/pax ~ `hiss`-]
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~)
=+ aut=any-auth
?- -.pax
%user (stat-user:aut [(to-sd p.pax)]~ opt)
:: %home (stat-home:auth ~ opt)
==
::
++ to-sd :: parse user name/numb
|= a=span ^- sd:twit
~| [%not-user a]
%+ rash a
;~(pose (stag %user-id dem) (stag %screen-name user:twir))
::
:: ++ pull :: release subscription
:: |= ost=bone
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
:: =+ [his pax]=(~(got by sup) ost)
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
:: `+>.$
:: =: ran (~(del by ran) [%peer pax])
:: fed (~(del by fed) pax)
:: ==
:: `+>.$
::
++ spam :: send by path
|= [a=path b=(list gift)] ^- (list move)
%- zing ^- (list (list move))
%+ turn (~(tap by sup))
|= [ost=bone @ pax=path]
?. =(pax a) ~
(turn b |=(c=gift [ost c]))
::
++ print
|=(mes=tape [ost %poke / [our %talk] (said our %twit now eny leaf/mes ~)])
--

View File

@ -413,7 +413,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(7 vez)
?> =(0 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -433,7 +433,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 7]
:~ [3 0]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -1018,7 +1018,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(7 (end 0 3 pac)) [~ fox]
?. =(0 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)
@ -1898,7 +1898,7 @@
?. &(?=(^ muc) ?=(^ luw)) ~
[~ `buck`[u.muc u.luw]]
?: ?=([%code ~] tyl)
[~ (end 6 1 (shaf %code (shax sec:ex:q:sen:u.gys)))]
[~ (end 6 1 (shaf %pass (shax sec:ex:q:sen:u.gys)))]
?: ?=([%will ~] tyl)
(rick mar our law.saf.u.gys)
~

View File

@ -178,7 +178,7 @@
|= [wid=@u tan=tang]
^- tape
=+ rolt=|=(a=wall `tape`?~(a ~ :(weld i.a "\0a" $(a t.a))))
(rolt (turn (flop tan) |=(a=tank (rolt (wash 0^wid a)))))
(rolt (turn tan |=(a=tank (rolt (wash 0^wid a)))))
::
::
++ add-cookies
@ -427,24 +427,18 @@
++ 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)
})
urb.waspFrom = function(sel,attr){
Array.prototype.map.call(document.querySelectorAll(sel),
function(ele){
if((new URL(ele[attr])).host != document.location.host) return;
var xhr = new XMLHttpRequest()
xhr.open("HEAD", ele[attr])
xhr.send()
xhr.onload = function(){
var tag = JSON.parse(this.getResponseHeader("etag"))
if(tag) urb.wasp(tag)
}})}
if(urb.wasp){urb.waspFrom('script','src'); urb.waspFrom('link','href')}
'''
--
++ xml
@ -760,8 +754,10 @@
=* cay p.q.sih
?. ?=(%mime p.cay)
=+ bek=-:(need (tome p.tee))
=- (pass-note tee (ford-req bek [%flag p.sih -]))
=+ bik=?+(r.bek bek [%ud %0] bek(r da/now))
=- (pass-note tee (ford-req bik [%flag p.sih -]))
=- `silk`[%cast %mime %done ~ cay(q.q -)]
?. ?=([%ud 0] r.bek) q.q.cay
?+ p.cay q.q.cay :: inject dependency long-poll
%urb =| urb=[[%html ~] [[%head ~] marl] [[%body ~] manx marl] ~]
.*(.(urb q.q.cay) !=((inject p.sih urb)))
@ -979,7 +975,7 @@
$(q.pok /index)
?. ((sane %tas) i.q.pok)
(tome q.pok)
`[[our i.q.pok da/now] (flop t.q.pok)]
`[[our i.q.pok ud/0] (flop t.q.pok)]
::
++ as-aux-request :: /~/... req parser
^- (unit perk)
@ -1191,7 +1187,8 @@
?. ?| (~(has in aut.yac) him.ham)
?~(paz.ham | =(u.paz.ham load-secret))
==
~|(try/`@t`load-secret !!) :: XX security
~& code=`@t`load-secret
~|([%try 'code' %in %console] !!) :: XX security
=^ jon ..ya stat-json:(logon:yac him.ham)
=. cug.yac :_(cug.yac (set-cookie %ship (scot %p him.ham)))
(give-json 200 cug.yac jon)

View File

@ -820,6 +820,8 @@
++ keel :: apply mutations
|= [cof=cafe suh=vase yom=(list (pair wing vase))]
^- (bolt vase)
%+ cool => |=([a=wing b=type *] [a b])
|.(leaf/"ford: keel {<p.suh>} {<(turn yom +)>}")
%^ maim cof
%+ slop suh
|- ^- vase
@ -960,8 +962,8 @@
=* for p.i.all
=+ raf=(fang cof for)
?: ?=(%2 -.q.raf)
%- (slog 0 leaf/"! {<`mark`for>} build failed, ignoring:" q.q.raf)
(fine cof lil)
=. q.q.raf :_(q.q.raf leaf/"! {<`mark`for>} build failed, ignoring.")
((slog 0 (flop q.q.raf)) (fine cof lil))
%+ cope `(bolt vase)`raf
|= [cof=cafe vax=vase]
%+ fine cof
@ -1023,11 +1025,12 @@
++ link :: translate
|= [cof=cafe too=mark for=mark vax=vase]
^- (bolt vase)
:: %+ cool |.(leaf/"ford: link {<too>} {<for>} {<p.vax>}")
?: =(too for) (fine cof vax)
?: |(=(%noun for) =(%$ for))
((lake too) cof vax)
%+ cope (fang cof for)
|= [cof=cafe pro=vase]
|= [cof=cafe pro=vase] ^- (bolt vase)
?: &((slob %grow p.pro) (slob too p:(slap pro [%cnzy %grow])))
%+ cope (keel cof pro [[%& 6]~ vax]~)
|= [cof=cafe pox=vase]

View File

@ -320,9 +320,10 @@
?: ?=([%f %made *] sih)
?- -.q.+.sih
%tabl ~|(%made-tabl !!)
%| ~& [%mo-cyst-fail p.q.+>.sih] :: XX better errors pls
(mo-give %unto %quit ~) ::
%& (mo-give %unto %diff p.q.+>.sih)
%& (mo-give %unto %diff p.q.+>.sih)
%| =. p.q.+>.sih (turn p.q.+>.sih |=(a=tank rose/[~ "! " ~]^[a]~))
~> %slog.`%*(. >[%wh %y]< +> [>%mo-cyst-fail< (flop p.q.+>.sih)])
(mo-give %unto %quit ~) :: XX better errors pls
==
?> ?=([%g %unto *] sih)
?. ?=(%diff -.+>.sih)
@ -432,8 +433,11 @@
::
%out ?: ?=([%f %made *] q.hin)
?- -.q.+>.q.hin
%tabl !!
%| ~& [%mo-cook-fail +.q.+>.q.hin]
%tabl ~|(%made-tabl !!)
%& ap-abet:(ap-pout:pap t.t.t.pax %diff +.q.+>.q.hin)
%| =+ why=p.q.+>.q.hin
=. why (turn why |=(a=tank rose/[~ "! " ~]^[a]~))
~> %slog.`%*(. >[%wh %y]< +> [>%mo-cook-fail< (flop why)])
~& [him=q.q.pry our=our pax=pax]
::
:: here we should crash because the right thing
@ -448,7 +452,6 @@
:: [%use pax]
:: [%g %deal [q.q.pry our] XXX %pull ~]
!!
%& ap-abet:(ap-pout:pap t.t.t.pax %diff +.q.+>.q.hin)
==
?. ?=([%g %unto *] q.hin)
~& [%mo-cook-weird q.hin]
@ -476,6 +479,7 @@
::
++ mo-beak :: build beak
|= dap=dude
=- ?.(=(p our) - -(r [%da now])) :: soft dependencies
^- beak
byk:(~(got by bum) dap)
::
@ -918,9 +922,8 @@
^+ +>
=+ cug=(ap-find /lame)
?~ cug
=. why [>%ap-lame< >wut< (turn why |=(a=tank rose/[~ "! " ~]^[a]~))]
~& [%ap-lame dap]
~> %slog.`%*(. >[%wh %y]< +> (flop why))
=. why [>%ap-lame dap wut< (turn why |=(a=tank rose/[~ "! " ~]^[a]~))]
~> %slog.`%*(. >[%wh %y]< +> (flop why))
+>.$
=^ cam +>.$
%+ ap-call q.u.cug

View File

@ -1150,20 +1150,20 @@
/remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
/lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
|%
++ ind ~/ %ind :: parse prefix
|= a=@tas
=+ b=0
|- ^- (unit ,@)
?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
++ ins ~/ %ins :: parse suffix
++ ins ~/ %ins :: parse prefix
|= a=@tas
=+ b=0
|- ^- (unit ,@)
?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
++ tod ~/ %tod :: fetch prefix
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
++ tos ~/ %tos :: fetch suffix
++ ind ~/ %ind :: parse suffix
|= a=@tas
=+ b=0
|- ^- (unit ,@)
?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
++ tos ~/ %tos :: fetch prefix
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
++ tod ~/ %tod :: fetch suffix
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
--
::
++ fa :: base58check
@ -1284,18 +1284,18 @@
=+ s=(sea:rd red)
=+ negexp==(1 (mod e.s 2))
[s=(sig:rd red) h=(hol:rd red) f=(fac:rd red) e=(err:rd red) n=negexp]
++ rlyh |=(reh=@rh ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ rlyq |=(req=@rq ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ rlys |=(res=@rs ~|(%real-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ rlyh |=(reh=@rh ~|(%realh-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ rlyq |=(req=@rq ~|(%realq-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ rlys |=(res=@rs ~|(%reals-nyet ^-([s=? h=@ f=@ e=(unit tape) n=?] !!)))
++ ryld |= v=[syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ^- @rd
?: &(=(hol.v 0) =(zer.v 0) =(fac.v 0))
(bit:rd (szer:vl:fl 1.023 52 syn.v))
?~ exp.v
(bit:rd (cof:fl 52 1.023 v))
(ipow:rd u.exp.v (bit:rd (cof:fl 52 1.023 v)))
++ rylh |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%real-nyet ^-(@rh !!)))
++ rylq |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%real-nyet ^-(@rq !!)))
++ ryls |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%real-nyet ^-(@rs !!)))
++ rylh |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%realh-nyet ^-(@rh !!)))
++ rylq |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%realq-nyet ^-(@rq !!)))
++ ryls |=([syn=? hol=@ zer=@ fac=@ exp=(unit ,@)] ~|(%reals-nyet ^-(@rs !!)))
:: Floating point operations for general floating points.
:: [s=sign, e=unbiased exponent, f=fraction a=ari]
@ -3699,7 +3699,7 @@
(stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
(stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
(stag %rd (cook ryld ;~(pfix sig voy)))
(stag %rs (cook ryls voy))
:: (stag %rs (cook ryls voy))
==
++ royl-cell
|= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
@ -9145,6 +9145,7 @@
%- stew
^. stet ^. limo
:~ [':' ;~(pfix col (toad expz))]
['.' ;~(pfix dot (toad |.(loaf(bug |))))]
[',' (rune com %zpcm expb)]
[';' (rune sem %zpsm expb)]
['^' ;~(pfix ket (sear prey (toad exps)))]

View File

@ -8,12 +8,14 @@
::::
::
|= [^ [arg=(list path)] ~]
=- tang/(zing -)
=- tang/(flop `tang`(zing -))
%+ turn arg
|= pax=path
^- tang
=+ ark=;;(arch .^(%cy pax))
?^ q.ark
?: =(%sched -:(flop pax))
[>;;((map ,@da cord) .^(%cx pax))<]~
[leaf/(spud pax) (pretty-file .^(%cx pax))]
?- r.ark :: handle ambiguity
~

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reload/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
:- %helm-init
p.bec

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reload/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
:- %helm-mass
~

View File

@ -1,12 +0,0 @@
::
:::: /hoon/merge/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[[syd=@tas her=@p sud=@tas gem=?([?(%auto germ) ~] ~)] ~]
==
:- %helm-merge
[syd her sud ?~(gem %auto -.gem)]

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reload/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
:- %helm-reload
arg

View File

@ -1,11 +0,0 @@
::
:::: /hoon/start/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[[who=@p dap=term ~] ~]
==
[%helm-start who dap]

View File

@ -1,12 +0,0 @@
::
:::: /hoon/sync/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=[syd=@tas her=@p sud=@tas ~] ~]
==
:- %helm-sync
arg

View File

@ -1,15 +0,0 @@
::
:::: /hoon/unix/helm/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[[syd=@tas syn=?(~ [? ~])] ~]
==
:+ %helm-unix
syd
?~ syn
~
`-.syn

View File

@ -1 +0,0 @@
|=([^ args=[ship $|(~ [tape ~])] ~] hi-args/args)

View File

@ -1,2 +0,0 @@
|= [^ [arg=cord ~] ~]
txt/arg

1
base/cat/hood/hi.hoon Normal file
View File

@ -0,0 +1 @@
|=([^ [who=ship mez=$|(~ [a=tape ~])] ~] helm-send-hi/[who ?~(mez ~ `a.mez)])

View File

@ -0,0 +1 @@
|=([^ [where=path tym=@da eve=@t ~] ~] kiln-schedule/[where tym eve])

View File

@ -10,4 +10,4 @@
[~ ~]
==
~& %hood-verb
(sole-so %hood-verb ~)
[%helm-verb ~]

View File

@ -1,15 +1,14 @@
::
:::: /hoon/solid/gun
:::: /hoon/solid/cat
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
%+ sole-so %noun
:- %noun
=+ top=`path`/(scot %p p.bec)/home/(scot %da now)/arvo
=+ pax=`path`(weld top `path`[%hoon ~])
~& %solid-start

View File

@ -8,7 +8,7 @@
|= [^ [pax=path fla=$|(~ [%full ~])] ~]
=+ len=(lent pax)
=+ rend=?^(fla dank:ut |=(a=path (dank:ut (slag len a))))
:- %tang
:- %tang %- flop
|- ^- tang
=+ ark=;;(arch .^(cy/pax))
=- ?~ q.ark -

8
base/cat/twit/as.hoon Normal file
View File

@ -0,0 +1,8 @@
/- *twitter
::
::::
::
|= $: [now=@da eny=@uvI bec=beak]
[[who=span msg=cord ~] ~]
==
[%twit-do [who %post eny msg]]

13
base/cat/twit/tweet.hoon Normal file
View File

@ -0,0 +1,13 @@
/+ sh-utils
!:
|_ [hide ~]
++ peer ,_`.
++ poke--args
%+ add-subs [[our /twit] our /post/(scot %uv eny)]
%^ gate-mess .
|=([a=span b=cord ~] [/twit %twit-do !>([a %post eny b])])
,_`.
++ posh-twit-stat
(args-into-gate . |=([@ @ a=@da @] tang/~[leaf/"Tweet recieved {<a>}"]))
++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
--

View File

@ -0,0 +1,22 @@
:: Display twitter feed
::
:::: /hook/core/twitter-feed/app
::
/+ sh-utils
!:
::
:::: ~fyr
::
|_ [hide ~]
++ stat ,[id=@u who=@ta now=@da txt=@t]
++ rens
|=(stat rose/[": " `~]^~[leaf/"{<now>} @{(trip who)}" leaf/(trip txt)])
++ peer ,_`.
++ poke--args
|= [ost=bone his=ship who=span ~]
%.(+< (add-subs [[our /twit] our /user/[who]] ,_`+>.$))
::
++ posh-twit-feed
(args-into-gate . |=(a=(list stat) tang/(turn a rens)))
:: ++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
--

View File

@ -1,45 +0,0 @@
::
:::: /hoon/begin/helm/gun
::
/? 314
/- *sole
::
::::
!:
=> |%
++ begs ,[his=@p tic=@p yen=@t ges=gens]
--
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
^- (sole-result (cask begs))
%+ sole-lo
[%& %helm-begin "your ship: ~"]
%+ sole-go fed:ag
|= his=@p
%+ sole-lo
[%& %helm-ticket "your ticket: ~"]
%+ sole-go fed:ag
|= tic=@p
%+ sole-lo
[%& %helm-entropy "some entropy: "]
%+ sole-go (boss 256 (more gon qit))
|= yen=@t
=+ ney=(shax yen)
%+ sole-yo `tank`[%leaf "entropy check: {(scow %p `@p`(mug ney))}"]
%+ sole-so %helm-begin
:* his
tic
ney
::
^- gens
:- %en
=+ can=(clan his)
?- can
%czar [%czar ~]
%duke [%duke %anon ~]
%earl [%earl (scot %p his)]
%king [%king ?:(=(~doznec his) 'Urban Republic' (scot %p his))]
%pawn [%pawn ~]
==
==

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reload/helm/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
(sole-so %helm-reload arg)

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reset/helm/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
(sole-so %helm-reset ~)

View File

@ -1,13 +0,0 @@
::
:::: /hoon/verb/helm/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@ bec=beak]
[~ ~]
==
~& %helm-verb
(sole-so %helm-verb ~)

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reload/hood/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
(sole-so %hood-reload arg)

View File

@ -1,12 +0,0 @@
::
:::: /hoon/reset/hood/gun
::
/? 314
/- *sole
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
(sole-so %hood-reset ~)

21
base/dog/twit/auth.hoon Normal file
View File

@ -0,0 +1,21 @@
:: Input twitter keys
/- *sole, *twitter
!:
|%
++ baz64 (cook crip (star alp))
--
!:
|= $: [now=@da eny=@uvI bec=beak]
[~ ~]
==
^- (sole-result (cask twit-do))
%+ sole-lo [%& %$ "User: "] %+ sole-go urs:ab |= acc=span
%+ sole-lo [%& %$ "App token: "] %+ sole-go baz64 |= ctok=cord
%+ sole-lo [%& %$ "App secret: "] %+ sole-go baz64 |= csec=cord
%+ sole-lo [%& %$ "User token: "] %+ sole-go baz64 |= atok=cord
%+ sole-lo [%& %$ "User secret: "] %+ sole-go baz64 |= asec=cord
(sole-so %twit-do [acc %auth [ctok csec] atok asec])

View File

@ -0,0 +1,5 @@
hoontap
AP3G1t8ki6rPzeeAqdWCTw03F
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl
jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8

View File

@ -53,6 +53,7 @@
++ pear :: poke fruit
$% [%hood-unsync desk ship desk] ::
[%talk-command command:talk] ::
[%helm-hi cord] ::
== ::
--
|_ moz=(list move)
@ -81,6 +82,17 @@
|= ~ =< abet
(emit %flog /heft %crud %hax-heft ~)
::
++ poke-send-hi
|= [her=ship mes=(unit tape)] =< abet
%^ emit %poke /helm/hi/(scot %p her)
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
::
++ poke-hi |=(mes=@t abet:(emit %flog /di %text "< {<src>}: {(trip mes)}"))
++ coup-hi
|= [pax=path cop=(unit tang)] =< abet
?> ?=([@t ~] pax)
(emit %flog ~ %text "hi {(trip i.pax)} {?~(cop "" "un")}succesful")
::
++ poke-reload |=(all=(list term) (poke-reload-desk %home all))
++ poke-reload-desk :: reload vanes
|= [syd=desk all=(list term)] =< abet

View File

@ -118,23 +118,30 @@
abet:abet:(merge:(work syd) ali sud gim)
::
++ do-info
|= [mez=tape pax=path tor=toro]
|= [mez=tape tor=toro]
abet:(emit:(spam leaf/mez ~) %info /kiln our tor)
::
++ poke-rm |=(a=path (do-info "removed" a (fray a)))
++ poke-rm |=(a=path (do-info "removed" (fray a)))
++ poke-cp
|= [input=path output=path]
%^ do-info "copied" input
%+ do-info "copied"
?> =(-:(flop input) -:(flop output))
(foal output -:(flop input) %noun .^(%cx input)) :: XX type
::
++ poke-mv
|= [input=path output=path]
%^ do-info "moved" input
%+ do-info "moved"
?> =(-:(flop input) -:(flop output))
%+ furl (fray output)
(foal output -:(flop input) %noun .^(%cx input))
::
++ poke-schedule
|= [where=path tym=@da eve=@t]
=. where (welp where /sched)
%+ do-info "scheduled"
=+ old=;;((map ,@da cord) (fall (file where) ~))
(foal where %sched !>((~(put by old) tym eve)))
::
++ take |=(way=wire ?>(?=([@ ~] way) (work i.way))) :: general handler
++ take-mere ::
|= [way=wire are=(each (set path) (pair term tang))]

View File

@ -18,13 +18,38 @@
%pattern %polygon %polyline %radial-gradient %rect %stop %svg
%text %tspan
==
++ react-vale
++ react-vale
~(has in react-elems)
++ react-to-tape
|= src=manx ^- tape
?: (~(has by (mo a.g.src)) [%urb %codemirror])
?> ?=([[%pre *] _:/(**) ~] src)
$(src ;codemirror(value "{v.i.a.g.i.c.src}");)
?: (~(has by (mo a.g.src)) [%urb %exec]) :: runnable code attribute tag
?> ?=([[%pre *] _:/(**) ~] src) :: verify its only a text node
=* code v.i.a.g.i.c.src
=+ ^= result
(mule |.((slap !>(.) (ream (crip code))))) :: compile and run safely
?: ?=(%.y -.result) :: it was ok
=+ ^= new
;div(class "rancode")
;pre:"{code}"
;code:"{~(ram re (sell p.result))}"
==
$(src new)
=+ ^= error
;div(class "failedcode")
;pre:"{code}"
;pre
;div:"error"
;* %+ turn
(scag (dec (lent p.result)) p.result) :: hide react trace
|= a=tank
^- manx
;div:"{~(ram re a)}"
==
==
$(src error)
;: weld
"React.createElement("
=* tan n.g.src
@ -41,7 +66,7 @@
", "
::
=< ~(ram re %rose [", " "[" "]"] (turn c.src .))
|= a=manx
|= a=manx
?: ?=(_:/(**) a)
leaf/(pojo (jape v.i.a.g.a))
leaf/^$(src a)

View File

@ -202,6 +202,9 @@ window.urb.send = function(params,cb) {
$this = this
this.qreq('post',url,params,true,function(err,data) {
if(err) { $this.seqn_s--; }
else if(data && data.data.fail && urb.wall !== false)
document.write("<pre>"+JSON.stringify(params.xyro)+"\n"
+data.data.mess+"</pre>") // XX
if(cb) { cb.apply(this,arguments); }
})
}

17
base/mar/helm-hi.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /hoon/helm-hi/mar
::
/? 314
|_ txt=cord
::
++ grab :: convert from
|%
++ noun ,@t :: clam from %noun
++ json (cork so:jo need)
--
++ grow
|%
++ psal ;div: {(trip txt)}
++ mime [text//plain (taco txt)]
--
--

29
base/mar/sched.hoon Normal file
View File

@ -0,0 +1,29 @@
!:
:::: /hoon/core/sched/mar
::
|_ dat=(map ,@da cord)
++ grow :: convert to
|% ++ mime [/text/x-sched (tact tape)]
++ tape
(zing `wall`(turn sorted-list |=([a=@da b=cord] "{<a>} {(trip b)}\0a")))
++ elem =< ;ul: *{(turn sorted-list .)}
|= [tym=@da ite=cord] ^- manx
;li: ;{b "{<tym>}"}: {(trip ite)}
++ sorted-list
(sort (~(tap by dat)) |=([[l=@ @] [r=@ @]] (lth l r)))
--
++ grab
|% :: convert from
++ mime
|= [p=mite q=octs] ^+ dat
=< (mo (turn (lore q.q) .))
|= a=@t ^- [@da @t]
%+ rash a
;~ (glue ace)
(cook |=(a=coin ?>(?=([~ %da @] a) `@da`q.p.a)) nuck:so)
(cook crip (star prn))
==
--
++ grad |%
++ sted %mime
-- --

View File

@ -68,11 +68,20 @@
%+ sear (soft passport)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
++ eval
|= a=(trel ,@da bouquet ?(speech [%eval p=@t])) ^- statement
?. ?=(%eval -.r.a) a
=+ pax=[&1:% &2:% (scot %da p.a) |3:%]
=- a(r [%fat tank/- %exp p.r.a])
p:(mule |.([(sell (slap !>(..zuse) (rain pax p.r.a)))]~))
::
++ stam
^- $+(json (unit statement))
%+ cu eval
=- (ot date/di bouquet/(as (ar so)) speech/(of -) ~)
:~ lin/(ot say/bo txt/so ~)
url/(su aurf:urlp)
eval/so
:: exp/(cu |=(a=cord [a ~]) so)
:: inv/(ot ship/(su fed:ag) party/(su urs:ab) ~)
==

View File

@ -13,7 +13,7 @@
++ grow
|%
++ mime [/text/json (taco (crip (pojo json)))]
++ json
++ json
=> +
|^ %+ joba -.rep
?- -.rep
@ -27,7 +27,7 @@
|= [a=span b=posture c=cord]
(jobe name/[%s a] posture/[%s a] caption/[%s b] ~)
::
++ jove
++ jove
|= [a=envelope b=delivery]
%- jobe :~
envelope/(jobe visible/[%b p.a] sender/?~(q.a ~ s/(parn u.q.a)) ~)
@ -36,7 +36,7 @@
++ jope |=(a=ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])
++ joke |=(a=tank [%s (role (turn (wash 0^80 a) crip))])
++ jode |=(a=time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1)))
:: ++ jase
:: ++ jase
:: |* a=,json
:: |= b=(set ,_+<.a) ^- json
:: ~! b
@ -56,8 +56,8 @@
++ phon |=(a=ship (scot %p a))
++ stas |=(status (jobe presence/(joce p) human/(huma q) ~))
++ gram |=(telegram (jobe ship/(jope p) thought/(thot q) ~))
++ thot
|= thought
++ thot
|= thought
(jobe serial/(jape <p>) audience/(audi q) statement/(stam r) ~)
::
++ audi (jome parn jove)
@ -79,29 +79,38 @@
|= a=station ^- cord
(crip "{<p.a>}/{(trip q.a)}")
::
++ stam
|= statement
++ stam
|= statement
(jobe date/(jode p) bouquet/(bouq q) speech/(spec r) ~)
::
++ spec
|= a=speech
%+ joba -.a
~| stub/-.a
?+ -.a !!
?+ -.a ~|(stub/-.a !!)
%lin (jobe say/[%b p.a] txt/[%s q.a] ~)
%url (jobe url/[%s (crip (earf p.a))] ~)
%exp (jobe code/[%s p.a] ~)
%app (jobe app/[%s p.a] txt/[%s q.a] ~)
%fat (jobe fat/(tors p.a) taf/$(a q.a) ~)
:: %inv (jobe ship/(jope p.a) party/[%s q.a] ~)
==
::
++ tors
|= a=torso
%+ joba -.a
?- -.a
%text [%s (role +.a)]
%tank [%a (turn +.a joke)]
%name (jobe nom/s/p.a mon/$(a q.a) ~)
==
::
++ huma
|= human
%^ jobe
hand/?~(hand ~ [%s u.hand])
:- %true
?~ true ~
=+ u.true
?~ true ~
=+ u.true
(jobe first/[%s p] middle/?~(q ~ [%s u.q]) last/[%s r] ~)
~
::

View File

@ -109,7 +109,7 @@ reloaded, vanes depending on the changes must be reloaded as well. For
example `:reload %zuse %ford` is necessary to make use of changes in
application code or the REPL.
Possible values for %vane-name see [Overview](overview.md "overview"):
Possible values for %vane-name see [Overview](overview "overview"):
------------------------------------------------------------------------

View File

@ -13,7 +13,7 @@ great place to test out your hoon knowledge. In this guide we're just
going to talk about some basic system utilities and get comfortable
moving around in `%clay`. If you'd just like to see a list of
command-line utilities, you can find the Arvo man pages
[here](../arvo/util.md).
[here](../arvo/util).
This rudimentary tour should work well in both places.

View File

@ -255,3 +255,124 @@ with 256 values, producing a byte.
0x0
~zod/try=> `@ux`(zyrt:un 187)
0xff
<h3 id="++ob"><code>++ob</code></h3>
Reversible scrambling core, v2
++ ob
|%
A core for performing reversible scrambling operations for the `@p` phonetic base.
------------------------------------------------------------------------
<h3 id="++feen"><code>++feen</code></h3>
Conceal structure, v2
++ feen :: conceal structure v2
|= pyn=@ ^- @
?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
(add 0x1.0000 (fice (sub pyn 0x1.0000)))
?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff))
=+ lo=(dis pyn 0xffff.ffff)
=+ hi=(dis pyn 0xffff.ffff.0000.0000)
%+ con hi
(add 0x1.0000 (fice (sub lo 0x1.0000)))
pyn
Randomly permutes atoms that fit into 17 to 32 bits into one another. If the atom fits into 33 to 64 bits, does the same permutation on the low 32 bits only. Otherwise, passes the atom through unchanged.
------------------------------------------------------------------------
<h3 id="++fend"><code>++fend</code></h3>
++ fend :: restore structure v2
|= cry=@ ^- @
?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
(add 0x1.0000 (teil (sub cry 0x1.0000)))
?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff))
=+ lo=(dis cry 0xffff.ffff)
=+ hi=(dis cry 0xffff.ffff.0000.0000)
%+ con hi
(add 0x1.0000 (teil (sub lo 0x1.0000)))
cry
Randomly permutes atoms that fit into 17 to 32 bits into one another, and randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits; otherwise, passes the atom through unchanged. The permutation is the inverse of the one applied by [`++feen`]().
------------------------------------------------------------------------
<h3 id="++fice"><code>++fice</code></h3>
++ fice :: adapted from
|= nor=@ :: black and rogaway
^- @ :: "ciphers with
=+ ^= sel :: arbitrary finite
%+ rynd 2 :: domains", 2002
%+ rynd 1
%+ rynd 0
[(mod nor 65.535) (div nor 65.535)]
(add (mul 65.535 -.sel) +.sel)
Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` to `2^32 - 2^16`. The construction given in Black and Rogaway is ideal for a domain with a size of that form, and as with a conventionel Feistel cipher, three rounds suffice to make the permutation pseudorandom.
------------------------------------------------------------------------
<h3 id="++teil"><code>++teil</code></h3>
++ teil :: reverse ++fice
|= vip=@
^- @
=+ ^= sel
%+ rund 0
%+ rund 1
%+ rund 2
[(mod vip 65.535) (div vip 65.535)]
(add (mul 65.535 -.sel) +.sel)
Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike a conventional Feistel cipher that is its own inverse if keys are used in reverse order, this Feistel-like cipher uses two moduli that must be swapped when applying the reverse transformation.
------------------------------------------------------------------------
<h3 id="++rynd"><code>++rynd</code></h3>
++ rynd :: feistel round
|= [n=@ l=@ r=@]
^- [@ @]
:- r
?~ (mod n 2)
(~(sum fo 65.535) l (en:aesc (snag n raku) r))
(~(sum fo 65.536) l (en:aesc (snag n raku) r))
A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is used as the round function.
------------------------------------------------------------------------
<h3 id="++rund"><code>++rund</code></h3>
++ rund :: reverse round
|= [n=@ l=@ r=@]
^- [@ @]
:- r
?~ (mod n 2)
(~(dif fo 65.535) l (en:aesc (snag n raku) r))
(~(dif fo 65.536) l (en:aesc (snag n raku) r))
A single round of the Feistel-like reverse cipher [`++teil`]().
------------------------------------------------------------------------
<h3 id="++raku"><code>++raku</code></h3>
++ raku
^- (list ,@ux)
:~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
43af.2750.219e.8a24.e5f8.fac3.6c36.f968
0xf2ff.24fe.54d0.1abd.4b2a.d8aa.4402.8e88.
e82f.19ec.948d.b1bb.ed2e.f791.83a3.8133
0xa3d8.6a7b.400e.9e91.187d.91a7.6942.f34a.
6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
==
Arbitrary keys for use with [`++aesc`]().

View File

@ -1,32 +1,24 @@
!! actual helptext
<-~michep-banlur: hello urbiters
<-~michep-banlur: is there a list of ; commands for that chat somewhere?
<-~michep-banlur: eh, i mean for this new chat. things changed a lot
----------[5.990]
<-~hidduc-posmeg: i'm not aware of a list
<-~hidduc-posmeg: but i know of ;join
<-~hidduc-posmeg: and ;create
<-~michep-banlur: right, thanks
<-~wictuc-folrex: welcome back, ~michep-banlur
----------[5.995]
<-~wictuc-folrex: there's four types of ; commands
<-~wictuc-folrex: ;join ;create ;<number> and ;<target>
<-~wictuc-folrex: where ;<number> "activates" a previous message
<-~wictuc-folrex: and ;<target> sets where you send the message
<-~wictuc-folrex: for example, ;~sampel-sipnym
----------[6.000]
<-~wictuc-folrex: would start private messaging ~sampel-sipnym
<-~michep-banlur: ahh, that is th new bare ~ship-name
<-~wictuc-folrex: yeah, although a target can also be a channel
<-~wictuc-folrex: like ;/urbit-meta
<-~wictuc-folrex: which means urbit-meta on ~doznec
----------[6.005]
<-~wictuc-folrex: you can also do ;~sampel-sipnym/channel-name
<-~michep-banlur: right
<-~wictuc-folrex: and, of course, just ;
----------------| for /urbit-meta
----------------| --bye ~modnut-migryd
<-~wictuc-folrex: makes it "autotarget"
<-~wictuc-folrex: which means, roughly, send to whatever channel the last
----------[6.010]
<-~wictuc-folrex: message was from
Besides `;help`, there are four main `talk` commands:
;join ~urbit-name/channel
`;join` subscribes your main feed to a remote channel.
;create channel %name 'description'
`;create` creates a channel on your urbit.
;<number>
`;<number>` activates a previous message number, like a URL that got
clipped.
;<target>
`;<target>` sets the target for your messages, such as `;~urbit-name`
for a private message, or `;/channel`
;
By itself is "autotarget", and maintains the audience of the last message
heard.

View File

@ -22,7 +22,7 @@
"react/0.13.1/react.js"
==
:: remove /~~ for anon
;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js");
;script(type "text/javascript", src "/~~/~/at/home/lib/urb.js");
;meta(name "viewport", content "width=device-width, height=device-height, ".
"initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0");
;link(type "text/css", rel "stylesheet", href "/home/pub/talk/src/css/main.css");

View File

@ -412,6 +412,9 @@ body {
.message.say .mess {
font-style: italic;
}
.message.exp .mess {
font-family: monospace;
}
a {
text-decoration: underline;
color: inherit;

View File

@ -361,6 +361,9 @@ body
.message.say .mess
font-style italic
.message.exp .mess
font-family monospace
a
text-decoration underline

View File

@ -41,6 +41,21 @@ module.exports =
sender:null
delivery:"pending"
speech =
lin:
say:true
txt:message
if message[0] is "@"
speech.lin.txt = speech.lin.txt.slice(1).trim()
speech.lin.say = false
else if message[0] is "#"
speech = eval: speech.lin.txt.slice(1).trim()
else if window.urb.util.isURL(message)
speech = url: message
_message =
ship:window.urb.ship
thought:
@ -48,19 +63,9 @@ module.exports =
audience:_audi
statement:
bouquet:[]
speech:
lin:
say:true
txt:message
speech:speech
date: Date.now()
if message[0] is "@"
_message.thought.statement.speech.lin.txt = _message.thought.statement.speech.lin.txt.slice(1).trim()
_message.thought.statement.speech.lin.say = false
if window.urb.util.isURL(message)
_message.thought.statement.speech = {url: message}
MessageDispatcher.handleViewAction
type:"message-send"
message:_message

View File

@ -1,7 +1,7 @@
moment = require 'moment-timezone'
recl = React.createClass
[div,br,input,textarea,a] = [React.DOM.div,React.DOM.br,React.DOM.input,React.DOM.textarea,React.DOM.a]
[div,pre,br,input,textarea,a] = [React.DOM.div,React.DOM.pre,React.DOM.br,React.DOM.input,React.DOM.textarea,React.DOM.a]
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
@ -33,8 +33,14 @@ Message = recl
# pendingClass = if @props.pending isnt "received" then "pending" else ""
delivery = _.uniq _.pluck @props.thought.audience, "delivery"
klass = if delivery.indexOf("received") isnt -1 then " received" else " pending"
if @props.thought.statement.speech?.lin?.say is false then klass += " say"
if @props.thought.statement.speech?.url then klass += " url"
speech = @props.thought.statement.speech
attachments = []
while speech.fat?
attachments.push pre {}, speech.fat.fat.tank.join("\n")
speech = speech.fat.taf # XX
if !speech? then return;
if speech.lin?.say is false then klass += " say"
if speech.url then klass += " url"
if @props.unseen is true then klass += " new"
if @props.sameAs is true then klass += " same" else klass += " first"
@ -45,13 +51,16 @@ Message = recl
type = ['private','public']
type = type[Number(aude.indexOf(window.util.mainStationPath(window.urb.user)) is -1)]
if @props.thought.statement.speech?.lin?.txt then txt = @props.thought.statement.speech.lin.txt
if @props.thought.statement.speech?.url
url = @props.thought.statement.speech.url.url
if speech.lin?.txt then txt = speech.lin.txt
if speech.url
url = speech.url.url
txt = (a {href:url,target:"_blank"}, url)
if @props.thought.statement.speech?.app
txt = @props.thought.statement.speech.app.txt
if speech.app
txt = speech.app.txt
klass += " say"
if speech.exp
txt = speech.exp.code
klass += " exp"
div {className:"message#{klass}"}, [
(div {className:"attr"}, [
@ -60,7 +69,9 @@ Message = recl
div {onClick:@_handleAudi,className:"audi"}, audi
div {className:"time"}, @convTime @props.thought.statement.date
])
div {className:"mess"}, txt
div {className:"mess"}, txt,
if attachments.length
div {className:"fat"}, attachments
]
module.exports = recl

View File

@ -78,21 +78,21 @@ module.exports = recl
_writingKeyUp: (e) ->
if not window.urb.util.isURL @$writing.text()
@$length.toggleClass('valid-false',(@$writing.text().length > 62))
r = window.getSelection().getRangeAt(0).cloneRange()
@$writing.text @$writing.text()
setTimeout =>
s = window.getSelection()
s.removeAllRanges()
s.addRange r
console.log r
,0
# r = window.getSelection().getRangeAt(0).cloneRange()
# @$writing.text @$writing.text()
# setTimeout =>
# s = window.getSelection()
# s.removeAllRanges()
# s.addRange r
# console.log r
# ,0
_writingKeyDown: (e) ->
if e.keyCode is 13
txt = @$writing.text()
e.preventDefault()
if (txt.length > 0 and txt.length < 63) or window.urb.util.isURL @$writing.text()
if ( (txt.length > 0 and txt.length < 63) or
window.urb.util.isURL @$writing.text() )
@sendMessage()
return false
@_input()

View File

@ -37,7 +37,7 @@ module.exports = {
return window.talk.MessagePersistence.get(station, start, end);
},
sendMessage: function(message, audience) {
var _audi, _message, k, serial, v;
var _audi, _message, k, serial, speech, v;
serial = window.util.uuid32();
audience = _.uniq(audience);
_audi = {};
@ -51,6 +51,24 @@ module.exports = {
delivery: "pending"
};
}
speech = {
lin: {
say: true,
txt: message
}
};
if (message[0] === "@") {
speech.lin.txt = speech.lin.txt.slice(1).trim();
speech.lin.say = false;
} else if (message[0] === "#") {
speech = {
"eval": speech.lin.txt.slice(1).trim()
};
} else if (window.urb.util.isURL(message)) {
speech = {
url: message
};
}
_message = {
ship: window.urb.ship,
thought: {
@ -58,25 +76,11 @@ module.exports = {
audience: _audi,
statement: {
bouquet: [],
speech: {
lin: {
say: true,
txt: message
}
},
speech: speech,
date: Date.now()
}
}
};
if (message[0] === "@") {
_message.thought.statement.speech.lin.txt = _message.thought.statement.speech.lin.txt.slice(1).trim();
_message.thought.statement.speech.lin.say = false;
}
if (window.urb.util.isURL(message)) {
_message.thought.statement.speech = {
url: message
};
}
MessageDispatcher.handleViewAction({
type: "message-send",
message: _message
@ -86,6 +90,7 @@ module.exports = {
};
},{"../dispatcher/Dispatcher.coffee":7}],2:[function(require,module,exports){
var StationDispatcher;
@ -173,6 +178,7 @@ module.exports = {
};
},{"../dispatcher/Dispatcher.coffee":7}],3:[function(require,module,exports){
var div, input, recl, ref, textarea;
@ -201,14 +207,15 @@ module.exports = recl({
});
},{}],4:[function(require,module,exports){
var Member, Message, MessageActions, MessageStore, StationActions, StationStore, a, br, div, input, moment, recl, ref, textarea;
var Member, Message, MessageActions, MessageStore, StationActions, StationStore, a, br, div, input, moment, pre, recl, ref, textarea;
moment = require('moment-timezone');
recl = React.createClass;
ref = [React.DOM.div, React.DOM.br, React.DOM.input, React.DOM.textarea, React.DOM.a], div = ref[0], br = ref[1], input = ref[2], textarea = ref[3], a = ref[4];
ref = [React.DOM.div, React.DOM.pre, React.DOM.br, React.DOM.input, React.DOM.textarea, React.DOM.a], div = ref[0], pre = ref[1], br = ref[2], input = ref[3], textarea = ref[4], a = ref[5];
MessageActions = require('../actions/MessageActions.coffee');
@ -255,13 +262,22 @@ Message = recl({
return this.props._handlePm(user);
},
render: function() {
var aude, audi, delivery, klass, name, ref1, ref2, ref3, ref4, ref5, ref6, ref7, txt, type, url;
var attachments, aude, audi, delivery, klass, name, ref1, ref2, speech, txt, type, url;
delivery = _.uniq(_.pluck(this.props.thought.audience, "delivery"));
klass = delivery.indexOf("received") !== -1 ? " received" : " pending";
if (((ref1 = this.props.thought.statement.speech) != null ? (ref2 = ref1.lin) != null ? ref2.say : void 0 : void 0) === false) {
speech = this.props.thought.statement.speech;
attachments = [];
while (speech.fat != null) {
attachments.push(pre({}, speech.fat.fat.tank.join("\n")));
speech = speech.fat.taf;
}
if (speech == null) {
return;
}
if (((ref1 = speech.lin) != null ? ref1.say : void 0) === false) {
klass += " say";
}
if ((ref3 = this.props.thought.statement.speech) != null ? ref3.url : void 0) {
if (speech.url) {
klass += " url";
}
if (this.props.unseen === true) {
@ -279,20 +295,24 @@ Message = recl({
});
type = ['private', 'public'];
type = type[Number(aude.indexOf(window.util.mainStationPath(window.urb.user)) === -1)];
if ((ref4 = this.props.thought.statement.speech) != null ? (ref5 = ref4.lin) != null ? ref5.txt : void 0 : void 0) {
txt = this.props.thought.statement.speech.lin.txt;
if ((ref2 = speech.lin) != null ? ref2.txt : void 0) {
txt = speech.lin.txt;
}
if ((ref6 = this.props.thought.statement.speech) != null ? ref6.url : void 0) {
url = this.props.thought.statement.speech.url.url;
if (speech.url) {
url = speech.url.url;
txt = a({
href: url,
target: "_blank"
}, url);
}
if ((ref7 = this.props.thought.statement.speech) != null ? ref7.app : void 0) {
txt = this.props.thought.statement.speech.app.txt;
if (speech.app) {
txt = speech.app.txt;
klass += " say";
}
if (speech.exp) {
txt = speech.exp.code;
klass += " exp";
}
return div({
className: "message" + klass
}, [
@ -313,7 +333,9 @@ Message = recl({
}, this.convTime(this.props.thought.statement.date))
]), div({
className: "mess"
}, txt)
}, txt, attachments.length ? div({
className: "fat"
}, attachments) : void 0)
]);
}
});
@ -470,6 +492,7 @@ module.exports = recl({
});
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":19,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3,"moment-timezone":14}],5:[function(require,module,exports){
var Member, StationActions, StationStore, a, div, h1, input, recl, ref, textarea;
@ -656,6 +679,7 @@ module.exports = recl({
});
},{"../actions/StationActions.coffee":2,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3}],6:[function(require,module,exports){
var Member, MessageActions, MessageStore, StationActions, StationStore, br, div, input, recl, ref, textarea;
@ -761,21 +785,9 @@ module.exports = recl({
}
},
_writingKeyUp: function(e) {
var r;
if (!window.urb.util.isURL(this.$writing.text())) {
this.$length.toggleClass('valid-false', this.$writing.text().length > 62);
return this.$length.toggleClass('valid-false', this.$writing.text().length > 62);
}
r = window.getSelection().getRangeAt(0).cloneRange();
this.$writing.text(this.$writing.text());
return setTimeout((function(_this) {
return function() {
var s;
s = window.getSelection();
s.removeAllRanges();
s.addRange(r);
return console.log(r);
};
})(this), 0);
},
_writingKeyDown: function(e) {
var txt;
@ -944,6 +956,7 @@ module.exports = recl({
});
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":19,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3}],7:[function(require,module,exports){
var Dispatcher;
@ -965,6 +978,7 @@ module.exports = _.merge(new Dispatcher(), {
});
},{"flux":10}],8:[function(require,module,exports){
$(function() {
var $c, MessagesComponent, StationActions, StationComponent, WritingComponent, clean, rend;
@ -995,6 +1009,7 @@ $(function() {
});
},{"./actions/StationActions.coffee":2,"./components/MessagesComponent.coffee":4,"./components/StationComponent.coffee":5,"./components/WritingComponent.coffee":6,"./move.coffee":9,"./persistence/MessagePersistence.coffee":17,"./persistence/StationPersistence.coffee":18,"./util.coffee":21}],9:[function(require,module,exports){
var ldy, setSo, so;
@ -1095,6 +1110,7 @@ $(window).on('scroll', function(e) {
$(window).on('scroll', window.util.checkScroll);
},{}],10:[function(require,module,exports){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
@ -5601,6 +5617,7 @@ module.exports = {
};
},{"../actions/MessageActions.coffee":1}],18:[function(require,module,exports){
var StationActions;
@ -5725,6 +5742,7 @@ module.exports = {
};
},{"../actions/StationActions.coffee":2}],19:[function(require,module,exports){
var EventEmitter, MessageDispatcher, MessageStore, _fetching, _last, _listening, _messages, _station, _typing, moment;
@ -5870,6 +5888,7 @@ MessageStore.dispatchToken = MessageDispatcher.register(function(payload) {
module.exports = MessageStore;
},{"../dispatcher/Dispatcher.coffee":7,"events":22,"moment-timezone":14}],20:[function(require,module,exports){
var EventEmitter, StationDispatcher, StationStore, _audience, _config, _listening, _members, _station, _stations, _typing, _validAudience;
@ -6069,6 +6088,7 @@ StationStore.dispatchToken = StationDispatcher.register(function(payload) {
module.exports = StationStore;
},{"../dispatcher/Dispatcher.coffee":7,"events":22}],21:[function(require,module,exports){
if (!window.util) {
window.util = {};
@ -6180,6 +6200,7 @@ _.merge(window.util, {
});
},{}],22:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//

3
base/pub/test.sched Normal file
View File

@ -0,0 +1,3 @@
~1970.1.1 Hello world
~1970.2.1 Hallo world?
~1970.1.2 Reordered for goo reason

View File

@ -127,6 +127,24 @@ h3 code {
font-size: inherit;
padding: 0.3rem;
}
#body > div > h1 {
height: 3rem;
}
#body > div > h1 span {
background-color: #000;
padding: 1rem;
margin-left: -1rem;
color: #fff;
}
#body > div > h2 {
height: 2.2rem;
}
#body > div > h2 span {
background-color: #c6c6c6;
padding: 0.6rem;
margin-left: -0.6rem;
color: #fff;
}
pre,
code {
font-size: 0.8rem;
@ -357,6 +375,11 @@ li:before {
.list h1 {
font-size: 0.7rem;
}
.list.default > li > a,
.list.default > li > a > h1,
.list.default li:before {
font-size: 1rem;
}
#body .CodeMirror {
font-size: 0.8rem;
line-height: 1rem;
@ -369,6 +392,9 @@ li:before {
padding-right: 1rem;
margin-left: -1rem;
}
.error {
color: #f91733;
}
@media only screen and (max-width: 1170px) {
#nav,
#nav > div,

View File

@ -57,6 +57,24 @@ h3 code
font-size inherit
padding .3rem
#body > div > h1
height 3rem
#body > div > h1 span
background-color #000
padding 1rem
margin-left -1rem
color #fff
#body > div > h2
height 2.2rem
#body > div > h2 span
background-color rgba(198,198,198,1)
padding .6rem
margin-left -.6rem
color #fff
pre
code
font-size .8rem
@ -282,6 +300,11 @@ li:before
.list h1
font-size .7rem
.list.default > li > a
.list.default > li > a > h1
.list.default li:before
font-size 1rem
#body .CodeMirror
font-size .8rem
line-height 1rem
@ -294,4 +317,7 @@ li:before
padding-right 1rem
margin-left -1rem
.error
color rgba(249,23,51,1)
@import 'mobile'

View File

@ -1,3 +1,5 @@
BodyComponent = require './BodyComponent.coffee'
TreeStore = require '../stores/TreeStore.coffee'
TreeActions = require '../actions/TreeActions.coffee'
@ -36,7 +38,14 @@ module.exports = recl
setPath: (href,hist) ->
if hist isnt false then history.pushState {}, "", window.tree.basepath href
TreeActions.setCurr href.split("#")[0]
next = href.split("#")[0]
rend = false
if next isnt @state.curr
React.unmountComponentAtNode $('#cont')[0]
rend = true
TreeActions.setCurr next
if rend is true
React.render (BodyComponent {}, ""),$('#cont')[0]
goTo: (path) ->
@toggleFocus false
@ -109,10 +118,10 @@ module.exports = recl
if @state.prev or @state.next
_parts = []
if @state.prev
href = window.tree.basepath window.tree.basepath @state.prev
href = window.tree.basepath @state.prev
_parts.push (a {key:"arow-prev",href:href,className:"arow-prev"},"")
if @state.next
href = window.tree.basepath window.tree.basepath @state.next
href = window.tree.basepath @state.next
_parts.push (a {key:"arow-next",href:href,className:"arow-next"},"")
parts.push (div {id:"sides"}, _parts)

View File

@ -16,13 +16,17 @@ module.exports = recl
componentDidMount: ->
TreeStore.addChangeListener @_onChangeStore
componentWillUnmount: ->
TreeStore.removeChangeListener @_onChangeStore
componentDidUpdate: (_props,_state) ->
if _state.curr isnt @state.curr
setTimeout (=> @getPath _state.curr), 0
getInitialState: -> @stateFromStore()
_onChangeStore: -> @setState @stateFromStore()
_onChangeStore: ->
@setState @stateFromStore()
getPath: (path) ->
if not @state.cont[path]?

View File

@ -15,13 +15,14 @@ module.exports = recl
path:path
}
componentDidMount: ->
TreeStore.addChangeListener @_onChangeStore
_onChangeStore: ->
@setState @stateFromStore()
componentWillUnmount: ->
TreeStore.removeChangeListener @_onChangeStore
getInitialState: -> @stateFromStore()
_onChangeStore: -> @setState @stateFromStore()
getCont: ->
cont = true
keys = _.keys @state.tree
@ -32,6 +33,7 @@ module.exports = recl
componentDidMount: ->
cont = @getCont()
TreeStore.addChangeListener @_onChangeStore
if not @state.tree or _.keys(@state.tree).length is 0 or not cont
TreeActions.getPath @state.path,"snip"
@ -54,4 +56,6 @@ module.exports = recl
prev = (h1 {},v)
href = window.tree.basepath _path
(li {}, (a {href:href,className:c,key:"list-a-"+_path}, prev))
(ul {className:"list",key:"list-"+@state.path}, _list)
k = "list"
if @props['data-source'] is 'default' then k += " default"
(ul {className:k,key:"list-"+@state.path}, _list)

View File

@ -1,4 +1,4 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee":[function(require,module,exports){
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee":[function(require,module,exports){
var TreeDispatcher, TreePersistence;
TreeDispatcher = require('../dispatcher/Dispatcher.coffee');
@ -72,8 +72,10 @@ module.exports = {
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee","../persistence/TreePersistence.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/AnchorComponent.coffee":[function(require,module,exports){
var TreeActions, TreeStore, a, div, recl, ref;
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee","../persistence/TreePersistence.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/AnchorComponent.coffee":[function(require,module,exports){
var BodyComponent, TreeActions, TreeStore, a, div, recl, ref;
BodyComponent = require('./BodyComponent.coffee');
TreeStore = require('../stores/TreeStore.coffee');
@ -121,10 +123,20 @@ module.exports = recl({
return dt = this.ts - Number(Date.now());
},
setPath: function(href, hist) {
var next, rend;
if (hist !== false) {
history.pushState({}, "", window.tree.basepath(href));
}
return TreeActions.setCurr(href.split("#")[0]);
next = href.split("#")[0];
rend = false;
if (next !== this.state.curr) {
React.unmountComponentAtNode($('#cont')[0]);
rend = true;
}
TreeActions.setCurr(next);
if (rend === true) {
return React.render(BodyComponent({}, ""), $('#cont')[0]);
}
},
goTo: function(path) {
var frag;
@ -219,7 +231,7 @@ module.exports = recl({
if (this.state.prev || this.state.next) {
_parts = [];
if (this.state.prev) {
href = window.tree.basepath(window.tree.basepath(this.state.prev));
href = window.tree.basepath(this.state.prev);
_parts.push(a({
key: "arow-prev",
href: href,
@ -227,7 +239,7 @@ module.exports = recl({
}, ""));
}
if (this.state.next) {
href = window.tree.basepath(window.tree.basepath(this.state.next));
href = window.tree.basepath(this.state.next);
_parts.push(a({
key: "arow-next",
href: href,
@ -295,7 +307,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/BodyComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee","./BodyComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/BodyComponent.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/BodyComponent.coffee":[function(require,module,exports){
var TreeActions, TreeStore, div, input, load, recl, ref, textarea;
TreeStore = require('../stores/TreeStore.coffee');
@ -320,6 +332,9 @@ module.exports = recl({
componentDidMount: function() {
return TreeStore.addChangeListener(this._onChangeStore);
},
componentWillUnmount: function() {
return TreeStore.removeChangeListener(this._onChangeStore);
},
componentDidUpdate: function(_props, _state) {
if (_state.curr !== this.state.curr) {
return setTimeout(((function(_this) {
@ -360,7 +375,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/CodeMirror.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/CodeMirror.coffee":[function(require,module,exports){
var div, recl, ref, textarea;
recl = React.createClass;
@ -384,7 +399,7 @@ module.exports = recl({
},{}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/KidsComponent.coffee":[function(require,module,exports){
},{}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/KidsComponent.coffee":[function(require,module,exports){
var TreeActions, TreeStore, a, div, hr, li, recl, ref, ul;
TreeStore = require('../stores/TreeStore.coffee');
@ -451,7 +466,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/ListComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/ListComponent.coffee":[function(require,module,exports){
var TreeActions, TreeStore, a, div, h1, li, load, recl, ref, ul;
TreeStore = require('../stores/TreeStore.coffee');
@ -474,15 +489,15 @@ module.exports = recl({
path: path
};
},
componentDidMount: function() {
return TreeStore.addChangeListener(this._onChangeStore);
_onChangeStore: function() {
return this.setState(this.stateFromStore());
},
componentWillUnmount: function() {
return TreeStore.removeChangeListener(this._onChangeStore);
},
getInitialState: function() {
return this.stateFromStore();
},
_onChangeStore: function() {
return this.setState(this.stateFromStore());
},
getCont: function() {
var cont, i, k, keys, len;
cont = true;
@ -501,12 +516,13 @@ module.exports = recl({
componentDidMount: function() {
var cont;
cont = this.getCont();
TreeStore.addChangeListener(this._onChangeStore);
if (!this.state.tree || _.keys(this.state.tree).length === 0 || !cont) {
return TreeActions.getPath(this.state.path, "snip");
}
},
render: function() {
var _list, doc, ref1;
var _list, doc, k, ref1;
doc = (ref1 = this.state.tree) != null ? ref1 : [];
if (!this.getCont()) {
_list = div({
@ -537,8 +553,12 @@ module.exports = recl({
};
})(this));
}
k = "list";
if (this.props['data-source'] === 'default') {
k += " default";
}
return ul({
className: "list",
className: k,
key: "list-" + this.state.path
}, _list);
}
@ -546,7 +566,7 @@ module.exports = recl({
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","../stores/TreeStore.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee","./LoadComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/LoadComponent.coffee":[function(require,module,exports){
var div, input, recl, ref, textarea;
recl = React.createClass;
@ -584,7 +604,7 @@ module.exports = recl({
},{}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee":[function(require,module,exports){
},{}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee":[function(require,module,exports){
var Dispatcher;
Dispatcher = require('flux').Dispatcher;
@ -606,7 +626,7 @@ module.exports = _.extend(new Dispatcher(), {
},{"flux":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/index.js"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/main.coffee":[function(require,module,exports){
},{"flux":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/index.js"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/main.coffee":[function(require,module,exports){
var rend;
rend = React.render;
@ -766,7 +786,7 @@ $(function() {
},{"./actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","./components/AnchorComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/AnchorComponent.coffee","./components/BodyComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/BodyComponent.coffee","./components/CodeMirror.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/CodeMirror.coffee","./components/KidsComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/KidsComponent.coffee","./components/ListComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/components/ListComponent.coffee","./persistence/TreePersistence.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/index.js":[function(require,module,exports){
},{"./actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee","./components/AnchorComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/AnchorComponent.coffee","./components/BodyComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/BodyComponent.coffee","./components/CodeMirror.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/CodeMirror.coffee","./components/KidsComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/KidsComponent.coffee","./components/ListComponent.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/components/ListComponent.coffee","./persistence/TreePersistence.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/index.js":[function(require,module,exports){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
@ -778,7 +798,7 @@ $(function() {
module.exports.Dispatcher = require('./lib/Dispatcher')
},{"./lib/Dispatcher":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js":[function(require,module,exports){
},{"./lib/Dispatcher":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/Dispatcher.js":[function(require,module,exports){
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -1030,7 +1050,7 @@ var _prefix = 'ID_';
module.exports = Dispatcher;
},{"./invariant":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/invariant.js"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/invariant.js":[function(require,module,exports){
},{"./invariant":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/invariant.js"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/node_modules/flux/lib/invariant.js":[function(require,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -1085,7 +1105,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
module.exports = invariant;
},{}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee":[function(require,module,exports){
},{}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/persistence/TreePersistence.coffee":[function(require,module,exports){
var TreeActions;
TreeActions = require('../actions/TreeActions.coffee');
@ -1107,7 +1127,7 @@ module.exports = {
},{"../actions/TreeActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee":[function(require,module,exports){
},{"../actions/TreeActions.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/actions/TreeActions.coffee"}],"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/stores/TreeStore.coffee":[function(require,module,exports){
var EventEmitter, MessageDispatcher, TreeStore, _cont, _curr, _load, _snip, _tree;
EventEmitter = require('events').EventEmitter;
@ -1192,15 +1212,19 @@ TreeStore = _.extend(EventEmitter.prototype, {
loadSnip: function(path, snip) {
var k, results, v;
this.mergePathToTree(path, _.pluck(snip, "name"));
results = [];
for (k in snip) {
v = snip[k];
results.push(_snip[path + "/" + v.name] = {
head: window.tree.reactify(v.body.head),
body: window.tree.reactify(v.body.body)
});
if ((snip != null ? snip.length : void 0) !== 0) {
results = [];
for (k in snip) {
v = snip[k];
results.push(_snip[path + "/" + v.name] = {
head: window.tree.reactify(v.body.head),
body: window.tree.reactify(v.body.body)
});
}
return results;
} else {
return _cont[path] = window.tree.reactify("React.createElement ('div', {}, [ React.createElement('h1', {className:'error'}, 'Error: Empty path'), React.createElement('div', {}, [ React.createElement('pre', {}, '" + (this.getCurr()) + "'), React.createElement('span', {}, 'is either empty or does not exist.') ]) ])");
}
return results;
},
loadKids: function(path, kids) {
var k, results, v;
@ -1321,7 +1345,7 @@ module.exports = TreeStore;
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee","events":"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js"}],"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js":[function(require,module,exports){
},{"../dispatcher/Dispatcher.coffee":"/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/dispatcher/Dispatcher.coffee","events":"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js"}],"/usr/local/lib/node_modules/watchify/node_modules/browserify/node_modules/events/events.js":[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@ -1626,4 +1650,4 @@ function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},["/Users/galen/Documents/src/urbit-test/urb/zod/base/pub/tree/src/js/main.coffee"]);
},{}]},{},["/Users/galen/src/urbit-dev/urb/zod/base/pub/tree/src/js/main.coffee"]);

View File

@ -54,10 +54,18 @@ TreeStore = _.extend EventEmitter.prototype, {
loadSnip: (path,snip) ->
@mergePathToTree path,_.pluck(snip,"name")
for k,v of snip
_snip[path+"/"+v.name] =
head: window.tree.reactify v.body.head
body: window.tree.reactify v.body.body
if snip?.length isnt 0
for k,v of snip
_snip[path+"/"+v.name] =
head: window.tree.reactify v.body.head
body: window.tree.reactify v.body.body
else
_cont[path] = window.tree.reactify "React.createElement ('div', {}, [
React.createElement('h1', {className:'error'}, 'Error: Empty path'),
React.createElement('div', {}, [
React.createElement('pre', {}, '#{@getCurr()}'),
React.createElement('span', {}, 'is either empty or does not exist.')
]) ])"
loadKids: (path,kids) ->
@mergePathToTree path,_.pluck(kids,"name")