Merge branch 'master' into decap-all

This commit is contained in:
pilfer-pandex 2019-08-09 14:26:20 -07:00
commit 06e25fdf89
115 changed files with 2820 additions and 7698 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f6e93cb3ee5fcb0970851bd10d2d2a640ff968292d147c35385623b86570296
size 6662042
oid sha256:6c7ad5eec00d0d6a6857ea023c6102999a30d5c99de7411e474b9d1c14a3e7b4
size 9765203

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e151f640e4b5a47a9dce35d637e16ad998d5cfcc1a0d4b5744f8489869aac8ee
size 4544002
oid sha256:6e828e89f4e6f2b39d4d8d62101f9c052253cdfa4e91abb8682678acd796f999
size 4707549

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:06b4bb531ef974ab706eed7f9caef3e1cf5fe4c515b889c2b61cc2dc9e8187e6
size 9626568
oid sha256:39dfca3234e5002df44f56479f4e352c7cb587932ada8ba9097ebffc691db78d
size 12252278

View File

@ -1,13 +1,15 @@
crossenv:
rec {
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
ivory-header = import ./deps/ivory-header/cross.nix { inherit crossenv; };
ca-header = import ./deps/ca-header/cross.nix { inherit crossenv; };
}

View File

@ -20,7 +20,7 @@ let
vendor =
with deps;
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ge-additions ];
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ge-additions ivory-header ca-header ];
in

27
nix/deps/ca-header/builder.sh Executable file
View File

@ -0,0 +1,27 @@
source $stdenv/setup
set -ex
cleanup () {
echo "done"
}
trap cleanup EXIT
if ! [ -f "$SSL_CERT_FILE" ]; then
echo "$SSL_CERT_FILE doesn't exist"
exit 1
fi
mkdir -p ./include
cat $SSL_CERT_FILE > include/ca-bundle.crt
xxd -i include/ca-bundle.crt > ca-bundle.h
mkdir -p $out/include
mv ca-bundle.h $out/include
rm -rf ./include
set +x

View File

@ -0,0 +1,8 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "ca-bundle.h";
builder = ./builder.sh;
native_inputs = with crossenv.nixpkgs; [ cacert xxd ];
SSL_CERT_FILE = "${crossenv.nixpkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
}

View File

@ -0,0 +1,7 @@
{ pkgs }:
pkgs.stdenv.mkDerivation {
name = "ca-bundle.h";
builder = ./builder.sh;
nativeBuildInputs = with pkgs; [ cacert xxd ];
}

View File

@ -1,13 +1,15 @@
{ pkgs ? import ../nixpkgs.nix }:
rec {
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; };
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; };
ivory-header = import ./ivory-header { inherit pkgs; };
ca-header = import ./ca-header { inherit pkgs; };
}

View File

@ -0,0 +1,41 @@
source $stdenv/setup
set -ex
cleanup () {
echo "done"
}
trap cleanup EXIT
if ! [ -f "$IVORY" ]; then
echo "$IVORY doesn't exist"
exit 1
fi
#
# heuristics to confirm the ivory pill is valid
#
# greater than 10KB
#
if [ $(du -k $IVORY | cut -f1) -gt 10 ]; then
echo "$IVORY is less than 10KB"
fi
# first 7 bytes != "version" (start of an lfs pointer)
#
if [ "$(cat $(IVORY) | head -c 7)" = "version" ]; then
echo "$IVORY starts with 'version'; it's an LFS pointer"
fi
cat $IVORY > u3_Ivory.pill
xxd -i u3_Ivory.pill > ivory.h
mkdir -p $out/include
mv ivory.h $out/include
rm u3_Ivory.pill
set +x

View File

@ -0,0 +1,11 @@
{
crossenv,
ivory ? ../../../bin/ivory.pill
}:
crossenv.make_derivation rec {
name = "ivory.h";
builder = ./builder.sh;
native_inputs = with crossenv.nixpkgs; [ xxd ];
IVORY = ivory;
}

View File

@ -0,0 +1,11 @@
{
pkgs,
ivory ? ../../../bin/ivory.pill
}:
pkgs.stdenv.mkDerivation {
name = "ivory.h";
builder = ./builder.sh;
nativeBuildInputs = with pkgs; [ xxd ];
IVORY = ivory;
}

View File

@ -15,21 +15,55 @@ 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="
cp $ARVO/lib/pill.hoon ./pier/home/lib/
chmod -R u+rw ./pier/home/lib/
until [ -d ./pier/home ]
do
sleep 1
done
# 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

@ -17,7 +17,7 @@ let
import ./urbit {
inherit pkgs ent debug ge-additions;
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
inherit (deps) secp256k1 h2o;
inherit (deps) secp256k1 h2o ivory-header ca-header;
};
urbit = mkUrbit { debug=false; };

View File

@ -1,8 +1,7 @@
{
pkgs,
debug,
ivory ? ../../../bin/ivory.pill,
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv, ivory-header, ca-header
}:
let
@ -12,10 +11,10 @@ let
deps =
with pkgs;
[ curl gmp libsigsegv ncurses openssl zlib lmdb cacert xxd ];
[ curl gmp libsigsegv ncurses openssl zlib lmdb ];
vendor =
[ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ];
[ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ivory-header ca-header ];
in
@ -31,7 +30,6 @@ pkgs.stdenv.mkDerivation {
hardeningDisable = if debug then [ "all" ] else [];
CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror";
IVORY = ivory;
MEMORY_DEBUG = debug;
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;

View File

@ -4,8 +4,7 @@
ent,
name ? "urbit",
debug ? false,
ivory ? ../../../bin/ivory.pill,
ge-additions, cacert, xxd
ge-additions
}:
let
@ -16,7 +15,7 @@ let
vendor =
with deps;
[ argon2 softfloat3 ed25519 ge-additions h2o scrypt uv murmur3 secp256k1 sni ];
[ argon2 softfloat3 ed25519 ge-additions h2o scrypt uv murmur3 secp256k1 sni ivory-header ca-header ];
in
@ -27,13 +26,10 @@ env.make_derivation {
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;
NCURSES = env.ncurses;
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
IVORY = ivory;
name = "${name}-${env_name}";
exename = name;
src = ../../../pkg/urbit;
native_inputs = [ xxd ];
cross_inputs = crossdeps ++ vendor ++ [ ent ];
builder = ./release.sh;
}

View File

@ -12,5 +12,5 @@ import ./default.nix {
inherit (tlon)
ent ge-additions;
inherit (deps)
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv;
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ivory-header ca-header;
}

View File

@ -21,8 +21,7 @@ let
urbit = env:
import ./pkgs/urbit/release.nix env
{ ent = ent env; ge-additions = ge-additions env; cacert = nixpkgs.cacert;
xxd = nixpkgs.xxd; debug = false; name = "urbit"; };
{ ent = ent env; ge-additions = ge-additions env; debug = false; name = "urbit"; };
builds-for-platform = plat:
plat.deps // {

View File

