Merge branch 'master' into alef-testnet (might not work)

This commit is contained in:
Ted Blackman 2019-08-19 14:43:39 -07:00
commit fc9104cb47
132 changed files with 2501 additions and 10714 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5debf91880c73d052429ca487555aa60aa2ee4f173c9f059e30b61372689910e
size 7118127
oid sha256:6c7ad5eec00d0d6a6857ea023c6102999a30d5c99de7411e474b9d1c14a3e7b4
size 9765203

View File

@ -15,8 +15,9 @@ cleanup () {
trap cleanup EXIT
# update pill strategy to ensure correct staging
# update pill strategy to ensure correct staging
#
herb ./pier -p hood -d "+hood/mount /=home="
until [ -d ./pier/home ]
@ -24,17 +25,45 @@ do
sleep 1
done
cp $ARVO/lib/pill.hoon ./pier/home/lib/
chmod -R u+rw ./pier/home/lib/
# update :lens, :dojo and dependencies
#
# XX reduce this list
#
cp $ARVO/app/lens.hoon ./pier/home/app/ 2>/dev/null || true
cp $ARVO/app/dojo.hoon ./pier/home/app/ 2>/dev/null || true
cp $ARVO/lib/base64.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/lib/server.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/lib/sole.hoon ./pier/home/lib/ 2>/dev/null || true
mkdir -p ./pier/home/mar/lens/
cp $ARVO/mar/lens/* ./pier/home/mar/lens/ 2>/dev/null || true
cp $ARVO/sur/lens.hoon ./pier/home/sur/ 2>/dev/null || true
cp $ARVO/sur/sole.hoon ./pier/home/sur/ 2>/dev/null || true
# update +solid and its dependencies
#
cp $ARVO/lib/pill.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/gen/solid.hoon ./pier/home/gen/ 2>/dev/null || true
chmod -R u+rw ./pier/home/
herb ./pier -p hood -d "+hood/commit %home"
herb ./pier -p hood -d "+hood/unmount %home"
# stage new desk for pill contents
# XX horrible hack to ensure the update is applied first
#
sleep 10
# stage new desk for pill contents
#
herb ./pier -p hood -d '+hood/merge %stage our %home'
herb ./pier -p hood -d "+hood/mount /=stage="
until [ -d ./pier/stage ]
do
sleep 1
done
rm -rf ./pier/stage
cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage

View File

@ -344,7 +344,7 @@
::
=/ directory-base=purl
=- (need (de-purl:html -))
'https://acme-staging-v02.api.letsencrypt.org/directory'
'https://acme-v02.api.letsencrypt.org/directory'
:: mov: list of outgoing moves for the current transaction
::
=| mov=(list move)

View File

@ -367,7 +367,6 @@
%f %ford
%g %gall
%j %jael
%k %kale
==
=/ pax
/(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane]

View File

@ -1,5 +1,5 @@
/+ tapp, stdio
=, able:kale
=, able:jael
=> |%
+$ pending-udiffs (map number:block udiffs:point)
+$ app-state
@ -13,7 +13,7 @@
+$ peek-data ~
+$ in-poke-data
$: %azimuth-tracker-poke
$% [%listen whos=(list ship) =source:kale]
$% [%listen whos=(list ship) =source:jael]
[%watch url=@ta]
==
==
@ -39,12 +39,19 @@
=> |%
++ topics
|= ships=(set ship)
^- (list ?(@ux (list @ux)))
:: The first topic should be one of these event types
::
:- => azimuth-events:azimuth
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
:: If we're looking for a specific set of ships, specify them as
:: the second topic. Otherwise don't specify the second topic so
:: we will match all ships.
::
?: =(~ ships)
~
[(turn ~(tap in ships) ,@) ~]
@ -266,10 +273,10 @@
::
=> |%
::
:: Send %listen to kale
:: Send %listen to jael
::
++ listen
|= [state=app-state whos=(list ship) =source:kale]
|= [state=app-state whos=(list ship) =source:jael]
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %listen /lo (silt whos) source)

View File

@ -41,6 +41,25 @@
::
=, chat
::
|%
+$ state
$% [%0 str=streams]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -56,7 +75,7 @@
=/ inboxpat /circle/inbox/config/group
=/ circlespat /circles/[(scot %p our.bol)]
=/ inboxwir /circle/[(scot %p our.bol)]/inbox/config/group
=/ inboxi/poke
=/ inboxi/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %i] ~]~)]
=/ fakeannounce=poke
@ -71,10 +90,10 @@
=/ dev=poke
:- %hall-action
[%create %urbit-dev 'Chat about developing on Urbit' %channel]
=/ sourcefakeannounce/poke
=/ sourcefakeannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %hall-internal-announcements] ~]~)]
=/ sourceannounce/poke
=/ sourceannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[~marzod %announcements] ~]~)]
=/ hallactions=(list move)
@ -99,7 +118,7 @@
[ost.bol %poke /chat [our.bol %launch] launcha]
==
:_ this
%+ weld moves hallactions
%+ weld moves hallactions
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
this(sta u.old)
::
@ -115,8 +134,8 @@
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
[cir (add num.last 1)]
=/ maptjson=(map @t json)
%- my
:~ ['config' (config-to-json str)]
%- my
:~ ['config' (config-to-json str)]
['numbers' (numbers-to-json numbers)]
==
[%o maptjson]
@ -142,7 +161,7 @@
?~ envs
~
=/ length/@ (lent u.envs)
=/ start/@
=/ start/@
?: (gte length 100)
(sub length 100)
0
@ -247,7 +266,7 @@
^- [circle:hall (list envelope:hall)]
[cir ~]
::
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -281,7 +300,7 @@
::
=* messages messages.str.sta
=/ circle/circle:hall [`@p`(slav %p &2:wir) &3:wir]
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -391,7 +410,7 @@
?+ -.dif.sto
[~ this]
::
:: %full: set all of config without side effects
:: %full: set all of config without side effects
::
%full
=* conf cof.dif.sto

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@
$% [%dns-authority =authority]
[%dns-bind =ship =target]
[%handle-http-request =inbound-request:eyre]
[%handle-http-cancel =inbound-request:eyre]
[%noun noun=*]
==
+$ out-poke-data
@ -779,7 +780,9 @@
;< ~ bind:m (poke-app:stdio [our dap]:bowl [%dns-bind ship target]:i.dep)
loop(dep t.dep)
::
:: XX need to %handle-http-cancel as well
%handle-http-cancel
~& %tapp-http-cant-cancel
(pure:m state)
::
%handle-http-request
:: always stash request bone for giving response

View File

@ -10,7 +10,6 @@
[%vein wire]
[%look wire src=(each ship purl:eyre)]
[%wind wire p=@ud]
[%snap wire snapshot=snapshot:jael kick=?]
==
++ state
$: a/@
@ -28,8 +27,6 @@
%turf [ost.hid %turf /hi ~]~
%vein [ost.hid %vein /hi]~
[%wind @ud] [ost.hid %wind /hi +.val]~
[%snap * ?]
[ost.hid %snap /hi (snapshot:jael +<.val) +>.val]~
::
%look-ethnode
:_ ~

View File

@ -161,6 +161,7 @@
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):from-helm
++ poke-helm-moon (wrap poke-moon):from-helm
++ poke-helm-nuke (wrap poke-nuke):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm
@ -182,6 +183,7 @@
++ poke-kiln-keep-ford (wrap poke-keep-ford):from-kiln
++ poke-kiln-autoload (wrap poke-autoload):from-kiln
++ poke-kiln-overload (wrap poke-overload):from-kiln
++ poke-kiln-wash-gall (wrap poke-wash-gall):from-kiln
++ poke-kiln-unmount (wrap poke-unmount):from-kiln
++ poke-kiln-unsync (wrap poke-unsync):from-kiln
++ poke-kiln-permission (wrap poke-permission):from-kiln

View File

@ -1,4 +1,6 @@
/+ *server, launch
/- launch
/+ *server
::
/= index
/^ $-(marl manx)
/: /===/app/launch/index /!noun/
@ -22,6 +24,21 @@
::
=, launch
::
|%
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -35,7 +52,7 @@
[~ this(sta u.old)]
::
++ poke-launch-action
|= act=action:launch
|= act=action
^- (quip move _this)
=/ beforedata (~(get by data.sta) name.act)
=/ newdata

View File

@ -1,19 +1,25 @@
/- lens
/+ *server, base64
/- lens, *sole
/+ base64, *server
/= lens-mark /: /===/mar/lens/command
/!noun/
=, format
|%
:: +move: output effect
:: +lens-out: json or named octet-stream
::
+$ lens-out
$% [%json =json]
[%mime =mime]
==
:: +move: output effect
::
+$ move [bone card]
:: +card: output effect payload
:: +card: output effect payload
::
+$ card
$% [%connect wire binding:eyre term]
[%http-response =http-event:http]
[%peer wire dock path]
[%peel wire dock mark path]
[%peer wire dock path]
[%poke wire dock poke]
[%pull wire dock ~]
==
@ -80,16 +86,74 @@
[ost.bow %poke /import [our.bow app.source.com] %import c]~
::
:_ this(job.state (some [ost.bow com]))
[ost.bow %peel /sole [our.bow %dojo] %lens-json /sole]~
[ost.bow %peer /sole [our.bow %dojo] /sole]~
::
++ diff-lens-json
|= [=wire jon=json]
++ diff-sole-effect
|= [=wire fec=sole-effect]
^- (quip move _this)
?~ jon
=/ out
|- ^- (unit lens-out)
=* loop $
?+ -.fec
~
::
%tan
%- some
:- %json
%- wall:enjs:format
(turn (flop p.fec) |=(=tank ~(ram re tank)))
::
%txt
(some %json s+(crip p.fec))
::
%sag
%- some
[%mime p.fec (as-octs:mimes:html (jam q.fec))]
::
%sav
:: XX use +en:base64 or produce %mime a la %sag
::
%- some
:- %json
%- pairs:enjs:format
:~ file+s+(crip <`path`p.fec>)
data+s+(crip (en-base64:mimes:html q.fec))
==
::
%mor
=/ all `(list lens-out)`(murn p.fec |=(a=sole-effect loop(fec a)))
?~ all ~
~| [%multiple-effects all]
?> ?=(~ t.all)
(some i.all)
==
::
?~ out
[~ this]
?> ?=(^ job.state)
:_ this(job.state ~)
[bone.u.job.state %http-response (json-response:app (json-to-octs jon))]~
:_ ~
:+ bone.u.job.state
%http-response
?- -.u.out
%json
(json-response:app (json-to-octs json.u.out))
::
%mime
:* %start
:~ 200
['content-type' 'application/octet-stream']
?> ?=([@ @ ~] p.mime.u.out)
:- 'content-disposition'
^- @t
%^ cat 3
'attachment; filename='
(rap 3 '"' i.p.mime.u.out '.' i.t.p.mime.u.out '"' ~)
==
(some q.mime.u.out)
%.y
==
==
::
++ diff-export
|= [=wire data=*]
@ -132,6 +196,8 @@
?> ?=(^ job.state)
:_ this
:~ [ost.bow %poke /sole [our.bow %dojo] %lens-command com.u.job.state]
:: XX move to +diff-sole-effect?
::
[ost.bow %pull /sole [our.bow %dojo] ~]
==
::

View File

@ -34,6 +34,15 @@
/: /===/app/publish/img /_ /png/
::
|%
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ move [bone card]
::
@ -268,7 +277,7 @@
(~(get by subs.sat) who.del col.del)
=/ new=collection
?~ old
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
[~ ~] [%white ~] ~ now.bol
==
%= u.old
@ -348,7 +357,7 @@
[~ da-this]
=. subs.sat (~(del by subs.sat) who.del col.del)
:- ~(tap in ~(key by pos.u.old))
%- da-emil
%- da-emil
:- [ost.bol %pull /collection/[col.del] [who.del %publish] ~]
(affection-primary del)
:: iterate through post ids collected before, removing each from
@ -373,7 +382,7 @@
da-this
?. (~(has in ~(key by pos.u.old)) u.pos.del)
da-this
=/ new=collection
=/ new=collection
%= u.old
pos (~(del by pos.u.old) u.pos.del)
com (~(del by com.u.old) u.pos.del)
@ -392,7 +401,7 @@
++ da-remove-unread
|= [who=@p coll=@tas post=@tas]
^+ da-this
=. unread.sat (~(del in unread.sat) who coll post)
=. unread.sat (~(del in unread.sat) who coll post)
(da-emil make-tile-moves)
::
++ da-remove-latest
@ -482,7 +491,7 @@
^+ da-this
=/ new-post=post-info (need (get-post-info-by-index who coll post))
=/ col=collection (need (get-coll-by-index who coll))
::
::
=/ pre=(list @tas) ~
=/ suf=(list @tas)
?: pinned.new-post
@ -635,7 +644,7 @@
:: 1st part of multi-part, store partial delta and don't process it
::
=/ del=delta
:* %total our.bol col [ost.bol dat]
:* %total our.bol col [ost.bol dat]
~ ~ [~ ~] [%white ~] ~ now.bol
==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
@ -648,7 +657,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -665,7 +674,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -733,8 +742,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
(~(put by pos.dat.u.partial.u.awa) pos [ost.bol dat])
com.dat.u.partial.u.awa
[~ ~]
@ -784,8 +793,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -801,8 +810,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -881,7 +890,7 @@
=/ pax=path /web/publish/[name.act]/publish-info
=/ blog-perms=card
:* %perm /perms q.byk.bol
/web/publish/[name.act]
/web/publish/[name.act]
%rw `read.perm.act `write.perm.act
==
=/ info-perms=card
@ -999,7 +1008,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
kills
moves
@ -1194,7 +1203,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
moves
make-tile-moves
@ -1259,7 +1268,13 @@
::
%read
=. unread.sat (~(del in unread.sat) who.act coll.act post.act)
[make-tile-moves this]
:_ this
%+ welp make-tile-moves
::
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %publish-update %unread %.n (sy [who.act coll.act post.act] ~)]
::
==
::
@ -1361,6 +1376,68 @@
::
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
++ make-tile-moves
^- (list move)
%+ turn (prey:pubsub:userlib /publishtile bol)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -716,8 +716,12 @@
++ circ :: circle
;~ pose
(cold incir col)
;~(pfix cen (stag self urs:ab))
;~(pfix net (stag (^sein:title self) urs:ab))
;~ pfix cen
%+ stag self
%+ sear |=(circ=name ?:(=('' circ) ~ (some circ)))
urs:ab
==
::
%+ cook
|= {a/@p b/(unit term)}
@ -2313,7 +2317,15 @@
url+(crip (apix:en-purl:html url.sep))
::
$exp
mor+~[txt+"# {(trip exp.sep)}" tan+res.sep]
=/ texp=tape ['>' ' ' (trip exp.sep)]
:- %mor
|- ^- (list sole-effect:sole-sur)
?: =("" texp) [tan+res.sep ~]
=/ newl (find "\0a" texp)
?~ newl [txt+texp $(texp "")]
=+ (trim u.newl texp)
:- txt+(scag u.newl texp)
$(texp [' ' ' ' (slag +(u.newl) texp)])
::
$ire
=+ num=(~(get by known) top.sep)
@ -2398,7 +2410,11 @@
==
::
$exp
:- (tr-chow wyd '#' ' ' (trip exp.sep))
=+ texp=(trip exp.sep)
=+ newline=(find "\0a" texp)
=? texp ?=(^ newline)
(weld (scag u.newline texp) " ...")
:- (tr-chow wyd '#' ' ' texp)
?~ res.sep ~
=- [' ' (tr-chow (dec wyd) ' ' -)]~
~(ram re (snag 0 `(list tank)`res.sep))

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
--
:- %say
|= [* [whos=(list ship) =src] ~]
=/ =source:kale
=/ =source:jael
?- -.src
%ship [%& ship.src]
%app [%| term.src]

View File

@ -1,6 +1,6 @@
=> |%
+$ config
[url=@ta =from=number:block:able:kale]
[url=@ta =from=number:block:able:jael]
--
:- %say
|= [* config ~]

View File

@ -0,0 +1,33 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=rift
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^rift
?. =(*^rift rift)
rift
+(.^(^rift j+/(scot %p our)/rift/(scot %da now)/(scot %p mon)))
`[mon *id:block:able:jael %rift rift]

View File

@ -0,0 +1,45 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=life
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^life
?. =(*^life life)
life
+(.^(^life j+/(scot %p our)/life/(scot %da now)/(scot %p mon)))
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys life 1 pass]

View File

@ -0,0 +1,44 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life=1 eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys 1 1 pass]

View File

@ -0,0 +1,13 @@
:: Kiln: clear Gall compiler caches
::
:::: /hoon/wash-gall/hood/gen
::
/? 310
::
::::
!:
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~ ~
==
[%kiln-wash-gall ~]

View File

@ -1,37 +0,0 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/gen
::
/? 310
/- *sole
/+ *generators
::
::::
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
~
==
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- produce
:- %tang :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- produce
:- %tang :_ ~
leaf+"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
=/ lyf=life .^(@ud k+/(scot %p our)/life/(scot %da now)/(scot %p our))
=/ sed=seed:able:kale
.^ seed:able:kale
k+/(scot %p our)/earl/(scot %da now)/(scot %p mon)/(scot %ud lyf)
==
%+ print leaf+"moon: {(scow %p mon)}"
%- produce [%atom (scot %uw (jam sed))]

View File

@ -16,7 +16,7 @@
dub=_|
==
:- %pill
%- pill:pill
^- pill:pill
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
=/ sys=path

View File

@ -1,69 +1,6 @@
/- hall
/- *chat, hall
/+ hall-json
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
::
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ state
$% [%0 str=streams]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
::
::
:: +utilities
::
++ msg-to-json
=, enjs:format
|= upd=update
@ -88,7 +25,7 @@
^- json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::
@ -135,6 +72,4 @@
[%length (numb len)]
==
==
::
--
::

View File

@ -65,7 +65,7 @@
++ lank ::: tank as string arr
|= a/tank
^- json
a+(turn (wash [0 1.024] a) tape)
a+(turn (wash [0 80] a) tape)
::
++ dank ::: tank
|= a/tank
@ -577,7 +577,7 @@
:+ ~ u.exp
=+ res=((ot res+(ar dank) ~) a)
?^ res u.res
p:(mule |.([(sell (slap !>(..zuse) (ream u.exp)))]~)) ::TODO oldz
p:(mule |.([(sell (slap !>(..^zuse) (ream u.exp)))]~)) ::TODO oldz
::
++ atta ::: attache
^- $-(json (unit attache))

View File

@ -85,6 +85,11 @@
[%base %dojo]
[%base %ping]
::[%base %modulo]
::[%home %launch]
::[%home %chat]
::[%home %publish]
::[%home %clock]
::[%home %weather]
==
:~ ::[%home %lens]
::[%home %acme]

View File

@ -40,12 +40,13 @@
$% [%bonk wire ~] ::
{$conf wire dock $load ship term} ::
{$flog wire flog:dill} ::
[%mint wire p=ship q=safe:rights:jael]
{$nuke wire ship} ::
[%serve wire binding:eyre generator:eyre]
[%serve wire binding:eyre generator:eyre] ::
{$poke wire dock pear} ::
{$rest wire @da} ::
{$wait wire @da} ::
{$rekey wire life ring} ::
{$moon wire ship udiff:point:able:jael} ::
== ::
++ move (pair bone card) :: user-level move
++ pear :: poke fruit
@ -79,14 +80,14 @@
?. =(our who.u.sed)
~& [%wrong-private-key-ship who.u.sed]
+>.$
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
?. =(+(lyf) lyf.u.sed)
~& [%wrong-private-key-life expected=+(lyf) actual=lyf.u.sed]
(emit %rekey / lyf.u.sed key.u.sed)
::
++ poke-moon :: rotate moon keys
|= sed=(unit [=ship =udiff:point:able:jael])
=< abet
?~ sed
+>.$
:: our new private key, as a +tree of +rite
::
=/ rit (sy [%jewel (my [lyf.u.sed key.u.sed] ~)] ~)
(emit %mint / our rit)
(emit %moon / u.sed)
::
++ poke-nuke :: initialize
|= him/ship =< abet

View File

@ -70,6 +70,7 @@
{$merg wire @tas @p @tas case germ} ::
{$perm wire desk path rite} ::
{$poke wire dock pear} ::
[%wash wire ~]
{$wipe wire @ud} ::
[%keep wire compiler-cache-size=@ud build-cache-size=@ud]
{$wait wire @da} ::
@ -276,6 +277,8 @@
|= [compiler-cache-size=@ud build-cache-size=@ud]
abet:(emit %keep /kiln compiler-cache-size build-cache-size)
::
++ poke-wash-gall |=(* abet:(emit %wash /kiln ~))
::
++ mack
|= {way/wire saw/(unit tang)}
~? ?=(^ saw) [%kiln-nack u.saw]

View File

@ -1,24 +0,0 @@
::
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
::
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
::
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
--
::

View File

@ -182,14 +182,14 @@
==
::
++ number-to-hash
|= =number:block:able:kale
|= =number:block:able:jael
^- @
?: (lth number launch:contracts:azimuth)
(cat 3 0x5364 (sub launch:contracts:azimuth number))
(cat 3 0x5363 (sub number launch:contracts:azimuth))
::
++ hash-to-number
|= =hash:block:able:kale
|= =hash:block:able:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
@ -205,8 +205,8 @@
logs
::
++ logs-by-hash
|= =hash:block:able:kale
=/ =number:block:able:kale (hash-to-number hash)
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json
@ -252,13 +252,19 @@
|= who=ship
=/ m (ph ,~)
^- form:m
;< now=@da bind:m
|= pin=ph-input
[& ~ %done now.pin]
(raw-ship:(ph-tests our) who `(dawn who now))
?. =(%earl (clan:title who))
(raw-ship:(ph-tests our) who `(dawn who ~))
=/ spon=ship (^sein:title who)
=/ cub (pit:nu:crub:crypto 512 (shaz (jam who life=1 %entropy)))
=/ =seed:able:jael
[who 1 sec:ex:cub ~]
=/ =pass pub:ex:cub
=/ com=tape "|moon {(scow %p who)}, =public-key {(scow %uw pass)}"
;< ~ bind:m (just-events:(ph-tests our) (dojo spon com))
(raw-ship:(ph-tests our) who `(dawn who `seed))
::
++ dawn
|= [who=ship now=@da]
|= [who=ship seed=(unit seed:able:jael)]
^- dawn-event
=/ spon
=/ =ship (^sein:title who)
@ -278,15 +284,9 @@
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
=/ =seed:able:kale
?: =(%earl (clan:title who))
=/ pax
;: weld
/i/(scot %p ship.spon)/k/(scot %p ship.spon)/earl/(scot %da now)
/(scot %p who)/(scot %ud life.spon)
/noun
==
(need (scry-aqua (unit seed:able:kale) our now pax))
=/ =seed:able:jael
?^ seed
u.seed
=/ life-rift (~(got by lives) who)
=/ =life lyfe.life-rift
[who life sec:ex:(get-keys who life) ~]
@ -296,7 +296,6 @@
~[~['arvo' 'netw' 'ork']]
0
`(need (de-purl:html 'http://localhost:8545'))
~
==
::
:: Should only do galaxies
@ -349,7 +348,7 @@
:+ & ~
=/ aqua-pax
:- %i
/(scot %p her)/k/(scot %p her)/life/(scot %da now.pin)/(scot %p who)/noun
/(scot %p her)/j/(scot %p her)/life/(scot %da now.pin)/(scot %p who)/noun
=/ lyfe (scry-aqua noun our now.pin aqua-pax)
~& [new-lyfe=[0 new-lyfe] lyfe=lyfe]
?: =([~ new-lyfe] lyfe)
@ -389,7 +388,7 @@
:+ & ~
=/ aqua-pax
:- %i
/(scot %p her)/k/(scot %p her)/rift/(scot %da now.pin)/(scot %p who)/noun
/(scot %p her)/j/(scot %p her)/rift/(scot %da now.pin)/(scot %p who)/noun
=/ rut (scry-aqua noun our now.pin aqua-pax)
?: =([~ new-rut] rut)
[%done ~]

View File

@ -24,7 +24,6 @@
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
snap=(unit snapshot:jael)
==
::
++ module-ova
@ -61,7 +60,7 @@
[%i /vane/iris]
:: sys/vane/kale: security
::
[%k /vane/kale]
[%j /vane/jael]
==
|= [=term =path]
=/ pax (weld sys path)
@ -75,7 +74,7 @@
=/ directories
`(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web]
|= bas=path
^- ovum
^- unix-event
::
:: /app %gall applications
:: /gen :dojo generators
@ -92,7 +91,7 @@
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
^- unix-event
::
:: hav: all user files
::
@ -118,7 +117,7 @@
=? hav ?=(^ fil.lon)
:: XX this whitelist needs to be reviewed
::
?. ?= ?($css $hoon $json $md $txt $udon $umd)
?. ?= ?($css $hoon $html $js $json $md $png $txt $udon $umd)
-.tyl
::
:: install only files with whitelisted marks

View File

@ -166,67 +166,4 @@
::
[%last-update (time:enjs:format last-update.col)]
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
--

View File

@ -62,6 +62,25 @@
::
:: ----
::
:: Scry from the namespace.
::
:: Direct scrys are impossible in a tapp, so this routes around that.
::
++ scry
|* result-type=mold
|= =path
=/ m (async ,result-type)
;< ~ bind:m (send-raw-card %scry path)
|= =async-input
:^ ~ ~ ~
?~ in.async-input
[%wait ~]
?. ?=(%scry-result -.sign.u.in.async-input)
[%fail %expected-scry-result >got=-.sign< ~]
[%done (result-type result.sign.u.in.async-input)]
::
:: ----
::
:: Outgoing HTTP requests
::
++ send-request

View File

@ -254,10 +254,10 @@
:: XX use only for development may break contracts!
:: XX if active clam contracts only to abort transaction?
::
~& [%tapp-reset dap.bowl]
`this-tapp
:: ~| [%tapp-load-incompatible dap.bowl]
:: !!
:: ~& [%tapp-reset dap.bowl]
:: `this-tapp
~| [%tapp-load-incompatible dap.bowl]
!!
::
:: because the clam replaces the active continuation with
:: the bunt of its mold, we must fail the transaction
@ -412,10 +412,10 @@
^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding])
::
:: Receive source update from kale
:: Receive source update from jael
::
++ source
|= [=wire whos=(set ship) =source:kale]
|= [=wire whos=(set ship) =source:jael]
^- (quip move _this-tapp)
=. waiting (~(put to waiting) ost.bowl [%take %source whos source])
?^ active
@ -428,6 +428,9 @@
|= =async-input:async-lib
^- (quip move _this-tapp)
=/ m tapp-async
=| moves=(list move)
=| scrys=(list path)
|- ^- (quip move _this-tapp)
?~ active
~| %no-active-async
~| ?~ in.async-input
@ -442,14 +445,27 @@
%& p.out
%| [[~ [%fail contracts.u.active %crash p.out]] u.active]
==
=. moves (weld moves (skip moves.r |=(=move =(%scry -.q.move))))
=. scrys
%+ weld scrys
^- (list path)
%+ murn moves.r
|= =move
^- (unit path)
?. ?=(%scry -.q.move)
~
`path.q.move
?^ scrys
=/ scry-result .^(* i.scrys)
$(scrys t.scrys, in.async-input `[i.scrys %scry-result scry-result])
=> .(active `(unit eval-form:eval:tapp-async)`active) :: TMI
=^ moves=(list move) this-tapp
=^ final-moves=(list move) this-tapp
?- -.eval-result.r
%next `this-tapp
%fail (fail-async [contracts err]:eval-result.r)
%done (done-async [contracts value]:eval-result.r)
==
[(weld moves.r moves) this-tapp]
[(weld moves final-moves) this-tapp]
::
:: Fails currently-running async
::

View File

@ -1,7 +1,7 @@
::
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ act=action:chat
++ grow

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ str=streams:chat
++ grow
@ -13,7 +13,7 @@
^- ^json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ upd=update:chat
++ grow

View File

@ -1,6 +1,4 @@
::
::
/+ launch
/- launch
::
|_ act=action:launch
::

View File

@ -1,12 +0,0 @@
::
:::: /hoon/json/lens/mar
::
/? 310
::
:::: ~fyr
::
|_ jon/json
++ grab |% ++ noun json
--
++ grow |% ++ json jon
-- --

View File

@ -47,7 +47,7 @@
::
++ new-collection
%- ot:dejs
:~ name+(su:dejs sym)
:~ name+so:dejs
title+so:dejs
comments+comment-config
allow-edit+edit-config
@ -57,8 +57,8 @@
++ new-post
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
name+(su:dejs sym)
coll+so:dejs
name+so:dejs
title+so:dejs
comments+comment-config
perm+perm-config
@ -68,40 +68,40 @@
++ new-comment
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
name+(su:dejs sym)
content+so:dejs
==
::
++ delete-collection
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ delete-post
%- ot:dejs
:~ coll+(su:dejs sym)
post+(su:dejs sym)
:~ coll+so:dejs
post+so:dejs
==
::
++ delete-comment
%- ot:dejs
:~ coll+(su:dejs sym)
post+(su:dejs sym)
comment+(su:dejs sym)
:~ coll+so:dejs
post+so:dejs
comment+so:dejs
==
::
++ edit-collection
%- ot:dejs
:~ name+(su:dejs sym)
:~ name+so:dejs
title+so:dejs
==
::
++ edit-post
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
name+(su:dejs sym)
coll+so:dejs
name+so:dejs
title+so:dejs
comments+comment-config
perm+perm-config
@ -110,9 +110,9 @@
::
++ edit-comment
%- ot:dejs
:~ coll+(su:dejs sym)
name+(su:dejs sym)
id+(su:dejs sym)
:~ coll+so:dejs
name+so:dejs
id+so:dejs
content+so:dejs
==
::
@ -147,7 +147,7 @@
::
++ invite
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
title+so:dejs
who+(ar:dejs (su:dejs fed:ag))
==
@ -155,36 +155,36 @@
++ reject-invite
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ serve
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ unserve
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ subscribe
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ unsubscribe
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ read
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
post+(su:dejs sym)
coll+so:dejs
post+so:dejs
==
::
--

View File

@ -19,6 +19,21 @@
[%coll s+col.upd]
[%title s+title.upd]
==
::
%unread
%- pairs
:~ [%add b+add.upd]
:+ %posts
%a
%+ turn ~(tap in keys.upd)
|= [who=@p coll=@tas post=@tas]
^- ^json
%- pairs
:~ [%who (ship who)]
[%coll s+coll]
[%post s+post]
==
==
::
==
::

View File

@ -1,16 +0,0 @@
::
:::: /hoon/snap/mar
::
=, mimes:html
|_ snap/snapshot:jael
++ grow
|%
++ mime [/application/octet-stream (jam snap)]
--
++ grab
|%
++ noun snapshot:jael
++ mime |=([p=mite:eyre q=octs:eyre] (cue q.q))
--
++ grad %mime
--

View File

@ -50,27 +50,6 @@
++ grow
=, enjs
|%
++ lens-json :: json for cli client
^- ?(~ ^json) :: null = ignore
?+ -.sef ~
$tan (wall (turn (flop p.sef) |=(a/tank ~(ram re a))))
$txt s+(crip p.sef)
$sag
=/ =atom (jam q.sef)
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
(pairs file+s+(crip <`path`p.sef>) data+s+enc ~)
$sav
(pairs file+s+(crip <`path`p.sef>) data+s+(crip (en-base64:mimes:html q.sef)) ~)
::
$mor
=+ all=(turn p.sef |=(a/sole-effect lens-json(sef a)))
=. all (skip all |=(a/^json ?=(~ a)))
?~ all ~
?~ t.all i.all
~|(multiple-effects+`(list ^json)`all !!)
==
::
++ json
^- ^json
?+ -.sef

45
pkg/arvo/sur/chat.hoon Normal file
View File

@ -0,0 +1,45 @@
/- hall
::
|%
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
--

7
pkg/arvo/sur/launch.hoon Normal file
View File

@ -0,0 +1,7 @@
|%
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
--

View File

@ -1,15 +1,15 @@
|%
::
+$ action
$% $: %new-collection
name=@tas
title=@t
$% $: %new-collection
name=@tas
title=@t
com=comment-config
edit=edit-config
perm=perm-config
==
::
$: %new-post
$: %new-post
who=@p
coll=@tas
name=@tas
@ -98,16 +98,6 @@
last-update=@da
==
::
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ delta
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]
@ -118,5 +108,6 @@
::
+$ update
$% [%invite add=? who=@p col=@tas title=@t]
[%unread add=? keys=(set [who=@p coll=@tas post=@tas])]
==
--

View File

@ -4,7 +4,8 @@
:: Possible async calls
::
+$ card
$% [%wait wire @da]
$% [%scry =path]
[%wait wire @da]
[%rest wire @da]
[%poke wire dock poke-data]
[%peer wire dock path]
@ -15,22 +16,23 @@
[%connect wire binding:eyre term]
[%http-response =http-event:http]
[%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:kale]
[%source wire whos=(set ship) src=source:jael]
[%sources wire ~]
[%new-event wire =ship =udiff:point:able:kale]
[%listen wire whos=(set ship) =source:kale]
[%new-event wire =ship =udiff:point:able:jael]
[%listen wire whos=(set ship) =source:jael]
==
::
:: Possible async responses
::
+$ sign
$% [%wake error=(unit tang)]
$% [%scry-result result=*]
[%wake error=(unit tang)]
[%coup =dock error=(unit tang)]
[%quit =dock =path]
[%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre]
[%http-response response=client-response:iris]
[%source whos=(set ship) =source:kale]
[%source whos=(set ship) =source:jael]
==
::
:: Outstanding contracts

View File

@ -481,12 +481,12 @@
|* {a/(unit) b/(unit)}
?~ b a
?~ a b
?.(=(u.a u.b) ~>(%mean.[%leaf "mate"] !!) a)
?.(=(u.a u.b) ~>(%mean.'mate' !!) a)
::
++ need :: demand
~/ %need
|* a/(unit)
?~ a ~>(%mean.[%leaf "need"] !!)
?~ a ~>(%mean.'need' !!)
u.a
::
++ some :: lift (pure)
@ -8927,7 +8927,7 @@
* gen
==
::
++ rake ~>(%mean.[%leaf "rake-hoon"] (need reek))
++ rake ~>(%mean.'rake-hoon' (need reek))
++ reek
^- (unit wing)
?+ gen ~
@ -8941,7 +8941,7 @@
^- term
=+ wig=rake
?. ?=({@ ~} wig)
~>(%mean.[%leaf "rusk-hoon"] !!)
~>(%mean.'rusk-hoon' !!)
i.wig
--
::
@ -9089,7 +9089,7 @@
%void %void
%noun [%atom p.base.skin ~]
[%atom *] ?. (fitz p.base.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max p.base.skin p.ref)
q.ref
@ -9134,7 +9134,7 @@
[%atom *] ?: &(?=(^ q.ref) !=(atom.skin u.q.ref))
%void
?. (fitz aura.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max aura.skin p.ref)
`atom.skin
@ -9626,14 +9626,14 @@
++ play
^- type
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.p.lug))
(elbo p.lug rig)
::
++ mint
|= gol/type
^- (pair type nock)
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug))
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
(etco p.lug rig)
::
@ -9902,7 +9902,7 @@
:- %hold
?. ?=({$core *} p)
~_ (dunk %fire-type)
~>(%mean.[%leaf "fire-core"] !!)
~>(%mean.'fire-core' !!)
=+ dox=[%core q.q.p q.p(r.p %gold)]
?: ?=($dry -.q)
:: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry)
@ -9934,7 +9934,7 @@
[%3 %0 axe]
(flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3)))
::
{$core *} ~>(%mean.[%leaf "fish-core"] !!)
{$core *} ~>(%mean.'fish-core' !!)
{$face *} $(sut q.sut)
{$fork *} =+ yed=~(tap in p.sut)
|- ^- nock
@ -9942,7 +9942,7 @@
{$hint *} $(sut q.sut)
{$hold *}
?: (~(has in vot) sut)
~>(%mean.[%leaf "fish-loop"] !!)
~>(%mean.'fish-loop' !!)
=> %=(. vot (~(put in vot) sut))
$(sut repo)
==
@ -9980,7 +9980,7 @@
{$hint *} (hint p.sut $(sut q.sut))
{$hold *}
?: (~(has in bix) [sut ref])
~>(%mean.[%leaf "fuse-loop"] !!)
~>(%mean.'fuse-loop' !!)
$(sut repo, bix (~(put in bix) [sut ref]))
::
$noun ref
@ -10185,7 +10185,7 @@
|^ ^- {p/type q/nock}
?: ?&(=(%void sut) !?=({$dbug *} gen))
?. |(!vet ?=({$lost *} gen) ?=({$zpzp *} gen))
~>(%mean.[%leaf "mint-vain"] !!)
~>(%mean.'mint-vain' !!)
[%void %0 0]
?- gen
::
@ -10267,7 +10267,7 @@
{$wthx *}
:- (nice bool)
=+ fid=(find %read [[%& 1] q.gen])
~> %mean.[%leaf "mint-fragment"]
~> %mean.'mint-fragment'
?> &(?=(%& -.fid) ?=(%& -.q.p.fid))
(~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid))
::
@ -10294,7 +10294,7 @@
{$lost *}
?: vet
~_ (dunk(sut (play p.gen)) 'lost')
~>(%mean.[%leaf "mint-lost"] !!)
~>(%mean.'mint-lost' !!)
[%void [%0 0]]
::
{$zpmc *}
@ -10311,7 +10311,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mint-open"] !!)
~>(%mean.'mint-open' !!)
$(gen doz)
==
::
@ -10349,7 +10349,7 @@
|= {gol/type dox/type gen/hoon}
|^ ^- {p/type q/type}
?: =(%void sut)
~>(%mean.[%leaf "mull-none"] !!)
~>(%mean.'mull-none' !!)
?- gen
::
{^ *}
@ -10414,9 +10414,9 @@
:- %void
?: =(%void q.fex)
%void
~>(%mean.[%leaf "if-z"] (play(sut q.fex) q.gen))
~>(%mean.'if-z' (play(sut q.fex) q.gen))
?: =(%void q.fex)
~>(%mean.[%leaf "mull-bonk-b"] !!)
~>(%mean.'mull-bonk-b' !!)
$(sut p.fex, dox q.fex, gen q.gen)
=+ ^= ran ^- {p/type q/type}
=+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)]
@ -10424,9 +10424,9 @@
:- %void
?: =(%void q.wux)
%void
~>(%mean.[%leaf "if-a"] (play(sut q.wux) r.gen))
~>(%mean.'if-a' (play(sut q.wux) r.gen))
?: =(%void q.wux)
~>(%mean.[%leaf "mull-bonk-c"] !!)
~>(%mean.'mull-bonk-c' !!)
$(sut p.wux, dox q.wux, gen r.gen)
[(nice (fork p.hiq p.ran ~)) (fork q.hiq q.ran ~)]
::
@ -10436,11 +10436,11 @@
q=(cove q:(mint(sut dox) %noun [%wing q.gen]))
=+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)]
?. &(=(p.syx q.syx) =(p.pov q.pov))
~>(%mean.[%leaf "mull-bonk-a"] !!)
~>(%mean.'mull-bonk-a' !!)
(beth bool)
::
{$wthx *}
~> %mean.[%leaf "mull-bonk-x"]
~> %mean.'mull-bonk-x'
=+ :- =+ (find %read [[%& 1] q.gen])
?> &(?=(%& -.-) ?=(%& -.q.p.-))
new=[type=p.q.p.- axis=(tend p.p.-)]
@ -10456,7 +10456,7 @@
{$lost *}
?: vet
:: ~_ (dunk(sut (play p.gen)) 'also')
~>(%mean.[%leaf "mull-skip"] !!)
~>(%mean.'mull-skip' !!)
(beth %void)
::
{$zpts *} (beth %noun)
@ -10468,7 +10468,7 @@
{$zpvt *}
=+ [(feel p.gen) (feel(sut dox) p.gen)]
?. =(-< ->)
~>(%mean.[%leaf "mull-bonk-f"] !!)
~>(%mean.'mull-bonk-f' !!)
?: -<
$(gen q.gen)
$(gen r.gen)
@ -10478,7 +10478,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mull-open"] !!)
~>(%mean.'mull-open' !!)
$(gen doz)
==
::
@ -10559,6 +10559,7 @@
gil/(set {p/type q/type}) :: assume nest
==
=< dext
~% %nest-in ..$ ~
|%
++ deem
|= {mel/vair ram/vair}
@ -10595,12 +10596,16 @@
== == ==
::
++ dext
=< $
~% %nest-dext + ~
|.
^- ?
=- ?: - &
?. tel |
:: ~_ (dunk %need)
:: ~_ (dunk(sut ref) %have)
~>(%mean.[%leaf "nest-fail"] !!)
~> %mean.'nest-fail'
!!
?: =(sut ref) &
?- sut
$void sint
@ -10769,7 +10774,8 @@
* =+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "play-open"] !!)
~> %mean.'play-open'
!!
$(gen doz)
==
:: ::
@ -10997,7 +11003,7 @@
{$hint *} q.sut
{$hold *} (rest [[p.sut q.sut] ~])
$noun (fork [%atom %$ ~] [%cell %noun %noun] ~)
* ~>(%mean.[%leaf "repo-fltt"] !!)
* ~>(%mean.'repo-fltt' !!)
==
::
++ rest
@ -11005,7 +11011,7 @@
|= leg/(list {p/type q/hoon})
^- type
?: (lien leg |=({p/type q/hoon} (~(has in fan) [p q])))
~>(%mean.[%leaf "rest-loop"] !!)
~>(%mean.'rest-loop' !!)
=> .(fan (~(gas in fan) leg))
%- fork
%~ tap in
@ -14134,7 +14140,7 @@
:: %mean.[%leaf "need"]
::
:: XX I'm not sure if the `[%leaf "need"]` bit represents a literal
:: AST fragment or an expression that evaluates to `[%leaf "need"]. I'm
:: AST fragment or an expression that evaluates to `[%leaf "need"]`. I'm
:: going to assume the latter for now.
::
++ tiscol-to-plum
@ -15904,7 +15910,6 @@
|* tem=rule
%- star
;~ pose
whit
;~(pfix bas tem)
;~(less tem prn)
==

View File

@ -57,8 +57,8 @@
=/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0
=, ames
=, able
=* point point:able:kale
=* public-keys-result public-keys-result:able:kale
=* point point:able:jael
=* public-keys-result public-keys-result:able:jael
::
=>
|%
@ -633,7 +633,7 @@
$: %d
$% [%flog flog:dill]
== ==
$: %k
$: %j
$% [%private-keys ~]
[%public-keys ships=(set ship)]
[%turf ~]
@ -655,7 +655,7 @@
$% $: %b
$% [%wake error=(unit tang)]
== ==
$: %k
$: %j
$% [%private-keys =life vein=(map life ring)]
[%public-keys =public-keys-result]
[%turf turfs=(list turf)]
@ -881,9 +881,9 @@
::
[%b %wake *] (on-take-wake:event-core wire error.sign)
::
[%k %turf *] (on-take-turf:event-core turfs.sign)
[%k %private-keys *] (on-priv:event-core [life vein]:sign)
[%k %public-keys *] (on-publ:event-core wire public-keys-result.sign)
[%j %turf *] (on-take-turf:event-core turfs.sign)
[%j %private-keys *] (on-priv:event-core [life vein]:sign)
[%j %public-keys *] (on-publ:event-core wire public-keys-result.sign)
==
::
[moves ames-gate]
@ -1143,8 +1143,8 @@
|= our=ship
^+ event-core
::
=~ (emit duct %pass /turf %k %turf ~)
(emit duct %pass /private-keys %k %private-keys ~)
=~ (emit duct %pass /turf %j %turf ~)
(emit duct %pass /private-keys %j %private-keys ~)
==
:: +on-priv: set our private key to jael's response
::
@ -1374,7 +1374,7 @@
=/ turfs
;; (list turf)
=< q.q %- need %- need
(scry-gate [%141 %noun] ~ %k `beam`[[our %turf %da now] /])
(scry-gate [%141 %noun] ~ %j `beam`[[our %turf %da now] /])
::
(emit unix-duct.ames-state %give %turf turfs)
:: +on-vega: handle kernel reload
@ -1404,7 +1404,7 @@
::
?: already-pending
event-core
(emit duct %pass /public-keys %k %public-keys [n=ship ~ ~])
(emit duct %pass /public-keys %j %public-keys [n=ship ~ ~])
:: +send-blob: fire packet at .ship and maybe sponsors
::
:: Send to .ship and sponsors until we find a direct lane or
@ -1816,7 +1816,7 @@
%a (emit duct %pass wire %a %plea her.channel plea)
%c (emit duct %pass wire %c %plea her.channel plea)
%g (emit duct %pass wire %g %plea her.channel plea)
%k (emit duct %pass wire %k %plea her.channel plea)
%j (emit duct %pass wire %j %plea her.channel plea)
==
:: we previously crashed on this message; send nack
::

View File

@ -498,8 +498,8 @@
== ::
task:able:ford ::
== ::
$: %k :: by %kale
$>(%public-keys task:able:kale) ::
$: %j :: by %jael
$>(%public-keys task:able:jael) ::
== == ::
++ riot (unit rant) :: response+complete
++ sign :: in result $<-
@ -527,8 +527,8 @@
$: %f :: by %ford
$>(%made gift:able:ford) ::
== ::
$: %k :: by %kale
$>(%public-keys gift:able:kale) ::
$: %j :: by %jael
$>(%public-keys gift:able:jael) ::
== ::
$: @tas :: by any
$>(%crud vane-task) :: XX strange
@ -2643,7 +2643,7 @@
::
:+ ?: (~(has by hoy.ruf) her)
~
[hun.rom.ruf %pass /sinks %k %public-keys (silt her ~)]~
[hun.rom.ruf %pass /sinks %j %public-keys (silt her ~)]~
~
=/ rus rus:(~(gut by hoy.ruf) her *rung)
%+ ~(gut by rus) syd
@ -4172,17 +4172,15 @@
[[[hen %slip %d %flog req] ~] ..^$]
::
%drop
?: =(~ act.ruf)
~& %clay-idle
[~ ..^$]
~& :- %clay-cancelling
?> ?=(^ act.ruf)
[hen -.req -.eval-data]:u.act.ruf
=. act.ruf ~
?~ cue.ruf
[~ ..^$]
=/ =duct duct:(need ~(top to cue.ruf))
[[duct %pass /queued-request %b %wait now]~ ..^$]
~? =(~ act.ruf)
[%clay-idle cue-length=~(wyt in cue.ruf)]
~? ?=(^ act.ruf)
[%clay-cancelling hen -.req -.eval-data]:u.act.ruf
=. act.ruf ~
?~ cue.ruf
[~ ..^$]
=/ =duct duct:(need ~(top to cue.ruf))
[[duct %pass /queued-request %b %wait now]~ ..^$]
::
%info
?: =(%$ des.req)

View File

@ -20,7 +20,7 @@
f/(unit mass) ::
g/(unit mass) ::
i/(unit mass) ::
k/(unit mass) ::
j/(unit mass) ::
== ::
== ::
++ axon :: dill per duct
@ -79,15 +79,15 @@
$: %i ::
$>(%wegh task:able:iris) ::
== ::
$: %k ::
$: %j ::
$> $? %dawn ::
%fake ::
%wegh ::
== ::
task:able:kale ::
task:able:jael ::
== == ::
++ sign :: in result $<-
$~ [%k %init *@p] ::
$~ [%j %init *@p] ::
$% $: %a ::
$% $>(%mass gift:able:ames) ::
== == ::
@ -122,11 +122,11 @@
$: %i ::
$>(%mass gift:able:iris) ::
== ::
$: %k ::
$: %j ::
$> $? %init ::
%mass ::
== ::
gift:able:kale ::
gift:able:jael ::
== == ::
:::::::: :: dill tiles
--
@ -278,7 +278,7 @@
[hen %pass /heft/ford %f %wegh ~]
[hen %pass /heft/gall %g %wegh ~]
[hen %pass /heft/iris %i %wegh ~]
[hen %pass /heft/jael %k %wegh ~]
[hen %pass /heft/jael %j %wegh ~]
moz
==
==
@ -289,7 +289,7 @@
;; ship
%- need %- need
%- (sloy-light ski)
[[151 %noun] %k our %sein da+now /(scot %p who)]
[[151 %noun] %j our %sein da+now /(scot %p who)]
::
++ init :: initialize
^+ .
@ -372,10 +372,10 @@
|= sih/sign
^+ +>
?- sih
{?($a $b $c $e $f $g $i $k) $mass *}
{?($a $b $c $e $f $g $i $j) $mass *}
(wegh -.sih p.sih)
::
[%k %init *]
[%j %init *]
:: pass thru to unix
::
+>(moz :_(moz [hen %give +.sih]))
@ -416,7 +416,7 @@
:: +wegh: receive a memory report from a vane and maybe emit full report
::
++ wegh
|= [lal=?(%a %b %c %e %f %g %i %k) mas=mass]
|= [lal=?(%a %b %c %e %f %g %i %j) mas=mass]
^+ +>
:: update our listing of vane responses with this new one
::
@ -429,7 +429,7 @@
%f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas))
%g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas))
%i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas))
%k ~?(?=(^ k.hef.all) %double-mass-k hef.all(k `mas))
%j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas))
==
:: if not all vanes have responded yet, no-op
::
@ -440,7 +440,7 @@
?=(^ f.hef.all)
?=(^ g.hef.all)
?=(^ i.hef.all)
?=(^ k.hef.all)
?=(^ j.hef.all)
==
+>.$
:: clear vane reports from our state before weighing ourself
@ -448,7 +448,7 @@
:: Otherwise, the state of vanes printed after this one get absorbed
:: into Dill's %dot catchall report.
::
=/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.k]:hef.all
=/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.j]:hef.all
=> .(hef.all [~ ~ ~ ~ ~ ~ ~ ~])
:: wegh ourself now that our state doesn't include other masses
::
@ -488,12 +488,12 @@
?> =(~ hey.all)
=. hey.all `hen
=/ boot
((soft $>($?(%dawn %fake) task:able:kale)) p.task)
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %k u.boot]~)
:_(..^$ [hen %pass / %j u.boot]~)
:: we are subsequently initialized. single-home
::
?: ?=(%init -.task)

View File

@ -374,6 +374,9 @@
#topborder {
border-top: 3px #fff solid;
}
#ship-name {
font-family: 'Source Code Pro', monospace, sans-serif;
}
h1 {
line-height: 77px;
font-size: 64px;
@ -425,7 +428,7 @@
;div#main
;div#inner
;h1#topborder:"Welcome"
;h1:"{(scow %p our)}"
;h1#ship-name:"{(scow %p our)}"
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;input(type "password", name "password", placeholder "passcode", autofocus "true");
;input(type "hidden", name "redirect", value redirect-str);

View File

@ -1244,19 +1244,21 @@
%keep `%f
%kill `%f
%look `%j
%listen `%k
%listen `%j
%merg `%c
%mint `%k
%mint `%j
%mont `%c
%moon `%j
%nuke `%a
%ogre `%c
%perm `%c
%rest `%b
%snap `%j
%rekey `%j
%wait `%b
%want `%a
%warp `%c
%wind `%k
%wind `%j
%wash `%g
%wipe `%f
::
%request `%i
@ -1300,6 +1302,10 @@
(mo-gawk:(mo-abed:mo hen) him dap mes)
::
$vega [~ ..^$]
::
%wash
=. bum.mast.all (~(run by bum.mast.all) |=(=seat seat(vel *worm)))
[~ ..^$]
::
$wegh
=/ =mass

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
:: - %eyre: web ("fair")
:: - %ford: build ("lord")
:: - %gall: application ("ball")
:: - %kale: security ("jail")
:: - %jael: security ("jail")
::
:: with %zuse in your core, the engines of any vane are
:: available at `engine:vane`. the models (molds) are
@ -73,9 +73,9 @@
++ life @ud :: ship key revision
++ rift @ud :: ship continuity
++ mime {p/mite q/octs} :: mimetyped data
::
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
++ octs {p/@ud q/@t} :: octet-stream
++ sock {p/ship q/ship} :: outgoing [our his]
@ -121,7 +121,7 @@
--
--
:: ::::
:::: ++ethereum-types :: eth surs for kale
:::: ++ethereum-types :: eth surs for jael
:: ::::
++ ethereum-types
|%
@ -135,7 +135,7 @@
++ events (set event-id)
--
:: ::::
:::: ++azimuth-types :: az surs for kale
:::: ++azimuth-types :: az surs for jael
:: ::::
++ azimuth-types
=, ethereum-types
@ -166,7 +166,7 @@
$= kid
%- unit
$: spawn-proxy=address
spawned=(set @p) ::TODO sparse range, pile, see old kale ++py
spawned=(set @p) ::TODO sparse range, pile, see old jael ++py
==
==
::
@ -216,7 +216,7 @@
[%plea =ship =plea:ames]
==
:: ::::
:::: ++http ::
:::: ++http ::
:: ::::
:: http: shared representations of http concepts
::
@ -403,7 +403,7 @@
:: %send: packet to unix
::
:: %mass: memory usage report
:: %turf: domain report, relayed from kale
:: %turf: domain report, relayed from jael
::
+$ gift
$% [%boon payload=*]
@ -1785,6 +1785,8 @@
$>(%init vane-task) :: set owner
$>(%plea vane-task) :: ames request
$>(%vega vane-task) :: report upgrade
$>(%plea vane-task) :: network request
[%wash ~] :: clear caches
$>(%wegh vane-task) :: report memory
== ::
-- ::able
@ -1961,240 +1963,6 @@
:: ::
:::: ++able:jael :: (1h1) arvo moves
:: ::::
++ able ^?
=, pki
=, rights
|%
:: %jael has two general kinds of task: changes
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %jael only talks to %ames and %behn. we send messages
:: through %ames and use %behn timers.
::
++ logs :: on-chain changes
%+ map event-id:ethereum-types :: per event log
diff-azimuth:azimuth-types :: the change
++ action :: balance change
%+ pair ship :: partner
%+ each bump :: &/liability change
bump :: |/asset change
:: ::
++ balance :: balance sheet
%+ pair ::
(map ship safe) :: liabilities
(map ship safe) :: assets
:: ::
++ vent-result :: %vent result
$% [%snap snap=snapshot:jael] :: restore snapshot
[%chain can=chain] :: get new events
== ::
:: ::
++ chain :: batch of changes
%+ each logs :: & all events
logs :: | new events
++ change :: urbit change
$% [%ethe can=chain] :: on-chain change
[%meet who=ship =life =pass] :: meet in new era
$: %rite :: rights change
rex/ship :: issuer
pal/ship :: issued to
del/bump :: change
== == ::
++ gift :: out result <-$
$% [%done error=(unit error:ames)] :: ames (n) ack
[%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%pubs public] :: public keys
[%turf turf=(list turf)] :: domains
[%vest p=tally] :: balance update
[%vein =life vein=(map life ring)] :: private keys
[%vine p=(list change)] :: all raw changes
[%vent p=vent-result] :: ethereum changes
== ::
:: ::
++ public :: public key state
$: life=life :: current key number
pubs=(map life pass) :: pubkeys by number
== ::
++ remote :: remote notification
%+ each safe :: &/addition
safe :: |/replacement
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
++ tally :: balance update
%+ each balance :: complete
action :: change
::
+= task :: in request ->$
$~ [%vega ~] ::
$% [%burn p=ship q=safe] :: destroy rights
[%hail p=ship q=remote] :: remote update
$: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%look src=(each ship purl:eyre)] :: set ethereum source
[%mint p=ship q=safe] :: create rights
[%move p=ship q=ship r=safe] :: transfer from=to
::TODO %next for generating/putting new private key
[%nuke ~] :: cancel tracker from
[%pubs =ship] :: view public keys
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%turf ~] :: view domains
$>(%vega vane-task) :: report upgrade
[%vein ~] :: view signing keys
[%vent ~] :: view ethereum events
[%vest ~] :: view public balance
[%vine ~] :: view secret history
$>(%wegh vane-task) :: memory usage request
[%wind p=@ud] :: rewind before block
$>(%plea vane-task) :: ames request message
== ::
-- ::
:: ::
:::: ::
:: ::
++ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
++ snapshot :: rewind point
=, azimuth-types ::
$: kyz=(map ship public:able) :: public key state
$= eth ::
$: dns=dnses :: on-chain dns state
pos=(map ship point) :: on-chain ship state
== ::
eth-bookmark
==
:: +eth-bookmark: cursor into the ethereum chain
::
++ eth-bookmark
$: heard=(set event-id:ethereum-types)
latest-block=@ud
==
:: +state-eth-node: state of a connection to an ethereum node
::
++ state-eth-node :: node config + meta
$: source=(each ship node-src) :: learning from
foreign-block=@ud :: node's latest block
eth-bookmark
== ::
:: ::
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
::TODO update to fit azimuth-style keys
:: the urbit meta-certificate (++will) is a sequence
:: of certificates (++cert). each cert in a will
:: revokes and replaces the previous cert. the
:: version number of a ship is a ++life.
::
:: the deed contains an ++arms, a definition
:: of cosmetic identity; a semi-trusted parent,
:: which signs the initial certificate and provides
:: routing services; and a dirty bit. if the dirty
:: bit is set, the new life of this ship may have
:: lost information that the old life had.
::
++ hand @uvH :: 128-bit hash
++ mind {who/ship lyf/life} :: key identifier
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
:: ::
:::: ++rights:jael :: (1h3) claims
:: ::::
++ rights ^?
=, pki
|%
:: %jael tracks promises (++rite) from ship to ship.
:: a rite may be any right, badge, asset, secret, etc.
:: un-shared secret or private asset is stored as a
:: rite from self to self.
::
:: each rite is really a class of rights, and often
:: has its own internal set or map structure.
::
:: present kinds of rite:
::
:: %apple: application secret for a web api.
:: %block: the promisee is banned.
:: %email: email tied to promissee's ship.
:: %final: ship/ticket pair, ready to launch.
:: %fungi: fungible, countable asset.
:: %guest: permission to adopt foreign child.
:: %hotel: block of unissued children.
:: %jewel: urbit private keys.
:: %login: user's login passcode.
:: %pword: password for a website/api.
:: %token: user access token for a web api.
:: %urban: symmetric key for urbit networking.
::
:: %fungi keys can be anything, but don't reuse
:: currency codes. codes for urbit invitations:
:: %ugl == galaxy, %usr == star, %upl == planet
::
:: you can think of [our her rite] as an rdf triple.
::
++ bill (pair @da @) :: expiring value
++ bump :: rights change
$: mor/safe :: add rights
les/safe :: lose rights
== ::
++ dorm (pair ship bloq) :: issuing group
++ pile (tree (pair @ @)) :: efficient ship set
++ rite :: urbit commitment
$% {$apple p/(map site @)} :: web api key
{$block ~} :: banned
{$email p/(set @t)} :: email addresses
{$final p/(map ship @pG)} :: ticketed ships
{$fungi p/(map term @ud)} :: fungibles
{$guest ~} :: refugee visa
{$hotel p/(map dorm pile)} :: reserved block
{$jewel p/(map life ring)} :: private keyring
{$login p/(set @pG)} :: login secret
{$pword p/(map site (map @t @t))} :: web passwd by user
{$token p/(map site (map @t @t))} :: app tokens by user
{$urban p/(map hand bill)} :: urbit symmetric keys
== ::
++ site (list @ta) :: [%com %yahoo %www ~]
++ safe (tree rite) :: rights set
-- :: rights
-- :: jael
:: ::::
:::: ++kale :: (1h) security
:: ::::
++ kale ^?
|%
:: ::
:::: ++able:kale :: (1h1) arvo moves
:: ::::
++ able ^?
=, pki
|%
@ -2219,46 +1987,27 @@
+= task :: in request ->$
$~ [%vega ~] ::
$% $: %dawn :: boot from keys
=seed:able:kale :: identity params
=seed:able:jael :: identity params
spon=[=ship point:azimuth-types] :: sponsor
czar=(map ship [=rift =life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%meet =ship =life =pass] :: met after breach
[%moon =ship =udiff:point] :: register moon keys
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%rekey =life =ring] :: update private keys
[%turf ~] :: view domains
$>(%vega vane-task) :: report upgrade
$>(%wegh vane-task) :: memory usage request
$>(%plea vane-task) :: ames request
[%wind p=@ud] :: rewind before block
== ::
:: %kale has two general kinds of task: changes
::
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %kale only talks to %ames and itself.
::
++ block
=< block
@ -2332,7 +2081,6 @@
%rift
?: =(rift.a-udiff +(rift.a-point))
`[%rift rift.a-point rift.a-udiff]
~& [%ignoring-udiff a-udiff a-point]
~
::
%keys
@ -2389,7 +2137,6 @@
:: ::
+$ source (each ship term)
+$ source-id @udsourceid
+$ snapshot ~
::
:: +state-eth-node: state of a connection to an ethereum node
::
@ -2402,7 +2149,7 @@
ship-sources-reverse=(jug source-id ship)
== ::
:: ::
:::: ++pki:kale :: (1h2) certificates
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
@ -2424,7 +2171,7 @@
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
-- :: kale
-- :: jael
--
:: :: ::
:::: :: :: (2) engines
@ -6961,7 +6708,7 @@
++ sein :: autoboss
|= [our=ship now=@da who=ship]
.^ ship
%k
%j
/(scot %p our)/sein/(scot %da now)/(scot %p who)
==
:: :: ++team:title
@ -7164,6 +6911,10 @@
=. size.queue +(size.queue)
::
[~ queue]
:: max is zero, the oldest item to return is the one which just went in.
::
?: =(~ queue.queue)
[`item queue]
:: we're at max capacity, so pop before pushing; size is unchanged
::
=^ oldest queue.queue ~(get to queue.queue)
@ -7538,7 +7289,6 @@
gift:able:gall
gift:able:iris
gift:able:jael
gift:able:kale
==
++ task-arvo :: in request ->$
$% task:able:ames
@ -7550,7 +7300,6 @@
task:able:gall
task:able:iris
task:able:jael
task:able:kale
==
++ note-arvo :: out request $->
$~ [%b %wake ~]
@ -7563,7 +7312,6 @@
{$g task:able:gall}
[%i task:able:iris]
{$j task:able:jael}
{$k task:able:kale}
{@tas $meta vase}
==
++ sign-arvo :: in result $<-
@ -7580,7 +7328,6 @@
{$g gift:able:gall}
[%i gift:able:iris]
{$j gift:able:jael}
{$k gift:able:kale}
==
:: $unix-task: input from unix
::
@ -7709,21 +7456,20 @@
:: # diffs
::
++ update
$% [%full ships=(map ship point) dns=dnses heard=events] ::TODO keys
$% [%full ships=(map ship point) dns=dnses heard=events]
[%difs dis=(list (pair event-id diff-azimuth))]
==
::
:: # constants
::
:: contract addresses
::TODO values below are for ropsten, update for mainnet
++ contracts
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract
::
:: ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet
++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
++ azimuth
0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb
::
++ linear-star-release
0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801
@ -7733,14 +7479,24 @@
::
:: launch: block number of azimuth deploy
::
:: ++ launch 6.784.800
++ launch 4.601.630
++ launch 6.784.800
::
:: public: block number of azimuth becoming independent
::
++ public 7.033.765
--
::
:: Testnet contract addresses
::
++ ropsten-contracts
|%
++ azimuth
0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579
::
++ launch 4.601.630
--
::
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
:: hashes of ship event signatures
++ azimuth-events
|%
@ -8883,7 +8639,7 @@
?> ?=(%king (clan:title i.tar))
$(tar t.tar, stars (~(put in stars) i.tar))
::
|- ^- seed:able:kale
|- ^- seed:able:jael
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ who=ship `@`fig:ex:cub
?: (~(has in stars) (^sein:title who))
@ -9077,60 +8833,10 @@
(~(put by tuf) q.i.dom p.i.dom)
$(dom t.dom)
--
:: |snap:dawn restore from snapshot
::
++ snap
!:
|%
:: +bloq:snap:dawn: extract block number
::
++ bloq
|= snap=snapshot:jael
^- (unit @ud)
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
latest-block.snap
:: +czar:snap:dawn: extract galaxy table
::
++ czar
|= snap=snapshot:jael
^- (unit (map ship [=life =pass]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%- ~(gas by *(map ship [=life =pass]))
%+ turn (gulf 0 255)
|= gal=@
^- [ship [life pass]]
:- gal
~| czar-gal=gal
[life pass]:(need net:(~(got by pos.eth.snap) gal))
:: +point:snap:dawn: extract ship's contract state
::
++ point
|= [who=ship snap=snapshot:jael]
^- (unit point:azimuth)
(~(get by pos.eth.snap) who)
:: +turf:snap:dawn: extract network domains
::
++ turf
|= snap=snapshot:jael
^- (unit (list ^turf))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ murn
^- (list host:eyre)
%+ murn
^- (list @t)
~[pri sec ter]:dns.eth.snap
|= dom=@t
^- (unit host:eyre)
(rush dom thos:de-purl:html)
|=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a)))
--
:: +veri:dawn: validate keys, life, discontinuity, &c
::
++ veri
|= [=seed:able:kale =point:azimuth =live]
|= [=seed:able:jael =point:azimuth =live]
^- (each sponsor=ship error=term)
=/ rac (clan:title who.seed)
=/ cub (nol:nu:crub:crypto key.seed)
@ -9151,28 +8857,10 @@
[%& (^sein:title who.seed)]
::
%earl
:: a moon must be signed by the parent
::
?~ sig.seed
[%| %missing-sig]
:: the parent must be launched
::
?~ net.point
[%| %parent-not-keyed]
:: life must match parent's
::
?. =(lyf.seed life.u.net.point)
[%| %life-mismatch]
=/ loy (com:nu:crub:crypto pass.u.net.point)
=/ hax (shaf %earl (sham who.seed lyf.seed pub:ex:cub))
:: the signature must be valid
::
?. =((some hax) (sure:as:loy u.sig.seed))
[%| %invalid-sig]
:: XX revisit for rekey
::
?^ live
[%| %already-booted]
[%& (^sein:title who.seed)]
::
*

View File

@ -208,12 +208,11 @@
%give
%response
%start
:- 404
:~ ['content-type' 'text/html']
['content-length' '156']
==
::
%+ complete-http-start-event
:- 404
['content-type' 'text/html']~
[~ (error-page:http-server-gate 404 %.n '/' ~)]
complete=%.y
== ==
==
::
@ -384,12 +383,11 @@
^= expected-move
:~ :* duct=~[/http-blah] %give %response
%start
:- 500
:~ ['content-type' 'text/html']
['content-length' '180']
==
::
%+ complete-http-start-event
:- 500
['content-type' 'text/html']~
[~ (internal-server-error:http-server-gate %.n '/' ~)]
complete=%.y
== == ==
::
;: weld
@ -736,14 +734,13 @@
==
^= expected-move
:~ :* duct=~[/http-blah] %give %response
:* %start
:- 200
:~ ['content-type' 'text/plain']
['content-length' '13']
==
`[13 'one two three']
%.y
== == == ==
%start
::
%+ complete-http-start-event
:- 200
['content-type' 'text/plain']~
`[13 'one two three']
== == ==
::
;: weld
results1
@ -870,11 +867,10 @@
%give
%response
%start
:- 403
:~ ['content-type' 'text/html']
['content-length' '182']
==
::
%+ complete-http-start-event
:- 403
['content-type' 'text/html']~
:- ~
%- error-page:http-server-gate :*
403
@ -882,8 +878,6 @@
'/~/channel/1234567890abcdef'
~
==
::
complete=%.y
== ==
==
::
@ -2050,12 +2044,11 @@
%give
%response
%start
:- 200
:~ ['content-type' 'text/html']
['content-length' '1752']
==
::
%+ complete-http-start-event
:- 200
['content-type' 'text/html']~
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
complete=%.y
== ==
==
:: a response post redirects back to the application, setting cookie
@ -2201,4 +2194,12 @@
:: This is the default code for a fakeship.
::
[~ ~ %noun !>(.~lidlut-tabwed-savheb-loslux)]
:: produce the body of a %start http-event with the correct content-length
::
++ complete-http-start-event
|= [response-header:http data=(unit octs)]
=- [[status-code -] data %.y]
?~ data headers
%+ weld headers
['content-length' (crip ((d-co:co 1) p.u.data))]~
--

View File

@ -1,159 +0,0 @@
/+ *test
::
/= jael-raw /: /===/sys/vane/jael
/!noun/
=/ type-spear -:!>(jael-raw)
::
=/ test-pit=vase !>(.)
=/ jael-gate (jael-raw test-pit)
::
|%
:: tests that booting into %jael inits other vanes
::
++ test-boot-dawn
:: +key ~nul
=/ key=ring
0w8O.k5Ry4.QsKQq.1k~uj.DBOU4.numfq.nXOwa.cSk7B.VcHVm.
-8~kX.3ALiG.rQjOi.HZ9hj.84b6G.P5pCZ.UtNtt.Lh9TE.2DQJ2
=/ url (de-purl:html 'http://localhost:8545')
=/ dan
[`seed:able:jael`[~nul 1 key ~] ~nul ~ [/org/urbit ~] 0 url ~]
::
=^ results1 jael-gate
=/ hen=duct
[/ /term/1 / ~]
%- jael-call
:* jael-gate
now=~1234.5.6
call-args=[hen type=*type %dawn dan]
:~ [hen %slip %a %init ~nul]
[hen %slip %c %init ~nul]
[hen %slip %g %init ~nul]
[hen %slip %d %init ~nul]
[hen %slip %e %init ~nul]
[hen %give %init ~nul]
[hen %pass /~nul/init %b %wait +(~1234.5.6)]
== ==
::
=^ results2 jael-gate
=/ wir=wire
/our/~nul/now/(scot %da (add ~s1 ~1234.5.6))
%- jael-call-with-comparator :*
jael-gate
now=(add ~s1 ~1234.5.6)
call-args=[duct=[/ /term/1 wir ~] type=*type %vein ~]
^= comparator
|= moves=(list move:jael-gate)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> [%give %vein 1 (my [1 key] ~)]
!> q:(head moves)
== ==
::
=^ results3 jael-gate
::
=/ request=request:http
%+ light-json-request:rpc:ethereum
(need url)
%+ request-to-json:rpc:ethereum
`'block number'
[%eth-block-number ~]
::
%- jael-take-with-comparator :*
jael-gate
now=(add ~s2 ~1234.5.6)
take-args=[wire=/~nul/init duct=[/ /term/1 ~] type=*type %b %wake ~]
^= comparator
|= moves=(list move:jael-gate)
?> ?=(^ moves)
?> ?=([* %pass * %i %request *] i.moves)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> request
!> request.q.q.i.moves
== ==
::
:(weld results1 results2 results3)
::
++ jael-call
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-call-with-comparator
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
::
++ jael-take
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-take-with-comparator
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
--

View File

@ -125,4 +125,29 @@
results1
results2
==
::
++ test-put-zero
::
=| q=(capped-queue @u)
=. max-size.q 0
:: specialize type
::
=+ to-capped-queue=(to-capped-queue @u)
:: push enough values to evict one
::
::
=^ maybe1 q (~(put to-capped-queue q) 5)
=/ results1
%+ expect-eq
!> [~ 5]
!> maybe1
=/ results2
%+ expect-eq
!> 0
!> size.q
::
;: weld
results1
results2
==
--

View File

@ -28,25 +28,6 @@
%- crip
%+ weld "0x"
(render-hex-bytes:ethereum 20 `@`azimuth:contracts:^azimuth)
:: snapshot
::
++ snap
=| =snapshot:jael
%_ snapshot
kyz ~
::
dns.eth
['urbit.org' 'urbit.org' '']
::
pos.eth
%- malt
:* ~zod^pot
~marzod^pot
(turn (gulf 1 255) |=(gal=@ gal^pot))
==
::
latest-block 4.230.000
==
::
++ test-give-bloq
=/ oct
@ -204,26 +185,6 @@
!> [~ [/org/urbit ~]]
!> (turf:take:dawn oct)
::
++ test-snap-bloq
%+ expect-eq
!> [~ 4.230.000]
!> (bloq:snap:dawn snap)
::
++ test-snap-point
%+ expect-eq
!> [~ pot]
!> (point:snap:dawn ~zod snap)
::
++ test-snap-czar
%+ expect-eq
!> 256
!> ~(wyt by (need (czar:snap:dawn snap)))
::
++ test-snap-turf
%+ expect-eq
!> [~ `(list turf)`~[~['org' 'urbit'] ~['org' 'urbit']]]
!> (turf:snap:dawn snap)
::
++ test-veri-good
=/ sed [~zod 1 sec ~]
%+ expect-eq
@ -272,15 +233,6 @@
!> [%& (^sein:title who)]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-missing-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
[who 1 sec:ex:cub ~]
%+ expect-eq
!> [%| %missing-sig]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-parent-not-keyed
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
@ -293,53 +245,6 @@
!> [%| %parent-not-keyed]
!> (veri:dawn sed =>(pot .(net ~)) ~)
::
++ test-veri-earl-life-mismatch
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 2 sec:ex:cub `sig]
%+ expect-eq
!> [%| %life-mismatch]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-invalid-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
;: weld
=/ sed
=/ sig
%- sign:as:cub
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
::
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 2 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
==
::
++ test-veri-earl-already-booted
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %already-booted]
!> (veri:dawn sed pot `[1 |])
::
++ test-veri-pawn-good
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who=ship `@`fig:ex:cub

View File

@ -425,7 +425,12 @@ url = "http://localhost:%s" % PORT
r = requests.post(url, data=json.dumps(payload))
if r.text[0] == '"':
if r.headers.get('content-type') == 'application/octet-stream':
name = r.headers.get('content-disposition').split('filename=',1)[1][1:-1]
with open(name, 'wb') as f:
for block in r.iter_content(1024):
f.write(block)
elif r.text[0] == '"':
print r.text[1:-1].encode('utf-8').decode('string_escape')
elif r.text[0] == '{':
# print r.text

View File

@ -88,6 +88,14 @@ h2 {
font-weight: bold;
}
.fs-italic {
font-style: italic;
}
.td-underline {
text-decoration: underline;
}
.bg-v-light-gray {
background-color: #f9f9f9;
}
@ -116,6 +124,16 @@ h2 {
-webkit-box-orient: vertical;
}
.clamp-message {
max-width: calc(100% - 36px - 1.5rem);
}
.clamp-attachment {
overflow: scroll;
max-height: 10em;
max-width: 100%;
}
.lh-16 {
line-height: 16px;
}

View File

@ -226,8 +226,8 @@ export class ChatScreen extends Component {
numPeers={peers.length} />
</div>
<div
className="overflow-y-scroll pt3 flex flex-column-reverse"
style={{ height: 'calc(100% - 157px)' }}
className="overflow-y-scroll pt3 pb2 flex flex-column-reverse"
style={{ height: 'calc(100% - 157px)', resize: 'vertical' }}
onScroll={this.onScroll}>
<div ref={ el => { this.scrollElement = el; }}></div>
{chatMessages}

View File

@ -54,7 +54,9 @@ export class ChatInput extends Component {
setTimeout(closure, 2000);*/
this.state = {
message: ""
message: '',
messageType: 'lin',
clipboard: null
};
this.textareaRef = React.createRef();
@ -100,22 +102,165 @@ export class ChatInput extends Component {
}
messageChange(event) {
this.setState({message: event.target.value});
const input = event.target.value;
const previous = this.state.message;
//NOTE dumb hack to work around paste event flow oddities
const pasted = (previous.length === 0 && input.length > 1);
if (input !== this.state.clipboard) {
this.setState({
message: input,
messageType: this.getSpeechType(input),
clipboard: (pasted ? input : null)
});
}
}
getSpeechType(input) {
if (input[0] === '#') {
return 'exp';
} else if (input.indexOf('\n') >= 0) {
return 'fat';
} else if (input[0] === '@') {
return 'lin@';
} else if (this.isUrl(input)) {
return 'url';
} else {
return 'lin';
}
}
getSpeechStyle(type, clipboard) {
switch (type) {
case 'lin@':
return 'fs-italic';
case 'url':
return 'td-underline';
case 'exp':
return 'code';
case 'fat':
if (clipboard) return 'code';
default:
return '';
}
}
isUrl(string) {
try {
const urlObject = new URL(string);
//NOTE we check for a host to ensure a url is actually being posted
// to combat false positives for things like "marzod: ur cool".
// this does mean you can't send "mailto:e@ma.il" as %url message,
// but the desirability of that seems questionable anyway.
return (urlObject.host !== '');
} catch (e) {
return false;
}
}
// turns select urls into arvo:// urls
//
// we detect app names from the url. if the app is known to handle requests
// for remote data (instead of serving only from the host) we transfor the
// url into a generic arvo:// one.
// the app name format is pretty distinct and rare to find in the non-urbit
// wild, but this could still result in false positives for older-school
// websites serving pages under /~user paths.
// we could match only on ship.arvo.network, but that would exclude those
// running on localhost or under a custom domain.
//
//
globalizeUrl(url) {
const urlObject = new URL(url);
const app = urlObject.pathname.split('/')[1];
if (app === '~chat' ||
app === '~publish') {
//TODO send proper url speeches once hall starts using a url type that
// supports non-http protocols.
return { lin: {
msg: 'arvo://' + url.slice(urlObject.origin.length),
pat: false
} };
} else {
return {url};
}
}
speechFromInput(content, type, clipboard) {
switch (type) {
case 'lin':
return { lin: {
msg: content,
pat: false
} };
//
case 'lin@':
return { lin: {
msg: content.slice(1),
pat: true
} };
//
case 'url':
return this.globalizeUrl(content);
//
case 'exp':
// remove leading #
content = content.slice(1);
// remove insignificant leading whitespace.
// aces might be relevant to style.
while (content[0] === '\n') {
content = content.slice(1);
}
return { exp: {
exp: content
} };
//
case 'fat':
// clipboard contents
if (clipboard !== null) {
return { fat: {
sep: { lin: { msg: '', pat: false } },
tac: { name: {
nom: 'clipboard',
tac: { text: content }
} }
} };
// long-form message
} else {
const lines = content.split('\n');
return { fat: {
sep: { lin: {
msg: lines[0],
pat: false
} },
tac: { name: {
nom: 'long-form',
tac: { text: lines.slice(1).join('\n') }
} },
} };
}
//
default:
throw new Error('Unimplemented speech type', type);
}
}
messageSubmit() {
const { props, state } = this;
if (state.message === '') {
return;
}
let message = {
uid: uuid(),
aut: window.ship,
wen: Date.now(),
aud: [props.station],
sep: {
lin: {
msg: state.message,
pat: false
}
}
sep: this.speechFromInput(
state.message,
state.messageType,
state.clipboard
)
};
props.api.hall(
@ -125,7 +270,8 @@ export class ChatInput extends Component {
);
this.setState({
message: ""
message: '',
messageType: 'lin'
});
}
@ -151,7 +297,7 @@ export class ChatInput extends Component {
}
return (
<div className="mt2 pa3 cf flex black bt b--black-30">
<div className="pa3 cf flex black bt b--black-30" style={{ flexGrow: 1 }}>
<div className="fl" style={{
marginTop: 4,
flexBasis: 32,
@ -159,9 +305,12 @@ export class ChatInput extends Component {
}}>
<Sigil ship={window.ship} size={32} />
</div>
<div className="fr h-100 flex" style={{ flexGrow: 1, height: 40 }}>
<input className="ml2 bn"
style={{ flexGrow: 1, height: 40 }}
<div className="fr h-100 flex" style={{ flexGrow: 1 }}>
<textarea
className={'ml2 mt2 mr2 bn ' +
this.getSpeechStyle(state.messageType, state.clipboard)
}
style={{ flexGrow: 1, height: 40, resize: 'none' }}
ref={this.textareaRef}
placeholder={props.placeholder}
value={state.message}

View File

@ -7,7 +7,7 @@ export class HeaderBar extends Component {
render() {
let spin = (this.props.spinner)
? <div className="absolute"
style={{width: 16, height: 16, top: 16, right: 16}}>
style={{width: 16, height: 16, top: 16, left: 55}}>
<IconSpinner/>
</div>
: null;

View File

@ -8,7 +8,7 @@ export class Sigil extends Component {
if (props.ship.length > 14) {
return (
<div className="bg-black" style={{width: 36, height: 36}}>
<div className="bg-black" style={{width: props.size, height: props.size}}>
</div>
);
} else {

View File

@ -16,7 +16,7 @@ export class MemberElement extends Component {
let actionElem;
if (`~${props.ship}` === props.host) {
actionElem = (
<p className="dib w-40 underline black label-small-mono label-regular">
<p className="dib w-10 underline black label-small-mono label-regular">
Host
</p>
);
@ -24,7 +24,7 @@ export class MemberElement extends Component {
`~${window.ship}` === props.host) {
actionElem = (
<a onClick={this.onRemove.bind(this)}
className="w-40 dib list-ship black underline label-small-mono pointer">
className="w-10 dib list-ship black underline label-small-mono pointer">
Remove
</a>
);
@ -39,7 +39,7 @@ export class MemberElement extends Component {
<Sigil ship={props.ship} size={32} />
<p
className={
"w-60 dib v-mid black pr3 ml2 nowrap label-small-mono list-ship label-regular"
"w-80 dib v-mid black ml2 nowrap label-small-mono list-ship label-regular"
}>
{props.ship}
</p>

View File

@ -5,62 +5,168 @@ import moment from 'moment';
import _ from 'lodash';
export class Message extends Component {
renderMessage(content) {
renderSpeech(speech) {
if (_.has(speech, 'lin')) {
return this.renderLin(speech.lin.msg, speech.lin.pat);
} else if (_.has(speech, 'url')) {
return this.renderUrl(speech.url);
} else if (_.has(speech, 'exp')) {
return this.renderExp(speech.exp.exp, speech.exp.res);
} else if (_.has(speech, 'ire')) {
return this.renderSpeech(speech.ire.sep);
} else if (_.has(speech, 'app')) {
return this.renderSpeech(speech.app.sep);
} else if (_.has(speech, 'fat')) {
return this.renderFat(speech.fat.sep, speech.fat.tac);
} else {
return this.renderUnknown();
}
}
renderUnknown() {
return this.renderLin('<unknown message type>')
}
renderLin(content, action = false) {
if (content === '') {
return null;
}
//TODO remove once arvo:// urls are supported in url speeches
if (content.indexOf('arvo://') === 0) {
return this.renderUrl(content);
}
return (
<p className="body-regular-400 v-top">
<p className={`body-regular-400 v-top ${action ? 'fs-italic' : ''}`}>
{content}
</p>
);
}
renderContent() {
const { props } = this;
let content = _.get(
props.msg,
'sep.lin.msg',
'<unknown message type>'
);
renderUrl(url) {
try {
let url = new URL(content);
let imgMatch =
let urlObject = new URL(url);
let imgMatch =
/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/
.exec(
url.pathname
urlObject.pathname
);
if (imgMatch) {
return (
<img
src={content}
style={{
width:"50%",
maxWidth: '250px'
}}
></img>
)
return this.renderImageUrl(url);
} else {
let url = this.urlTransmogrifier(content);
return (
<a className="body-regular"
href={url}
target="_blank">{url}</a>
)
let localUrl = this.localizeUrl(url);
return this.renderAnchor(localUrl, url);
}
} catch(e) {
return this.renderMessage(content);
console.error('url render error', e);
return this.renderAnchor(url);
}
}
urlTransmogrifier(url) {
if (typeof url !== 'string') { throw 'Only transmogrify strings!'; }
const ship = window.ship;
if (url.indexOf('arvo://') === 0) {
return url.split('arvo://')[1];
renderImageUrl(url) {
return this.renderAnchor(url, (
<img
src={url}
style={{
width:"50%",
maxWidth: '250px'
}}
></img>
));
}
renderAnchor(href, content) {
content = content || href;
return (
<a className="body-regular"
href={href}
target="_blank">{content}</a>
);
}
renderExp(expression, result) {
return (<>
<p>
<pre className="clamp-attachment pa1 mt0 mb0 bg-light-gray">
{expression}
</pre>
<pre className="clamp-attachment pa1 mt0 mb0">
{result[0].join('\n')}
</pre>
</p>
</>);
}
renderFat(speech, attachment) {
return (<>
{this.renderSpeech(speech)}
{this.renderAttachment(attachment)}
</>);
}
renderAttachment(content, title = '') {
if (_.has(content, 'name')) {
return this.renderAttachment(content.name.tac, content.name.nom);
}
return (<details>
<summary className="inter fs-italic">{'Attached: ' + title}</summary>
{ _.has(content, 'text')
? (title === 'long-form')
? this.renderParagraphs(content.text.split('\n'))
: this.renderPlaintext(content.text)
: _.has(content, 'tank')
? this.renderPlaintext(content.tank.join('\n'))
: null
}
</details>);
}
renderParagraphs(paragraphs) {
return (<div className="clamp-attachment">
{paragraphs.map(p => (<p className="mt2">{p}</p>))}
</div>);
}
renderPlaintext(text) {
return (<pre className="clamp-attachment">{text}</pre>);
}
renderContent() {
const { props } = this;
try {
if (!_.has(props.msg, 'sep')) {
return this.renderUnknown();
}
return this.renderSpeech(props.msg.sep);
} catch (e) {
console.error('speech rendering error', e);
return this.renderUnknown();
}
}
renderAuthor() {
const msg = this.props.msg;
const ship = '~' + msg.aut;
if (_.has(msg, 'sep.app.app')) {
return `:${msg.sep.app.app} (${ship})`;
} else {
return ship;
}
}
//NOTE see also lib/chat-input's globalizeUrl
localizeUrl(url) {
if (typeof url !== 'string') { throw 'Only localize strings!'; }
const arvo = 'arvo://';
if (url.indexOf(arvo) === 0) {
// this application is being served by an urbit also, so /path will
// point to the arvo url as hosted by this same urbit.
return url.slice(arvo.length);
} else {
return url;
}
return url;
}
render() {
@ -82,10 +188,10 @@ export class Message extends Component {
<div className="fl mr2">
<Sigil ship={props.msg.aut} size={36} />
</div>
<div className="fr" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="fr clamp-message" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="hide-child">
<p className="v-top label-small-mono gray dib mr3">
~{props.msg.aut}
{this.renderAuthor()}
</p>
<p className="v-top label-small-mono gray dib">{timestamp}</p>
<p className="v-top label-small-mono ml2 gray dib child">
@ -105,12 +211,11 @@ export class Message extends Component {
minHeight: 'min-content'
}}>
<p className="child pl3 pr2 label-small-mono gray dib">{timestamp}</p>
<div className="fr" style={{ flexGrow: 1 }}>
<div className="fr clamp-message" style={{ flexGrow: 1 }}>
{this.renderContent()}
</div>
</div>
)
}
}
}

View File

@ -61,7 +61,7 @@ export class Root extends Component {
let internalStation = host + '/hall-internal-' + circle;
if (internalStation in state.configs) {
unreads[cir] =
unreads[cir] =
state.configs[internalStation].red <=
messages[cir][messages[cir].length - 1].num;
} else {
@ -87,6 +87,18 @@ export class Root extends Component {
inviteConfig = configs[`~${window.ship}/i`];
}
const renderChannelsSidebar = (props) => (
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
);
return (
<BrowserRouter>
<div>
@ -94,17 +106,7 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props)}>
<div className="w-100 h-100 fr" style={{ flexGrow: 1 }}>
<div className="dt w-100 h-100">
<div className="dtc center v-mid w-100 h-100 bg-white">
@ -119,18 +121,8 @@ export class Root extends Component {
return (
<Skeleton
spinner={this.state.spinner}
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<NewScreen
sidebar={renderChannelsSidebar(props)}>
<NewScreen
setSpinner={this.setSpinner}
api={api}
circles={circles}
@ -143,17 +135,7 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderDefaultSidebar(props)}>
<LandingScreen
api={api}
configs={configs}
@ -164,24 +146,14 @@ export class Root extends Component {
}} />
<Route exact path="/~chat/:ship/:station"
render={ (props) => {
let station =
let station =
props.match.params.ship
+ "/" +
props.match.params.station;
let messages = state.messages[station] || [];
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props) }>
<ChatScreen
api={api}
configs={configs}
@ -197,19 +169,9 @@ export class Root extends Component {
render={ (props) => {
return (
<Skeleton
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
sidebar={renderChannelsSidebar(props) }>
<MemberScreen
{...props}
{...props}
api={api}
peers={state.peers}
/>
@ -221,18 +183,8 @@ export class Root extends Component {
return (
<Skeleton
spinner={this.state.spinner}
sidebar={
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<SettingsScreen
sidebar={renderChannelsSidebar(props) }>
<SettingsScreen
{...props}
setSpinner={this.setSpinner}
api={api}

View File

@ -83,6 +83,30 @@ export class Sidebar extends Component {
this.props.history.push('/~chat/new');
}
summarizeMessage(speech) {
const fallback = '...';
if (_.has(speech, 'lin')) {
return speech.lin.msg;
} else if (_.has(speech, 'url')) {
return speech.url;
} else if (_.has(speech, 'exp')) {
return '# ' + speech.exp.exp;
} else if (_.has(speech, 'ire')) {
return this.summarizeMessage(speech.ire.sep);
} else if (_.has(speech, 'app')) {
return this.summarizeMessage(speech.app.sep);
} else if (_.has(speech, 'fat')) {
const msg = this.summarizeMessage(speech.fat.sep);
if (msg !== '' && msg !== fallback) return msg;
return 'Attachment' +
(_.has(speech, 'fat.tac.name.nom')
? ': ' + speech.fat.tac.name.nom
: '');
} else {
return fallback;
}
}
render() {
const { props, state } = this;
let station = props.match.params.ship + '/' + props.match.params.station;
@ -93,7 +117,9 @@ export class Sidebar extends Component {
})
.map((cir) => {
let msg = props.messagePreviews[cir];
let content = _.get(msg, 'gam.sep.lin.msg', 'No messages yet');
let content = _.has(msg, 'gam.sep')
? this.summarizeMessage(msg.gam.sep)
: 'No messages yet';
let aut = !!msg ? msg.gam.aut : '';
let wen = !!msg ? msg.gam.wen : 0;
let datetime =

View File

@ -1,10 +1,10 @@
# Weather tile for Urbit
# Clock tile for Urbit
To install this on your Urbit planet:
1. In your Urbit's Dojo, run |mount %
2. Write in the filepath to your Urbit's pier in the urbitrc-sample file in this repository, then copy it to .urbitrc in this directory.
3. Run `npm install` in terminal in this directory.
4. Run `gulp default` in terminal in this directory.
5. Run |start %weather in your Urbit's Dojo.
5. Run |start %clock in your Urbit's Dojo.
To see it, navigate to your Urbit's url and add /~home to the URL path.

View File

@ -23,6 +23,12 @@ pre {
background-color: #f9f9f9;
}
code {
padding: 8px;
background-color: #f9f9f9;
white-space: pre-wrap;
}
a {
color: inherit;
text-decoration: inherit;

View File

@ -1,6 +1,5 @@
import React, { Component } from 'react';
import classnames from 'classnames';
import { PostPreview } from '/components/lib/post-preview';
import _ from 'lodash';
import { PathControl } from '/components/lib/path-control';
import { BlogData } from '/components/lib/blog-data';
@ -82,8 +81,8 @@ export class Blog extends Component {
let blogId = this.props.blogId;
let blog = (ship === window.ship)
? _.get(this.props, `pubs[${blogId}]`, false)
: _.get(this.props, `subs[${ship}][${blogId}]`, false);
? _.get(this.props, `pubs["${blogId}"]`, false)
: _.get(this.props, `subs["${ship}"]["${blogId}"]`, false);
if (!(blog) && (ship === window.ship)) {
@ -110,8 +109,8 @@ export class Blog extends Component {
let ship = this.props.ship;
let blogId = this.props.blogId;
let blog = (ship == window.ship)
? _.get(this.props, `pubs[${blogId}]`, false)
: _.get(this.props, `subs[${ship}][${blogId}]`, false);
? _.get(this.props, `pubs["${blogId}"]`, false)
: _.get(this.props, `subs["${ship}"]["${blogId}"]`, false);
if (!(blog) && (ship === window.ship)) {
this.setState({notFound: true});
@ -158,6 +157,13 @@ export class Blog extends Component {
}
buildPostPreviewProps(post, blog, pinned){
let unread = (-1 === _.findIndex(this.props.unread, {
post: post.post.info.filename,
coll: blog.info.filename,
who: blog.info.owner.slice(1),
}))
? false: true;
return {
postTitle: post.post.info.title,
postName: post.post.info.filename,
@ -169,13 +175,14 @@ export class Blog extends Component {
blogOwner: blog.info.owner,
date: post.post.info["date-created"],
pinned: pinned,
unread: unread,
}
}
buildData(){
let blog = (this.props.ship == window.ship)
? _.get(this.props, `pubs[${this.props.blogId}]`, false)
: _.get(this.props, `subs[${this.props.ship}][${this.props.blogId}]`, false);
? _.get(this.props, `pubs["${this.props.blogId}"]`, false)
: _.get(this.props, `subs["${this.props.ship}"]["${this.props.blogId}"]`, false);
if (this.state.temporary) {
return {
@ -228,17 +235,14 @@ export class Blog extends Component {
}
viewSubs() {
console.log("view subs");
this.setState({view: 'subs'});
}
viewSettings() {
console.log("view settings");
this.setState({view: 'settings'});
}
viewNotes() {
console.log("view notes");
this.setState({view: 'notes'});
}
@ -259,7 +263,7 @@ export class Blog extends Component {
let subNum = _.get(data.blog, 'subscribers.length', 0);
let foreign = _.get(this.props,
`subs[${this.props.ship}][${this.props.blogId}]`, false);
`subs["${this.props.ship}"]["${this.props.blogId}"]`, false);
let actionType = false;
if (this.state.temporary) {

View File

@ -7,7 +7,7 @@ export class HeaderBar extends Component {
render() {
let spin = (this.props.spinner)
? <div className="absolute"
style={{width: 16, height: 16, top: 16, right: 16}}>
style={{width: 16, height: 16, top: 16, left: 55}}>
<IconSpinner/>
</div>
: null;

View File

@ -6,9 +6,6 @@ export class Sigil extends Component {
render() {
const { props } = this;
console.log("sigil ship", props.ship);
if (props.ship.length > 14) {
return (
<div className="bg-black" style={{width: 44, height: 44}}>

View File

@ -64,13 +64,14 @@ class Preview extends Component {
return (
<div className="w-336">
<Link className="ml2 mr2 gray-50 body-regular" to={prevUrl}>
<Link className="ml2 mr2 gray-50 body-regular db mb3" to={prevUrl}>
{this.props.text}
</Link>
<div className="w-336 relative"
style={{height:195}}>
<Link to={postLink}>
<TitleSnippet title={previewProps.postTitle}/>
style={{height:210}}>
<Link to={postLink} className="db">
<TitleSnippet badge={false} title={previewProps.postTitle} />
<div className="w-100" style={{height:16}}></div>
<PostSnippet
body={previewProps.postBody}
/>

View File

@ -31,9 +31,9 @@ export class PathControl extends Component {
if ((last.lastMatch === '/~publish/:ship/:blog/:post') ||
(last.lastMatch === '/~publish/:ship/:blog')){
blog = (last.lastParams.ship.slice(1) == window.ship)
? _.get(this.props, `pubs[${last.lastParams.blog}]`, false)
? _.get(this.props, `pubs["${last.lastParams.blog}"]`, false)
: _.get(this.props,
`subs[${last.lastParams.ship.slice(1)}][${last.lastParams.blog}]`, false);
`subs["${last.lastParams.ship.slice(1)}"]["${last.lastParams.blog}"]`, false);
}
}

View File

@ -59,6 +59,11 @@ export class PostBody extends Component {
return element;
}
renderHR(what, node, attr, parentNode) {
const element = React.createElement(node, attr);
return element;
}
renderDefault(what, node, attr, parentNode) {
let dStyle = {
wordWrap: "break-word",
@ -84,6 +89,8 @@ export class PostBody extends Component {
return this.renderIMG(what, node, attr, parentNode);
case "p":
return this.renderP(what, node, attr, parentNode);
case "hr":
return this.renderHR(what, node, attr, parentNode);
default:
return this.renderDefault(what, node, attr, parentNode);
}

View File

@ -47,7 +47,7 @@ export class PostPreview extends Component {
<div className="w-336 relative"
style={{height:195, marginBottom: 72, marginRight:16}}>
<Link to={postLink}>
<TitleSnippet title={this.props.post.postTitle}/>
<TitleSnippet badge={this.props.post.unread} title={this.props.post.postTitle}/>
<PostSnippet
body={this.props.post.postBody}
/>

View File

@ -47,7 +47,7 @@ export class RecentPreview extends Component {
<div className="w-336 relative"
style={{height:240, marginBottom: 72, marginRight: 16}}>
<Link to={postLink}>
<TitleSnippet title={this.props.post.postTitle}/>
<TitleSnippet badge={this.props.post.unread} title={this.props.post.postTitle}/>
<PostSnippet
body={this.props.post.postBody}
/>

View File

@ -7,12 +7,24 @@ export class TitleSnippet extends Component {
}
render() {
return (
<p className="body-large b two-lines"
style={{WebkitBoxOrient: "vertical"}}>
{this.props.title}
</p>
);
if (this.props.badge) {
return (
<div className="body-large two-lines b"
style={{WebkitBoxOrient: "vertical"}}>
<span className="h2 green-medium"></span>
<span>
{this.props.title}
</span>
</div>
);
} else {
return (
<p className="body-large b two-lines"
style={{WebkitBoxOrient: "vertical"}}>
{this.props.title}
</p>
);
}
}
}

View File

@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
import { PathControl } from '/components/lib/path-control';
import { withRouter } from 'react-router';
import urbitOb from 'urbit-ob';
import { stringToSymbol } from '/lib/util';
const PC = withRouter(PathControl);
@ -39,30 +40,14 @@ export class NewBlog extends Component {
this.returnHome = this.returnHome.bind(this);
this.addInvites = this.addInvites.bind(this);
this.blogSubmit = this.blogSubmit.bind(this);
}
stringToSymbol(str){
let result = '';
for (var i=0; i<str.length; i++){
var n = str.charCodeAt(i);
if (( (n >= 97) && (n <= 122) ) ||
( (n >= 48) && (n <= 57) ))
{
result += str[i];
} else if ( (n >= 65) && (n <= 90) )
{
result += String.fromCharCode(n + 32);
} else {
result += '-';
}
}
return result.replace(/^\-+|\-+$/g, '');
this.titleHeight = 52;
}
blogSubmit() {
let ship = window.ship;
let blogTitle = this.state.title;
let blogId = this.stringToSymbol(blogTitle);
let blogId = stringToSymbol(blogTitle);
let permissions = {
read: {
@ -126,6 +111,11 @@ export class NewBlog extends Component {
}
titleChange(evt){
this.titleInput.style.height = 'auto';
this.titleInput.style.height = (this.titleInput.scrollHeight < 52)
? 52 : this.titleInput.scrollHeight;
this.titleHeight = this.titleInput.style.height;
this.setState({title: evt.target.value});
}
@ -172,13 +162,16 @@ export class NewBlog extends Component {
style={{height: 'calc(100% - 124px)', top: 124}}>
<div className="h-inner dt center mw-688 w-100">
<div className="flex-col dtc v-mid">
<input autoFocus
className="header-2 b--none"
<textarea autoFocus
ref={(el) => {this.titleInput = el}}
className="header-2 b--none w-100"
style={{resize:"none", height: this.titleHeight}}
rows={1}
type="text"
name="blogName"
placeholder="Add a Title"
onChange={this.titleChange}
/>
onChange={this.titleChange}>
</textarea>
<hr className="gray-30" style={{marginTop:32, marginBottom: 32}}/>
@ -219,13 +212,16 @@ export class NewBlog extends Component {
style={{height: 'calc(100% - 124px)', top: 124}}>
<div className="h-inner dt center mw-688 w-100">
<div className="flex-col dtc v-mid">
<input autoFocus
className="header-2 b--none"
<textarea autoFocus
ref={(el) => {this.titleInput = el}}
className="header-2 b--none w-100"
style={{resize:"none", height: this.titleHeight}}
rows={1}
type="text"
name="blogName"
placeholder="Add a Title"
onChange={this.titleChange}
/>
onChange={this.titleChange}>
</textarea>
<p className="body-regular-400" style={{marginTop:25, marginBottom:27}}>
Who is invited to read this notebook?

View File

@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
import _ from 'lodash';
import { PathControl } from '/components/lib/path-control';
import { withRouter } from 'react-router';
import { stringToSymbol } from '/lib/util';
const PC = withRouter(PathControl);
@ -67,8 +68,6 @@ export class NewPost extends Component {
constructor(props){
super(props);
console.log("props", this.props);
this.state = {
title: "",
body: "",
@ -92,24 +91,6 @@ export class NewPost extends Component {
this.comments = false;
}
stringToSymbol(str){
let result = '';
for (var i=0; i<str.length; i++){
var n = str.charCodeAt(i);
if (( (n >= 97) && (n <= 122) ) ||
( (n >= 48) && (n <= 57) ))
{
result += str[i];
} else if ( (n >= 65) && (n <= 90) )
{
result += String.fromCharCode(n + 32);
} else {
result += '-';
}
}
return result.replace(/^\-+|\-+$/g, '');
}
postSubmit() {
let last = _.get(this.props, 'location.state', false);
let ship = window.ship;
@ -121,7 +102,7 @@ export class NewPost extends Component {
}
let postTitle = this.state.title;
let postId = this.stringToSymbol(postTitle);
let postId = stringToSymbol(postTitle);
let awaiting = Object.assign({}, {
ship: ship,
@ -202,17 +183,17 @@ export class NewPost extends Component {
if (ship == window.ship) {
post =
_.get(this.props,
`pubs[${blogId}].posts[${postId}].post`, false) || false;
`pubs["${blogId}"].posts["${postId}"].post`, false) || false;
comments =
_.get(this.props,
`pubs[${blogId}].posts[${postId}].comments`, false) || false;
`pubs["${blogId}"].posts["${postId}"].comments`, false) || false;
} else {
post =
_.get(this.props,
`subs[${ship}][${blogId}].posts[${postId}].post`, false) || false;
`subs["${ship}"]["${blogId}"].posts["${postId}"].post`, false) || false;
comments =
_.get(this.props,
`subs[${ship}][${blogId}].posts[${postId}].comments`, false) || false;
`subs["${ship}"]["${blogId}"].posts["${postId}"].comments`, false) || false;
}
if (!_.isEqual(this.post, post)) {

View File

@ -1,6 +1,5 @@
import React, { Component } from 'react';
import classnames from 'classnames';
import { PostPreview } from '/components/lib/post-preview';
import moment from 'moment';
import { Link } from 'react-router-dom';
import { PostBody } from '/components/lib/post-body';
@ -159,11 +158,11 @@ export class Post extends Component {
if (ship !== window.ship) {
let blog = _.get(this.props, `subs[${ship}][${blogId}]`, false);
let blog = _.get(this.props, `subs["${ship}"]["${blogId}"]`, false);
if (blog) {
let post = _.get(blog, `posts[${postId}].post`, false);
let comments = _.get(blog, `posts[${postId}].comments`, false);
let post = _.get(blog, `posts["${postId}"].post`, false);
let comments = _.get(blog, `posts["${postId}"].comments`, false);
let blogUrl = `/~publish/${blog.info.owner}/${blog.info.filename}`;
let postUrl = `${blogUrl}/${post.info.filename}`;
@ -208,9 +207,9 @@ export class Post extends Component {
this.handleError.bind(this));
}
} else {
let blog = _.get(this.props, `pubs[${blogId}]`, false);
let post = _.get(blog, `posts[${postId}].post`, false);
let comments = _.get(blog, `posts[${postId}].comments`, false);
let blog = _.get(this.props, `pubs["${blogId}"]`, false);
let post = _.get(blog, `posts["${postId}"].post`, false);
let comments = _.get(blog, `posts["${postId}"].comments`, false);
if (!blog || !post) {
this.setState({notFound: true});
@ -303,13 +302,13 @@ export class Post extends Component {
let blog;
if (ship === window.ship) {
blog = _.get(this.props, `pubs[${blogId}]`, false);
post = _.get(blog, `posts[${postId}].post`, false);
comments = _.get(blog, `posts[${postId}].comments`, false);
blog = _.get(this.props, `pubs["${blogId}"]`, false);
post = _.get(blog, `posts["${postId}"].post`, false);
comments = _.get(blog, `posts["${postId}"].comments`, false);
} else {
blog = _.get(this.props, `subs[${ship}][${blogId}]`, false);
post = _.get(blog, `posts[${postId}].post`, false);
comments = _.get(blog, `posts[${postId}].comments`, false);
blog = _.get(this.props, `subs["${ship}"]["${blogId}"]`, false);
post = _.get(blog, `posts["${postId}"].post`, false);
comments = _.get(blog, `posts["${postId}"].comments`, false);
}
@ -329,6 +328,9 @@ export class Post extends Component {
((post.info.title != oldPost.info.title) ||
(post.raw != oldPost.raw))) {
let blogUrl = `/~publish/${blog.info.owner}/${blog.info.filename}`;
let postUrl = `${blogUrl}/${post.info.filename}`;
this.setState({
mode: 'view',
titleOriginal: post.info.title,
@ -337,18 +339,49 @@ export class Post extends Component {
body: post.raw,
awaitingEdit: false,
post: post,
pathData: [
{ text: "Home", url: "/~publish/recent" },
{ text: blog.info.title, url: blogUrl },
{ text: post.info.title, url: postUrl },
],
});
this.props.setSpinner(false);
let read = {
read: {
who: ship,
coll: blogId,
post: postId,
}
};
this.props.api.action("publish", "publish-action", read);
}
if (!this.state.temporary){
if (oldPost != post) {
let blogUrl = `/~publish/${blog.info.owner}/${blog.info.filename}`;
let postUrl = `${blogUrl}/${post.info.filename}`;
this.setState({
titleOriginal: post.info.title,
bodyOriginal: post.raw,
post: post,
pathData: [
{ text: "Home", url: "/~publish/recent" },
{ text: blog.info.title, url: blogUrl },
{ text: post.info.title, url: postUrl },
],
});
let read = {
read: {
who: ship,
coll: blogId,
post: postId,
}
};
this.props.api.action("publish", "publish-action", read);
}
if (oldComments != comments) {
this.setState({comments: comments});

View File

@ -51,6 +51,13 @@ export class Recent extends Component {
let col = this.retrieveColl(coll, who);
let com = this.retrieveComments(post, coll, who);
let unread = (-1 === _.findIndex(this.props.unread, {
post: post,
coll: coll,
who: who,
}))
? false: true;
return {
postTitle: pos.info.title,
postName: post,
@ -60,7 +67,8 @@ export class Recent extends Component {
collectionName: coll,
author: pos.info.creator.slice(1),
blogOwner: who,
date: pos.info["date-created"]
date: pos.info["date-created"],
unread: unread,
}
}

View File

@ -1,9 +1,6 @@
import React, { Component } from 'react';
import { BrowserRouter, Route } from "react-router-dom";
import Mousetrap from 'mousetrap';
import classnames from 'classnames';
import _ from 'lodash';
import { api } from '/api';
import { store } from '/store';
import { Recent } from '/components/recent';

View File

@ -0,0 +1,38 @@
export function stringToSymbol(str) {
let result = '';
for (var i=0; i<str.length; i++){
var n = str.charCodeAt(i);
if (( (n >= 97) && (n <= 122) ) ||
( (n >= 48) && (n <= 57) ))
{
result += str[i];
} else if ( (n >= 65) && (n <= 90) )
{
result += String.fromCharCode(n + 32);
} else {
result += '-';
}
}
result = result.replace(/^[\-\d]+|\-+/g, '-');
result = result.replace(/^\-+|\-+$/g, '');
if (result === ''){
return dateToDa(new Date());
}
return result;
}
export function dateToDa(d, mil) {
  var fil = function(n) {
    return n >= 10 ? n : "0" + n;
  };
  return (
    `~${d.getUTCFullYear()}.` +
    `${(d.getUTCMonth() + 1)}.` +
    `${fil(d.getUTCDate())}..` +
    `${fil(d.getUTCHours())}.` +
    `${fil(d.getUTCMinutes())}.` +
    `${fil(d.getUTCSeconds())}` +
`${mil ? "..0000" : ""}`
  );
}

View File

@ -3,22 +3,34 @@ import _ from 'lodash';
export class UpdateReducer {
reduce(json, state){
if (json.invite) {
this.reduceInvite(json, state);
this.reduceInvite(json.invite, state);
} else if (json.unread) {
this.reduceUnread(json.unread, state);
}
}
reduceInvite(json, state) {
let val = {
title: json.invite.title,
coll: json.invite.coll,
who: json.invite.who,
title: json.title,
coll: json.coll,
who: json.who,
};
if (json.invite.add) {
if (json.add) {
state.invites.push(val);
} else {
let idx = _.findIndex(state.invites, val)
_.pullAt(state.invites, [idx]);
}
}
reduceUnread(json, state) {
if (json.add) {
state.unread = _.uniq(state.unread.concat(json.posts));
} else {
let idx = json.posts.map((val) => {
return _.findIndex(state.unread, val);
});
_.pullAt(state.unread, idx);
}
}
}

View File

@ -1,5 +1,4 @@
import { api } from '/api';
import _ from 'lodash';
import { store } from '/store';

View File

@ -236,12 +236,6 @@
"integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=",
"dev": true
},
"array-differ": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=",
"dev": true
},
"array-each": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
@ -314,12 +308,6 @@
}
}
},
"array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
"dev": true
},
"array-unique": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
@ -483,12 +471,6 @@
}
}
},
"beeper": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz",
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
"dev": true
},
"binary-extensions": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
@ -1261,12 +1243,6 @@
"type": "^1.0.1"
}
},
"dateformat": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz",
"integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=",
"dev": true
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
@ -1289,9 +1265,9 @@
"dev": true
},
"deep-extend": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz",
"integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==",
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"dev": true
},
"default-compare": {
@ -1463,35 +1439,6 @@
"is-obj": "^1.0.0"
}
},
"duplexer2": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=",
"dev": true,
"requires": {
"readable-stream": "~1.1.9"
},
"dependencies": {
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
}
}
},
"duplexify": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz",
@ -2739,25 +2686,35 @@
}
},
"gulp-cssimport": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/gulp-cssimport/-/gulp-cssimport-6.0.1.tgz",
"integrity": "sha512-czRve6HMVHEFAOq+h/DUHOWixyABynQCE+EZn9v9Yp4LRYluFCfNnniALVg/G0P4aEm2EVjWdbyUYVK+n1WhmQ==",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/gulp-cssimport/-/gulp-cssimport-7.0.0.tgz",
"integrity": "sha512-ulnmFwJTY+i6f2b5sN4ePzCotwWKx8I68rwdBu7fRtVAj6QE+X0L2mUhUoXDcDBt4LVnOYhWtFBH3ETXGxDzTg==",
"dev": true,
"requires": {
"collect-stream": "^1.2.1",
"deep-extend": "^0.5.0",
"gulp-util": "*",
"deep-extend": "^0.6.0",
"http-https": "^1.0.0",
"lodash.trim": "^4.5.1",
"lookup-path": "^0.3.1",
"magic-string": "^0.22.4",
"magic-string": "^0.25.1",
"minimatch": "^3.0.4",
"pify": "^3.0.0",
"plugin-error": "^0.1.2",
"strip-bom": "^3.0.0",
"through2": "^2.0.3",
"vinyl": "^2.2.0",
"vinyl-sourcemaps-apply": "^0.2.1"
},
"dependencies": {
"magic-string": {
"version": "0.25.3",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz",
"integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==",
"dev": true,
"requires": {
"sourcemap-codec": "^1.4.4"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
@ -2844,100 +2801,6 @@
}
}
},
"gulp-util": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz",
"integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=",
"dev": true,
"requires": {
"array-differ": "^1.0.0",
"array-uniq": "^1.0.2",
"beeper": "^1.0.0",
"chalk": "^1.0.0",
"dateformat": "^2.0.0",
"fancy-log": "^1.1.0",
"gulplog": "^1.0.0",
"has-gulplog": "^0.1.0",
"lodash._reescape": "^3.0.0",
"lodash._reevaluate": "^3.0.0",
"lodash._reinterpolate": "^3.0.0",
"lodash.template": "^3.0.0",
"minimist": "^1.1.0",
"multipipe": "^0.1.2",
"object-assign": "^3.0.0",
"replace-ext": "0.0.1",
"through2": "^2.0.0",
"vinyl": "^0.5.0"
},
"dependencies": {
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"clone": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
"dev": true
},
"clone-stats": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz",
"integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"object-assign": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz",
"integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=",
"dev": true
},
"replace-ext": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz",
"integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=",
"dev": true
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
},
"vinyl": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz",
"integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=",
"dev": true,
"requires": {
"clone": "^1.0.0",
"clone-stats": "^0.0.1",
"replace-ext": "0.0.1"
}
}
}
},
"gulplog": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz",
@ -2956,30 +2819,12 @@
"function-bind": "^1.1.1"
}
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"has-gulplog": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz",
"integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=",
"dev": true,
"requires": {
"sparkles": "^1.0.0"
}
},
"has-symbols": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
@ -3814,137 +3659,18 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz",
"integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw=="
},
"lodash._basecopy": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
"integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=",
"dev": true
},
"lodash._basetostring": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz",
"integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=",
"dev": true
},
"lodash._basevalues": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz",
"integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=",
"dev": true
},
"lodash._getnative": {
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=",
"dev": true
},
"lodash._isiterateecall": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
"integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=",
"dev": true
},
"lodash._reescape": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz",
"integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=",
"dev": true
},
"lodash._reevaluate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz",
"integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=",
"dev": true
},
"lodash._reinterpolate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
"integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=",
"dev": true
},
"lodash._root": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz",
"integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=",
"dev": true
},
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=",
"dev": true
},
"lodash.escape": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz",
"integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=",
"dev": true,
"requires": {
"lodash._root": "^3.0.0"
}
},
"lodash.isarguments": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
"integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=",
"dev": true
},
"lodash.isarray": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
"integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=",
"dev": true
},
"lodash.keys": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz",
"integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=",
"dev": true,
"requires": {
"lodash._getnative": "^3.0.0",
"lodash.isarguments": "^3.0.0",
"lodash.isarray": "^3.0.0"
}
},
"lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true
},
"lodash.restparam": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz",
"integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=",
"dev": true
},
"lodash.template": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz",
"integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=",
"dev": true,
"requires": {
"lodash._basecopy": "^3.0.0",
"lodash._basetostring": "^3.0.0",
"lodash._basevalues": "^3.0.0",
"lodash._isiterateecall": "^3.0.0",
"lodash._reinterpolate": "^3.0.0",
"lodash.escape": "^3.0.0",
"lodash.keys": "^3.0.0",
"lodash.restparam": "^3.0.0",
"lodash.templatesettings": "^3.0.0"
}
},
"lodash.templatesettings": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz",
"integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=",
"dev": true,
"requires": {
"lodash._reinterpolate": "^3.0.0",
"lodash.escape": "^3.0.0"
}
},
"lodash.trim": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz",
@ -4257,15 +3983,6 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"multipipe": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=",
"dev": true,
"requires": {
"duplexer2": "0.0.2"
}
},
"mute-stdout": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz",

View File

@ -28,12 +28,13 @@ export default class WeatherTile extends Component {
let api = window.api;
this.state = {
latlng: ''
latlng: '',
manualEntry: false,
error: false
};
}
locationSubmit() {
console.log('location submit');
navigator.geolocation.getCurrentPosition((res) => {
console.log(res);
let latlng = `${res.coords.latitude},${res.coords.longitude}`;
@ -46,6 +47,30 @@ export default class WeatherTile extends Component {
});
}
manualLocationSubmit() {
event.preventDefault();
let gpsInput = document.getElementById('gps');
let latlngNoSpace = gpsInput.value.replace(/\s+/g, '');
let latlngParse = /-?[0-9]+(?:\.[0-9]*)?,-?[0-9]+(?:\.[0-9]*)?/g;
if (latlngParse.test(latlngNoSpace)) {
let latlng = latlngNoSpace;
this.setState({latlng}, (err) => {console.log(err)}, {maximumAge: Infinity, timeout: 10000});
api.action('weather', 'json', latlng);
this.setState({manualEntry: !this.state.manualEntry});
}
else {
this.setState({error: true});
return false;
}
}
keyPress(e) {
if (e.keyCode === 13) {
e.preventDefault();
this.manualLocationSubmit(e.target.value);
}
}
renderWrapper(child) {
return (
<div className="pa2 relative" style={{
@ -58,9 +83,53 @@ export default class WeatherTile extends Component {
);
}
renderManualEntry() {
let secureCheck;
let error;
if (this.state.error === true) {
error = <p
className="label-small red pt1">
Incorrect latitude/longitude formatting. Please try again. <br/>
(eg. "29.558107, -95.089023")
</p>
}
if (location.protocol === "https:") {
secureCheck = <a
className="label-regular b gray absolute pointer"
style={{right: 8, top: 4}}
onClick={() => this.locationSubmit()}>Detect location -></a>
}
return this.renderWrapper((
<div>
<a style={{"color": "white", "cursor": "pointer"}}
onClick={() => this.setState({manualEntry: !this.state.manualEntry})}>
&lt;&#45;
</a>
{secureCheck}
<p className="label-regular white pt2">
Please enter your <a href="https://latitudeandlongitude.org/" target="_blank">latitude and longitude</a>.</p>
{error}
<form className="flex absolute" style={{"bottom": 0, "left": 8}}>
<input id="gps"
className="white pa1 bg-transparent outline-0 bn bb-ns b--white"
style={{width: "100%"}}
type="text"
placeholder="29.558107, -95.089023"
onKeyDown={this.keyPress.bind(this)}>
</input>
<input className="bg-transparent inter white w-20 outliner-0 bn pointer"
type="submit"
onClick={() => this.manualLocationSubmit()}
value="->">
</input>
</form>
</div>
))
}
renderNoData() {
return this.renderWrapper((
<div onClick={this.locationSubmit.bind(this)}>
<div onClick={() => this.setState({manualEntry: !this.state.manualEntry})}>
<p className="gray label-regular b absolute"
style={{left: 8, top: 4}}>
Weather
@ -82,6 +151,9 @@ export default class WeatherTile extends Component {
style={{left: 8, top: 4}}>
Weather
</p>
<a className="label-regular b gray absolute pointer"
style={{right: 8, top: 4}}
onClick={() => this.setState({manualEntry: !this.state.manualEntry})}>Update location -></a>
<div className="w-100 mb2 mt2 absolute"
style={{left: 18, top: 28}}>
<img
@ -130,6 +202,10 @@ export default class WeatherTile extends Component {
render() {
let data = !!this.props.data ? this.props.data : {};
if (this.state.manualEntry === true) {
return this.renderManualEntry();
}
if ('currently' in data && 'daily' in data) {
return this.renderWithData(data);
}

View File

@ -75,7 +75,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.can = c3n;
u3_Host.ops_u.dem = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.etn = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
@ -95,7 +94,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.kno_w = DefaultKernel;
while ( -1 != (ch_i=getopt(argc, argv,
"G:J:B:K:A:H:I:w:u:e:E:f:F:k:m:p:LjabcCdgqstvxPDRS")) )
"G:J:B:K:A:H:I:w:u:e:E:f:F:k:p:LjabcCdgqsvxPDRS")) )
{
switch ( ch_i ) {
case 'J': {
@ -164,10 +163,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.key_c = strdup(optarg);
break;
}
case 'm': {
u3_Host.ops_u.sap_c = strdup(optarg);
break;
}
case 'p': {
if ( c3n == _main_readw(optarg, 65536, &arg_w) ) {
return c3n;
@ -192,7 +187,6 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case 's': { u3_Host.ops_u.git = c3y; break; }
case 'S': { u3_Host.ops_u.has = c3y; break; }
case 't': { u3_Host.ops_u.etn = c3y; break; }
case '?': default: {
return c3n;
}
@ -298,24 +292,6 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3n;
}
if ( u3_Host.ops_u.nuu != c3y && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m only makes sense when bootstrapping a new instance\n");
return c3n;
}
if ( u3_Host.ops_u.fak_c != 0 && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -F cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.ets_c != 0 && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -E cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.can == c3y && u3_Host.ops_u.sap_c != 0 ) {
fprintf(stderr, "-m and -C cannot be used together\n");
return c3n;
}
if ( u3_Host.ops_u.can == c3y && u3_Host.ops_u.ets_c != 0 ) {
fprintf(stderr, "-C and -E cannot be used together\n");
return c3n;
@ -325,12 +301,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.eth_c = "http://eth-mainnet.urbit.org:8545";
}
if ( u3_Host.ops_u.sap_c == 0 && u3_Host.ops_u.can == c3n ) {
u3_Host.ops_u.sap_c =
"https://bootstrap.urbit.org/urbit-" URBIT_VERSION ".snap";
}
if ( u3_Host.ops_u.url_c != 0 && u3_Host.ops_u.pil_c != 0 ) {
fprintf(stderr, "-B and -u cannot be used together\n");
return c3n;

View File

@ -298,6 +298,7 @@
# define c3__delc c3_s4('d','e','l','c')
# define c3__delt c3_s4('d','e','l','t')
# define c3__dept c3_s4('d','e','p','t')
# define c3__dext c3_s4('d','e','x','t')
# define c3__dgdp c3_s4('d','g','d','p')
# define c3__dgkt c3_s4('d','g','k','t')
# define c3__dgnp c3_s4('d','g','n','p')

View File

@ -229,7 +229,6 @@
u3_noun u3gfu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_bust(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_conk(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_crop(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
u3_noun u3gfu_duck(u3_noun, u3_noun);

View File

@ -247,44 +247,4 @@
# define u3qfu_van_vet 118
# define u3qfu_van_fab 119
u3_noun u3qfu_burn(u3_noun, u3_noun);
u3_noun u3qfu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_bust(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_conk(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_crop(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
u3_noun u3qfu_duck(u3_noun, u3_noun);
u3_noun u3qfu_dung(u3_noun, u3_noun cap, u3_noun);
u3_noun u3qfu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qfu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qfu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_find(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fire(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_firm(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fish(u3_noun, u3_noun, u3_atom);
u3_noun u3qfu_fuse(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_gain(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_heal(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_lose(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_mint(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_mull(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_nest(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_nost(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_orth(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_peek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_peel(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_play(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_repo(u3_noun, u3_noun);
u3_noun u3qfu_rest(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
u3_noun u3qfu_shew(u3_noun, u3_noun);
u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_snub(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_wrap(u3_noun, u3_noun, u3_noun);
void u3qf_test(const c3_c*, u3_noun);

View File

@ -269,29 +269,17 @@
u3_noun u3wfp_open(u3_noun);
u3_noun u3wfp_rake(u3_noun);
u3_noun u3wfu_burn(u3_noun);
u3_noun u3wfu_busk(u3_noun);
u3_noun u3wfu_bust(u3_noun);
u3_noun u3wfu_conk(u3_noun);
u3_noun u3wfu_crop(u3_noun);
u3_noun u3wfu_cull(u3_noun);
u3_noun u3wfu_duck(u3_noun);
u3_noun u3wfu_find(u3_noun);
u3_noun u3wfu_fond(u3_noun);
u3_noun u3wfu_fink(u3_noun);
u3_noun u3wfu_fire(u3_noun);
u3_noun u3wfu_firm(u3_noun);
u3_noun u3wfu_fish(u3_noun);
u3_noun u3wfu_fuse(u3_noun);
u3_noun u3wfu_heal(u3_noun);
u3_noun u3wfu_mint(u3_noun);
u3_noun u3wfu_mull(u3_noun);
u3_noun u3wfu_nest(u3_noun);
u3_noun u3wfu_nest_dext(u3_noun);
u3_noun u3wfu_peek(u3_noun);
u3_noun u3wfu_peel(u3_noun);
u3_noun u3wfu_play(u3_noun);
u3_noun u3wfu_repo(u3_noun);
u3_noun u3wfu_rest(u3_noun);
u3_noun u3wfu_snub(u3_noun);
u3_noun u3wfu_toss(u3_noun);
u3_noun u3wfu_wrap(u3_noun);

Some files were not shown because too many files have changed in this diff Show More