From 64eb3ce1f928957e9abd89ead62fdae621d9245c Mon Sep 17 00:00:00 2001 From: Florian Steinel Date: Wed, 27 May 2015 21:16:31 +0200 Subject: [PATCH 01/37] fix link --- base/pub/doc/guide/b-cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/pub/doc/guide/b-cli.md b/base/pub/doc/guide/b-cli.md index 8e55405c2a..b3f598556a 100644 --- a/base/pub/doc/guide/b-cli.md +++ b/base/pub/doc/guide/b-cli.md @@ -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. From 357c8606c74eaaa029cba57bfce1fa0f5ca62cb5 Mon Sep 17 00:00:00 2001 From: Florian Steinel Date: Wed, 27 May 2015 21:20:23 +0200 Subject: [PATCH 02/37] fix link --- base/pub/doc/arvo/util.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/pub/doc/arvo/util.md b/base/pub/doc/arvo/util.md index d53607020b..9449da42f4 100644 --- a/base/pub/doc/arvo/util.md +++ b/base/pub/doc/arvo/util.md @@ -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"): ------------------------------------------------------------------------ From 6e904f5b6fcc4f0ed668475a9769f5a2215d7d7b Mon Sep 17 00:00:00 2001 From: Henry Ault Date: Fri, 29 May 2015 19:45:56 -0700 Subject: [PATCH 03/37] complete unified interface, actions & imgs left --- base/ape/cloud/core.hook | 542 ++++++++++++++++++++++------------- base/pub/cloud/fab/hymn.hook | 9 +- base/pub/cloud/src/main.js | 194 ++++++++----- 3 files changed, 466 insertions(+), 279 deletions(-) diff --git a/base/ape/cloud/core.hook b/base/ape/cloud/core.hook index 4912b31884..52a1181f7c 100644 --- a/base/ape/cloud/core.hook +++ b/base/ape/cloud/core.hook @@ -13,31 +13,22 @@ !: |% -++ droplet -$: id=@ud name=@t memory=@ud vcpus=@ud disk=@ud locked=? - created=@t status=@t backup-ids=(list ,@t) snapshot-ids=(list ,@ud) - features=(list ,@t) region=regi image=img - size=syze size-slug=@t networks=ntwrks kernel=kern - next-backup-window=json +++ instance +$: plat=?(%do %gce) name=@t id=@t status=@t created=@da snapshot=name=@t ::disk=@u region=@t +ip=(list ,@if) == -++ regi ,[name=@t slug=@t sizes=(list ,@t)] -++ kern ,[id=@ud name=@t version=@t] -++ img -$: id=@ud name=@t distribution=@t slug=(unit ,@t) public=? regions=(list ,@t) - created-at=@t type=@t min-disk-size=@ud -== -++ ntwrks ,[v4=(list v) v6=(list v)] -++ v ,[ip-address=@t netmask=@t gateway=@t type=@t] -++ syze -$: memory=@ud price-monthly=@t price-hourly=@t disk=@ud vcpus=@ud - slug=@t transfer=@t available=? regions=(list ,@t) -== -++ reqbody +++ create-req-do $: -name=@t region=@t size=@t image=@ud ssh=(list cord) -backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t) +name=@t ::region=@t +size=@t image=@t ssh=(list cord) +backups=(unit ,?) ipv6=(unit ,?) +private-networking=(unit ,?) user-data=(unit ,@t) +== +++ create-req-gce ,[project=@t zone=@t name=@t machine-type=@t] +++ axle +$: auth=[do=keys gce=keys] toke=[do=tokens gce=tokens] + insts=(map ,@t instance) == -++ axle ,[auth=[do=keys gcp=keys] toke=tokens drops=(list droplet)] ++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)] ++ tokens ,[access=@t refresh=@t] ++ move ,[bone card] @@ -49,113 +40,111 @@ $% [%diff %json json] == -- !: -|% ::: -++ parse-img - => jo - %- ot - :~ id/ni name/so distribution/so slug/(mu so) public/bo - regions/(ar so) 'created_at'^so type/so 'min_disk_size'^ni - == -++ parse-ntwrks +|% ::: +++ parse-iso8601 + =< (cook to-time (parsf ;"{parse-day}T{parse-seconds}{parse-zone}")) + |% + ++ to-time + |= [[y=@u m=@u d=@u] t=[h=@u m=@u s=@u ms=@u] [syn=? zh=@u zm=@u]] + ^- @da + %- year + ^- date + =: h.t ?:(syn (sub h.t zh) (add h.t zh)) + m.t ?:(syn (sub m.t zm) (add m.t zm)) + == + [[& y] m d h.t m.t s.t (div (mul ms.t 0x1.0000) 1.000) ~] + ++ parse-day (parsf ;"{dem}\-{dem}\-{dem}") + ++ parse-seconds (parsf ;"{dem}:{dem}:{dem}{(optional ;~(pfix dot dem))}") + ++ optional |*(fel=_rule ;~(pose fel (easy 0))) + ++ parse-zone + ;~ pose + (cold [& 0 0] (jest 'Z')) + (parsf ;"{parse-zone-sign}{dem}:{dem}") + == + ++ parse-zone-sign ;~(plug ;~(pose (cold & lus) (cold | hep))) + -- +++ key-do + (mo [%start 'power_on'] [%stop 'shutdown'] [%reboot 'power_cycle'] ~) +++ adapter-do + |= a=cord + (~(got by key-do) a) +++ parse-ip-do => jo %- ot - :+ v4/(ar (ot 'ip_address'^so netmask/so gateway/so type/so ~)) - v6/(ar (ot 'ip_address'^so netmask/so gateway/so type/so ~)) - ~ -++ parse-size + :_ ~ v4/(ar (ot 'ip_address'^(su lip:ag) ~)) +++ parse-ip-gce => jo - %- ot - :~ memory/ni 'price_monthly'^no 'price_hourly'^no disk/ni - vcpus/ni slug/so transfer/no available/bo regions/(ar so) - == + %+ cu |=(a=(list (list ,@if)) `(list ,@if)`(zing a)) + (ar (ot 'accessConfigs'^(ar (ot 'natIP'^(su lip:ag) ~)) ~)) +++ tail-url + |= a=cord + -:(flop q.q:(need (epur a))) ++ parse-region => jo - (ot name/so slug/so sizes/(ar so) ~) -++ create-body - |= $: name=@t region=@t size=@t image=@ud ssh-keys=(list cord) + (ot name/so ~) +++ parse-id-text + |= jon=json + ?.(?=([?(%n %s) *] jon) ~ (some p.jon)) +++ create-do-body + |= $: name=@t ::region=@t + size=@t image=@t ssh-keys=(list cord) backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t) == %- jobe - :~ name/s/name region/s/region size/s/size image/(jone image) ::(jone image) + :~ name/s/name ::region/s/region + size/s/size image/s/image ::(jone image) backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6) 'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking) == +++ convert-do + |= a=?(%start %stop %reboot) + ?- a + %start + 'power_on' + %stop + 'shutdown' + %reboot + 'power_cycle' + == ++ state-to-json - |= a=(list droplet) + |= a=(list instance) :- %a %+ turn a - |= droplet + |= instance ^- json %- jobe - :~ id/`json`(jone id) - name/`json`s/name - vcpus/`json`(jone vcpus) - disk/`json`(jone disk) - locked/b/locked - created/s/created + :~ name/`json`s/name + id/s/id status/s/status - backup-ids/a/(turn backup-ids |=(el=cord s/el)) - snapshot-ids/a/(turn snapshot-ids jone) - features/a/(turn features |=(el=cord s/el)) - =+ ^= reg - :~ name/s/name.region slug/s/slug.region - sizes/a/(turn sizes.region |=(el=cord s/el)) - == - region/(jobe reg) - =+ ^= im - :~ id/(jone id.image) name/s/name.image distribution/s/distribution.image - slug/?~(slug.image ~ s/u.slug.image) public/b/public.image - regions/a/(turn regions.image |=(el=cord s/el)) - created-at/s/created-at.image type/s/type.image - min-disk-size/(jone min-disk-size.image) - == - image/(jobe im) - =+ ^= sz - :~ memory/(jone memory.size) price-monthly/s/price-monthly.size - price-hourly/s/price-hourly.size disk/(jone disk.size) vcpus/(jone vcpus.size) - slug/s/slug.size transfer/s/transfer.size available/b/available.size - regions/a/(turn regions.size |=(el=cord s/el)) - == - size/(jobe sz) - size-slug/s/size-slug - =+ ^= nt - =+ ^= vobj - |= v - %- jobe :~ - ip-address/s/ip-address netmask/s/netmask - gateway/s/gateway type/s/type - == - :~ v4/[%a (turn v4.networks vobj)] - v6/[%a (turn v4.networks vobj)] - == - networks/(jobe nt) - kernel/s/'kernel' - next-backup-window/s/'valid' + created/s/(crip (dust (yore created))) + ::region/s/region + snapshot/s/snapshot + :: disk/`json`(jone disk) + ip/a/(turn ip |=(a=@if s/(rsh 3 1 (scot %if a)))) == -- !: |_ [hid=hide vat=axle] :: -++ prep ,_`. -::: +::++ prep ,_`. +:: +++ peer + |= [[ost=bone you=ship] pax=path] + ^- [(list move) _+>.$] + :_ +>.$ + =+ lis=(~(tap by insts.vat)) + [ost %diff %json (state-to-json (turn lis |=(a=[@t instance] +.a)))]~ +:: ++ spam |= jon=json %+ turn (~(tap by sup.hid)) |= [sub=bone @ pax=path] ^- move [sub %diff %json jon] -++ auth-queries - |= code=cord - :~ 'grant_type'^'authorization_code' - 'code'^code - :- 'client_id' - 'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f' - 'redirect_uri'^'http://localhost:8443/home/pub/cloud/fab' - == ++ httpreq |= $: ost=bone pour-path=wire domain=(list cord) end-point=path - req-type=$?(%get [%post json]) headers=math + req-type=$?(%get %delt [%post json]) headers=math queries=quay == ^- move @@ -169,206 +158,349 @@ $% [%diff %json json] =+ ^- request=hiss :: cast to hiss :- parsed-url ?@ req-type - [%get headers ~] + [req-type headers ~] [%post headers ~ (tact (pojo +.req-type))] :^ ost %them pour-path `(unit hiss)`[~ request] :: -++ peer - |= [[ost=bone you=ship] pax=path] - ^- [(list move) _+>.$] - :_ +>.$ - [ost %diff %json (state-to-json drops.vat)]~ +++ auth-queries + |= code=cord + :~ 'grant_type'^'authorization_code' + 'code'^code + :- 'client_id' + 'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f' + 'redirect_uri'^'http://localhost:8443/home/pub/cloud/fab' + == :: ++ poke-cloud-auth |= [[ost=bone you=ship] [cde=cord typ=cord]] ^- [(list move) _+>.$] - ~& [cde typ] ?: =(%do typ) =. authc.do.auth.vat [~ cde] - :_ +>.$ - ~ - =. authc.gcp.auth.vat - [~ cde] + :_ +>.$ ~ + =. access.gce.toke.vat + cde :_ +>.$ + :- (list-instances-gce ost) ~ :: ++ poke-cloud-secret |= [[ost=bone you=ship] secret=cord typ=cord] ^- [(list move) _+>.$] - ::=+ [newvat code path]=[vat(auth auth.vat) ...] - ::=. vat newvat ?+ typ ~|(missing-platform=typ !!) %do =. client-secret.do.auth.vat [~ secret] :_ +>.$ :_ ~ - %^ httpreq ost /auth + %^ httpreq ost /auth-do :^ ~[%digitalocean %cloud] `path`/v1/oauth/token [%post ~] :- ~ `quay`['client_secret'^secret (auth-queries (need authc.do.auth.vat))] %gce - =. client-secret.gcp.auth.vat + =. client-secret.gce.auth.vat [~ secret] :_ +>.$ :_ ~ - %^ httpreq ost /auth + %^ httpreq ost /auth-gce :^ ~[%google %cloud] `path`/v1/oauth/token [%post ~] - :- ~ `quay`['client_secret'^secret (auth-queries (need authc.gcp.auth.vat))] + :- (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~) + `quay`['client_secret'^secret %'access_token'^(need authc.gce.auth.vat) ~] ::(auth-queries (need authc.gcp.auth.vat))] == :: ++ receive-auth - |= [ost=bone pour-path=path resp=httr] + |= [ost=bone pour-path=cord resp=httr] ^- [(list move) _+>.$] ~| resp =+ body=(rash q:(need r.resp) apex:poja) ~| recieve-auth/resp(r body) + ?+ pour-path !! + %auth-do =+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body)) - =: access.toke.vat ac - refresh.toke.vat re + =: access.do.toke.vat ac + refresh.do.toke.vat re == :_ +>.$ - :~ (list-droplets ost) + :~ (list-instances-do ost) (publish ost our.hid [%lin & 'successfully authenticated']~) == + %auth-gce + :_ +>.$ + ~ + == :: ++ poke-json |= [[ost=bone you=ship] act=json] ^- [(list move) _+>.$] =+ do=(need ((ot action/so ~):jo act)) + :_ +>.$ + :_ ~ ?+ do !! %list - :_ +>.$ - :- (list-droplets ost) - ~ + (list-instances-do ost) :: - %create - :_ +>.$ - =+ ^- deets=reqbody - %- need - %. act - => jo - %- ot - :~ name/so region/so size/so image/(su dem) :: id key:img object - ssh/(ar so) backups/(mu bo) - 'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so) - == - :- (create-droplet ost deets) - ~ + %create-do + (create-do ost act) :: - $? %reboot %'power_cycle' %shutdown %'power_off' %'power_on' - %'password_reset' %'enable_ipv6' %'enable_private_networking' - %snapshot %upgrade - == - =+ id=(need ((ot id/no ~):jo act)) - (droplet-action ost id do) + %create-gce-disk + (create-gce-disk ost act) + :: + %create-gce + (create-gce ost act) + :: + ?(%start %stop %reboot %delete) + =+ id=(need ((ot id/so ~):jo act)) + (instance-action ost id do) == :: -++ droplet-action +++ instance-action |= $: os=bone id=@t $= action $? - %delete %reboot %'power_cycle' %shutdown %'power_off' - %'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking' - %snapshot %upgrade :: add retrieve droplet action + %start %stop %reboot %delete == == - :: restore, resize, rebuild, change_kernelm, retrieve droplet action - :_ +>.$ - ^- (list move) - :_ ~ + =+ meth=?:(?=(%delete action) %delt [%post (jobe type/s/(convert-do action) ~)]) + ^- move + ~& 'do i get here?' =+ ^= req %- httpreq :* - os /reboot - ~[%digitalocean %api] /v2/droplets/[id]/actions - [%post `json`(jobe type/s/action ~)] - (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~) + os /action-test + ~[%digitalocean %api] + ?:(?=(%delt meth) /v2/droplets/[id] /v2/droplets/[id]/actions) + meth + %^ mo ['Content-Type' 'application/json' ~] + ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~ *quay == req - -++ list-droplets - |= os=bone - =+ ^= lis - :~ os /list - ~[%digitalocean %api] /v2/droplets - %get - (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] ~) - == - (httpreq lis) :: -++ receive-list - |= [ost=bone pour-path=path resp=httr] - ^- [(list move) _+>.$] - =+ parsed=(rash q:(need r.resp) apex:poja) - ~| recieve-list/parsed - =+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) - =+ ^- dropz=(list droplet) - ~| bad-json/-.dar - %+ turn dar - |= drp=json +++ create-do + |= [os=bone act=json] + =+ ^- deets=create-req-do %- need - %. drp =+ jo + %. act + => jo %- ot - :~ id/ni name/so - memory/ni vcpus/ni disk/ni - locked/bo 'created_at'^so status/so - 'backup_ids'^(ar so) 'snapshot_ids'^(ar ni) features/(ar so) - region/parse-region image/parse-img size/parse-size - 'size_slug'^so networks/parse-ntwrks kernel/(ot id/ni name/so version/so ~) - 'next_backup_window'^some + :~ name/so size/so image/so :: id key:img object region/so + ssh/(ar so) backups/(mu bo) + 'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so) == - =. drops.vat - dropz - =+ buf=`@da`(add ~s10 lat.hid) - :_ +>.$ - :_ (spam (state-to-json drops.vat)) - [ost %wait /refresh buf] -:: -++ create-droplet - |= [os=bone reqbody] - =- ~& - - =+ ^- body=json - %- create-body :* - name region size image ssh backups - ipv6 private-networking user-data + %- create-do-body :* + name.deets size.deets image.deets ssh.deets backups.deets ::region.deets + ipv6.deets private-networking.deets user-data.deets == %- httpreq :* - os /create + os /create-do ~[%digitalocean %api] /v2/droplets [%post body] - %^ mo ['Content-Type' 'application/json' ~] - ['Authorization' (cat 3 'Bearer ' access.toke.vat) ~] + %^ mo ['Content-Type' 'application/json; charset=utf-8' ~] + ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~ ~ == +:: +++ create-gce-disk + |= [os=bone act=json] :: num=(unit ,@u) + :: =. name ?~(num name ... + =+ :- name=(need ((ot name/so ~):jo act)) + snap=(need ((ot snap/so ~):jo act)) + =+ ^- body=json + (jobe name/s/name %'sourceSnapshot'^s/'compute/v1/projects/urbcloud/global/snapshots/snapshot-1' ~) ::^so/snap ~) + %- httpreq + :* os /create-gce-disk + ~['googleapis' 'www'] /compute/v1/projects/urbcloud/zones/us-central1-b/disks + [%post body] + %^ mo ['Content-Type' 'application/json' ~] + ['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] + ~ + ~ + == +++ ask-disk-status + |= [os=bone pax=path] ^- move + =+ safe=(slav %uv ?~(pax !! -.pax)) + =+ link=(need (epur ?~(pax !! safe))) + =. r.link ['access_token'^access.gce.toke.vat r.link] + :^ os %them `wire`/disk-status + `(unit hiss)`[~ [link [%get ~ ~]]] +:: +++ disk-status ::receive + |= [ost=bone resp=httr] + ^- [(list move) _+>.$] + =+ hcode=p.resp + ?: =('200' hcode) + ~| 'did not receive 200' !! + =+ :-(parsed=(rash q:(need r.resp) apex:poja) jo) + =+ :- status=(need ((ot status/so ~) parsed)) + lin=(need ((ot 'selfLink'^so ~) parsed)) + =+ link=(scot %uv lin) + ?: =('DONE' status) + ~& resp + ~& 'boot disk now running, now starting instance' + =+ target=(need ((ot 'targetLink'^so ~):jo parsed)) + =+ nam=-:(flop q.q:(need (epur target))) + ~& nam + ::(create-gce-disk ost nam 'tbd') + :- ~ +>.$ + :_ +>.$ + [ost %wait `path`[%check-status link ~] `@da`(add ~s3 lat.hid)]~ :: refesh every 10 sec +:: +++ create-gce + |= [os=bone act=json] + =+ ^- deets=create-req-gce + %- need + %. act + => jo + %- ot + :~ project/so zone/so name/so %'machine_type'^so + == + =+ src=(cat 3 'compute/v1/projects/urbcloud/zones/us-central1-b/disks/' name.deets) + =+ ^- body=json + %- jobe + :~ name/s/'name-provided' 'machineType'^s/'zones/us-central1-b/machineTypes/n1-standard-1' + :- %disks :- %a :_ ~ + (jobe boot/b/%.y type/s/'persistent' source/s/src ~) + :- 'networkInterfaces' :- %a :_ ~ + (joba 'network' `json`[%s 'global/networks/default']) + == + %- httpreq + :* `bone`os `path`/create-gce + `(list cord)`~['googleapis' 'www'] `path`/compute/v1/projects/urbcloud/zones/us-central1-b/'instances' + [%post `json`body] + %^ mo ['Content-Type' 'application/json' ~] + ['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] + ~ + `quay`[%key access.gce.toke.vat]~ + == :: ++ wake |= [[ost=bone him=ship pour-path=path] ~] ?+ -.pour-path !! - %refresh + %refresh-do :_ +>.$ - [(list-droplets ost)]~ + [(list-instances-do ost)]~ + %refresh-gce + :_ +>.$ + [(list-instances-gce ost)]~ + %check-status + :_ +>.$ + [(ask-disk-status ost +.pour-path)]~ == +:: +++ list-instances-gce + |= os=bone + =+ ^= lis + :* os /list-gce + ~[%googleapis %www] /compute/v1/projects/urbcloud/zones/['us-central1-a']/'instances' + %get ~ + ^- quay + [%'access_token' access.gce.toke.vat]~ + == + (httpreq lis) +:: +++ receive-list-gce + |= [os=bone resp=httr] + ^- [(list move) _+>.$] + =+ parsed=(rash q:(need r.resp) apex:poja) :: body httr to json + =+ items=(need ((ot items/(ar some) ~):jo parsed)) + =+ ^- ins=(list ,[@t instance]) + ~| 'bad-json'^items + %+ turn items + |= in=json + =- ~! want=*[@t instance] ~! have=- - + =< [id .] + ^- instance + :- %gce + %- need + %. in =+ jo + %- ot + :~ name/so id/so status/so 'creationTimestamp'^(su parse-iso8601) ::zone/so + 'machineType'^(cu tail-url so) + 'networkInterfaces'^parse-ip-gce + == + =+ ^= new + %+ skip ins + |=(a=[@t instance] (~(has by insts.vat) id.a)) + =. insts.vat + (~(gas by insts.vat) new) + =+ buf=`@da`(add ~s10 lat.hid) + :_ +>.$ + =+ lis=(~(tap by insts.vat)) + :_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a)))) + [os %wait /refresh-gce buf] +:: +++ list-instances-do + |= os=bone + =+ ^= lis + :~ os /list-do + ~[%digitalocean %api] /v2/droplets + %get + (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~) + == + (httpreq lis) +:: +++ receive-list-do + |= [ost=bone resp=httr] + ^- [(list move) _+>.$] + =+ parsed=(rash q:(need r.resp) apex:poja) :: parse httr to json + ~| recieve-list/parsed + =+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) :: reparse ar of insts + =. insts.vat + %- ~(gas by insts.vat) + ^- dropz=(list ,[@t instance]) + ~| bad-json/-.dar + %+ turn dar + |= drp=json ^- [@t instance] + =- ~! - - + =< [id .] + ^- instance + :- %do + %- need + %. drp + =+ jo + %- ot + :~ name/so id/parse-id-text status/so 'created_at'^(su parse-iso8601) ::region/parse-region + image/(ot name/so ~) ::disk/ni + networks/parse-ip-do + == + =+ buf=`@da`(add ~s10 lat.hid) + :_ +>.$ + =+ lis=(~(tap by insts.vat) *(list ,[@t instance])) + :_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a)))) + [ost %wait /refresh-do buf] + ++ thou |= [[ost=bone him=ship pour-path=path] resp=httr] ^- [(list move) _+>.$] - ?+ -.pour-path !! - %auth - (receive-auth `bone`ost `path`pour-path resp) + ?+ -.pour-path ~& pour-path !! + %auth-do + (receive-auth ost -.pour-path resp) :: - %list - (receive-list ost pour-path resp) + %auth-gce + (receive-auth ost -.pour-path resp) + :: + %list-do + (receive-list-do ost resp) + %list-gce + (receive-list-gce ost resp) +:: :_ +>.$ +:: ~ :: $? %delete %reboot %'power_cycle' %shutdown %'power_off' %'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking' %snapshot %upgrade :: add retrieve droplet action - %create + %create-do %create-gce %action-test == ~& resp :_ +>.$ ~ + :: + ?(%create-gce-disk %disk-status) + (disk-status ost resp) + :: + %check-status + :_ +>.$ ~[(ask-disk-status ost +.pour-path)] :: %pub :_ +>.$ ~ diff --git a/base/pub/cloud/fab/hymn.hook b/base/pub/cloud/fab/hymn.hook index 78bffedd95..05b8131d63 100644 --- a/base/pub/cloud/fab/hymn.hook +++ b/base/pub/cloud/fab/hymn.hook @@ -9,7 +9,6 @@ !: ^- manx =+ do=(~(get by qix.gas) %'code') -=+ g=(~(get by qix.gas) %'access_token') ;html ;head @@ -21,10 +20,10 @@ ;title: DO & GCE Manager == ;body - ;* =+ d=?~(do ~ (trip u.do)) - =+ g=?~(g ~ (trip u.g)) - :_ ~ - ;script: authcode='{?~(d g d)}'; console.log(authcode) + ;script:""" + var authcode = \{} + authcode.do='{?~(do ~ (trip u.do))}' + """ ;div#container; ;script@"/home/pub/cloud/src/main.js"; == diff --git a/base/pub/cloud/src/main.js b/base/pub/cloud/src/main.js index 410126bf36..faade1da3a 100644 --- a/base/pub/cloud/src/main.js +++ b/base/pub/cloud/src/main.js @@ -9,25 +9,130 @@ tr = React.DOM.tr td = React.DOM.td input = React.DOM.input +function HashToJSON() { + var pairs = window.location.hash.slice(1).split('&'); + var result = {}; + pairs.forEach(function(pair) { + pair = pair.split('='); + result[pair[0]] = decodeURIComponent(pair[1] || ''); + }); + + return JSON.parse(JSON.stringify(result)); +} + + +DOControls = React.createClass({ + createDroplet: function(){ + urb.send({appl: "cloud", + data: { + action:'create-do', + name:$('#name').val(), + region:$('#region').val(), + size:$('#size').val(), + image:$('#image').val(), + ssh:[], // $('#ssh').val()] + backups:null,//$('#backups').val(), + ipv6:null,//$('#ipv6').val(), + priv_networking:null,//$('#priv-networking').val(), + user_data:null//$('#user-data').val() + }, + mark: "json"}) + }, + + render: function(){ + href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fhome%2Fpub%2Fcloud%2Ffab&response_type=code&scope=read+write" + return ( + div({}, [ + div({}, + a({href:href},"get authcode"), + b({onClick:this.props.handleClick('do')}, "Send Authcode") + ), + div({}, [ + input({id:"appsecret"}, + b({onClick:this.props.sendSecret('do','#appsecret')}, "Send Secret")) + ]), + + div({}, [ + b({onClick:this.createDroplet}, "Create Droplet"), + input({id:"name",placeholder:"Name of droplet"}), + input({id:"region",placeholder:"Region"}), + input({id:"size",placeholder:"Size (str ending in mb"}), + input({id:"image",placeholder:"Image"}), + input({id:"ssh",placeholder:"ssh keys (optional)"}), + input({id:"backups",placeholder:"backups (optional)"}), + input({id:"ipv6",placeholder:"ipv6 (boolean, optional)"}), + input({id:"user-data",placeholder:" user-data string (optional)"}), + input({id:"priv-networking",placeholder:"Private Networking (boolean, optional)"}) + ]) + ]) + ) + } +}) + +GCEControls = React.createClass({ + createDroplet: function(){ + urb.send({ + appl: 'cloud', + data: {action:'create-gce', + project:$('#project').val(), + zone:$('#zone').val(), + name:$('#gname').val(), + machine_type:$('#machine_type').val() + }, + mark: 'json'}) + }, + + createDisk: function(){ + urb.send({ + appl: 'cloud', + data: {action:'create-gce-disk', + snap:$('#gsnap').val(), + number:$('#number').val(), + name:$('#gcpName').val()}, + mark: 'json'}) + }, + + render: function(){ + ghref = "https://accounts.google.com/o/oauth2/auth?response_type=token&scope=https://www.googleapis.com/auth/compute&redirect_uri=http://localhost:8443/home/pub/cloud/fab&client_id=719712694742-6htfj2t9s1j2jid92rc4dfq9psrr9qpo.apps.googleusercontent.com" + return( + div({}, [ + div({}, [ + b({onClick:this.createDisk}, 'Create Disk From Image'), + input({id:'gcpName',placeholder:'Name for GCE Disk and Instance'}), + input({id:'number',placeholder:'Number of instances'}), + input({id:'gsnap',placeholder:'Snapshot'}) + ]), + div({}, [ + a({href:ghref},"Get Google Authcode"), + b({onClick:this.props.handleClick('gce')}, "Send Google Authcode") + ]), + div({}, [ + input({id:"gappsecret"}, + b({onClick:this.props.sendSecret('gce','#gappsecret')}, "Send Google Secret")) + ]), + div({}, [ + b({onClick:this.createDroplet}, "Create Droplet"), + input({id:"project",placeholder:"project"}), + input({id:"zone",placeholder:"zone"}), + input({id:"gname",placeholder:"Name of droplet"}), + input({id:"machine_type",placeholder:"Machine Type"}), + //input({id:"image",placeholder:"Image"}), + ]) + ])) + } +}) + Droplet = React.createClass({ dropletAction:function(id, action){ urb.send({ appl:"cloud", - data: {action: action, - id: id}}) - }, - - rebootDroplet: function() { - urb.send({ - appl: "cloud", - data: {action: 'reboot', - id: this.props.id}}) + data: {action:action, + id:id}}) }, render: function() { var $this = this //local var, else it always points at second - var acts = ["reboot","power_cycle","shutdown","power_off","power_on","password_reset", - "enable_ipv6","enable_private_networking","snapshot","upgrade"] + var acts = ["start","stop","reboot","delete"] var buttons = []; var buttons = acts.map(function(act){ console.log($this.props.id) @@ -50,10 +155,11 @@ Page = recl({ handleClick: function(platform){ return function(){ console.log(platform); + console.log(window.authcode.platform) if(window.authcode.length !== ''){ urb.send({ appl: "cloud", - data: {authcode:window.authcode, + data: {authcode:authcode[platform], platform:platform}, mark: "cloud-auth"}) } else { console.log("nocode") } @@ -79,68 +185,18 @@ Page = recl({ mark: "json"}) }, - createDroplet: function(){ - urb.send({appl: "cloud", - data: { - action:'create', - name:$('#name').val(), - region:$('#region').val(), - size:$('#size').val(), - image:$('#image').val(), - ssh:[], // $('#ssh').val()] - backups:null,//$('#backups').val(), - ipv6:null,//$('#ipv6').val(), - priv_networking:null,//$('#priv-networking').val(), - user_data:null//$('#user-data').val() - }, - mark: "json"}) - }, render: function(){ - href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fhome%2Fpub%2Fcloud%2Ffab&response_type=code&scope=read+write" - ghref = "https://accounts.google.com/o/oauth2/auth?response_type=token&scope=https://www.googleapis.com/auth/compute&state=someinfo&redirect_uri=http://localhost:8443/home/pub/cloud/fab&client_id=720541965785-jr3c6ijo8abonu9qj77qre1itsdra52r.apps.googleusercontent.com" - return (div({}, [ - div({}, - a({href:href},[ - "get authcode" - ]), - b({onClick:this.handleClick('do')}, "Send Authcode") - ), - div({}, [ - input({id:"appsecret"}, - b({onClick:this.sendSecret('do','#appsecret')}, "Send Secret")) - ]), - b({onClick:this.getList}, "Get List"), - div({}, - a({href:ghref},[ - "Get Google Authcode" - ]), - b({onClick:this.handleClick('gce','#gappsecret')}, "Send Google Authcode") - ), - div({}, [ - input({id:"gappsecret"}, - b({onClick:this.sendSecret('gce')}, "Send Google Secret")) - ]), - div({}, [ - b({onClick:this.createDroplet}, "Create Droplet"), - input({id:"name",placeholder:"Name of droplet"}), - input({id:"region",placeholder:"Region"}), - input({id:"size",placeholder:"Size (str ending in mb"}), - input({id:"image",placeholder:"Image"}), - input({id:"ssh",placeholder:"ssh keys (optional)"}), - input({id:"backups",placeholder:"backups (optional)"}), - input({id:"ipv6",placeholder:"ipv6 (boolean, optional)"}), - input({id:"user-data",placeholder:" user-data string (optional)"}), - input({id:"priv-networking",placeholder:"Private Networking (boolean, optional)"}) - ]), - div({}, - this.props.droplets.map(Droplet) - ) - ]) - ) + return (div({}, + DOControls({handleClick:this.handleClick,sendSecret:this.sendSecret}), + GCEControls({handleClick:this.handleClick,sendSecret:this.sendSecret}), + this.props.droplets.map(Droplet) + )) } }) +var hash = HashToJSON() //pull out hash of query string for gce authcode +authcode.gce = hash.access_token mounted = React.render(Page({droplets:[]}), $("#container")[0]) urb.bind("/", function(err,d) { From 23fbe88af9ae587d952a7b40629a99617693f1de Mon Sep 17 00:00:00 2001 From: Henry Ault Date: Tue, 2 Jun 2015 12:51:29 -0700 Subject: [PATCH 04/37] better gcp commands --- base/ape/cloud/core.hook | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/base/ape/cloud/core.hook b/base/ape/cloud/core.hook index 52a1181f7c..d9dfe2fe15 100644 --- a/base/ape/cloud/core.hook +++ b/base/ape/cloud/core.hook @@ -260,6 +260,13 @@ $% [%diff %json json] $= action $? %start %stop %reboot %delete == == + =+ d=(~(got by insts.vat) id) + ~| 'can\'t find id' + =+ typ=?~(d !! -.d) + ~& typ + ~! typ + ?- typ + %do =+ meth=?:(?=(%delete action) %delt [%post (jobe type/s/(convert-do action) ~)]) ^- move ~& 'do i get here?' @@ -274,6 +281,9 @@ $% [%diff %json json] *quay == req + %gce + !! + == :: ++ create-do |= [os=bone act=json] @@ -408,7 +418,6 @@ $% [%diff %json json] ~| 'bad-json'^items %+ turn items |= in=json - =- ~! want=*[@t instance] ~! have=- - =< [id .] ^- instance :- %gce From ee4eb06e931fca0c256fb7e65eebcb090bd24465 Mon Sep 17 00:00:00 2001 From: ault011 Date: Tue, 2 Jun 2015 13:17:34 -0700 Subject: [PATCH 05/37] cloud not ready --- base/ape/cloud/core.hook | 537 --------------------------------------- 1 file changed, 537 deletions(-) delete mode 100644 base/ape/cloud/core.hook diff --git a/base/ape/cloud/core.hook b/base/ape/cloud/core.hook deleted file mode 100644 index d9dfe2fe15..0000000000 --- a/base/ape/cloud/core.hook +++ /dev/null @@ -1,537 +0,0 @@ -:: digital ocean fleet management -:: -:::: - :: -/? 314 -/- *talk -/+ talk, sole, http - -:: -:: -:::: sivtyv-barnel - :: - -!: -|% -++ instance -$: plat=?(%do %gce) name=@t id=@t status=@t created=@da snapshot=name=@t ::disk=@u region=@t -ip=(list ,@if) -== -++ create-req-do -$: -name=@t ::region=@t -size=@t image=@t ssh=(list cord) -backups=(unit ,?) ipv6=(unit ,?) -private-networking=(unit ,?) user-data=(unit ,@t) -== -++ create-req-gce ,[project=@t zone=@t name=@t machine-type=@t] -++ axle -$: auth=[do=keys gce=keys] toke=[do=tokens gce=tokens] - insts=(map ,@t instance) -== -++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)] -++ tokens ,[access=@t refresh=@t] -++ move ,[bone card] -++ card -$% [%diff %json json] - [%wait wire @da] - [%send wire [ship term] %poke %talk-command command] - [%them wire (unit hiss)] -== --- -!: -|% ::: -++ parse-iso8601 - =< (cook to-time (parsf ;"{parse-day}T{parse-seconds}{parse-zone}")) - |% - ++ to-time - |= [[y=@u m=@u d=@u] t=[h=@u m=@u s=@u ms=@u] [syn=? zh=@u zm=@u]] - ^- @da - %- year - ^- date - =: h.t ?:(syn (sub h.t zh) (add h.t zh)) - m.t ?:(syn (sub m.t zm) (add m.t zm)) - == - [[& y] m d h.t m.t s.t (div (mul ms.t 0x1.0000) 1.000) ~] - ++ parse-day (parsf ;"{dem}\-{dem}\-{dem}") - ++ parse-seconds (parsf ;"{dem}:{dem}:{dem}{(optional ;~(pfix dot dem))}") - ++ optional |*(fel=_rule ;~(pose fel (easy 0))) - ++ parse-zone - ;~ pose - (cold [& 0 0] (jest 'Z')) - (parsf ;"{parse-zone-sign}{dem}:{dem}") - == - ++ parse-zone-sign ;~(plug ;~(pose (cold & lus) (cold | hep))) - -- -++ key-do - (mo [%start 'power_on'] [%stop 'shutdown'] [%reboot 'power_cycle'] ~) -++ adapter-do - |= a=cord - (~(got by key-do) a) -++ parse-ip-do - => jo - %- ot - :_ ~ v4/(ar (ot 'ip_address'^(su lip:ag) ~)) -++ parse-ip-gce - => jo - %+ cu |=(a=(list (list ,@if)) `(list ,@if)`(zing a)) - (ar (ot 'accessConfigs'^(ar (ot 'natIP'^(su lip:ag) ~)) ~)) -++ tail-url - |= a=cord - -:(flop q.q:(need (epur a))) -++ parse-region - => jo - (ot name/so ~) -++ parse-id-text - |= jon=json - ?.(?=([?(%n %s) *] jon) ~ (some p.jon)) -++ create-do-body - |= $: name=@t ::region=@t - size=@t image=@t ssh-keys=(list cord) - backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t) - == - %- jobe - :~ name/s/name ::region/s/region - size/s/size image/s/image ::(jone image) - backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6) - 'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking) - == -++ convert-do - |= a=?(%start %stop %reboot) - ?- a - %start - 'power_on' - %stop - 'shutdown' - %reboot - 'power_cycle' - == -++ state-to-json - |= a=(list instance) - :- %a - %+ turn a - |= instance - ^- json - %- jobe - :~ name/`json`s/name - id/s/id - status/s/status - created/s/(crip (dust (yore created))) - ::region/s/region - snapshot/s/snapshot - :: disk/`json`(jone disk) - ip/a/(turn ip |=(a=@if s/(rsh 3 1 (scot %if a)))) - == --- -!: -|_ [hid=hide vat=axle] -:: -::++ prep ,_`. -:: -++ peer - |= [[ost=bone you=ship] pax=path] - ^- [(list move) _+>.$] - :_ +>.$ - =+ lis=(~(tap by insts.vat)) - [ost %diff %json (state-to-json (turn lis |=(a=[@t instance] +.a)))]~ -:: -++ spam - |= jon=json - %+ turn (~(tap by sup.hid)) - |= [sub=bone @ pax=path] - ^- move - [sub %diff %json jon] -++ httpreq - |= $: ost=bone pour-path=wire - domain=(list cord) end-point=path - req-type=$?(%get %delt [%post json]) headers=math - queries=quay - == - ^- move - =+ ^- parsed-url=purl - :+ ^= host-port :: ++hart - :+ security=%.y - port=~ - host=[%.y [path=[%com domain]]] - endpoint=[extensions=~ point=end-point] :: ++pork, - q-strings=queries :: ++quay - =+ ^- request=hiss :: cast to hiss - :- parsed-url - ?@ req-type - [req-type headers ~] - [%post headers ~ (tact (pojo +.req-type))] - :^ ost %them pour-path - `(unit hiss)`[~ request] -:: -++ auth-queries - |= code=cord - :~ 'grant_type'^'authorization_code' - 'code'^code - :- 'client_id' - 'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f' - 'redirect_uri'^'http://localhost:8443/home/pub/cloud/fab' - == -:: -++ poke-cloud-auth - |= [[ost=bone you=ship] [cde=cord typ=cord]] - ^- [(list move) _+>.$] - ?: =(%do typ) - =. authc.do.auth.vat - [~ cde] - :_ +>.$ ~ - =. access.gce.toke.vat - cde - :_ +>.$ - :- (list-instances-gce ost) - ~ -:: -++ poke-cloud-secret - |= [[ost=bone you=ship] secret=cord typ=cord] - ^- [(list move) _+>.$] - ?+ typ ~|(missing-platform=typ !!) - %do - =. client-secret.do.auth.vat - [~ secret] - :_ +>.$ - :_ ~ - %^ httpreq ost /auth-do - :^ ~[%digitalocean %cloud] `path`/v1/oauth/token - [%post ~] - :- ~ `quay`['client_secret'^secret (auth-queries (need authc.do.auth.vat))] - %gce - =. client-secret.gce.auth.vat - [~ secret] - :_ +>.$ - :_ ~ - %^ httpreq ost /auth-gce - :^ ~[%google %cloud] `path`/v1/oauth/token - [%post ~] - :- (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~) - `quay`['client_secret'^secret %'access_token'^(need authc.gce.auth.vat) ~] ::(auth-queries (need authc.gcp.auth.vat))] - == -:: -++ receive-auth - |= [ost=bone pour-path=cord resp=httr] - ^- [(list move) _+>.$] - ~| resp - =+ body=(rash q:(need r.resp) apex:poja) - ~| recieve-auth/resp(r body) - ?+ pour-path !! - %auth-do - =+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body)) - =: access.do.toke.vat ac - refresh.do.toke.vat re - == - :_ +>.$ - :~ (list-instances-do ost) - (publish ost our.hid [%lin & 'successfully authenticated']~) - == - %auth-gce - :_ +>.$ - ~ - == -:: -++ poke-json - |= [[ost=bone you=ship] act=json] - ^- [(list move) _+>.$] - =+ do=(need ((ot action/so ~):jo act)) - :_ +>.$ - :_ ~ - ?+ do !! - %list - (list-instances-do ost) - :: - %create-do - (create-do ost act) - :: - %create-gce-disk - (create-gce-disk ost act) - :: - %create-gce - (create-gce ost act) - :: - ?(%start %stop %reboot %delete) - =+ id=(need ((ot id/so ~):jo act)) - (instance-action ost id do) - == -:: -++ instance-action - |= $: os=bone id=@t - $= action $? - %start %stop %reboot %delete - == == - =+ d=(~(got by insts.vat) id) - ~| 'can\'t find id' - =+ typ=?~(d !! -.d) - ~& typ - ~! typ - ?- typ - %do - =+ meth=?:(?=(%delete action) %delt [%post (jobe type/s/(convert-do action) ~)]) - ^- move - ~& 'do i get here?' - =+ ^= req - %- httpreq :* - os /action-test - ~[%digitalocean %api] - ?:(?=(%delt meth) /v2/droplets/[id] /v2/droplets/[id]/actions) - meth - %^ mo ['Content-Type' 'application/json' ~] - ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~ - *quay - == - req - %gce - !! - == -:: -++ create-do - |= [os=bone act=json] - =+ ^- deets=create-req-do - %- need - %. act - => jo - %- ot - :~ name/so size/so image/so :: id key:img object region/so - ssh/(ar so) backups/(mu bo) - 'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so) - == - =+ ^- body=json - %- create-do-body :* - name.deets size.deets image.deets ssh.deets backups.deets ::region.deets - ipv6.deets private-networking.deets user-data.deets - == - %- httpreq :* - os /create-do - ~[%digitalocean %api] /v2/droplets - [%post body] - %^ mo ['Content-Type' 'application/json; charset=utf-8' ~] - ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] - ~ - ~ - == -:: -++ create-gce-disk - |= [os=bone act=json] :: num=(unit ,@u) - :: =. name ?~(num name ... - =+ :- name=(need ((ot name/so ~):jo act)) - snap=(need ((ot snap/so ~):jo act)) - =+ ^- body=json - (jobe name/s/name %'sourceSnapshot'^s/'compute/v1/projects/urbcloud/global/snapshots/snapshot-1' ~) ::^so/snap ~) - %- httpreq - :* os /create-gce-disk - ~['googleapis' 'www'] /compute/v1/projects/urbcloud/zones/us-central1-b/disks - [%post body] - %^ mo ['Content-Type' 'application/json' ~] - ['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] - ~ - ~ - == -++ ask-disk-status - |= [os=bone pax=path] ^- move - =+ safe=(slav %uv ?~(pax !! -.pax)) - =+ link=(need (epur ?~(pax !! safe))) - =. r.link ['access_token'^access.gce.toke.vat r.link] - :^ os %them `wire`/disk-status - `(unit hiss)`[~ [link [%get ~ ~]]] -:: -++ disk-status ::receive - |= [ost=bone resp=httr] - ^- [(list move) _+>.$] - =+ hcode=p.resp - ?: =('200' hcode) - ~| 'did not receive 200' !! - =+ :-(parsed=(rash q:(need r.resp) apex:poja) jo) - =+ :- status=(need ((ot status/so ~) parsed)) - lin=(need ((ot 'selfLink'^so ~) parsed)) - =+ link=(scot %uv lin) - ?: =('DONE' status) - ~& resp - ~& 'boot disk now running, now starting instance' - =+ target=(need ((ot 'targetLink'^so ~):jo parsed)) - =+ nam=-:(flop q.q:(need (epur target))) - ~& nam - ::(create-gce-disk ost nam 'tbd') - :- ~ +>.$ - :_ +>.$ - [ost %wait `path`[%check-status link ~] `@da`(add ~s3 lat.hid)]~ :: refesh every 10 sec -:: -++ create-gce - |= [os=bone act=json] - =+ ^- deets=create-req-gce - %- need - %. act - => jo - %- ot - :~ project/so zone/so name/so %'machine_type'^so - == - =+ src=(cat 3 'compute/v1/projects/urbcloud/zones/us-central1-b/disks/' name.deets) - =+ ^- body=json - %- jobe - :~ name/s/'name-provided' 'machineType'^s/'zones/us-central1-b/machineTypes/n1-standard-1' - :- %disks :- %a :_ ~ - (jobe boot/b/%.y type/s/'persistent' source/s/src ~) - :- 'networkInterfaces' :- %a :_ ~ - (joba 'network' `json`[%s 'global/networks/default']) - == - %- httpreq - :* `bone`os `path`/create-gce - `(list cord)`~['googleapis' 'www'] `path`/compute/v1/projects/urbcloud/zones/us-central1-b/'instances' - [%post `json`body] - %^ mo ['Content-Type' 'application/json' ~] - ['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] - ~ - `quay`[%key access.gce.toke.vat]~ - == -:: -++ wake - |= [[ost=bone him=ship pour-path=path] ~] - ?+ -.pour-path !! - %refresh-do - :_ +>.$ - [(list-instances-do ost)]~ - %refresh-gce - :_ +>.$ - [(list-instances-gce ost)]~ - %check-status - :_ +>.$ - [(ask-disk-status ost +.pour-path)]~ - == -:: -++ list-instances-gce - |= os=bone - =+ ^= lis - :* os /list-gce - ~[%googleapis %www] /compute/v1/projects/urbcloud/zones/['us-central1-a']/'instances' - %get ~ - ^- quay - [%'access_token' access.gce.toke.vat]~ - == - (httpreq lis) -:: -++ receive-list-gce - |= [os=bone resp=httr] - ^- [(list move) _+>.$] - =+ parsed=(rash q:(need r.resp) apex:poja) :: body httr to json - =+ items=(need ((ot items/(ar some) ~):jo parsed)) - =+ ^- ins=(list ,[@t instance]) - ~| 'bad-json'^items - %+ turn items - |= in=json - =< [id .] - ^- instance - :- %gce - %- need - %. in =+ jo - %- ot - :~ name/so id/so status/so 'creationTimestamp'^(su parse-iso8601) ::zone/so - 'machineType'^(cu tail-url so) - 'networkInterfaces'^parse-ip-gce - == - =+ ^= new - %+ skip ins - |=(a=[@t instance] (~(has by insts.vat) id.a)) - =. insts.vat - (~(gas by insts.vat) new) - =+ buf=`@da`(add ~s10 lat.hid) - :_ +>.$ - =+ lis=(~(tap by insts.vat)) - :_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a)))) - [os %wait /refresh-gce buf] -:: -++ list-instances-do - |= os=bone - =+ ^= lis - :~ os /list-do - ~[%digitalocean %api] /v2/droplets - %get - (mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~) - == - (httpreq lis) -:: -++ receive-list-do - |= [ost=bone resp=httr] - ^- [(list move) _+>.$] - =+ parsed=(rash q:(need r.resp) apex:poja) :: parse httr to json - ~| recieve-list/parsed - =+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) :: reparse ar of insts - =. insts.vat - %- ~(gas by insts.vat) - ^- dropz=(list ,[@t instance]) - ~| bad-json/-.dar - %+ turn dar - |= drp=json ^- [@t instance] - =- ~! - - - =< [id .] - ^- instance - :- %do - %- need - %. drp - =+ jo - %- ot - :~ name/so id/parse-id-text status/so 'created_at'^(su parse-iso8601) ::region/parse-region - image/(ot name/so ~) ::disk/ni - networks/parse-ip-do - == - =+ buf=`@da`(add ~s10 lat.hid) - :_ +>.$ - =+ lis=(~(tap by insts.vat) *(list ,[@t instance])) - :_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a)))) - [ost %wait /refresh-do buf] - -++ thou - |= [[ost=bone him=ship pour-path=path] resp=httr] - ^- [(list move) _+>.$] - ?+ -.pour-path ~& pour-path !! - %auth-do - (receive-auth ost -.pour-path resp) - :: - %auth-gce - (receive-auth ost -.pour-path resp) - :: - %list-do - (receive-list-do ost resp) - %list-gce - (receive-list-gce ost resp) -:: :_ +>.$ -:: ~ - :: - $? - %delete %reboot %'power_cycle' %shutdown %'power_off' - %'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking' - %snapshot %upgrade :: add retrieve droplet action - %create-do %create-gce %action-test - == - ~& resp - :_ +>.$ ~ - :: - ?(%create-gce-disk %disk-status) - (disk-status ost resp) - :: - %check-status - :_ +>.$ ~[(ask-disk-status ost +.pour-path)] - :: - %pub - :_ +>.$ ~ - :: - == -++ publish - |= [ost=bone you=ship act=(list speech)] - ^- move - =+ ^= spchz - %+ turn act - |= sp=speech - =+ ^= tail - :- ^- audience - :+ :- `partner`[%& our.hid ?+((clan our.hid) !! %czar %court, %duke %porch)] - ^- (pair envelope delivery) - [`envelope`[& ~] %pending] - ~ - ~ - `statement`[lat.hid ~ sp] - ^- thought - :- `@`(sham eny.hid tail) - tail - =+ mez=[%talk-command [%publish `(list thought)`spchz]] - [ost %send /pub [our.hid %talk] %poke mez] --- From c3a18d3c91e1e755d16257337c59ed9020ec2257 Mon Sep 17 00:00:00 2001 From: ault011 Date: Tue, 2 Jun 2015 13:18:37 -0700 Subject: [PATCH 06/37] Delete hymn.hook --- base/pub/cloud/fab/hymn.hook | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 base/pub/cloud/fab/hymn.hook diff --git a/base/pub/cloud/fab/hymn.hook b/base/pub/cloud/fab/hymn.hook deleted file mode 100644 index 05b8131d63..0000000000 --- a/base/pub/cloud/fab/hymn.hook +++ /dev/null @@ -1,30 +0,0 @@ -:: -:::: - ::: -/? 310 -/= gas /$ fuel -:: -:::: - :: - !: -^- manx -=+ do=(~(get by qix.gas) %'code') - -;html - ;head - ;script@"/~/at/home/lib/urb.js"; - ;script: urb.appl = 'cloud' - ;script@"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"; - ;script@"https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js"; - ::;link/"/main/pub/cloud/src/main.css"(rel "stylesheet"); - ;title: DO & GCE Manager - == - ;body - ;script:""" - var authcode = \{} - authcode.do='{?~(do ~ (trip u.do))}' - """ - ;div#container; - ;script@"/home/pub/cloud/src/main.js"; - == -== From 5df03ea9b1e7fbf167956d28dd0d40ea7a757da1 Mon Sep 17 00:00:00 2001 From: ault011 Date: Tue, 2 Jun 2015 13:19:10 -0700 Subject: [PATCH 07/37] Delete main.js --- base/pub/cloud/src/main.js | 205 ------------------------------------- 1 file changed, 205 deletions(-) delete mode 100644 base/pub/cloud/src/main.js diff --git a/base/pub/cloud/src/main.js b/base/pub/cloud/src/main.js deleted file mode 100644 index faade1da3a..0000000000 --- a/base/pub/cloud/src/main.js +++ /dev/null @@ -1,205 +0,0 @@ -recl = React.createClass -div = React.DOM.div -a = React.DOM.a -b = React.DOM.button -hr = React.DOM.hr -table = React.DOM.table -th = React.DOM.th -tr = React.DOM.tr -td = React.DOM.td -input = React.DOM.input - -function HashToJSON() { - var pairs = window.location.hash.slice(1).split('&'); - var result = {}; - pairs.forEach(function(pair) { - pair = pair.split('='); - result[pair[0]] = decodeURIComponent(pair[1] || ''); - }); - - return JSON.parse(JSON.stringify(result)); -} - - -DOControls = React.createClass({ - createDroplet: function(){ - urb.send({appl: "cloud", - data: { - action:'create-do', - name:$('#name').val(), - region:$('#region').val(), - size:$('#size').val(), - image:$('#image').val(), - ssh:[], // $('#ssh').val()] - backups:null,//$('#backups').val(), - ipv6:null,//$('#ipv6').val(), - priv_networking:null,//$('#priv-networking').val(), - user_data:null//$('#user-data').val() - }, - mark: "json"}) - }, - - render: function(){ - href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fhome%2Fpub%2Fcloud%2Ffab&response_type=code&scope=read+write" - return ( - div({}, [ - div({}, - a({href:href},"get authcode"), - b({onClick:this.props.handleClick('do')}, "Send Authcode") - ), - div({}, [ - input({id:"appsecret"}, - b({onClick:this.props.sendSecret('do','#appsecret')}, "Send Secret")) - ]), - - div({}, [ - b({onClick:this.createDroplet}, "Create Droplet"), - input({id:"name",placeholder:"Name of droplet"}), - input({id:"region",placeholder:"Region"}), - input({id:"size",placeholder:"Size (str ending in mb"}), - input({id:"image",placeholder:"Image"}), - input({id:"ssh",placeholder:"ssh keys (optional)"}), - input({id:"backups",placeholder:"backups (optional)"}), - input({id:"ipv6",placeholder:"ipv6 (boolean, optional)"}), - input({id:"user-data",placeholder:" user-data string (optional)"}), - input({id:"priv-networking",placeholder:"Private Networking (boolean, optional)"}) - ]) - ]) - ) - } -}) - -GCEControls = React.createClass({ - createDroplet: function(){ - urb.send({ - appl: 'cloud', - data: {action:'create-gce', - project:$('#project').val(), - zone:$('#zone').val(), - name:$('#gname').val(), - machine_type:$('#machine_type').val() - }, - mark: 'json'}) - }, - - createDisk: function(){ - urb.send({ - appl: 'cloud', - data: {action:'create-gce-disk', - snap:$('#gsnap').val(), - number:$('#number').val(), - name:$('#gcpName').val()}, - mark: 'json'}) - }, - - render: function(){ - ghref = "https://accounts.google.com/o/oauth2/auth?response_type=token&scope=https://www.googleapis.com/auth/compute&redirect_uri=http://localhost:8443/home/pub/cloud/fab&client_id=719712694742-6htfj2t9s1j2jid92rc4dfq9psrr9qpo.apps.googleusercontent.com" - return( - div({}, [ - div({}, [ - b({onClick:this.createDisk}, 'Create Disk From Image'), - input({id:'gcpName',placeholder:'Name for GCE Disk and Instance'}), - input({id:'number',placeholder:'Number of instances'}), - input({id:'gsnap',placeholder:'Snapshot'}) - ]), - div({}, [ - a({href:ghref},"Get Google Authcode"), - b({onClick:this.props.handleClick('gce')}, "Send Google Authcode") - ]), - div({}, [ - input({id:"gappsecret"}, - b({onClick:this.props.sendSecret('gce','#gappsecret')}, "Send Google Secret")) - ]), - div({}, [ - b({onClick:this.createDroplet}, "Create Droplet"), - input({id:"project",placeholder:"project"}), - input({id:"zone",placeholder:"zone"}), - input({id:"gname",placeholder:"Name of droplet"}), - input({id:"machine_type",placeholder:"Machine Type"}), - //input({id:"image",placeholder:"Image"}), - ]) - ])) - } -}) - -Droplet = React.createClass({ - dropletAction:function(id, action){ - urb.send({ - appl:"cloud", - data: {action:action, - id:id}}) - }, - - render: function() { - var $this = this //local var, else it always points at second - var acts = ["start","stop","reboot","delete"] - var buttons = []; - var buttons = acts.map(function(act){ - console.log($this.props.id) - return b({onClick:function(){ - $this.dropletAction($this.props.id, act) - }}, act) - }) - kay = Object.keys(this.props) - kay = kay.filter(function(b){return b!="children"}) // XX individually adress props - return div({}, - buttons, - table({}, - tr({},kay.map(function(k){return th({},k)})), - tr({},kay.map(function(k){return td({},JSON.stringify($this.props[k]))}))), - hr()) - } -}) - -Page = recl({ - handleClick: function(platform){ - return function(){ - console.log(platform); - console.log(window.authcode.platform) - if(window.authcode.length !== ''){ - urb.send({ - appl: "cloud", - data: {authcode:authcode[platform], - platform:platform}, - mark: "cloud-auth"}) - } else { console.log("nocode") } - } - }, - - sendSecret: function(platform,codeid){ - return function(){ - console.log(platform,codeid) - secret= $(codeid).val() - if(secret !== '') { - urb.send({appl: "cloud", - data: {secret:secret, - platform:platform}, - mark: "cloud-secret"}) - } - } - }, - - getList: function(){ - urb.send({appl: "cloud", - data: {action:"list"}, - mark: "json"}) - }, - - - render: function(){ - return (div({}, - DOControls({handleClick:this.handleClick,sendSecret:this.sendSecret}), - GCEControls({handleClick:this.handleClick,sendSecret:this.sendSecret}), - this.props.droplets.map(Droplet) - )) - } -}) - -var hash = HashToJSON() //pull out hash of query string for gce authcode -authcode.gce = hash.access_token - -mounted = React.render(Page({droplets:[]}), $("#container")[0]) -urb.bind("/", function(err,d) { - - mounted.setProps({droplets:d.data}) -return}) From 1afa1602e987c1671a84e78314c0deb03099bd05 Mon Sep 17 00:00:00 2001 From: ault011 Date: Tue, 2 Jun 2015 13:19:16 -0700 Subject: [PATCH 08/37] Delete main.css --- base/pub/cloud/src/main.css | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 base/pub/cloud/src/main.css diff --git a/base/pub/cloud/src/main.css b/base/pub/cloud/src/main.css deleted file mode 100644 index e69de29bb2..0000000000 From c21b335a36cf7e83fcb5fcaa4103293b82c2e8f9 Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Wed, 3 Jun 2015 16:29:41 -0400 Subject: [PATCH 09/37] better ames pass paths for debugging --- base/arvo/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/arvo/ames.hoon b/base/arvo/ames.hoon index ad3922acd9..654c9d44a6 100644 --- a/base/arvo/ames.hoon +++ b/base/arvo/ames.hoon @@ -1717,7 +1717,7 @@ =. ton.fox (~(su go ton.fox) gus) :_ fox :~ :- hen - [%pass ~ %a %want p.bon [%r %ta t.t.q.q.bon] `(unit will)`wyl] + [%pass /ta/beginning %a %want p.bon [%r %ta t.t.q.q.bon] `(unit will)`wyl] == %re :: %re :_ fox From e2124792cce76da479f326588bb7aaf58f3259f7 Mon Sep 17 00:00:00 2001 From: Charlie Cummings Date: Thu, 11 Jun 2015 14:55:02 -0400 Subject: [PATCH 10/37] runnable
 examples

---
 base/lib/react/core.hook | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/base/lib/react/core.hook b/base/lib/react/core.hook
index d4aae3e0ba..98d62c580b 100644
--- a/base/lib/react/core.hook
+++ b/base/lib/react/core.hook
@@ -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)

From 098bb0fed7cd08a19c1e8ade99b157dd93f5ead4 Mon Sep 17 00:00:00 2001
From: Anton Dyudin 
Date: Tue, 16 Jun 2015 14:36:04 -0700
Subject: [PATCH 11/37] rectify tree and cat usage of %tang

---
 base/arvo/gall.hoon | 5 ++---
 base/cat/cat.hoon   | 2 +-
 base/cat/tree.hoon  | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/base/arvo/gall.hoon b/base/arvo/gall.hoon
index bf6cb0e8e7..8cb7fff562 100644
--- a/base/arvo/gall.hoon
+++ b/base/arvo/gall.hoon
@@ -918,9 +918,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
diff --git a/base/cat/cat.hoon b/base/cat/cat.hoon
index 05168203b8..c054ecaf27 100644
--- a/base/cat/cat.hoon
+++ b/base/cat/cat.hoon
@@ -8,7 +8,7 @@
 ::::
   ::
 |=  [^ [arg=(list path)] ~]
-=-  tang/(zing -)
+=-  tang/(flop (zing -))
 %+  turn  arg
 |=  pax=path
 ^-  tang
diff --git a/base/cat/tree.hoon b/base/cat/tree.hoon
index bc3951205e..0a9bc91021 100644
--- a/base/cat/tree.hoon
+++ b/base/cat/tree.hoon
@@ -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  -

From 409d208cd9db22e94d7531562e0dc44fe612b4dc Mon Sep 17 00:00:00 2001
From: Galen Wolfe-Pauly 
Date: Tue, 16 Jun 2015 15:57:29 -0700
Subject: [PATCH 12/37] too many basepath

---
 .../tree/src/js/components/AnchorComponent.coffee |  6 ++++--
 base/pub/tree/src/js/main.js                      | 15 ++-------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/base/pub/tree/src/js/components/AnchorComponent.coffee b/base/pub/tree/src/js/components/AnchorComponent.coffee
index 5d598dfa63..2c56f1cbef 100644
--- a/base/pub/tree/src/js/components/AnchorComponent.coffee
+++ b/base/pub/tree/src/js/components/AnchorComponent.coffee
@@ -1,3 +1,5 @@
+# comment
+
 TreeStore   = require '../stores/TreeStore.coffee'
 TreeActions = require '../actions/TreeActions.coffee'
 
@@ -109,10 +111,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)
 
diff --git a/base/pub/tree/src/js/main.js b/base/pub/tree/src/js/main.js
index d15456b4f6..a78d40e1d2 100644
--- a/base/pub/tree/src/js/main.js
+++ b/base/pub/tree/src/js/main.js
@@ -71,7 +71,6 @@ module.exports = {
 };
 
 
-
 },{"../dispatcher/Dispatcher.coffee":8,"../persistence/TreePersistence.coffee":13}],2:[function(require,module,exports){
 var TreeActions, TreeStore, a, div, recl, ref;
 
@@ -219,7 +218,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 +226,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,
@@ -294,7 +293,6 @@ module.exports = recl({
 });
 
 
-
 },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14}],3:[function(require,module,exports){
 var TreeActions, TreeStore, div, input, load, recl, ref, textarea;
 
@@ -359,7 +357,6 @@ module.exports = recl({
 });
 
 
-
 },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14,"./LoadComponent.coffee":7}],4:[function(require,module,exports){
 var div, recl, ref, textarea;
 
@@ -383,7 +380,6 @@ module.exports = recl({
 });
 
 
-
 },{}],5:[function(require,module,exports){
 var TreeActions, TreeStore, a, div, hr, li, recl, ref, ul;
 
@@ -450,7 +446,6 @@ module.exports = recl({
 });
 
 
-
 },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14}],6:[function(require,module,exports){
 var TreeActions, TreeStore, a, div, h1, li, load, recl, ref, ul;
 
@@ -545,7 +540,6 @@ module.exports = recl({
 });
 
 
-
 },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14,"./LoadComponent.coffee":7}],7:[function(require,module,exports){
 var div, input, recl, ref, textarea;
 
@@ -583,7 +577,6 @@ module.exports = recl({
 });
 
 
-
 },{}],8:[function(require,module,exports){
 var Dispatcher;
 
@@ -605,7 +598,6 @@ module.exports = _.extend(new Dispatcher(), {
 });
 
 
-
 },{"flux":10}],9:[function(require,module,exports){
 var rend;
 
@@ -765,7 +757,6 @@ $(function() {
 });
 
 
-
 },{"./actions/TreeActions.coffee":1,"./components/AnchorComponent.coffee":2,"./components/BodyComponent.coffee":3,"./components/CodeMirror.coffee":4,"./components/KidsComponent.coffee":5,"./components/ListComponent.coffee":6,"./persistence/TreePersistence.coffee":13}],10:[function(require,module,exports){
 /**
  * Copyright (c) 2014-2015, Facebook, Inc.
@@ -1106,7 +1097,6 @@ module.exports = {
 };
 
 
-
 },{"../actions/TreeActions.coffee":1}],14:[function(require,module,exports){
 var EventEmitter, MessageDispatcher, TreeStore, _cont, _curr, _load, _snip, _tree;
 
@@ -1320,7 +1310,6 @@ TreeStore.dispatchToken = MessageDispatcher.register(function(payload) {
 module.exports = TreeStore;
 
 
-
 },{"../dispatcher/Dispatcher.coffee":8,"events":15}],15:[function(require,module,exports){
 // Copyright Joyent, Inc. and other Node contributors.
 //

From 8a8055ba3a0005c7fe0fdd7419d48ac4981cb194 Mon Sep 17 00:00:00 2001
From: Anton Dyudin 
Date: Tue, 16 Jun 2015 18:06:58 -0700
Subject: [PATCH 13/37] demo sched mark

---
 base/cat/cat.hoon   |  4 +++-
 base/mar/sched.hoon | 29 +++++++++++++++++++++++++++++
 base/pub/test.sched |  3 +++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 base/mar/sched.hoon
 create mode 100644 base/pub/test.sched

diff --git a/base/cat/cat.hoon b/base/cat/cat.hoon
index c054ecaf27..c93260303b 100644
--- a/base/cat/cat.hoon
+++ b/base/cat/cat.hoon
@@ -8,12 +8,14 @@
 ::::
   ::
 |=  [^ [arg=(list path)] ~]
-=-  tang/(flop (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
     ~
diff --git a/base/mar/sched.hoon b/base/mar/sched.hoon
new file mode 100644
index 0000000000..7d3b15682e
--- /dev/null
+++ b/base/mar/sched.hoon
@@ -0,0 +1,29 @@
+!:
+::::  /hoon/core/sched/mar
+  ::
+|_  dat=(map ,@da cord)
+++  grow                                                ::  convert to
+  |%  ++  mime  `^mime`[/text/x-sched (tact tape)]
+      ++  tape  
+        (zing `wall`(turn sorted-list |=([a=@da b=cord] "{} {(trip b)}\0a")))
+      ++  elem  =<  ;list: *{(turn sorted-list .)}
+                |=  [tym=@da ite=cord]  ^-  manx
+                ;li: ;{b "{}"}: {(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
+--        --
diff --git a/base/pub/test.sched b/base/pub/test.sched
new file mode 100644
index 0000000000..84e85f6e1b
--- /dev/null
+++ b/base/pub/test.sched
@@ -0,0 +1,3 @@
+~1970.1.1 Hello world
+~1970.2.1 Hallo world?
+~1970.1.2 Reordered for goo reason

From 60f5becaa70865c53bdd01e516328eb5108fdfc7 Mon Sep 17 00:00:00 2001
From: Anton Dyudin 
Date: Wed, 17 Jun 2015 10:54:25 -0700
Subject: [PATCH 14/37] |schedule add to .sched

Demo suggestion:
- vim :set autoread, :e pier/home/pub/test.sched (TODO: rename)
- http://zod.local/home/pub/test -- ordered
- add an element in vim -- still ordered
- +cat %/pub/test -- data structure, hash order
- |schedule %/pub/test ~2016.5.5..07.30.00 'new event' -- vim now ordered, reloaded alongside web
- +cat it again for good measure?
---
 base/ape/hood.hoon          |  1 +
 base/arvo/ford.hoon         |  9 ++++++---
 base/arvo/zuse.hoon         |  3 ++-
 base/cat/hood/schedule.hoon |  1 +
 base/lib/kiln.hoon          | 15 +++++++++++----
 base/mar/sched.hoon         |  2 +-
 6 files changed, 22 insertions(+), 9 deletions(-)
 create mode 100644 base/cat/hood/schedule.hoon

diff --git a/base/ape/hood.hoon b/base/ape/hood.hoon
index ce5d3318c2..b719c7e9e8 100644
--- a/base/ape/hood.hoon
+++ b/base/ape/hood.hoon
@@ -88,6 +88,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
diff --git a/base/arvo/ford.hoon b/base/arvo/ford.hoon
index 881f66c36f..fa7c31e082 100644
--- a/base/arvo/ford.hoon
+++ b/base/arvo/ford.hoon
@@ -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 {} {<(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)  (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]
diff --git a/base/arvo/zuse.hoon b/base/arvo/zuse.hoon
index 55fe5cf595..e6590e7ba6 100644
--- a/base/arvo/zuse.hoon
+++ b/base/arvo/zuse.hoon
@@ -1030,7 +1030,8 @@
   =+  dir=((hard arch) .^(%cy pax))
   ?~  q.dir  [%ins val]
   =+  for=((hard mark) -:(flop pax))
-  [%mut [for [%atom %$] .^(%cx pax)] val]
+  ?>  =(for p.val)
+  [%mut [for p.q.val .^(%cx pax)] val]
 ::
 ++  file                                                ::  simple file load
   |=  pax=path
diff --git a/base/cat/hood/schedule.hoon b/base/cat/hood/schedule.hoon
new file mode 100644
index 0000000000..8e94d034ca
--- /dev/null
+++ b/base/cat/hood/schedule.hoon
@@ -0,0 +1 @@
+|=([^ [where=path tym=@da eve=@t ~] ~] kiln-schedule/[where tym eve])
diff --git a/base/lib/kiln.hoon b/base/lib/kiln.hoon
index 8d32df42ab..cacc0c3cc8 100644
--- a/base/lib/kiln.hoon
+++ b/base/lib/kiln.hoon
@@ -101,23 +101,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))]
diff --git a/base/mar/sched.hoon b/base/mar/sched.hoon
index 7d3b15682e..85a5cb82f0 100644
--- a/base/mar/sched.hoon
+++ b/base/mar/sched.hoon
@@ -3,7 +3,7 @@
   ::
 |_  dat=(map ,@da cord)
 ++  grow                                                ::  convert to
-  |%  ++  mime  `^mime`[/text/x-sched (tact tape)]
+  |%  ++  mime  [/text/x-sched (tact tape)]
       ++  tape  
         (zing `wall`(turn sorted-list |=([a=@da b=cord] "{} {(trip b)}\0a")))
       ++  elem  =<  ;list: *{(turn sorted-list .)}

From 22f5d4bf49b82fea56f03518bdc84b2dec05da5c Mon Sep 17 00:00:00 2001
From: Anton Dyudin 
Date: Wed, 17 Jun 2015 12:49:03 -0700
Subject: [PATCH 15/37] fixed old-revision refresh loop, commented out
 real-nyet parser

---
 base/arvo/eyre.hoon | 36 ++++++++++++++++--------------------
 base/arvo/hoon.hoon |  3 ++-
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/base/arvo/eyre.hoon b/base/arvo/eyre.hoon
index 98670d98fc..6359c534ab 100644
--- a/base/arvo/eyre.hoon
+++ b/base/arvo/eyre.hoon
@@ -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)
diff --git a/base/arvo/hoon.hoon b/base/arvo/hoon.hoon
index aedc91d37f..8dbcec2e45 100644
--- a/base/arvo/hoon.hoon
+++ b/base/arvo/hoon.hoon
@@ -3701,7 +3701,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=@])]  
@@ -9147,6 +9147,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)))]

From 4e406694e01e45f60b9c3c4f80eaa88c8f1314ef Mon Sep 17 00:00:00 2001
From: Anton Dyudin 
Date: Wed, 17 Jun 2015 13:26:53 -0700
Subject: [PATCH 16/37] update talk help from readme, closing #293

---
 base/pub/doc/talk/help.txt | 56 ++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/base/pub/doc/talk/help.txt b/base/pub/doc/talk/help.txt
index 1d1f3bf495..eaf20e62a4 100644
--- a/base/pub/doc/talk/help.txt
+++ b/base/pub/doc/talk/help.txt
@@ -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 ; and ;
-<-~wictuc-folrex: where ; "activates" a previous message
-<-~wictuc-folrex: and ; 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.
+
+    ;
+
+`;` activates a previous message number, like a URL that got
+clipped.
+
+    ;
+
+`;` 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.

From 74ea5dc5997e6e7aec5e68a8cb19490614374abf Mon Sep 17 00:00:00 2001
From: Raymond Pasco 
Date: Wed, 17 Jun 2015 17:11:40 -0400
Subject: [PATCH 17/37] Document ++ob

---
 base/pub/doc/hoon/library/2en.md | 97 ++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/base/pub/doc/hoon/library/2en.md b/base/pub/doc/hoon/library/2en.md
index 14ce8bf2f7..2af6ddc6d9 100644
--- a/base/pub/doc/hoon/library/2en.md
+++ b/base/pub/doc/hoon/library/2en.md
@@ -255,3 +255,100 @@ with 256 values, producing a byte.
     0x0
     ~zod/try=> `@ux`(zyrt:un 187)
     0xff
+
+

++ob

+ +Reversible scrambling core, v2 + + ++ ob + |% + +A core for performing reversible scrambling operations for the `@p` phonetic base. + +------------------------------------------------------------------------ + +

++feen

+ +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. + + ++ 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`](). + + ++ 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. + + ++ 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. + + ++ 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. + + ++ 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`](). + + ++ 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`](). From 6b9b3bf850cfc47c61ba605d5686ac5a70ab9344 Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Wed, 17 Jun 2015 14:16:43 -0700 Subject: [PATCH 18/37] Document ++ob formatting --- base/pub/doc/hoon/library/2en.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/base/pub/doc/hoon/library/2en.md b/base/pub/doc/hoon/library/2en.md index 2af6ddc6d9..452b6d6cba 100644 --- a/base/pub/doc/hoon/library/2en.md +++ b/base/pub/doc/hoon/library/2en.md @@ -284,6 +284,10 @@ Conceal structure, v2 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. +------------------------------------------------------------------------ + +

++fend

+ ++ fend :: restore structure v2 |= cry=@ ^- @ ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff)) @@ -297,6 +301,10 @@ Randomly permutes atoms that fit into 17 to 32 bits into one another. If the ato 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`](). +------------------------------------------------------------------------ + +

++fice

+ ++ fice :: adapted from |= nor=@ :: black and rogaway ^- @ :: "ciphers with @@ -309,6 +317,10 @@ Randomly permutes atoms that fit into 17 to 32 bits into one another, and random 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. +------------------------------------------------------------------------ + +

++teil

+ ++ teil :: reverse ++fice |= vip=@ ^- @ @@ -321,6 +333,10 @@ Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` 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. +------------------------------------------------------------------------ + +

++rynd

+ ++ rynd :: feistel round |= [n=@ l=@ r=@] ^- [@ @] @@ -331,6 +347,10 @@ Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike a A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is used as the round function. +------------------------------------------------------------------------ + +

++rund

+ ++ rund :: reverse round |= [n=@ l=@ r=@] ^- [@ @] @@ -341,6 +361,10 @@ A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is us A single round of the Feistel-like reverse cipher [`++teil`](). +------------------------------------------------------------------------ + +

++raku

+ ++ raku ^- (list ,@ux) :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3. From 8d29d40b1a921e9b9f439000c25b043536139f87 Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Wed, 17 Jun 2015 17:54:02 -0400 Subject: [PATCH 19/37] Cosmetic fixes to ++po --- base/arvo/hoon.hoon | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/base/arvo/hoon.hoon b/base/arvo/hoon.hoon index 8dbcec2e45..545a5f0063 100644 --- a/base/arvo/hoon.hoon +++ b/base/arvo/hoon.hoon @@ -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 From 2bb8921fdfbfedc4c5129d8622c95097190137a4 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 17 Jun 2015 15:31:44 -0700 Subject: [PATCH 20/37] removed extraneous cats and dogs --- base/ape/hood.hoon | 2 +- base/arvo/hoon.hoon | 12 +++++------ base/cat/helm/init.hoon | 12 ----------- base/cat/helm/mass.hoon | 12 ----------- base/cat/helm/merge.hoon | 12 ----------- base/cat/helm/reload.hoon | 12 ----------- base/cat/helm/start.hoon | 11 ---------- base/cat/helm/sync.hoon | 12 ----------- base/cat/helm/unix.hoon | 15 ------------- base/cat/hi/args.hoon | 1 - base/cat/hi/txt.hoon | 2 -- base/dog/helm/begin.hoon | 45 --------------------------------------- base/dog/helm/reload.hoon | 12 ----------- base/dog/helm/reset.hoon | 12 ----------- base/dog/helm/verb.hoon | 13 ----------- base/dog/hood/reload.hoon | 12 ----------- base/dog/hood/reset.hoon | 12 ----------- base/dog/hood/verb.hoon | 13 ----------- base/dog/solid.hoon | 40 ---------------------------------- 19 files changed, 7 insertions(+), 255 deletions(-) delete mode 100644 base/cat/helm/init.hoon delete mode 100644 base/cat/helm/mass.hoon delete mode 100644 base/cat/helm/merge.hoon delete mode 100644 base/cat/helm/reload.hoon delete mode 100644 base/cat/helm/start.hoon delete mode 100644 base/cat/helm/sync.hoon delete mode 100644 base/cat/helm/unix.hoon delete mode 100644 base/cat/hi/args.hoon delete mode 100644 base/cat/hi/txt.hoon delete mode 100644 base/dog/helm/begin.hoon delete mode 100644 base/dog/helm/reload.hoon delete mode 100644 base/dog/helm/reset.hoon delete mode 100644 base/dog/helm/verb.hoon delete mode 100644 base/dog/hood/reload.hoon delete mode 100644 base/dog/hood/reset.hoon delete mode 100644 base/dog/hood/verb.hoon delete mode 100644 base/dog/solid.hoon diff --git a/base/ape/hood.hoon b/base/ape/hood.hoon index b719c7e9e8..4fa4bdfdb7 100644 --- a/base/ape/hood.hoon +++ b/base/ape/hood.hoon @@ -72,12 +72,12 @@ :: ++ 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-hood-link (wrap poke-link):from-drum ++ poke-hood-mass (wrap poke-mass):from-helm ++ poke-hood-sync (wrap poke-sync):from-kiln ++ poke-hood-unsync (wrap poke-unsync):from-kiln ++ poke-hood-unix (wrap poke-unix):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 diff --git a/base/arvo/hoon.hoon b/base/arvo/hoon.hoon index 8dbcec2e45..06338f95c3 100644 --- a/base/arvo/hoon.hoon +++ b/base/arvo/hoon.hoon @@ -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] diff --git a/base/cat/helm/init.hoon b/base/cat/helm/init.hoon deleted file mode 100644 index 4b41d2f8bf..0000000000 --- a/base/cat/helm/init.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reload/helm/cat - :: -/? 314 -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [~ ~] - == -:- %helm-init -p.bec diff --git a/base/cat/helm/mass.hoon b/base/cat/helm/mass.hoon deleted file mode 100644 index 9fd3430cc9..0000000000 --- a/base/cat/helm/mass.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reload/helm/cat - :: -/? 314 -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [~ ~] - == -:- %helm-mass -~ diff --git a/base/cat/helm/merge.hoon b/base/cat/helm/merge.hoon deleted file mode 100644 index b94865f5c0..0000000000 --- a/base/cat/helm/merge.hoon +++ /dev/null @@ -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)] diff --git a/base/cat/helm/reload.hoon b/base/cat/helm/reload.hoon deleted file mode 100644 index 595f131ff6..0000000000 --- a/base/cat/helm/reload.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reload/helm/cat - :: -/? 314 -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [arg=(list term) ~] - == -:- %helm-reload -arg diff --git a/base/cat/helm/start.hoon b/base/cat/helm/start.hoon deleted file mode 100644 index eed889d0ea..0000000000 --- a/base/cat/helm/start.hoon +++ /dev/null @@ -1,11 +0,0 @@ -:: -:::: /hoon/start/helm/cat - :: -/? 314 -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [[who=@p dap=term ~] ~] - == -[%helm-start who dap] diff --git a/base/cat/helm/sync.hoon b/base/cat/helm/sync.hoon deleted file mode 100644 index 881fceefbb..0000000000 --- a/base/cat/helm/sync.hoon +++ /dev/null @@ -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 diff --git a/base/cat/helm/unix.hoon b/base/cat/helm/unix.hoon deleted file mode 100644 index fcb668e4bb..0000000000 --- a/base/cat/helm/unix.hoon +++ /dev/null @@ -1,15 +0,0 @@ -:: -:::: /hoon/unix/helm/cat - :: -/? 314 -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [[syd=@tas syn=?(~ [? ~])] ~] - == -:+ %helm-unix - syd -?~ syn - ~ -`-.syn diff --git a/base/cat/hi/args.hoon b/base/cat/hi/args.hoon deleted file mode 100644 index cc33d23f0d..0000000000 --- a/base/cat/hi/args.hoon +++ /dev/null @@ -1 +0,0 @@ -|=([^ args=[ship $|(~ [tape ~])] ~] hi-args/args) diff --git a/base/cat/hi/txt.hoon b/base/cat/hi/txt.hoon deleted file mode 100644 index 9ad747bf34..0000000000 --- a/base/cat/hi/txt.hoon +++ /dev/null @@ -1,2 +0,0 @@ -|= [^ [arg=cord ~] ~] -txt/arg diff --git a/base/dog/helm/begin.hoon b/base/dog/helm/begin.hoon deleted file mode 100644 index bab867922a..0000000000 --- a/base/dog/helm/begin.hoon +++ /dev/null @@ -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 ~] - == -== diff --git a/base/dog/helm/reload.hoon b/base/dog/helm/reload.hoon deleted file mode 100644 index 8707a52251..0000000000 --- a/base/dog/helm/reload.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reload/helm/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [arg=(list term) ~] - == -(sole-so %helm-reload arg) diff --git a/base/dog/helm/reset.hoon b/base/dog/helm/reset.hoon deleted file mode 100644 index 09a2828f8d..0000000000 --- a/base/dog/helm/reset.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reset/helm/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [~ ~] - == -(sole-so %helm-reset ~) diff --git a/base/dog/helm/verb.hoon b/base/dog/helm/verb.hoon deleted file mode 100644 index d3f5dd7a14..0000000000 --- a/base/dog/helm/verb.hoon +++ /dev/null @@ -1,13 +0,0 @@ -:: -:::: /hoon/verb/helm/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@ bec=beak] - [~ ~] - == -~& %helm-verb -(sole-so %helm-verb ~) diff --git a/base/dog/hood/reload.hoon b/base/dog/hood/reload.hoon deleted file mode 100644 index 97675c8a01..0000000000 --- a/base/dog/hood/reload.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reload/hood/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [arg=(list term) ~] - == -(sole-so %hood-reload arg) diff --git a/base/dog/hood/reset.hoon b/base/dog/hood/reset.hoon deleted file mode 100644 index 21f72fbba2..0000000000 --- a/base/dog/hood/reset.hoon +++ /dev/null @@ -1,12 +0,0 @@ -:: -:::: /hoon/reset/hood/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [~ ~] - == -(sole-so %hood-reset ~) diff --git a/base/dog/hood/verb.hoon b/base/dog/hood/verb.hoon deleted file mode 100644 index 4b28f7c074..0000000000 --- a/base/dog/hood/verb.hoon +++ /dev/null @@ -1,13 +0,0 @@ -:: -:::: /hoon/verb/hood/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@ bec=beak] - [~ ~] - == -~& %hood-verb -(sole-so %hood-verb ~) diff --git a/base/dog/solid.hoon b/base/dog/solid.hoon deleted file mode 100644 index 21e2262cba..0000000000 --- a/base/dog/solid.hoon +++ /dev/null @@ -1,40 +0,0 @@ -:: -:::: /hoon/solid/gun - :: -/? 314 -/- *sole -:: -:::: - !: -|= $: [now=@da eny=@uvI bec=beak] - [~ ~] - == -%+ sole-so %noun -=+ top=`path`/(scot %p p.bec)/home/(scot %da now)/arvo -=+ pax=`path`(weld top `path`[%hoon ~]) -~& %solid-start -=+ gen=(reck pax) -~& %solid-parsed -=+ ken=q:(~(mint ut %noun) %noun gen) -~& %solid-compiled -:- ken -=+ all=.*(0 ken) -=+ ^= vay ^- (list ,[p=@tas q=@tas]) - :~ [%$ %zuse] - [%g %gall] - [%f %ford] - [%a %ames] - [%c %clay] - [%d %dill] - [%e %eyre] - [%t %time] - == -|- ^+ all -?~ vay all -=+ pax=(weld top `path`[q.i.vay ~]) -=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~]))) -=+ sam=[now `ovum`[[%gold ~] [%veer p.i.vay pax txt]]] -~& [%solid-veer i.vay] -=+ gat=.*(all .*(all [0 42])) -=+ nex=+:.*([-.gat [sam +>.gat]] -.gat) -$(vay t.vay, all nex) From 43728c690e279ae665ee5ed9f2cfa8929fe6f33d Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 17 Jun 2015 15:44:55 -0700 Subject: [PATCH 21/37] fixed sched mark to make ;ul; --- base/mar/sched.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/mar/sched.hoon b/base/mar/sched.hoon index 85a5cb82f0..d22b3471e3 100644 --- a/base/mar/sched.hoon +++ b/base/mar/sched.hoon @@ -6,7 +6,7 @@ |% ++ mime [/text/x-sched (tact tape)] ++ tape (zing `wall`(turn sorted-list |=([a=@da b=cord] "{
} {(trip b)}\0a"))) - ++ elem =< ;list: *{(turn sorted-list .)} + ++ elem =< ;ul: *{(turn sorted-list .)} |= [tym=@da ite=cord] ^- manx ;li: ;{b "{}"}: {(trip ite)} ++ sorted-list From d506d38fd37f46b2d69817d0344ea80689ae370e Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 17 Jun 2015 18:08:47 -0700 Subject: [PATCH 22/37] forgot to add solid --- base/cat/solid.hoon | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 base/cat/solid.hoon diff --git a/base/cat/solid.hoon b/base/cat/solid.hoon new file mode 100644 index 0000000000..52eb262733 --- /dev/null +++ b/base/cat/solid.hoon @@ -0,0 +1,39 @@ +:: +:::: /hoon/solid/cat + :: +/? 314 +:: +:::: + !: +|= $: [now=@da eny=@uvI bec=beak] + [~ ~] + == +:- %noun +=+ top=`path`/(scot %p p.bec)/home/(scot %da now)/arvo +=+ pax=`path`(weld top `path`[%hoon ~]) +~& %solid-start +=+ gen=(reck pax) +~& %solid-parsed +=+ ken=q:(~(mint ut %noun) %noun gen) +~& %solid-compiled +:- ken +=+ all=.*(0 ken) +=+ ^= vay ^- (list ,[p=@tas q=@tas]) + :~ [%$ %zuse] + [%g %gall] + [%f %ford] + [%a %ames] + [%c %clay] + [%d %dill] + [%e %eyre] + [%t %time] + == +|- ^+ all +?~ vay all +=+ pax=(weld top `path`[q.i.vay ~]) +=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~]))) +=+ sam=[now `ovum`[[%gold ~] [%veer p.i.vay pax txt]]] +~& [%solid-veer i.vay] +=+ gat=.*(all .*(all [0 42])) +=+ nex=+:.*([-.gat [sam +>.gat]] -.gat) +$(vay t.vay, all nex) From 7ef6d782609711602bb1269503b5b00576817c5e Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 17 Jun 2015 18:11:43 -0700 Subject: [PATCH 23/37] =?UTF-8?q?recovered=20twitter=20d=C3=A6mon=20from?= =?UTF-8?q?=20the=20sands=20of=20time:=20closes=20#303?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/ape/twit.hoon | 212 ++++++++++++++++++++++++++++ base/cat/twit/as.hoon | 8 ++ base/cat/twit/tweet.hoon | 13 ++ base/cat/twit/twitter-feed.hoon | 22 +++ base/dog/twit/auth.hoon | 21 +++ base/dog/twit/auth/hoontap-keys.txt | 5 + 6 files changed, 281 insertions(+) create mode 100644 base/ape/twit.hoon create mode 100644 base/cat/twit/as.hoon create mode 100644 base/cat/twit/tweet.hoon create mode 100644 base/cat/twit/twitter-feed.hoon create mode 100644 base/dog/twit/auth.hoon create mode 100644 base/dog/twit/auth/hoontap-keys.txt diff --git a/base/ape/twit.hoon b/base/ape/twit.hoon new file mode 100644 index 0000000000..66f53ae52c --- /dev/null +++ b/base/ape/twit.hoon @@ -0,0 +1,212 @@ +:: Twitter daemon +:: +:::: /hook/core/twit/app + :: +/- *twitter +/+ twitter +:: +:::: ~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 + [%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 + ~& twit-auth/p.act + done(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) + :_ +>.$ + (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 {}" (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])) +-- diff --git a/base/cat/twit/as.hoon b/base/cat/twit/as.hoon new file mode 100644 index 0000000000..8ede39e81c --- /dev/null +++ b/base/cat/twit/as.hoon @@ -0,0 +1,8 @@ +/- *twitter +:: +:::: + :: +|= $: [now=@da eny=@uvI bec=beak] + [[who=span msg=cord ~] ~] + == +[%twit-do [who %post eny msg]] diff --git a/base/cat/twit/tweet.hoon b/base/cat/twit/tweet.hoon new file mode 100644 index 0000000000..70ec4de0b5 --- /dev/null +++ b/base/cat/twit/tweet.hoon @@ -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 {}"])) +++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~)) +-- diff --git a/base/cat/twit/twitter-feed.hoon b/base/cat/twit/twitter-feed.hoon new file mode 100644 index 0000000000..85d72c16f0 --- /dev/null +++ b/base/cat/twit/twitter-feed.hoon @@ -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/"{} @{(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]~)) +-- diff --git a/base/dog/twit/auth.hoon b/base/dog/twit/auth.hoon new file mode 100644 index 0000000000..10be28ee31 --- /dev/null +++ b/base/dog/twit/auth.hoon @@ -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]) + + + + diff --git a/base/dog/twit/auth/hoontap-keys.txt b/base/dog/twit/auth/hoontap-keys.txt new file mode 100644 index 0000000000..7b938bffbe --- /dev/null +++ b/base/dog/twit/auth/hoontap-keys.txt @@ -0,0 +1,5 @@ +hoontap +AP3G1t8ki6rPzeeAqdWCTw03F +VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD +2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl +jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8 From 177d4e530cac216c976598a242b26fd692f4c8af Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Wed, 17 Jun 2015 18:30:19 -0700 Subject: [PATCH 24/37] fixed arvo spinner --- .../src/js/components/ListComponent.coffee | 10 +++-- base/pub/tree/src/js/main.js | 42 ++++++++----------- base/pub/tree/src/js/stores/TreeStore.coffee | 16 +++++-- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/base/pub/tree/src/js/components/ListComponent.coffee b/base/pub/tree/src/js/components/ListComponent.coffee index d4ddbad115..783883590f 100644 --- a/base/pub/tree/src/js/components/ListComponent.coffee +++ b/base/pub/tree/src/js/components/ListComponent.coffee @@ -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" diff --git a/base/pub/tree/src/js/main.js b/base/pub/tree/src/js/main.js index e9e5042931..c6c2b7b8d4 100644 --- a/base/pub/tree/src/js/main.js +++ b/base/pub/tree/src/js/main.js @@ -71,7 +71,6 @@ module.exports = { }; - },{"../dispatcher/Dispatcher.coffee":8,"../persistence/TreePersistence.coffee":13}],2:[function(require,module,exports){ var TreeActions, TreeStore, a, div, recl, ref; @@ -294,7 +293,6 @@ module.exports = recl({ }); - },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14}],3:[function(require,module,exports){ var TreeActions, TreeStore, div, input, load, recl, ref, textarea; @@ -359,7 +357,6 @@ module.exports = recl({ }); - },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14,"./LoadComponent.coffee":7}],4:[function(require,module,exports){ var div, recl, ref, textarea; @@ -383,7 +380,6 @@ module.exports = recl({ }); - },{}],5:[function(require,module,exports){ var TreeActions, TreeStore, a, div, hr, li, recl, ref, ul; @@ -450,7 +446,6 @@ module.exports = recl({ }); - },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14}],6:[function(require,module,exports){ var TreeActions, TreeStore, a, div, h1, li, load, recl, ref, ul; @@ -474,15 +469,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,6 +496,7 @@ 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"); } @@ -545,7 +541,6 @@ module.exports = recl({ }); - },{"../actions/TreeActions.coffee":1,"../stores/TreeStore.coffee":14,"./LoadComponent.coffee":7}],7:[function(require,module,exports){ var div, input, recl, ref, textarea; @@ -583,7 +578,6 @@ module.exports = recl({ }); - },{}],8:[function(require,module,exports){ var Dispatcher; @@ -605,7 +599,6 @@ module.exports = _.extend(new Dispatcher(), { }); - },{"flux":10}],9:[function(require,module,exports){ var rend; @@ -765,7 +758,6 @@ $(function() { }); - },{"./actions/TreeActions.coffee":1,"./components/AnchorComponent.coffee":2,"./components/BodyComponent.coffee":3,"./components/CodeMirror.coffee":4,"./components/KidsComponent.coffee":5,"./components/ListComponent.coffee":6,"./persistence/TreePersistence.coffee":13}],10:[function(require,module,exports){ /** * Copyright (c) 2014-2015, Facebook, Inc. @@ -1106,7 +1098,6 @@ module.exports = { }; - },{"../actions/TreeActions.coffee":1}],14:[function(require,module,exports){ var EventEmitter, MessageDispatcher, TreeStore, _cont, _curr, _load, _snip, _tree; @@ -1192,15 +1183,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', {}, '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; @@ -1320,7 +1315,6 @@ TreeStore.dispatchToken = MessageDispatcher.register(function(payload) { module.exports = TreeStore; - },{"../dispatcher/Dispatcher.coffee":8,"events":15}],15:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // diff --git a/base/pub/tree/src/js/stores/TreeStore.coffee b/base/pub/tree/src/js/stores/TreeStore.coffee index 284f493d19..b0e147abe1 100644 --- a/base/pub/tree/src/js/stores/TreeStore.coffee +++ b/base/pub/tree/src/js/stores/TreeStore.coffee @@ -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', {}, '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") From e173fb24e74db6664f9647f784e735ffc2403592 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 17 Jun 2015 18:46:01 -0700 Subject: [PATCH 25/37] =?UTF-8?q?Rescued=20|hi=20Yfr=C4=ABt=20from=20the?= =?UTF-8?q?=20sands=20of=20time=20into=20helm:=20closes=20#304?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/ape/hood.hoon | 3 +++ base/cat/hood/hi.hoon | 1 + base/lib/helm.hoon | 12 ++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 base/cat/hood/hi.hoon diff --git a/base/ape/hood.hoon b/base/ape/hood.hoon index 4fa4bdfdb7..5d10c032cd 100644 --- a/base/ape/hood.hoon +++ b/base/ape/hood.hoon @@ -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) @@ -73,6 +74,8 @@ ++ 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-sync (wrap poke-sync):from-kiln diff --git a/base/cat/hood/hi.hoon b/base/cat/hood/hi.hoon new file mode 100644 index 0000000000..fb27f299d6 --- /dev/null +++ b/base/cat/hood/hi.hoon @@ -0,0 +1 @@ +|=([^ [who=ship mez=$|(~ [a=tape ~])] ~] helm-send-hi/[who ?~(mez ~ `a.mez)]) diff --git a/base/lib/helm.hoon b/base/lib/helm.hoon index 71917596b4..55b4fb2b79 100644 --- a/base/lib/helm.hoon +++ b/base/lib/helm.hoon @@ -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 "< {}: {(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 From 35e91eb322ddfd475e179c06b499139bc5ee86e8 Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Wed, 17 Jun 2015 23:26:09 -0700 Subject: [PATCH 26/37] questionable tree fix --- base/pub/tree/src/css/main.css | 26 ++++++++ base/pub/tree/src/css/main.styl | 26 ++++++++ .../src/js/components/BodyComponent.coffee | 5 +- .../src/js/components/ListComponent.coffee | 4 +- base/pub/tree/src/js/main.js | 60 ++++++++++++------- base/pub/tree/src/js/stores/TreeStore.coffee | 2 +- 6 files changed, 100 insertions(+), 23 deletions(-) diff --git a/base/pub/tree/src/css/main.css b/base/pub/tree/src/css/main.css index 59da8339f7..d886f9d3c2 100644 --- a/base/pub/tree/src/css/main.css +++ b/base/pub/tree/src/css/main.css @@ -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, diff --git a/base/pub/tree/src/css/main.styl b/base/pub/tree/src/css/main.styl index 20d6e71df6..481379d175 100644 --- a/base/pub/tree/src/css/main.styl +++ b/base/pub/tree/src/css/main.styl @@ -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' \ No newline at end of file diff --git a/base/pub/tree/src/js/components/BodyComponent.coffee b/base/pub/tree/src/js/components/BodyComponent.coffee index 960b848f07..481228059f 100644 --- a/base/pub/tree/src/js/components/BodyComponent.coffee +++ b/base/pub/tree/src/js/components/BodyComponent.coffee @@ -22,7 +22,10 @@ module.exports = recl getInitialState: -> @stateFromStore() - _onChangeStore: -> @setState @stateFromStore() + _onChangeStore: -> + if TreeStore.getCurr() isnt @state.curr + React.unmountComponentAtNode @getDOMNode() + @setState @stateFromStore() getPath: (path) -> if not @state.cont[path]? diff --git a/base/pub/tree/src/js/components/ListComponent.coffee b/base/pub/tree/src/js/components/ListComponent.coffee index 783883590f..3afa988801 100644 --- a/base/pub/tree/src/js/components/ListComponent.coffee +++ b/base/pub/tree/src/js/components/ListComponent.coffee @@ -56,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) \ No newline at end of file + k = "list" + if @props['data-source'] is 'default' then k += " default" + (ul {className:k,key:"list-"+@state.path}, _list) \ No newline at end of file diff --git a/base/pub/tree/src/js/main.js b/base/pub/tree/src/js/main.js index c6c2b7b8d4..7f6b765986 100644 --- a/base/pub/tree/src/js/main.js +++ b/base/pub/tree/src/js/main.js @@ -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 Date: Thu, 18 Jun 2015 09:10:34 -0700 Subject: [PATCH 27/37] tree body rendering --- .../src/js/components/AnchorComponent.coffee | 11 +++++++-- .../src/js/components/BodyComponent.coffee | 5 ++-- base/pub/tree/src/js/main.js | 24 ++++++++++++++----- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/base/pub/tree/src/js/components/AnchorComponent.coffee b/base/pub/tree/src/js/components/AnchorComponent.coffee index 2c56f1cbef..95a54410cc 100644 --- a/base/pub/tree/src/js/components/AnchorComponent.coffee +++ b/base/pub/tree/src/js/components/AnchorComponent.coffee @@ -1,4 +1,4 @@ -# comment +BodyComponent = require './BodyComponent.coffee' TreeStore = require '../stores/TreeStore.coffee' TreeActions = require '../actions/TreeActions.coffee' @@ -38,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 diff --git a/base/pub/tree/src/js/components/BodyComponent.coffee b/base/pub/tree/src/js/components/BodyComponent.coffee index 481228059f..224e6fe8a1 100644 --- a/base/pub/tree/src/js/components/BodyComponent.coffee +++ b/base/pub/tree/src/js/components/BodyComponent.coffee @@ -16,6 +16,9 @@ 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 @@ -23,8 +26,6 @@ module.exports = recl getInitialState: -> @stateFromStore() _onChangeStore: -> - if TreeStore.getCurr() isnt @state.curr - React.unmountComponentAtNode @getDOMNode() @setState @stateFromStore() getPath: (path) -> diff --git a/base/pub/tree/src/js/main.js b/base/pub/tree/src/js/main.js index 7f6b765986..9c9a523806 100644 --- a/base/pub/tree/src/js/main.js +++ b/base/pub/tree/src/js/main.js @@ -73,7 +73,9 @@ module.exports = { },{"../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 TreeActions, TreeStore, a, div, recl, ref; +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; @@ -295,7 +307,7 @@ module.exports = recl({ -},{"../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/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) { @@ -333,9 +348,6 @@ module.exports = recl({ return this.stateFromStore(); }, _onChangeStore: function() { - if (TreeStore.getCurr() !== this.state.curr) { - React.unmountComponentAtNode(this.getDOMNode()); - } return this.setState(this.stateFromStore()); }, getPath: function(path) { From 4a0044ed930ef73b714b7943074297595379d030 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 11:26:45 -0700 Subject: [PATCH 28/37] :twif listen on twitter feed --- base/ape/dojo.hoon | 2 +- base/ape/twif.hoon | 7 +++++++ base/ape/twit.hoon | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 base/ape/twif.hoon diff --git a/base/ape/dojo.hoon b/base/ape/dojo.hoon index 89f928df0b..a79ef0ba98 100644 --- a/base/ape/dojo.hoon +++ b/base/ape/dojo.hoon @@ -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))) == diff --git a/base/ape/twif.hoon b/base/ape/twif.hoon new file mode 100644 index 0000000000..b2564e8f4a --- /dev/null +++ b/base/ape/twif.hoon @@ -0,0 +1,7 @@ +/- *twitter +!: +|_ [bowl ~] +++ poke-noun |=(span (onwards [%send / [our %twit] %peer /user/[+<]])) +++ onwards |*([mark *] [[ost +<]~ +>.$]) +++ diff-twit-feed |=([* a=(list twit-stat)] ?~(a `+>.$ ~&(i.a $(a t.a)))) +-- diff --git a/base/ape/twit.hoon b/base/ape/twit.hoon index 66f53ae52c..b3f39ca7d2 100644 --- a/base/ape/twit.hoon +++ b/base/ape/twit.hoon @@ -141,7 +141,7 @@ =+ ren=(cull t.pax rep) :: new messages ?~ ren (wait pax ~) :: pump polling - ~& spam-feed/ren + :: ~& spam-feed/ren =: ran (~(del by ran) pax) :: clear poll delay fed (~(put by fed) t.pax rep) :: saw last message == From a190bfbbbd8a6db241f7042d3d525e5417f859eb Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 11:37:49 -0700 Subject: [PATCH 29/37] direct %peer usage --- base/ape/twif.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/ape/twif.hoon b/base/ape/twif.hoon index b2564e8f4a..79123fe50d 100644 --- a/base/ape/twif.hoon +++ b/base/ape/twif.hoon @@ -1,7 +1,7 @@ /- *twitter !: |_ [bowl ~] -++ poke-noun |=(span (onwards [%send / [our %twit] %peer /user/[+<]])) +++ poke-noun |=(span (onwards [%peer / [our %twit] /user/[+<]])) ++ onwards |*([mark *] [[ost +<]~ +>.$]) ++ diff-twit-feed |=([* a=(list twit-stat)] ?~(a `+>.$ ~&(i.a $(a t.a)))) -- From 5c3bd9c053ad7fadbd6385c5da947c612c56e54c Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 11:55:05 -0700 Subject: [PATCH 30/37] added :talk feedback to twitter app --- base/ape/twit.hoon | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/base/ape/twit.hoon b/base/ape/twit.hoon index b3f39ca7d2..a3b7174baa 100644 --- a/base/ape/twit.hoon +++ b/base/ape/twit.hoon @@ -3,7 +3,7 @@ :::: /hook/core/twit/app :: /- *twitter -/+ twitter +/+ twitter, talk :: :::: ~fyr :: @@ -36,6 +36,7 @@ ++ card :: arvo request $? gift $% [%them path ~ u=hiss] :: HTTP request + [%poke wire dock %talk-command command:talk] :: [%wait path p=@da] :: timeout == == :: @@ -88,8 +89,8 @@ ^+ [*(list move) +>] ?- -.q.act %auth - ~& twit-auth/p.act - done(kes (~(put by kes) p.act p.q.act)) :: XX verify key + :- [(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) @@ -132,6 +133,8 @@ (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 @@ -209,4 +212,7 @@ |= [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 ~)]) -- From 3e06521c8e6add9e6bed0fdef00991863c5c939d Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 14:39:11 -0700 Subject: [PATCH 31/37] missed a mark door, re-flop eyre stack traces --- base/arvo/eyre.hoon | 2 +- base/mar/helm-hi.hoon | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 base/mar/helm-hi.hoon diff --git a/base/arvo/eyre.hoon b/base/arvo/eyre.hoon index 6359c534ab..4927268ba0 100644 --- a/base/arvo/eyre.hoon +++ b/base/arvo/eyre.hoon @@ -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 diff --git a/base/mar/helm-hi.hoon b/base/mar/helm-hi.hoon new file mode 100644 index 0000000000..d077762f20 --- /dev/null +++ b/base/mar/helm-hi.hoon @@ -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)] + -- +-- From 8367c449185808b6790c2ad38a5dee9776a454c9 Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Thu, 18 Jun 2015 14:42:34 -0700 Subject: [PATCH 32/37] bad webtalk chars fixed --- .../src/js/components/WritingComponent.coffee | 17 ++++++++--------- base/pub/talk/src/js/main.js | 14 +------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/base/pub/talk/src/js/components/WritingComponent.coffee b/base/pub/talk/src/js/components/WritingComponent.coffee index cff4ece0c5..a675dc8dc1 100644 --- a/base/pub/talk/src/js/components/WritingComponent.coffee +++ b/base/pub/talk/src/js/components/WritingComponent.coffee @@ -78,15 +78,14 @@ 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 diff --git a/base/pub/talk/src/js/main.js b/base/pub/talk/src/js/main.js index 254810f57f..922855b502 100644 --- a/base/pub/talk/src/js/main.js +++ b/base/pub/talk/src/js/main.js @@ -761,21 +761,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; From 9924013c3e54fb706a5ded1729d912972d2b8515 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 15:34:17 -0700 Subject: [PATCH 33/37] missed |verb --- base/cat/hood/verb.hoon | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 base/cat/hood/verb.hoon diff --git a/base/cat/hood/verb.hoon b/base/cat/hood/verb.hoon new file mode 100644 index 0000000000..57576b81f2 --- /dev/null +++ b/base/cat/hood/verb.hoon @@ -0,0 +1,13 @@ +:: +:::: /hoon/verb/hood/gun + :: +/? 314 +/- *sole +:: +:::: + !: +|= $: [now=@da eny=@ bec=beak] + [~ ~] + == +~& %hood-verb +[%helm-verb ~] From b2a8251bb36094f8952dfd07bd36a2ccc613e9be Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 18 Jun 2015 18:47:41 -0700 Subject: [PATCH 34/37] added # speech --- base/ape/talk.hoon | 38 ++++++-- base/arvo/gall.hoon | 15 ++-- base/lib/urb.js | 3 + base/mar/talk-command.hoon | 9 ++ base/mar/talk-report.hoon | 31 ++++--- base/pub/talk/fab/hymn.hook | 2 +- base/pub/talk/src/css/main.css | 3 + base/pub/talk/src/css/main.styl | 3 + .../talk/src/js/actions/MessageActions.coffee | 29 +++--- .../js/components/MessagesComponent.coffee | 29 ++++-- .../src/js/components/WritingComponent.coffee | 3 +- base/pub/talk/src/js/main.js | 89 +++++++++++++------ 12 files changed, 181 insertions(+), 73 deletions(-) diff --git a/base/ape/talk.hoon b/base/ape/talk.hoon index db59a8845f..2a20366dcf 100644 --- a/base/ape/talk.hoon +++ b/base/ape/talk.hoon @@ -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 diff --git a/base/arvo/gall.hoon b/base/arvo/gall.hoon index 8cb7fff562..5ef6af1b6b 100644 --- a/base/arvo/gall.hoon +++ b/base/arvo/gall.hoon @@ -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] diff --git a/base/lib/urb.js b/base/lib/urb.js index 556459aa07..90481ca0ac 100644 --- a/base/lib/urb.js +++ b/base/lib/urb.js @@ -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("
"+JSON.stringify(params.xyro)+"\n"
+                            +data.data.mess+"
") // XX if(cb) { cb.apply(this,arguments); } }) } diff --git a/base/mar/talk-command.hoon b/base/mar/talk-command.hoon index 59edc2c795..b6417e71bf 100644 --- a/base/mar/talk-command.hoon +++ b/base/mar/talk-command.hoon @@ -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) ~) == diff --git a/base/mar/talk-report.hoon b/base/mar/talk-report.hoon index a82e0a88bc..42c49a4d37 100644 --- a/base/mar/talk-report.hoon +++ b/base/mar/talk-report.hoon @@ -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 +:
)) ::[%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

) audience/(audi q) statement/(stam r) ~) :: ++ audi (jome parn jove) @@ -79,29 +79,38 @@ |= a=station ^- cord (crip "{}/{(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] ~) ~ :: diff --git a/base/pub/talk/fab/hymn.hook b/base/pub/talk/fab/hymn.hook index 3b46fcd9ca..dfc5beb274 100644 --- a/base/pub/talk/fab/hymn.hook +++ b/base/pub/talk/fab/hymn.hook @@ -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"); diff --git a/base/pub/talk/src/css/main.css b/base/pub/talk/src/css/main.css index 3da467aacc..2c0efb8004 100644 --- a/base/pub/talk/src/css/main.css +++ b/base/pub/talk/src/css/main.css @@ -412,6 +412,9 @@ body { .message.say .mess { font-style: italic; } +.message.exp .mess { + font-family: monospace; +} a { text-decoration: underline; color: inherit; diff --git a/base/pub/talk/src/css/main.styl b/base/pub/talk/src/css/main.styl index 7bd381ddc0..d363512757 100644 --- a/base/pub/talk/src/css/main.styl +++ b/base/pub/talk/src/css/main.styl @@ -361,6 +361,9 @@ body .message.say .mess font-style italic + +.message.exp .mess + font-family monospace a text-decoration underline diff --git a/base/pub/talk/src/js/actions/MessageActions.coffee b/base/pub/talk/src/js/actions/MessageActions.coffee index 14d6e303b2..75bde06ae6 100644 --- a/base/pub/talk/src/js/actions/MessageActions.coffee +++ b/base/pub/talk/src/js/actions/MessageActions.coffee @@ -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 diff --git a/base/pub/talk/src/js/components/MessagesComponent.coffee b/base/pub/talk/src/js/components/MessagesComponent.coffee index 2d67683dc2..8da63e7845 100644 --- a/base/pub/talk/src/js/components/MessagesComponent.coffee +++ b/base/pub/talk/src/js/components/MessagesComponent.coffee @@ -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 diff --git a/base/pub/talk/src/js/components/WritingComponent.coffee b/base/pub/talk/src/js/components/WritingComponent.coffee index a675dc8dc1..7e6ae4b5ed 100644 --- a/base/pub/talk/src/js/components/WritingComponent.coffee +++ b/base/pub/talk/src/js/components/WritingComponent.coffee @@ -91,7 +91,8 @@ module.exports = recl 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() diff --git a/base/pub/talk/src/js/main.js b/base/pub/talk/src/js/main.js index 922855b502..11412995a6 100644 --- a/base/pub/talk/src/js/main.js +++ b/base/pub/talk/src/js/main.js @@ -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; @@ -932,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; @@ -953,6 +978,7 @@ module.exports = _.merge(new Dispatcher(), { }); + },{"flux":10}],8:[function(require,module,exports){ $(function() { var $c, MessagesComponent, StationActions, StationComponent, WritingComponent, clean, rend; @@ -983,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; @@ -1083,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. @@ -5589,6 +5617,7 @@ module.exports = { }; + },{"../actions/MessageActions.coffee":1}],18:[function(require,module,exports){ var StationActions; @@ -5713,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; @@ -5858,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; @@ -6057,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 = {}; @@ -6168,6 +6200,7 @@ _.merge(window.util, { }); + },{}],22:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // From 5a1f3002975781d8e2887c4d1dac43088a932be9 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 19 Jun 2015 10:27:03 -0700 Subject: [PATCH 35/37] bump eyre security --- base/arvo/eyre.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/arvo/eyre.hoon b/base/arvo/eyre.hoon index 4927268ba0..95f340d17b 100644 --- a/base/arvo/eyre.hoon +++ b/base/arvo/eyre.hoon @@ -1187,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) From 258c69eb785ca642f2e44bfddc3a177594fb00c7 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 19 Jun 2015 11:49:31 -0700 Subject: [PATCH 36/37] change passcode derivation seed --- base/arvo/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/arvo/ames.hoon b/base/arvo/ames.hoon index 5c7a769963..b46e319d8b 100644 --- a/base/arvo/ames.hoon +++ b/base/arvo/ames.hoon @@ -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) ~ From ffe56f62056a6915f05d39fe64e88c6acf1fedb8 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 19 Jun 2015 12:01:42 -0700 Subject: [PATCH 37/37] fix old versinos of marks being used when translating --- base/arvo/gall.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/base/arvo/gall.hoon b/base/arvo/gall.hoon index 5ef6af1b6b..0d5b980007 100644 --- a/base/arvo/gall.hoon +++ b/base/arvo/gall.hoon @@ -479,6 +479,7 @@ :: ++ mo-beak :: build beak |= dap=dude + =- ?.(=(p our) - -(r [%da now])) :: soft dependencies ^- beak byk:(~(got by bum) dap) ::