@ -169,7 +169,7 @@
=. ..abet-pe
=/ sof ((soft unix-effect) i.effects)
?~ sof
~? aqua-debug=| [who=who %unknown-effect i.effects]
~? aqua-debug=& [who=who %unknown-effect i.effects]
..abet-pe
(publish-effect u.sof)
$(effects t.effects)
@ -366,7 +366,7 @@
%e %eyre
%f %ford
%g %gall
%j %ford
%j %jael
==
=/ pax
/(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane]
@ -435,8 +435,9 @@
[%fake who.ae]
[%dawn u.keys.ae]
-.userspace-ova.pil
[//http/0v1n.2m9vh %born ~]
[//http/0v1n.2m9vh %live 8.080 `8.445]
[//http-client/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %live 8.080 `8.445]
==
=. this abet-pe:initted
(pe who.ae)
@ -545,6 +546,17 @@
:^ ~ ~ %noun
`(list ship)`(turn ~(tap by piers) head)
::
::
::
++ peek-x-pill
|= pax=path
^- (unit (unit [%pill pill]))
=/ pill-size (met 3 (jam pil))
?: (lth pill-size 100)
~& [%no-pill size=pill-size]
[~ ~]
``pill+pil
::
:: Trivial scry for mock
::
++ scry |=([* *] ~)

View File

@ -1,28 +1,26 @@
/+ tapp, stdio
=, able:kale
=, able:jael
=> |%
+$ pending-udiffs (map number:block udiffs:point)
+$ config
$: url=@ta
from-number=number:block
==
+$ app-state
$: url=@ta
$: %2
url=@ta
=number:block
=pending-udiffs
blocks=(list block)
whos=(set ship)
==
+$ peek-data ~
+$ in-poke-data
$: %azimuth-tracker-poke
$% [%init ~]
[%listen whos=(set ship) =source:kale]
[%watch =config]
$% [%listen whos=(list ship) =source:jael]
[%watch url=@ta]
==
==
+$ out-poke-data ~
+$ in-peer-data ~
+$ out-peer-data ~
+$ out-peer-data
[%azimuth-udiff =ship =udiff:point]
++ tapp
%: ^tapp
app-state
@ -40,13 +38,23 @@
::
=> |%
++ topics
=> azimuth-events:azimuth
:_ ~
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
|= 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) ,@) ~]
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
@ -77,7 +85,9 @@
=/ m (async:stdio ,(unit json))
^- form:m
?> ?=(%finished -.client-response)
=/ body=@t q.data:(need full-file.client-response)
?~ full-file.client-response
(pure:m ~)
=/ body=@t q.data.u.full-file.client-response
=/ jon=(unit json) (de-json:html body)
?~ jon
(pure:m ~)
@ -177,7 +187,7 @@
--
::
++ get-logs-by-hash
|= [url=@ta =hash:block]
|= [url=@ta whos=(set ship) =hash:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -186,7 +196,7 @@
%eth-get-logs-by-hash
hash
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -194,7 +204,7 @@
(pure:m udiffs)
::
++ get-logs-by-range
|= [url=@ta =from=number:block =to=number:block]
|= [url=@ta whos=(set ship) =from=number:block =to=number:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -204,7 +214,7 @@
`number+from-number
`number+to-number
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -253,8 +263,9 @@
=* loop $
?~ udiffs
(pure:m ~)
~& [%sending-event i.udiffs]
;< ~ bind:m (send-effect:stdio %new-event /ne i.udiffs)
=/ =path /(scot %p ship.i.udiffs)
;< ~ bind:m (give-result:stdio / %azimuth-udiff i.udiffs)
;< ~ bind:m (give-result:stdio path %azimuth-udiff i.udiffs)
loop(udiffs t.udiffs)
--
::
@ -262,44 +273,22 @@
::
=> |%
::
:: Subscribe to %sources from kale
::
++ init
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %sources /se ~)
(pure:m state)
::
:: Send %listen to kale
:: Send %listen to jael
::
++ listen
|= [state=app-state whos=(set 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 whos source)
;< ~ bind:m (send-effect:stdio %listen /lo (silt whos) source)
(pure:m state)
::
:: Take %source from kale
::
++ take-source
|= [state=app-state whos=(set ship) =source:kale]
=/ m (async:stdio ,app-state)
^- form:m
?: ?=(%& -.source)
(pure:m state)
=/ a-purl=purl:eyre node.p.source
=. url.state (crip (en-purl:html a-purl))
(watch state url.state launch:contracts:azimuth)
::
:: Start watching a node
::
++ watch
|= [state=app-state =config]
++ start
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
=: url.state url.config
number.state from-number.config
=: number.state 0
pending-udiffs.state *pending-udiffs
blocks.state *(list block)
==
@ -311,20 +300,18 @@
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
~& [%get-updates number.state]
;< =latest=block bind:m (get-latest-block url.state)
;< =new=number:block bind:m (zoom state number.id.latest-block)
=. number.state new-number
;< =latest=block bind:m (get-latest-block url.state)
;< state=app-state bind:m (zoom state number.id.latest-block)
|- ^- form:m
=* walk-loop $
~& [%walk-loop number.state]
?: (gth number.state number.id.latest-block)
;< now=@da bind:m get-time:stdio
;< ~ bind:m (wait-effect:stdio (add now ~s10))
;< ~ bind:m (wait-effect:stdio (add now ~m5))
(pure:m state)
;< =block bind:m (get-block-by-number url.state number.state)
;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m
(take-block url.state pending-udiffs.state block blocks.state)
%- take-block
[url.state whos.state pending-udiffs.state block blocks.state]
=: pending-udiffs.state new-pending-udiffs
blocks.state new-blocks
number.state +(number.id.i.new-blocks)
@ -334,17 +321,14 @@
:: Process a block, detecting and handling reorgs
::
++ take-block
|= [url=@ta =a=pending-udiffs =block blocks=(list block)]
|= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)]
=/ m (async:stdio ,[pending-udiffs (lest ^block)])
^- form:m
~& [%taking id.block]
?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks))
~& %rewinding
(rewind url a-pending-udiffs block blocks)
;< =b=pending-udiffs bind:m
(release-old-events a-pending-udiffs number.id.block)
;< =new=udiffs:point bind:m (get-logs-by-hash url hash.id.block)
~? !=(~ new-udiffs) [%adding-diffs new-udiffs]
;< =new=udiffs:point bind:m (get-logs-by-hash url whos hash.id.block)
=. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs)
(pure:m b-pending-udiffs block blocks)
::
@ -366,7 +350,6 @@
=/ m (async:stdio ,[^pending-udiffs (lest ^block)])
|- ^- form:m
=* loop $
~& [%wind block ?~(blocks ~ i.blocks)]
?~ blocks
(pure:m pending-udiffs block blocks)
?: =(parent-hash.block hash.id.i.blocks)
@ -394,15 +377,18 @@
::
++ zoom
|= [state=app-state =latest=number:block]
=/ m (async:stdio ,number:block)
=/ m (async:stdio ,app-state)
^- form:m
?: (lth latest-number (add number.state 500))
(pure:m latest-number)
=/ to-number=number:block (sub latest-number 500)
=/ zoom-margin=number:block 100
?: (lth latest-number (add number.state zoom-margin))
(pure:m state)
=/ to-number=number:block (sub latest-number zoom-margin)
;< =udiffs:point bind:m
(get-logs-by-range url.state number.state to-number)
(get-logs-by-range url.state whos.state number.state to-number)
;< ~ bind:m (jael-update udiffs)
(pure:m to-number)
=. number.state +(to-number)
=. blocks.state ~
(pure:m state)
--
::
:: Main
@ -415,9 +401,8 @@
=/ m tapp-async
^- form:m
?- +<.in-poke-data
%init (init state)
%listen (listen state +>.in-poke-data)
%watch (watch state +>.in-poke-data)
%listen (listen state +>.in-poke-data)
%watch (pure:m state(url url.in-poke-data))
==
::
++ handle-take
@ -425,9 +410,17 @@
=/ m tapp-async
^- form:m
?+ -.sign ~|([%strange-sign -.sign] !!)
%source (take-source state +.sign)
%wake (get-updates state)
==
::
++ handle-peer ~(handle-peer default-tapp bowl state)
++ handle-peer
|= =path
=/ m tapp-async
^- form:m
=/ who=(unit ship) ?~(path ~ `(slav %p i.path))
=. whos.state
?~ who
~
(~(put in whos.state) u.who)
(start state)
--

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

File diff suppressed because one or more lines are too long

View File

@ -1019,6 +1019,8 @@
==
::
$listen-api !!
$export !!
$import !!
$as
:* %as mar.source.com
$(num +(num), source.com next.source.com)

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

@ -92,6 +92,7 @@
++ lime :: diff fruit
$% {$hall-prize prize} ::
{$hall-rumor rumor} ::
{$export [%hall-v0 (list telegram)]} :: sent to lens
== ::
++ pear :: poke fruit
$% {$hall-command command} ::
@ -2789,6 +2790,8 @@
^- (list move)
=+ mur=(~(get by res) p)
?^ mur u.mur
?: =([%export ~] p)
~
=- =. res (~(put by res) p -)
-
=+ qer=(path-to-query p)
@ -3017,6 +3020,10 @@
|= pax/path
^- (quip move _+>)
?: ?=([%sole *] pax) ~&(%hall-no-sole !!)
?: ?=([%export *] pax)
:_ +>.$
[ost.bol %diff %export [%hall-v0 grams:(~(got by stories) ~.inbox)]]~
::
=+ qer=(path-to-query pax)
?. (leak src.bol qer) ~&(%peer-invisible !!)
=^ mos +>.$
@ -3196,6 +3203,20 @@
:- ~
+>.$(log (~(del by log) nom))
::
++ poke-import
|= i=*
^- (quip move _+>)
::
?> ?=([%hall-v0 *] i)
=/ grams=(list telegram) ;;((list telegram) +.i)
::
~& [%importing-telegrams count=(lent grams)]
::
%- pre-bake
%+ turn grams
|= t/telegram
[%story ~.inbox %gram [our.bol ~.inbox] t]
::
++ log-all-to-file
:: update stories logs
::

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

View File

@ -1,24 +1,32 @@
/- lens
/+ *server
/- 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]
[%peel wire dock mark path]
[%peer wire dock path]
[%peer wire dock path]
[%poke wire dock poke]
[%pull wire dock ~]
==
::
+$ poke
$% [%lens-command command:lens]
[%import *]
==
::
+$ state
@ -49,6 +57,7 @@
%- (require-authorization:app ost.bow move this)
|= =inbound-request:eyre
^- (quip move _this)
::
?^ job.state
:_ this
[ost.bow %http-response %start [%500 ~] ~ %.y]~
@ -60,17 +69,114 @@
(need (de-json:html q:(need body.request.inbound-request)))
=/ com=command:lens
(json:grab:lens-mark jon)
::
?: ?=(%export -.source.com)
~& [%export app.source.com]
:_ this(job.state (some [ost.bow com]))
[ost.bow %peer /export [our.bow app.source.com] /export]~
::
?: ?=(%import -.source.com)
?~ enc=(de:base64 base64-jam.source.com)
:_ this
[ost.bow %http-response %start [%500 ~] ~ %.y]~
::
=/ c=* (cue q.u.enc)
::
:_ this(job.state (some [ost.bow com]))
[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=*]
^- (quip move _this)
::
?> ?=(^ job.state)
:: herb will do whatever we tell it to, so by convention have it write to an
:: app name based on the file name.
::
?> ?=(%export -.source.com.u.job.state)
=/ app-name=tape (trip app.source.com.u.job.state)
=/ output=@t (crip "/{app-name}/jam")
::
=/ jon=json
=/ =atom (jam data)
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
(pairs:enjs:format file+s+output data+s+enc ~)
::
:_ this(job.state ~)
:~ [bone.u.job.state %http-response (json-response:app (json-to-octs jon))]
[ost.bow %pull /export [our.bow app.source.com.u.job.state] ~]
==
::
++ quit
|= =wire
@ -81,17 +187,36 @@
++ reap
|= [=wire saw=(unit tang)]
^- (quip move _this)
::
?: =([%export ~] wire)
[~ this]
::
?^ saw
[((slog u.saw) ~) this]
?> ?=(^ 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] ~]
==
::
++ coup
|= [=wire saw=(unit tang)]
^- (quip move _this)
::
?: =([%import ~] wire)
?> ?=(^ job.state)
:_ this(job.state ~)
:_ ~
:* bone.u.job.state
%http-response
%start
[%200 ~]
[~ (as-octt:mimes:html "\"Imported data\"")]
%.y
==
::
?^ saw
[((slog u.saw) ~) this]
[~ this]

View File

@ -61,6 +61,7 @@
++ manual-tests
^- (list (pair term [(list ship) _*form:(ph ,~)]))
=+ (ph-tests our.hid)
=+ ph-azimuth=(ph-azimuth our.hid)
=/ eth-node (spawn:ph-azimuth ~bud)
=/ m (ph ,~)
:~ :+ %boot-bud
@ -110,7 +111,49 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
(pure:m ~)
::
:+ %hi-az
~[~bud ~dev]
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > %dev-done
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > %bud-done
(send-hi ~bud ~dev)
(pure:m ~)
::
:+ %moon-az
~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~linnup-torsyx)
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx)
~& > 'LINNUP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx-linnup-torsyx)
~& > 'MOON LINNUP DONE'
;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx)
~& > 'HI DOWN DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud)
~& > 'HI UP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev)
~& > 'HI OVER UP DONE'
;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx)
~& > 'HI OVER DOWN DONE'
(pure:m ~)
(pure:m ~)
::
:+ %breach-hi
@ -119,17 +162,24 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
(send-hi ~bud ~dev)
~& > 'HI DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~dev ~bud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~bud ~dev)
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
~& > 'HI NOT RESPONDING DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'REBOOT DEV DONE'
(wait-for-dojo ~bud "hi ~dev successful")
~& > 'DONE'
(pure:m ~)
::
:+ %breach-hi-cousin
@ -140,10 +190,10 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-real-ship:eth-node ~dev)
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(send-hi ~marbud ~mardev)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~mardev ~marbud)
@ -151,59 +201,111 @@
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~marbud ~mardev)
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(wait-for-dojo ~marbud "hi ~mardev successful")
(pure:m ~)
::
:+ %breach-sync
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& %checking-file-touched
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& %checked-file-touched
~& > 'TOUCH FILE CHECK DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-multiple
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH DONE'
(check-file-touched ~marbud %home file)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH-1 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~marbud ~bud)
~& > 'BREACH-2 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD RE DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-sudden
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& > 'TOUCH FILE CHECK DONE'
=. eth-node (breach:eth-node ~bud)
~& > 'BREACH EXECUTED'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
==
::

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

@ -66,9 +66,9 @@
== ::
++ work :: interface action
$% :: circle management ::
{$join (map circle range)} :: subscribe to
{$join (map circle range) (unit char)} :: subscribe to
{$leave audience} :: unsubscribe from
{$create security name cord} :: create circle
{$create security name cord (unit char)} :: create circle
{$delete name (unit cord)} :: delete circle
{$depict name cord} :: change description
{$filter name ? ?} :: change message rules
@ -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)}
@ -838,14 +842,14 @@
::
;~((glue ace) (perk %read ~) cire dem:ag)
::
;~((glue ace) (perk %join ~) sorz)
;~((glue ace) (perk %join ~) ;~(plug sorz (punt ;~(pfix ace glyph))))
::
;~((glue ace) (perk %leave ~) cirs)
::
;~ (glue ace) (perk %create ~)
pore
cire
qut
;~(plug qut (punt ;~(pfix ace glyph)))
==
::
;~ plug (perk %delete ~)
@ -1186,9 +1190,11 @@
:: change local mailbox config to include
:: subscriptions to {pas}.
::
|= pos/(map circle range)
|= {pos/(map circle range) gyf/(unit char)}
^+ ..sh-work
=+ pas=~(key by pos)
=? ..sh-work ?=(^ gyf)
(bind u.gyf `pas)
=. ..sh-work
sh-prod(active.she pas)
:: default to a day of backlog
@ -1226,11 +1232,11 @@
::
:: creates circle {nom} with specified config.
::
|= {sec/security nom/name txt/cord}
|= {sec/security nom/name txt/cord gyf/(unit char)}
^+ ..sh-work
=. ..sh-work
(sh-act %create nom txt sec)
(join [[[self nom] ~] ~ ~])
(join [[[self nom] ~] ~ ~] gyf)
::
++ delete
:: %delete
@ -1922,7 +1928,7 @@
$(dif [%filter fit.cof.dif])
?: ?=($remove -.dif)
(sh-note (weld "rip " (~(cr-show cr cir) ~)))
?: ?=($usage -.dif) +>
?: ?=(?($usage $read) -.dif) +>
%- sh-note
%+ weld
(weld ~(cr-phat cr cir) ": ")
@ -1933,9 +1939,6 @@
::
$caption
"cap: {(trip cap.dif)}"
::
$read
""
::
$filter
;: weld
@ -2314,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)
@ -2399,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

@ -0,0 +1,9 @@
/+ pill
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=~
~
==
:- %pill
.^(pill:pill %gx /(scot %p p.bec)/aqua/(scot %da now)/pill/noun)

View File

@ -1,14 +1,14 @@
=> |%
+$ src
$% [%ship =ship ~]
[%node url=@t ~]
[%app =term ~]
==
--
:- %say
|= [* [whos=(set ship) =src] ~]
=/ =source:kale
|= [* [whos=(list ship) =src] ~]
=/ =source:jael
?- -.src
%ship [%& ship.src]
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da]
%app [%| term.src]
==
[%azimuth-tracker-poke %listen whos source]

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

@ -1,38 +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)}"
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
=/ sig=oath:pki:jael
.^(@ j+/(scot %p our)/earl/(scot %da now)/(scot %p mon)/(scot %ud lyf)/(scot %ux pub:ex:cub))
=/ sed=seed:able:jael
[mon lyf sec:ex:cub `sig]
%+ print leaf+"moon: {(scow %p mon)}"
%- produce [%atom (scot %uw (jam sed))]

View File

@ -15,7 +15,8 @@
arg=$@(~ [top=path ~])
dub=_|
==
:- %noun
:- %pill
^- pill:pill
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
=/ sys=path

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

@ -97,6 +97,7 @@
[%home %publish]
[%home %clock]
[%home %weather]
[%home %azimuth-tracker]
==
::
++ deft-fish :: default connects
@ -105,7 +106,7 @@
^- (list gill:gall)
[[our %talk] [our %dojo] ~]
::
++ make :: initial part
++ make :: initial part
|= our/ship
^- part
:* %drum

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

@ -1,9 +1,10 @@
:: Mock Azimuth
::
/+ ph, ph-util, ph-philter
/+ ph, ph-util, ph-philter, ph-tests
=, ph
=, ph-util
=, ph-philter
|= our=ship
=> |%
+$ az-log [topics=(lest @) data=@t]
--
@ -30,22 +31,39 @@
|= pin=ph-input
^- output:n
=, enjs:format
=/ thus (extract-thus-to uf.pin 'http://localhost:8545')
?~ thus
=/ ask (extract-request uf.pin 'http://localhost:8545/')
?~ ask
[& ~ %wait ~]
?~ r.mot.u.thus
?~ body.request.u.ask
[& ~ %wait ~]
=/ req q.u.r.mot.u.thus
=/ req q.u.body.request.u.ask
|^ ^- output:n
=/ method (get-method req)
:: =; a ~& [%give-azimuth-response a] -
?: =(method 'eth_blockNumber')
:- | :_ [%wait ~]
%+ answer-request req
s+(crip (num-to-hex:ethereum latest-block))
?: =(method 'eth_getBlockByNumber')
:- | :_ [%wait ~]
%+ answer-request req
:- %o
=/ number (hex-to-num:ethereum (get-first-param req))
=/ hash (number-to-hash number)
=/ parent-hash (number-to-hash ?~(number number (dec number)))
%- malt
^- (list (pair term json))
:~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
number+s+(crip (num-to-hex:ethereum number))
'parentHash'^s+(crip (num-to-hex:ethereum parent-hash))
==
?: =(method 'eth_getLogs')
:- | :_ [%wait ~]
%+ answer-request req
%+ logs-to-json
?^ (get-param-obj-maybe req 'blockHash')
%- logs-by-hash
(get-param-obj req 'blockHash')
%+ logs-by-range
(get-param-obj req 'fromBlock')
(get-param-obj req 'toBlock')
?: =(method 'eth_newFilter')
@ -67,7 +85,7 @@
:+ |
%+ answer-request req
~| [eth-filters latest-block]
(logs-to-json from-block.u.fil latest-block)
(logs-by-range from-block.u.fil latest-block)
=. last-block.u.fil latest-block
[%cont ..stay]
?: =(method 'eth_getFilterChanges')
@ -77,16 +95,17 @@
~|(%no-filter-not-implemented !!)
:+ |
%+ answer-request req
(logs-to-json last-block.u.fil latest-block)
(logs-by-range last-block.u.fil latest-block)
=. all.eth-filters
%+ ~(put by all.eth-filters)
fil-id
u.fil(last-block latest-block)
[%cont ..stay]
~& [%ph-azimuth-miss req]
[& ~ %wait ~]
::
++ latest-block
(add launch:contracts:azimuth (lent logs))
(add launch:contracts:azimuth (dec (lent logs)))
::
++ get-id
|= req=@t
@ -110,6 +129,20 @@
?> ?=([* ~] array)
i.array
::
++ get-param-obj-maybe
|= [req=@t param=@t]
^- (unit @ud)
=, dejs-soft:format
=/ array
%. (need (de-json:html req))
(ot params+(ar (ot param^so ~)) ~)
?~ array
~
:- ~
?> ?=([* ~] u.array)
%- hex-to-num:ethereum
i.u.array
::
++ get-filter-id
|= req=@t
=, dejs:format
@ -120,6 +153,14 @@
?> ?=([* ~] id)
i.id
::
++ get-first-param
|= req=@t
=, dejs:format
=/ id
%. (need (de-json:html req))
(ot params+(at so bo ~) ~)
-.id
::
++ answer-request
|= [req=@t result=json]
^- (list ph-event)
@ -136,19 +177,42 @@
who.pin
//http-client/0v1n.2m9vh
%receive
num.u.thus
num.u.ask
[%start [200 ~] `(as-octs:mimes:html resp) &]
==
::
++ logs-to-json
++ number-to-hash
|= =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:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
|= [from-block=@ud to-block=@ud]
%+ logs-to-json (max launch:contracts:azimuth from-block)
?: (lth to-block launch:contracts:azimuth)
~
%+ swag
?: (lth from-block launch:contracts:azimuth)
[0 +((sub to-block launch:contracts:azimuth))]
:- (sub from-block launch:contracts:azimuth)
+((sub to-block from-block))
logs
::
++ logs-by-hash
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json
|= [count=@ud selected-logs=(list az-log)]
^- json
:- %a
=/ selected-logs
%+ swag
[(sub from-block launch:contracts:azimuth) (sub to-block from-block)]
logs
=/ count from-block
|- ^- (list json)
?~ selected-logs
~
@ -160,7 +224,8 @@
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5362)))
::
:+ 'blockHash' %s
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5363)))
=/ hash (number-to-hash count)
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
::
:+ 'blockNumber' %s
(crip (num-to-hex:ethereum count))
@ -183,23 +248,60 @@
--
--
::
++ dawn
++ raw-real-ship
|= who=ship
=/ m (ph ,~)
^- form:m
?. =(%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 seed=(unit seed:able:jael)]
^- dawn-event
=/ lyfe lyfe:(~(got by lives) who)
:* [who lyfe sec:ex:(get-keys who lyfe) ~]
(^sein:title who)
=/ spon
=/ =ship (^sein:title who)
=/ spon-spon
?: ?=(%czar (clan:title ship))
[| ~zod]
[& (^sein:title ship)]
=/ life-rift ~|([ship lives] (~(got by lives) ship))
=/ =life lyfe.life-rift
=/ =rift rut.life-rift
=/ =pass
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public ship life %crypt))
(as-octs:mimes:html (get-public ship life %auth))
1
:^ ship=ship
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
=/ =seed:able:jael
?^ seed
u.seed
=/ life-rift (~(got by lives) who)
=/ =life lyfe.life-rift
[who life sec:ex:(get-keys who life) ~]
:* seed
spon
get-czars
~[~['arvo' 'netw' 'ork']]
0
`(need (de-purl:html 'http://localhost:8545'))
~
==
::
:: Should only do galaxies
::
++ get-czars
^- (map ship [life pass])
^- (map ship [rift life pass])
%- malt
%+ murn
~(tap by lives)
@ -207,7 +309,7 @@
?. =(%czar (clan:title who))
~
%- some
:+ who lyfe
:^ who rut lyfe
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public who lyfe %crypt))
(as-octs:mimes:html (get-public who lyfe %auth))
@ -217,21 +319,17 @@
|= who=@p
?< (~(has by lives) who)
=. lives (~(put by lives) who [1 0])
%- add-logs
%+ welp
?: =(%czar (clan:title who))
~
~[(spawned:lo (^sein:title who) who)]
:~ (activated:lo who)
(owner-changed:lo who 0xdead.beef)
%- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
=. this-az
%- add-logs
:~ %- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
(spam-logs 30)
::
:: our: host ship
:: who: cycle keys
@ -303,9 +401,16 @@
=/ prev (~(got by lives) who)
=/ rut +(rut.prev)
=. lives (~(put by lives) who [lyfe.prev rut])
%- add-logs
:_ ~
(broke-continuity:lo who rut)
=. this-az
(add-logs (broke-continuity:lo who rut) ~)
(spam-logs 30)
::
++ spam-logs
|= n=@
?: =(n 0)
this-az
=. this-az ?:((~(has by lives) ~fes) (cycle-keys ~fes) (spawn ~fes))
$(n (dec n))
::
++ get-keys
|= [who=@p lyfe=life]
@ -326,11 +431,6 @@
++ lo
=, azimuth-events:azimuth
|%
++ activated
|= who=ship
^- az-log
[~[^activated who] '']
::
++ broke-continuity
|= [who=ship rut=rift]
^- az-log
@ -351,15 +451,5 @@
(render-hex-bytes:ethereum 32 `@`crypto)
(render-hex-bytes:ethereum 32 `@`lyfe)
==
::
++ owner-changed
|= [who=ship owner=@ux]
^- az-log
[~[^owner-changed who owner] '']
::
++ spawned
|= [par=ship who=ship]
^- az-log
[~[^spawned par who] '']
--
--

View File

@ -80,13 +80,12 @@
::
:: Check if given effect is an http request; extract
::
++ extract-thus-to
++ extract-request
|= [uf=unix-effect dest=@t]
^- (unit [num=@ud mot=moth:eyre])
?. ?=(%thus -.q.uf) ~
?~ q.q.uf ~
?. =(p.u.q.q.uf (rash dest auri:de-purl:html)) ~
`[p.q.uf q.u.q.q.uf]
^- (unit [num=@ud =request:http])
?. ?=(%request -.q.uf) ~
?. =(dest url.request.q.uf) ~
`[id.q.uf request.q.uf]
::
:: Scry into a running aqua ship
::

View File

@ -6,6 +6,26 @@
::
:: sys: full path to /sys directory
::
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ dawn-event
$: =seed:able:jael
spon=[=ship point:azimuth]
czar=(map ship [=rift =life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
==
::
++ module-ova
|= sys=path
^- (list [wire [%veer term path cord]])
@ -54,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
@ -71,7 +91,7 @@
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
^- unix-event
::
:: hav: all user files
::
@ -97,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

@ -255,7 +255,7 @@
:: XX if active clam contracts only to abort transaction?
::
:: ~& [%tapp-reset dap.bowl]
:: `this-tapp
:: `this-tapp
~| [%tapp-load-incompatible dap.bowl]
!!
::
@ -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

View File

@ -35,6 +35,8 @@
;~(pfix col (more net (cook crip (star ;~(less net prn)))))
==
listen-api+(su ;~(plug sym ;~(pfix col sym)))
export+so
import+(ot app+so base64-jam+so ~)
as+(ot mark+(su sym) next+source ~)
hoon+(ot code+so next+source ~)
==

View File

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

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

View File

@ -10,12 +10,18 @@
:: Short names are simply the first letter of each word plus `s` if
:: it's a list.
::
/+ pill
=, pill-lib=pill
|%
++ ph-event
$% [%test-done p=?]
aqua-event
==
::
+$ unix-event unix-event:pill-lib
+$ dawn-event dawn-event:pill-lib
+$ pill pill:pill-lib
::
+$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event)]
[%pause-events who=ship]
@ -40,16 +46,6 @@
::
+$ unix-timed-event [tym=@da ue=unix-event]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%live p=@ud q=(unit @ud)]
[%barn ~]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ unix-effect
%+ pair wire
$% [%blit p=(list blit:dill)]
@ -60,20 +56,8 @@
[%sleep ~]
[%restore ~]
[%init ~]
[%request id=@ud request=request:http]
==
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ dawn-event
$: =seed:able:jael
spon=ship
czar=(map ship [=life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
snap=(unit snapshot:jael)
==
::
+$ vane-move
%+ pair bone
$% [%peer wire dock path]

View File

@ -15,6 +15,8 @@
{$hoon code/@t next/source} :: end since they
{$tuple next/(list source)} :: don't bunt well
{$listen-api api/term event/term}
{$export app/@t}
{$import app/@t base64-jam/@t}
==
++ sink
$% {$stdout ~}

View File

@ -15,10 +15,10 @@
[%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
@ -30,7 +30,7 @@
[%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

@ -459,7 +459,7 @@
::
++ dint :: input routing
|= hap/path ^- @tas
?+ hap !!
?+ hap ~|([%bad-dint hap] !!)
{@ $ames *} %a
{@ $boat *} %c
{@ $newt *} %a

View File

@ -15910,7 +15910,6 @@
|* tem=rule
%- star
;~ pose
whit
;~(pfix bas tem)
;~(less tem prn)
==
@ -17296,6 +17295,14 @@
=+ new=(~(mint ut sut) %noun gen)
[new +>+<.$(mit (~(put by mit) [sut gen] new))]
::
++ slam :: ++slam, cached
|= [gat=vase sam=vase]
^- [vase worm]
=/ sut=type [%cell p.gat p.sam]
=/ gen=hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~]
=^ new=type +>+<.$ (play sut gen)
[[new (slum q.gat q.sam)] +>+<.$]
::
++ slap :: ++slap, cached
|= {vax/vase gen/hoon}
^- {vase worm}

View File

@ -22,9 +22,9 @@
== ::
$: %j :: to %jael
$> $? %meet :: neighbor
%pubs :: view public keys
%public-keys :: view public keys
%turf :: view domains
%vein :: view private keys
%private-keys :: view private keys
== ::
task:able:jael ::
== ::
@ -37,9 +37,9 @@
$>(%wake gift:able:behn) :: timer activate
== ::
$: %j :: from %jael
$> $? %pubs :: public keys
$> $? %public-keys :: public keys
%turf :: bind to domains
%vein :: private keys
%private-keys :: private keys
== ::
gift:able:jael ::
== ::
@ -270,7 +270,7 @@
::
=/ bil=(unit deed)
=/ rac (clan:title our)
?. ?| ?=(?(%earl %pawn) rac)
?. ?| ?=(%pawn rac)
&(!?=(%czar rac) =(our seg))
==
~
@ -832,20 +832,6 @@
=* wed u.law
?> ^- ?
?- (clan:title her)
%earl
:: signed by parent
::
=/ seg (^sein:title her)
=/ yig
?: =(our seg)
sen:gus
cluy:(myx:gus seg)
?& =(lyf.yig life.wed)
?=(^ oath.wed)
.= (need (sure:as:cub.yig u.oath.wed))
(shaf %earl (sham [her life.wed pass.wed]))
==
::
%pawn
:: self-signed, life 1, address is fingerprint
::
@ -919,10 +905,7 @@
:: if :her is a comet, or a moon of a known ship, proceed
::
=/ =rank:title (clan:title her)
?: ?| ?=(%pawn rank)
?& ?=(%earl rank)
!=(~ lew.wod.dur:(myx:gus (sein-scry her)))
== ==
?: ?=(%pawn rank)
apse
:: otherwise, drop the packet
::
@ -1358,7 +1341,7 @@
?- -.bon
%beer
=/ =wire /pubs/(scot %p p.bon)
:_ fox [hen [%pass wire %j %pubs p.bon]]~
:_ fox [hen [%pass wire %j %public-keys (silt p.bon ~)]]~
::
%bock
:: ignore %turf if we haven't yet learned a unix duct
@ -1421,20 +1404,23 @@
::
%sake
=/ =wire /our/(scot %p our)
:_ fox [hen [%pass wire %j %vein ~]]~
:_ fox [hen [%pass wire %j %private-keys ~]]~
::
%wine
:_ fox
=+ fom=~(rend co %$ %p p.bon)
:~ :- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
q.bon
==
==
[[(print hen p.bon q.bon) ~] fox]
==
::
++ print
|= [hen=duct who=ship =tape]
^- move
=+ fom=~(rend co %$ %p who)
:- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
tape
==
::
++ knap
@ -1453,30 +1439,44 @@
%mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code
$(sih [%g %mean `[%mack +>+.sih]])
::
%pubs
%public-keys
?. ?=([%pubs @ ~] tea)
~& [%strange-pubs tea]
[~ +>]
[~ +>.$]
?: ?& ?=(%diff -.public-keys-result.sih)
?=(%rift -.diff.public-keys-result.sih)
==
(sink hen [who [from to]:diff]:public-keys-result.sih)
?: ?& ?=(%diff -.public-keys-result.sih)
!?=(%keys -.diff.public-keys-result.sih)
==
[~ +>.$]
=/ her=ship (slav %p i.t.tea)
=/ gus (~(us go ton.fox) our)
=/ diz (myx:gus her)
?: =(0 life.sih)
:: this should clear lew.wod.dur.diz because it means
:: we no longer trust that their public key came to
:: us honestly (becuse of a %jael snapshot restore).
:: in practice, that crashes in ++cluy:las:as:go, so
:: we ignore for now.
~& [%ames-hear-empty-pub her]
[~ +>.$]
=/ ded=deed
[life.sih (~(got by pubs.sih) life.sih) oath=~]
=. lew.wod.dur.diz `ded
=/ ded=(unit deed)
?: ?=(%full -.public-keys-result.sih)
~| [her=her public-keys-result=public-keys-result.sih]
=/ a-point=(unit point:able:jael)
(~(get by points.public-keys-result.sih) her)
?~ a-point
~
=/ a-pass=pass pass:(~(got by keys.u.a-point) life.u.a-point)
`[life.u.a-point a-pass oath=~]
?> ?=(%keys -.diff.public-keys-result.sih)
?> =(her who.public-keys-result.sih)
=/ a-key-update=key-update:point:able:jael
to.diff.public-keys-result.sih
`[life.a-key-update pass.a-key-update oath=~]
?~ ded
[~ +>.$]
=. lew.wod.dur.diz `u.ded
=. ton.fox (~(su go ton.fox) (nux:gus diz))
[~ +>.$]
::
%unto [~ +>]
::
%vein
%private-keys
?. ?=([%our @ ~] tea)
~& [%strange-vein tea]
[~ +>]
@ -1521,6 +1521,17 @@
$(p.fuy t.p.fuy, out (weld (flop toe) out))
==
::
++ sink
|= [hen=duct who=ship from=rift to=rift]
^- [(list move) _+>]
?: =(our who)
[[(print hen who ", you have sunk") ~] +>.$]
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[(print hen who " has sunk") ~] +>.$]
::
++ knob
~/ %knob
|= [hen=duct kyz=task:able]
@ -1585,25 +1596,6 @@
fox(bad (~(del in bad.fox) p.kyz))
~& [%block p.kyz]
fox(bad (~(put in bad.fox) p.kyz))
::
%sunk
=* who p.kyz
=* lyf q.kyz
?: =(our who)
?: (lth lyf p:(head val.ton.fox))
:: replaying our old sinkage, ignore
:: XX review
::
[~ fox]
:: XX include some helpful instructions here
::
:_ fox
[%wine who ", you have sunk"]~
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[%wine who " has sunk"]~ fox]
::
%vega
:: re-initialize our cryptosuite B cores

View File

@ -101,8 +101,11 @@
++ wake
|= error=(unit tang)
^+ [moves state]
:: no-op on spurious but innocuous unix wakeups
::
?~ timers.state ~| %behn-wake-no-timer^error !!
?~ timers.state
~? ?=(^ error) %behn-wake-no-timer^u.error
[moves state]
:: if we errored, pop the timer and notify the client vane of the error
::
?^ error
@ -111,7 +114,6 @@
:: if unix woke us too early, retry by resetting the unix wakeup timer
::
?: (gth date.i.timers.state now)
~? debug=%.n [%behn-wake-too-soon `@dr`(sub date.i.timers.state now)]
set-unix-wake(next-wake.state ~)
:: pop first timer, tell vane it has elapsed, and adjust next unix wakeup
::
@ -197,7 +199,6 @@
:: ignore duplicates
::
?: =(t i.timers)
~? debug=%.n [%behn-set-duplicate t]
timers
:: timers at the same date form a fifo queue
::
@ -214,7 +215,6 @@
:: if we don't have this timer, no-op
::
?~ timers
~? debug=%.n [%behn-unset-missing t]
~
?: =(i.timers t)
t.timers
@ -260,11 +260,10 @@
:: +load: migrate an old state to a new behn version
::
++ load
|= old=*
|= old=behn-state
^+ behn-gate
::
~| %behn-load-fail
behn-gate(state (behn-state old))
behn-gate(state old)
:: +scry: view timer state
::
:: TODO: not referentially transparent w.r.t. elapsed timers,

View File

@ -497,6 +497,9 @@
%wipe ::
== ::
task:able:ford ::
== ::
$: %j :: by %jael
$>(%public-keys task:able:jael) ::
== == ::
++ riot (unit rant) :: response+complete
++ sign :: in result $<-
@ -524,6 +527,9 @@
$: %f :: by %ford
$>(%made gift:able:ford) ::
== ::
$: %j :: by %jael
$>(%public-keys gift:able:jael) ::
== ::
$: @tas :: by any
$>(%crud vane-task) :: XX strange
== == ::
@ -2402,7 +2408,6 @@
:: Must uni the old-lat into the new-lat so that if we recreate
:: the same blob hash, we use the old blob not the new one. Else
:: you get mutually recurring %delta blobs.
::
++ add-blobs
|= [new-blobs=(map path blob) old-lat=(map lobe blob)]
^- (map lobe blob)
@ -2632,22 +2637,24 @@
::
=* ruf |4.+6.^$
::
=+ ^- [hun=(unit duct) rede]
=+ ^- [mow=(list move) hun=(unit duct) rede]
?. =(our her)
:: no duct, foreign +rede or default
::
:- ~
:+ ?: (~(has by hoy.ruf) her)
~
[hun.rom.ruf %pass /sinks %j %public-keys (silt her ~)]~
~
=/ rus rus:(~(gut by hoy.ruf) her *rung)
%+ ~(gut by rus) syd
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~]
:: administrative duct, domestic +rede
::
:- `hun.rom.ruf
:+ ~ `hun.rom.ruf
=/ jod (~(gut by dos.rom.ruf) syd *dojo)
[lim=now ref=~ [qyx dom per pew]:jod]
::
=* red=rede ->
=| mow/(list move)
=* red=rede ->+
|%
++ abet :: resolve
^- [(list move) raft]
@ -4107,7 +4114,7 @@
%boat
:_ ..^$
[hen %give %hill (turn ~(tap by mon.ruf) head)]~
::.
::
%cred
=. cez.ruf
?~ cew.req (~(del by cez.ruf) nom.req)
@ -4304,49 +4311,6 @@
=/ den ((de our now ski hen ruf) our des.req)
abet:(perm:den pax.req rit.req)
[mos ..^$]
::
%sunk
~& rift=[p.req q.req]
~& desks=(turn ~(tap by dos.rom.ruf) head)
~& hoy=(turn ~(tap by hoy.ruf) head)
::
?: =(our p.req)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) p.req)
?~ foreign-desk
~& [%never-heard-of-her p.req q.req]
[~ ..^$]
~& old-rift=rit.u.foreign-desk
?: (gte rit.u.foreign-desk q.req)
~& 'replaying sunk, so not clearing state'
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) p.req)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
%vega [~ ..^$]
::
@ -4446,30 +4410,30 @@
::
++ stay [%1 ruf]
++ take :: accept response
|= {tea/wire hen/duct hin/(hypo sign)}
|= [tea=wire hen=duct hin=(hypo sign)]
^+ [*(list move) ..^$]
?: ?=({$commit @ *} tea)
?: ?=([%commit @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-commit:den q.hin)
[mos ..^$]
::
?: ?=({$merge @ *} tea)
?: ?=([%merge @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-merge:den q.hin)
[mos ..^$]
::
?: ?=({$mount @ *} tea)
?: ?=([%mount @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-mount:den q.hin)
[mos ..^$]
::
?: ?=({%foreign-request @ @ @ *} tea)
?: ?=([%foreign-request @ @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=/ inx (slav %ud i.t.t.t.tea)
@ -4478,7 +4442,7 @@
abet:(take-foreign-request:den inx q.hin)
[mos ..^$]
::
?: ?=({%foreign-update @ @ *} tea)
?: ?=([%foreign-update @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=^ mos ruf
@ -4486,8 +4450,8 @@
abet:(take-foreign-update:den q.hin)
[mos ..^$]
::
?: ?=({$blab care @ @ *} tea)
?> ?=($made +<.q.hin)
?: ?=([%blab care @ @ *] tea)
?> ?=(%made +<.q.hin)
?. ?=([%complete %success *] result.q.hin)
~| %blab-fail
~> %mean.|.((made-result-as-error:ford result.q.hin))
@ -4495,14 +4459,59 @@
:_ ..^$ :_ ~
:* hen %slip %b %drip !>
:* %writ ~
^- {care case @tas}
^- [care case @tas]
[i.t.tea ;;(case +>:(slay i.t.t.tea)) i.t.t.t.tea]
::
`path`t.t.t.t.tea
`cage`(result-to-cage:ford build-result.result.q.hin)
== ==
::
?: ?=([%sinks ~] tea)
?> ?=(%public-keys +<.q.hin)
?: ?=(%full -.public-keys-result.q.hin)
[~ ..^$]
?. ?=(%rift -.diff.public-keys-result.q.hin)
[~ ..^$]
=/ who who.public-keys-result.q.hin
=/ to-rift to.diff.public-keys-result.q.hin
::
?: =(our who)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) who)
?~ foreign-desk
[~ ..^$]
?: (gte rit.u.foreign-desk to-rift)
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) who)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
?- -.+.q.hin
%public-keys ~|([%public-keys-raw tea] !!)
%init-clad
~|(%clad-not-real !!)
::

View File

@ -297,7 +297,6 @@
[[151 %noun] %j our %sein da+now /(scot %p who)]
::
++ init :: initialize
~& [%dill-init our ram]
^+ .
=. moz
:_ moz
@ -305,7 +304,6 @@
.
::
++ mere :: continue init
~& [%dill-mere our ram]
^+ .
=/ myt (flop (fall tem ~))
=/ can (clan:title our)
@ -514,6 +512,8 @@
=/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %j u.boot]~)
:: we are subsequently initialized. single-home
@ -539,10 +539,6 @@
=? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~]
::
$(hen u.hey.all, wrapped-task p.task)
:: a %sunk notification from %jail comes in on an unfamiliar duct
::
?: ?=(%sunk -.task)
[~ ..^$]
:: a %vega notification on kernel upgrade comes in on an unfamiliar duct
::
?: ?=(%vega -.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);
@ -802,7 +805,7 @@
::
:_ state
:_ ~
:^ duct %pass /run-app/[app.act]
:^ duct %pass /run-app-request/[app.act]
^- note
:^ %g %deal [our our]
::
@ -847,7 +850,7 @@
%app
:_ state
:_ ~
:^ duct %pass /run-app/[app.action]
:^ duct %pass /run-app-request/[app.action]
^- note
:^ %g %deal [our our]
:: todo: i don't entirely understand gall; there's a way to make a gall
@ -892,12 +895,9 @@
%app
:_ state
:_ ~
:^ duct %pass /run-app/[app.action.u.connection]
:^ duct %pass /run-app-cancel/[app.action.u.connection]
^- note
:^ %g %deal [our our]
:: todo: i don't entirely understand gall; there's a way to make a gall
:: use a %handle arm instead of a sub-%poke with the
:: %handle-http-request type.
::
^- cush:gall
:* app.action.u.connection
@ -2029,13 +2029,14 @@
?+ i.wire
~|([%bad-take-wire wire] !!)
::
%run-app run-app
%run-build run-build
%channel channel
%acme acme-ack
%run-app-request run-app-request
%run-app-cancel run-app-cancel
%run-build run-build
%channel channel
%acme acme-ack
==
::
++ run-app
++ run-app-request
::
?> ?=([%g %unto *] sign)
::
@ -2060,6 +2061,18 @@
=^ moves server-state.ax (handle-response http-event.p.sign)
[moves http-server-gate]
::
++ run-app-cancel
::
?> ?=([%g %unto *] sign)
::
:: we explicitly don't care about the return value of a
:: %handle-http-cancel. It is purely a notification and we don't care if
:: it succeeds or not. The user might not have implemented
:: +poke-handle-http-cancel or it might have crashed, but since it's a
:: notification, we don't don't care about its return value.
::
[~ http-server-gate]
::
++ run-build
::
?> ?=([%f %made *] sign)

View File

@ -6168,12 +6168,6 @@
=^ moves state.ax cancel:this-event
::
[moves ford-gate]
::
:: %sunk: foreign ship has lost continutity
::
%sunk
::
[~ ford-gate]
::
:: %vega: learn of kernel upgrade
::

View File

@ -1334,21 +1334,18 @@
%keep `%f
%kill `%f
%look `%j
%listen `%k
%listen `%j
%merg `%c
%mint `%j
%mont `%c
%new-event `%k
%moon `%j
%nuke `%a
%ogre `%c
%perm `%c
%rest `%b
%snap `%j
%sources `%k
%rekey `%j
%wait `%b
%want `%a
%warp `%c
%wind `%j
%wipe `%f
::
%request `%i
@ -1381,8 +1378,6 @@
::
$init
[~ ..^$(sys.mast.all hen)]
::
$sunk [~ ..^$]
::
$vega [~ ..^$]
::

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -203,9 +203,6 @@
:: boot completed (XX legacy)
::
[%init p=ship]
:: peer discontinuity
::
[%sunk p=ship q=rift]
:: kernel upgraded
::
[%vega ~]
@ -393,7 +390,6 @@
$>(%init vane-task) :: report install
{$kick p/@da} :: wake up
{$nuke p/@p} :: toggle auto-block
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$wake ~} :: timer activate
$>(%wegh vane-task) :: report memory
@ -628,7 +624,6 @@
{$dirk des/desk} :: mark mount dirty
{$ogre pot/$@(desk beam)} :: delete mount point
{$perm des/desk pax/path rit/rite} :: change permissions
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$warp wer/ship rif/riff} :: internal file req
{$werp who/ship wer/ship rif/riff} :: external file req
@ -795,7 +790,6 @@
$>(%init vane-task) :: after gall ready
{$lyra p/@t q/@t} :: upgrade kernel
{$noop ~} :: no operation
$>(%sunk vane-task) :: report death
{$talk p/tank} ::
{$text p/tape} ::
{$veer p/@ta q/path r/@t} :: install vane
@ -1182,9 +1176,6 @@
:: %kill: stop a build; send on same duct as original %build request
::
[%kill ~]
:: %sunk: receive a report that a foreign ship has lost continuity
::
$>(%sunk vane-task)
:: %vega: report kernel upgrade
::
$>(%vega vane-task)
@ -1879,7 +1870,6 @@
$% {$conf p/dock q/culm} :: configure app
$>(%init vane-task) :: set owner
{$deal p/sock q/cush} :: full transmission
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
$>(%west vane-task) :: network request
$>(%wegh vane-task) :: report memory
@ -2061,257 +2051,48 @@
:: ::::
++ 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
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ 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 <-$
$% [%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
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-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
$% $: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
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
[%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
[%listen whos=(set ship) =source] :: set ethereum source
::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
[%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
[%rekey =life =ring] :: update private keys
[%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
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
++ 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
|%
:: %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
@ -2378,13 +2159,17 @@
::
++ udiff-to-diff
|= [=a=udiff =a=point]
^- diff
^- (unit diff)
?- +<.a-udiff
%disavow ~|(%udiff-to-diff-disavow !!)
%rift [%rift rift.a-point rift.a-udiff]
%spon [%spon sponsor.a-point sponsor.a-udiff]
%spon `[%spon sponsor.a-point sponsor.a-udiff]
%rift
?: =(rift.a-udiff +(rift.a-point))
`[%rift rift.a-point rift.a-udiff]
~
::
%keys
:+ %keys
:^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff
==
@ -2431,71 +2216,17 @@
a-point(sponsor to.diff)
==
--
::
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ gift :: out result <-$
$% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%source whos=(set ship) src=source] ::
[%turf turf=(list turf)] :: domains
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-result] :: ethereum changes
== ::
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
+= task :: in request ->$
$~ [%vega ~] ::
$% $: %dawn :: boot from keys
=seed:able:kale :: 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
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%sources ~]
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%turf ~] :: view domains
[%new-event =ship =udiff:point] :: update from app
$>(%vega vane-task) :: report upgrade
$>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
+$ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
::
+$ source (each ship node-src)
+$ source (each ship term)
+$ source-id @udsourceid
+$ snapshot ~
::
:: +state-eth-node: state of a connection to an ethereum node
::
+$ state-eth-node :: node config + meta
$: yen=(set duct)
top-source-id=source-id
$: top-source-id=source-id
sources=(map source-id source)
sources-reverse=(map source source-id)
default-source=source-id
@ -2503,7 +2234,7 @@
ship-sources-reverse=(jug source-id ship)
== ::
:: ::
:::: ++pki:kale :: (1h2) certificates
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
@ -2525,7 +2256,7 @@
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
-- :: kale
-- :: jael
:: ::::
:::: ++xmas :: (1i) new network
:: ::::
@ -7315,6 +7046,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)
@ -7728,7 +7463,6 @@
{$g gift:able:gall}
[%i gift:able:iris]
{$j gift:able:jael}
{$k gift:able:kale}
==
::
+$ unix-task :: input from unix
@ -7862,21 +7596,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
@ -7893,6 +7626,17 @@
++ 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
|%
@ -9071,7 +8815,7 @@
`(cat 3 'gal-' (scot %ud gal))
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'getKeys(uint32)' [%uint gal]~)
(encode-call 'points(uint32)' [%uint gal]~)
[%number boq]
:: +point:give:dawn: Eth RPC for ship's contract state
::
@ -9132,7 +8876,7 @@
::
++ czar
|= rep=octs
^- (unit (map ship [=life =pass]))
^- (unit (map ship [=rift =life =pass]))
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%czar-take-dawn %invalid-json] ~)
@ -9140,27 +8884,31 @@
((ar (ot id+so result+so ~)) u.jon)
?~ res
~&([%czar-take-dawn %invalid-response rep] ~)
=/ dat=(unit (list [who=ship enc=octs aut=octs sut=@ud rev=@ud]))
=/ dat=(unit (list [who=@p point:azimuth-types]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ turn u.res
|= [id=@t result=@t]
^- [who=ship enc=octs aut=octs sut=@ud rev=@ud]
:- `@p`(slav %ud (rsh 3 4 id))
^- [who=ship point:azimuth-types]
=/ who `@p`(slav %ud (rsh 3 4 id))
:- who
%+ point-from-eth
who
:_ *deed:eth-noun
%+ decode-results
result
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
point:eth-type
?~ dat
~&([%bloq-take-dawn %invalid-galaxy-table] ~)
:- ~
%+ roll u.dat
|= $: [who=ship enc=octs aut=octs sut=@ud rev=@ud]
kyz=(map ship [=life =pass])
|= $: [who=ship =point:azimuth-types]
kyz=(map ship [=rift =life =pass])
==
^+ kyz
=/ pub=pass
(pass-from-eth enc aut sut)
(~(put by kyz) who [rev pub])
?~ net.point
kyz
(~(put by kyz) who [continuity-number life pass]:u.net.point)
:: +point:take:dawn: parse ship's contract state
::
++ point
@ -9225,56 +8973,6 @@
(~(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
@ -9299,28 +8997,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

@ -0,0 +1,37 @@
/+ *test
|%
++ test-slam-wa-dry ^- tang
::
%+ expect-eq
!>(7)
-:(~(slam wa *worm) !>(add) !>([3 4]))
:: +test-slam-wa-wet: does +slam:wa perform correct wet type inference?
::
:: Also test that the cache doesn't gain any new entries when given a
:: sample of a previously seen type.
::
++ test-slam-wa-wet ^- tang
:: use the same .list-type for both calls
::
:: Types defined on different lines won't be noun-equal, and so
:: won't test that the cache kicked in on the second entry.
::
=/ list-type=type -:!>(*(list @))
=| worm0=worm
=+ [res1 worm1]=(~(slam wa worm0) !>(flop) [list-type ~[1 2 3]])
=+ [res2 worm2]=(~(slam wa worm1) !>(flop) [list-type ~[4 5 6]])
::
;: weld
%+ expect-eq
res1
[list-type ~[3 2 1]]
::
%+ expect-eq
res2
[list-type ~[6 5 4]]
::
%+ expect-eq
!> worm1
!> worm2
==
--

View File

@ -18,7 +18,7 @@
ames-gate
now=~1234.5.6
call-args=[duct type=*type %soft %init ~nul]
expected-moves=[[duct %pass wire %j %vein ~] [duct %pass / %j %turf ~] ~]
expected-moves=[[duct %pass wire %j %private-keys ~] [duct %pass / %j %turf ~] ~]
==
::
results1
@ -56,7 +56,7 @@
%: ames-take
ames-gate
now
take-args=[wire duct -:!>([%j %vein vein-data]) [%j %vein vein-data]]
take-args=[wire duct -:!>([%j %private-keys vein-data]) [%j %private-keys vein-data]]
expected-moves=~
==
::
@ -67,7 +67,7 @@
ames-gate
now
call-args=[duct type=*type %soft [%want ~nul /foo 1]]
:~ [duct %pass /pubs/~nul %j %pubs ~nul]
:~ [duct %pass /pubs/~nul %j %public-keys (silt ~nul ~)]
[duct %give %send *lane:ames pact1]
:: XX why ~s4 ??
::

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
== ==
==
::
@ -272,7 +271,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -287,7 +286,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate)
:- *type
:* %g %unto %http-response
@ -359,7 +358,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -374,7 +373,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate)
:- *type
:* %g %unto %coup ~
@ -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
@ -449,7 +447,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -464,7 +462,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
%start
@ -485,7 +483,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
[%continue [~ (as-octs:mimes:html 'ya!')] %.y]
@ -556,7 +554,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/~landscape/inner-path' ~ ~]])
@ -571,7 +569,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
[%start [307 ['location' '/~/login?redirect=/~landscape/inner-path']~] ~ %.y]
@ -624,7 +622,7 @@
:: expect authenticated=%.y in the handle below
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!> :*
@ -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
== ==
==
::
@ -1814,7 +1808,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -1848,19 +1842,38 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-cancel/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-cancel
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
==
card
==
:: app1 doesn't have a %handle-http-cancel arm, but that's fine and doesn't
:: crash eyre when it sends its error coup back because we take no action on
:: the response to handle-http-cancel.
::
=^ results5 http-server-gate
%- http-server-take :*
http-server-gate
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app-cancel/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %coup
`[[%leaf "error! error! error!"] ~]
==
==
expected-move=~
==
::
;: weld
results1
results2
results3
results4
results5
==
::
++ http-server-call
@ -2031,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
@ -2182,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
@ -116,16 +97,34 @@
'3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000002'
'"},{"id":"gal-1","jsonrpc":"2.0","result":"'
'0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3'
'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000003'
'"},{"id":"gal-2","jsonrpc":"2.0","result":"'
'0x0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000004'
'"}]'
==
=/ kyz
@ -139,8 +138,8 @@
823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146
%+ expect-eq
!> :- ~
%- ~(gas by *(map ship [=life =pass]))
[[~zod 1 zod.kyz] [~nec 1 nec.kyz] [~bud 0 'b'] ~]
%- ~(gas by *(map ship [=rift =life =pass]))
[[~zod 2 1 zod.kyz] [~nec 3 1 nec.kyz] [~bud 4 1 'b'] ~]
!> (czar:take:dawn oct)
::
++ test-take-point
@ -186,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
@ -254,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
@ -275,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

@ -113,6 +113,33 @@ class sourceAction(argparse.Action):
else:
return {self.which: new_value}
class importFileAction(argparse.Action):
"""Handles the import statement.
The --import statement reads in a jammed noun file from the current working
directory and stuffs it the base64 encoded version which gets passed into
your Urbit.
"""
def __call__(self, parser, res, new_value, option_string):
logging.debug('%r %r' % (new_value, option_string))
logging.debug('source %s' % res.source)
logging.debug('level %s' % res.level)
# We check to see if there's a "{new_value}.jam" file in the current
# working directory. If there isn't, we error
data = ""
filename = new_value + ".jam"
with open(filename, 'rb') as f:
data = f.read()
if data == "":
raise ValueError('Failed to read jamfile')
base_data = base64.b64encode(data)
res.source = {"import": {"app": new_value, "base64-jam": base_data}}
class transformerAction(argparse.Action):
"""Handle transformer flag.
@ -310,6 +337,14 @@ parser.add_argument('-l', '--listen-api', which='listen-api',
metavar='api:event',
help='listen to event from api',
action=sourceAction)
parser.add_argument('-e', '--export', which='export',
metavar='app-name',
help='exports the application state',
action=sourceAction)
parser.add_argument('-i', '--import',
metavar='app-name',
help='imports the application state',
action=importFileAction)
parser.add_argument('-m', '--mark', which='as',
metavar='mark',
help='transform a source to another mark',
@ -390,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

@ -1,16 +1,14 @@
var gulp = require('gulp');
var cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano');
var postcss = require('gulp-postcss');
var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify');
var exec = require('child_process').exec;
var rename = require('gulp-rename');
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var replace = require('rollup-plugin-replace');
var json = require('rollup-plugin-json');
var builtins = require('@joseph184/rollup-plugin-node-builtins');
var rootImport = require('rollup-plugin-root-import');
var globals = require('rollup-plugin-node-globals');
@ -25,9 +23,13 @@ var urbitrc = require('../urbitrc');
***/
gulp.task('css-bundle', function() {
let plugins = [
cssnano()
];
return gulp
.src('src/index.css')
.pipe(cssimport())
.pipe(postcss(plugins))
.pipe(gulp.dest('../../arvo/app/chat/css'));
});
@ -57,17 +59,12 @@ gulp.task('js-imports', function(cb) {
'node_modules/react-is/index.js': [ 'isValidElementType' ],
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development')
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
json(),
globals(),
builtins(),
resolve()
]
}, 'umd'))
@ -93,9 +90,7 @@ gulp.task('tile-js-imports', function(cb) {
useEntry: 'prepend',
extensions: '.js'
}),
json(),
globals(),
builtins(),
resolve()
]
}, 'umd'))
@ -107,7 +102,6 @@ gulp.task('tile-js-imports', function(cb) {
.on('end', cb);
});
gulp.task('js-minify', function () {
return gulp.src('../../arvo/app/chat/js/index.js')
.pipe(minify())
@ -132,18 +126,6 @@ gulp.task('rename-tile-min', function() {
.pipe(gulp.dest('../../arvo/app/chat/js/'));
});
gulp.task('js-cachebust', function(cb) {
return Promise.resolve(
exec('git log', function (err, stdout, stderr) {
let firstLine = stdout.split("\n")[0];
let commitHash = firstLine.split(' ')[1].substr(0, 10);
let newFilename = "index-" + commitHash + "-min.js";
exec('mv ../../arvo/app/chat/js/index-min.js ../../arvo/app/chat/js/' + newFilename);
})
);
})
gulp.task('urbit-copy', function () {
let ret = gulp.src('../../arvo/**/*');

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@joseph184/rollup-plugin-node-builtins": "^2.1.4",
"@sucrase/gulp-plugin": "^2.0.0",
"autoprefixer": "^9.6.1",
"cssnano": "^4.1.10",
"gulp": "^4.0.0",
"gulp-better-rollup": "^4.0.1",
@ -21,10 +19,8 @@
"gulp-rename": "^1.4.0",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-root-import": "^0.2.3",
"sucrase": "^3.8.0"
},
@ -32,11 +28,10 @@
"classnames": "^2.2.6",
"lodash": "^4.17.11",
"moment": "^2.20.1",
"mousetrap": "^1.6.1",
"mousetrap": "^1.6.3",
"react": "^16.5.2",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"rollup-plugin-postcss": "^2.0.3",
"urbit-ob": "^3.1.1",
"urbit-sigil-js": "^1.3.2"
},

View File

@ -4,6 +4,7 @@ p, h1, h2, h3, h4, h5, h6, a, input, textarea, button {
-webkit-margin-before: unset;
-webkit-margin-after: unset;
font-family: Inter, sans-serif;
padding: 0;
}
textarea, select, input, button {
@ -87,6 +88,14 @@ h2 {
font-weight: bold;
}
.fs-italic {
font-style: italic;
}
.td-underline {
text-decoration: underline;
}
.bg-v-light-gray {
background-color: #f9f9f9;
}
@ -115,6 +124,24 @@ 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;
}
.mono {
font-family: "Source Code Pro", monospace;
}
.label-small-mono.list-ship {
line-height: 29px;
}

View File

@ -191,13 +191,29 @@ export class ChatScreen extends Component {
.slice(messages.length - (50 * state.numPages), messages.length);
}
let chatMessages = messages.reverse().map((msg) => {
let reversedMessages = messages.reverse();
let chatMessages = reversedMessages.map((msg, i) => {
// Render sigil if previous message is not by the same sender
let gamAut = ['gam', 'aut'];
let renderSigil =
_.get(reversedMessages[i + 1], gamAut) !== _.get(msg, gamAut);
// More padding top if previous message is not by the same sender
let paddingTop = renderSigil;
// More padding bot if next message is not by the same sender
let paddingBot =
_.get(reversedMessages[i - 1], gamAut) !== _.get(msg, gamAut);
return (
<Message
key={msg.gam.uid}
msg={msg.gam} />
msg={msg.gam}
renderSigil={renderSigil}
paddingTop={paddingTop}
paddingBot={paddingBot} />
);
});
let peers = props.peers[state.station] || [window.ship];
return (
@ -210,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

@ -27,8 +27,34 @@ export class LandingScreen extends Component {
}
onClickSubscribe() {
const { props } = this;
let station = props.match.params.ship + '/' + props.match.params.station;
this.props.api.source(station, true);
let actions = [
{
create: {
nom: 'hall-internal-' + props.match.params.station,
des: "chatroom",
sec: "channel"
}
},
{
source: {
nom: "inbox",
sub: true,
srs: [station]
}
},
{
source: {
nom: "inbox",
sub: true,
srs: [`~${window.ship}/hall-internal-${props.match.params.station}`]
}
}
];
this.props.api.chat(actions);
this.props.history.push('/~chat');
}
@ -50,7 +76,7 @@ export class LandingScreen extends Component {
<br />
<button
onClick={this.onClickSubscribe.bind(this)}
className="label-r"
className="label-regular fw-bold pointer"
>Subscribe</button>
</div>
</div>

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 }}
<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

@ -6,11 +6,9 @@ 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: 32, height: 32}}>
<div className="bg-black" style={{width: 36, height: 36}}>
</div>
);
} else {

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import classnames from 'classnames';
import { Sigil } from '/components/lib/icons/sigil';
export class MemberElement extends Component {
@ -23,7 +24,7 @@ export class MemberElement extends Component {
`~${window.ship}` === props.host) {
actionElem = (
<a onClick={this.onRemove.bind(this)}
className="w-40 dib underline black btn-font">
className="w-40 dib list-ship black underline label-small-mono pointer">
Remove
</a>
);
@ -34,10 +35,11 @@ export class MemberElement extends Component {
}
return (
<div>
<div className="flex mb2">
<Sigil ship={props.ship} size={32} />
<p
className={
"w-60 dib black pr3 mb2 label-small-mono label-regular"
"w-60 dib v-mid black pr3 ml2 nowrap label-small-mono list-ship label-regular"
}>
{props.ship}
</p>

View File

@ -6,92 +6,216 @@ 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 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 `http://${ship}.arvo.network` + 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() {
const { props } = this;
let pending = !!props.msg.pending ? ' o-80' : '';
let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm');
let datestamp = moment.unix(props.msg.wen / 1000).format('LL');
return (
<div className={"w-100 pl3 pr3 pt2 pb2 cf flex" + pending}
style={{
minHeight: 'min-content'
}}>
<div className="fl mr2">
<Sigil ship={props.msg.aut} size={36} />
</div>
<div className="fr" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="hide-child">
<p className="v-top label-small-mono gray dib mr3">
~{props.msg.aut}
</p>
<p className="v-top label-small-mono gray dib">{timestamp}</p>
<p className="v-top label-small-mono ml2 gray dib child">
{datestamp}
</p>
let paddingTop = props.paddingTop ? 'pt3' : '';
let paddingBot = props.paddingBot ? 'pb2' : 'pb1';
if (props.renderSigil) {
let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm a');
return (
<div className={"w-100 pl3 pr3 cf flex " + paddingTop + " " + paddingBot + pending}
style={{
minHeight: 'min-content'
}}>
<div className="fl mr2">
<Sigil ship={props.msg.aut} size={36} />
</div>
<div className="fr clamp-message" style={{ flexGrow: 1, marginTop: -8 }}>
<div className="hide-child">
<p className="v-top label-small-mono gray dib mr3">
{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">
{datestamp}
</p>
</div>
{this.renderContent()}
</div>
{this.renderContent()}
</div>
</div>
);
);
} else {
let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm');
return (
<div className={"w-100 pr3 pb1 cf hide-child flex" + pending}
style={{
minHeight: 'min-content'
}}>
<p className="child pl3 pr2 label-small-mono gray dib">{timestamp}</p>
<div className="fr clamp-message" style={{ flexGrow: 1 }}>
{this.renderContent()}
</div>
</div>
)
}
}
}

View File

@ -83,7 +83,7 @@ export class MemberScreen extends Component {
);
let inviteButtonClasses = "label-regular underline black btn-font pointer";
let inviteButtonClasses = "label-regular black btn-font pointer";
if (!this.state.error) {
inviteButtonClasses = inviteButtonClasses + ' black';
}
@ -113,16 +113,17 @@ export class MemberScreen extends Component {
</p>
<textarea
ref={ e => { this.textarea = e; } }
className="w-80 db ba overflow-y-hidden gray mb2"
className="w-80 db ba overflow-y-hidden mono gray mb2"
style={{
resize: 'none',
height: 150
}}
spellCheck="false"
onChange={this.inviteMembersChange.bind(this)}></textarea>
<button
onClick={this.inviteMembers.bind(this)}
className={inviteButtonClasses}>
Invite
-> Invite
</button>
{errorElem}
{successElem}

View File

@ -185,8 +185,9 @@ export class NewScreen extends Component {
</p>
<textarea
ref={ e => { this.textarea = e; } }
className="body-regular fw-normal ba pa2 mb2 db w-100"
className="body-regular mono fw-normal ba pa2 mb2 db w-100"
placeholder="~zod, ~bus"
spellCheck="false"
style={{
resize: 'none',
height: 150

View File

@ -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,17 +121,7 @@ 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}
/>
}>
sidebar={renderChannelsSidebar(props)}>
<NewScreen
setSpinner={this.setSpinner}
api={api}
@ -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}
@ -171,17 +153,7 @@ export class Root extends Component {
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,17 +169,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) }>
<MemberScreen
{...props}
api={api}
@ -221,17 +183,7 @@ 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}
/>
}>
sidebar={renderChannelsSidebar(props) }>
<SettingsScreen
{...props}
setSpinner={this.setSpinner}

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

@ -127,7 +127,6 @@ class Clock extends Component {
}
render() {
console.log('hi')
return <div style={{position:'relative'}}>
<svg style={{position:'absolute'}} width="218" height="218" viewBox="0 0 234 234" fill="none" xmlns="http://www.w3.org/2000/svg">

View File

@ -2,18 +2,13 @@ var gulp = require('gulp');
var cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano');
var autoprefixer = require('autoprefixer');
var postcss = require('gulp-postcss')
var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify');
var exec = require('child_process').exec;
var rename = require('gulp-rename');
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var replace = require('rollup-plugin-replace');
var json = require('rollup-plugin-json');
var builtins = require('@joseph184/rollup-plugin-node-builtins');
var rootImport = require('rollup-plugin-root-import');
var globals = require('rollup-plugin-node-globals');
@ -29,7 +24,6 @@ var urbitrc = require('../urbitrc');
gulp.task('css-bundle', function() {
let plugins = [
autoprefixer({ browsers: ['last 1 version'] }),
cssnano()
];
return gulp
@ -57,17 +51,12 @@ gulp.task('js-imports', function(cb) {
'node_modules/react-is/index.js': [ 'isValidElementType' ],
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development')
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
json(),
globals(),
builtins(),
resolve()
]
}, 'umd'))
@ -91,18 +80,6 @@ gulp.task('rename-index-min', function() {
.pipe(gulp.dest('../../arvo/app/launch/js/'));
});
gulp.task('js-cachebust', function(cb) {
return Promise.resolve(
exec('git log', function (err, stdout, stderr) {
let firstLine = stdout.split("\n")[0];
let commitHash = firstLine.split(' ')[1].substr(0, 10);
let newFilename = "index-" + commitHash + "-min.js";
exec('mv ../../arvo/app/launch/js/index-min.js ../../arvo/app/launch/js/' + newFilename);
})
);
})
gulp.task('urbit-copy', function () {
let ret = gulp.src('../../arvo/**/*');

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@joseph184/rollup-plugin-node-builtins": "^2.1.4",
"@sucrase/gulp-plugin": "^2.0.0",
"autoprefixer": "^9.6.1",
"cssnano": "^4.1.10",
"gulp": "^4.0.0",
"gulp-better-rollup": "^4.0.1",
@ -21,10 +19,8 @@
"gulp-rename": "^1.4.0",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-root-import": "^0.2.3",
"sucrase": "^3.8.0"
},
@ -32,9 +28,7 @@
"classnames": "^2.2.6",
"lodash": "^4.17.11",
"moment": "^2.20.1",
"mousetrap": "^1.6.1",
"react": "^16.5.2",
"react-custom-scrollbars": "^4.2.1",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"urbit-ob": "^3.1.1"

View File

@ -2,18 +2,13 @@ var gulp = require('gulp');
var cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano');
var autoprefixer = require('autoprefixer');
var postcss = require('gulp-postcss')
var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify');
var exec = require('child_process').exec;
var rename = require('gulp-rename');
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var replace = require('rollup-plugin-replace');
var json = require('rollup-plugin-json');
var builtins = require('@joseph184/rollup-plugin-node-builtins');
var rootImport = require('rollup-plugin-root-import');
var globals = require('rollup-plugin-node-globals');
@ -29,7 +24,6 @@ var urbitrc = require('../urbitrc');
gulp.task('css-bundle', function() {
let plugins = [
autoprefixer({ browsers: ['last 1 version'] }),
cssnano()
];
return gulp
@ -65,17 +59,12 @@ gulp.task('js-imports', function(cb) {
'node_modules/react-is/index.js': [ 'isValidElementType' ],
}
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development')
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
json(),
globals(),
builtins(),
resolve()
]
}, 'umd'))
@ -101,9 +90,7 @@ gulp.task('tile-js-imports', function(cb) {
useEntry: 'prepend',
extensions: '.js'
}),
json(),
globals(),
builtins(),
resolve()
]
}, 'umd'))
@ -140,18 +127,6 @@ gulp.task('rename-tile-min', function() {
.pipe(gulp.dest('../../arvo/app/publish/js/'));
});
gulp.task('js-cachebust', function(cb) {
return Promise.resolve(
exec('git log', function (err, stdout, stderr) {
let firstLine = stdout.split("\n")[0];
let commitHash = firstLine.split(' ')[1].substr(0, 10);
let newFilename = "index-" + commitHash + "-min.js";
exec('mv ../../arvo/app/publish/js/index-min.js ../../arvo/app/publish/js/' + newFilename);
})
);
})
gulp.task('urbit-copy', function () {
let ret = gulp.src('../../arvo/**/*');

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@joseph184/rollup-plugin-node-builtins": "^2.1.4",
"@sucrase/gulp-plugin": "^2.0.0",
"autoprefixer": "^9.6.1",
"cssnano": "^4.1.10",
"gulp": "^4.0.0",
"gulp-better-rollup": "^4.0.1",
@ -21,10 +19,8 @@
"gulp-rename": "^1.4.0",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-root-import": "^0.2.3",
"sucrase": "^3.8.0"
},
@ -32,9 +28,7 @@
"classnames": "^2.2.6",
"lodash": "^4.17.11",
"moment": "^2.20.1",
"mousetrap": "^1.6.1",
"react": "^16.5.2",
"react-custom-scrollbars": "^4.2.1",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"urbit-ob": "^3.1.1",

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

@ -8,8 +8,6 @@ export default class PublishTile extends Component {
}
render(){
console.log("tile", this.props);
let info = [];
if (this.props.data.invites > 0) {
let text = (this.props.data.invites == 1)

View File

@ -48,7 +48,7 @@ export default class WeatherTile extends Component {
renderWrapper(child) {
return (
<div className="pa2" style={{
<div className="pa2 relative" style={{
width: 234,
height: 234,
background: '#1a1a1a'
@ -60,9 +60,12 @@ export default class WeatherTile extends Component {
renderNoData() {
return this.renderWrapper((
<div>
<p className="white sans-serif">Weather</p>
<button onClick={this.locationSubmit.bind(this)}>Set location</button>
<div onClick={this.locationSubmit.bind(this)}>
<p className="gray label-regular b absolute"
style={{left: 8, top: 4}}>
Weather
</p>
<p className="absolute w-100 flex-col body-regular white" style={{verticalAlign: "bottom", bottom: 8, left: 8, cursor: "pointer"}}>-> Set location</p>
</div>
));
}
@ -75,12 +78,12 @@ export default class WeatherTile extends Component {
return this.renderWrapper((
<div>
<p className="gray" style={{
fontWeight: 'bold',
fontSize: 14,
lineHeight: '24px'
}}>Weather</p>
<div className="w-100 mb2 mt2">
<p className="gray label-regular b absolute"
style={{left: 8, top: 4}}>
Weather
</p>
<div className="w-100 mb2 mt2 absolute"
style={{left: 18, top: 28}}>
<img
src={'/~weather/img/' + c.icon + '.png'}
width={64}
@ -95,7 +98,8 @@ export default class WeatherTile extends Component {
}}>
{Math.round(c.temperature)}°</h2>
</div>
<div className="w-100 cf">
<div className="w-100 cf absolute"
style={{ left: 18, top: 118 }}>
<div className="fl w-50">
<IconWithData
icon='winddirection'

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