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 version https://git-lfs.github.com/spec/v1
oid sha256:8f6e93cb3ee5fcb0970851bd10d2d2a640ff968292d147c35385623b86570296 oid sha256:6c7ad5eec00d0d6a6857ea023c6102999a30d5c99de7411e474b9d1c14a3e7b4
size 6662042 size 9765203

View File

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

View File

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

View File

@ -1,13 +1,15 @@
crossenv: crossenv:
rec { rec {
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; }; argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; }; murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; }; uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; }; ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; }; sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; }; scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; }; softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; }; secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; }; 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 = vendor =
with deps; 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 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 }: { pkgs ? import ../nixpkgs.nix }:
rec { rec {
argon2 = import ./argon2 { inherit pkgs; }; argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; }; murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; }; uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; }; ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; }; sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; }; scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; }; softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; }; secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; }; 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 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=" herb ./pier -p hood -d "+hood/mount /=home="
cp $ARVO/lib/pill.hoon ./pier/home/lib/ until [ -d ./pier/home ]
chmod -R u+rw ./pier/home/lib/ 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/commit %home"
herb ./pier -p hood -d "+hood/unmount %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/merge %stage our %home'
herb ./pier -p hood -d "+hood/mount /=stage=" herb ./pier -p hood -d "+hood/mount /=stage="
until [ -d ./pier/stage ]
do
sleep 1
done
rm -rf ./pier/stage rm -rf ./pier/stage
cp -r $ARVO ./pier/stage cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage chmod -R u+rw ./pier/stage

View File

@ -17,7 +17,7 @@ let
import ./urbit { import ./urbit {
inherit pkgs ent debug ge-additions; inherit pkgs ent debug ge-additions;
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3; 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; }; urbit = mkUrbit { debug=false; };

View File

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

View File

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

View File

@ -12,5 +12,5 @@ import ./default.nix {
inherit (tlon) inherit (tlon)
ent ge-additions; ent ge-additions;
inherit (deps) 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: urbit = env:
import ./pkgs/urbit/release.nix env import ./pkgs/urbit/release.nix env
{ ent = ent env; ge-additions = ge-additions env; cacert = nixpkgs.cacert; { ent = ent env; ge-additions = ge-additions env; debug = false; name = "urbit"; };
xxd = nixpkgs.xxd; debug = false; name = "urbit"; };
builds-for-platform = plat: builds-for-platform = plat:
plat.deps // { plat.deps // {

View File

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

View File

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

View File

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

View File

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

View File

@ -161,6 +161,7 @@
++ poke-helm-send-hi (wrap poke-send-hi):from-helm ++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm ++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):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-nuke (wrap poke-nuke):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm ++ poke-helm-automass (wrap poke-automass):from-helm
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm ++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm

View File

@ -1,24 +1,32 @@
/- lens /- lens, *sole
/+ *server /+ base64, *server
/= lens-mark /: /===/mar/lens/command /= lens-mark /: /===/mar/lens/command
/!noun/ /!noun/
=, format =, format
|% |%
:: +move: output effect :: +lens-out: json or named octet-stream
::
+$ lens-out
$% [%json =json]
[%mime =mime]
==
:: +move: output effect
:: ::
+$ move [bone card] +$ move [bone card]
:: +card: output effect payload :: +card: output effect payload
:: ::
+$ card +$ card
$% [%connect wire binding:eyre term] $% [%connect wire binding:eyre term]
[%http-response =http-event:http] [%http-response =http-event:http]
[%peel wire dock mark path] [%peer wire dock path]
[%peer wire dock path]
[%poke wire dock poke] [%poke wire dock poke]
[%pull wire dock ~] [%pull wire dock ~]
== ==
:: ::
+$ poke +$ poke
$% [%lens-command command:lens] $% [%lens-command command:lens]
[%import *]
== ==
:: ::
+$ state +$ state
@ -49,6 +57,7 @@
%- (require-authorization:app ost.bow move this) %- (require-authorization:app ost.bow move this)
|= =inbound-request:eyre |= =inbound-request:eyre
^- (quip move _this) ^- (quip move _this)
::
?^ job.state ?^ job.state
:_ this :_ this
[ost.bow %http-response %start [%500 ~] ~ %.y]~ [ost.bow %http-response %start [%500 ~] ~ %.y]~
@ -60,17 +69,114 @@
(need (de-json:html q:(need body.request.inbound-request))) (need (de-json:html q:(need body.request.inbound-request)))
=/ com=command:lens =/ com=command:lens
(json:grab:lens-mark jon) (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])) :_ 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 ++ diff-sole-effect
|= [=wire jon=json] |= [=wire fec=sole-effect]
^- (quip move _this) ^- (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] [~ this]
?> ?=(^ job.state) ?> ?=(^ job.state)
:_ 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 ++ quit
|= =wire |= =wire
@ -81,17 +187,36 @@
++ reap ++ reap
|= [=wire saw=(unit tang)] |= [=wire saw=(unit tang)]
^- (quip move _this) ^- (quip move _this)
::
?: =([%export ~] wire)
[~ this]
::
?^ saw ?^ saw
[((slog u.saw) ~) this] [((slog u.saw) ~) this]
?> ?=(^ job.state) ?> ?=(^ job.state)
:_ this :_ this
:~ [ost.bow %poke /sole [our.bow %dojo] %lens-command com.u.job.state] :~ [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] ~] [ost.bow %pull /sole [our.bow %dojo] ~]
== ==
:: ::
++ coup ++ coup
|= [=wire saw=(unit tang)] |= [=wire saw=(unit tang)]
^- (quip move _this) ^- (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 ?^ saw
[((slog u.saw) ~) this] [((slog u.saw) ~) this]
[~ this] [~ this]

View File

@ -61,6 +61,7 @@
++ manual-tests ++ manual-tests
^- (list (pair term [(list ship) _*form:(ph ,~)])) ^- (list (pair term [(list ship) _*form:(ph ,~)]))
=+ (ph-tests our.hid) =+ (ph-tests our.hid)
=+ ph-azimuth=(ph-azimuth our.hid)
=/ eth-node (spawn:ph-azimuth ~bud) =/ eth-node (spawn:ph-azimuth ~bud)
=/ m (ph ,~) =/ m (ph ,~)
:~ :+ %boot-bud :~ :+ %boot-bud
@ -110,7 +111,49 @@
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router: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 ~) (pure:m ~)
:: ::
:+ %breach-hi :+ %breach-hi
@ -119,17 +162,24 @@
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) ;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev)) ~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
(send-hi ~bud ~dev) (send-hi ~bud ~dev)
~& > 'HI DONE'
;< eth-node=_eth-node bind:m ;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~dev ~bud) (breach-and-hear:eth-node our.hid ~dev ~bud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (send-hi-not-responding ~bud ~dev) ;< ~ 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") (wait-for-dojo ~bud "hi ~dev successful")
~& > 'DONE'
(pure:m ~) (pure:m ~)
:: ::
:+ %breach-hi-cousin :+ %breach-hi-cousin
@ -140,10 +190,10 @@
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) ;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev)) ;< ~ bind:m (raw-real-ship:eth-node ~dev)
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) ;< ~ bind:m (raw-real-ship:eth-node ~marbud)
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev)) ;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(send-hi ~marbud ~mardev) (send-hi ~marbud ~mardev)
;< eth-node=_eth-node bind:m ;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~mardev ~marbud) (breach-and-hear:eth-node our.hid ~mardev ~marbud)
@ -151,59 +201,111 @@
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) ;< ~ 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") (wait-for-dojo ~marbud "hi ~mardev successful")
(pure:m ~) (pure:m ~)
:: ::
:+ %breach-sync :+ %breach-sync
~[~bud ~marbud] ~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud) =. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) ;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) ~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base) ;< file=@t bind:m (touch-file ~bud %base)
~& %checking-file-touched ~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file) (check-file-touched ~marbud %home file)
~& %checked-file-touched ~& > 'TOUCH FILE CHECK DONE'
;< eth-node=_eth-node bind:m ;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud) (breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router: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")) ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base) ;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base) ;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file) (check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~) (pure:m ~)
:: ::
:+ %breach-multiple :+ %breach-multiple
~[~bud ~marbud] ~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud) =. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router:eth-node router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) ;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) ~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base) ;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH DONE'
(check-file-touched ~marbud %home file) (check-file-touched ~marbud %home file)
;< eth-node=_eth-node bind:m ;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud) (breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH-1 DONE'
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router: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 ;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~marbud ~bud) (breach-and-hear:eth-node our.hid ~marbud ~bud)
~& > 'BREACH-2 DONE'
;< [eth-node=_eth-node ~] bind:m ;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~) %+ (wrap-philter ,_eth-node ,~)
router: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) ;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base) ;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file) (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 ~) (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 ++ work :: interface action
$% :: circle management :: $% :: circle management ::
{$join (map circle range)} :: subscribe to {$join (map circle range) (unit char)} :: subscribe to
{$leave audience} :: unsubscribe from {$leave audience} :: unsubscribe from
{$create security name cord} :: create circle {$create security name cord (unit char)} :: create circle
{$delete name (unit cord)} :: delete circle {$delete name (unit cord)} :: delete circle
{$depict name cord} :: change description {$depict name cord} :: change description
{$filter name ? ?} :: change message rules {$filter name ? ?} :: change message rules
@ -716,8 +716,12 @@
++ circ :: circle ++ circ :: circle
;~ pose ;~ pose
(cold incir col) (cold incir col)
;~(pfix cen (stag self urs:ab))
;~(pfix net (stag (^sein:title self) urs:ab)) ;~(pfix net (stag (^sein:title self) urs:ab))
;~ pfix cen
%+ stag self
%+ sear |=(circ=name ?:(=('' circ) ~ (some circ)))
urs:ab
==
:: ::
%+ cook %+ cook
|= {a/@p b/(unit term)} |= {a/@p b/(unit term)}
@ -838,14 +842,14 @@
:: ::
;~((glue ace) (perk %read ~) cire dem:ag) ;~((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 %leave ~) cirs)
:: ::
;~ (glue ace) (perk %create ~) ;~ (glue ace) (perk %create ~)
pore pore
cire cire
qut ;~(plug qut (punt ;~(pfix ace glyph)))
== ==
:: ::
;~ plug (perk %delete ~) ;~ plug (perk %delete ~)
@ -1186,9 +1190,11 @@
:: change local mailbox config to include :: change local mailbox config to include
:: subscriptions to {pas}. :: subscriptions to {pas}.
:: ::
|= pos/(map circle range) |= {pos/(map circle range) gyf/(unit char)}
^+ ..sh-work ^+ ..sh-work
=+ pas=~(key by pos) =+ pas=~(key by pos)
=? ..sh-work ?=(^ gyf)
(bind u.gyf `pas)
=. ..sh-work =. ..sh-work
sh-prod(active.she pas) sh-prod(active.she pas)
:: default to a day of backlog :: default to a day of backlog
@ -1226,11 +1232,11 @@
:: ::
:: creates circle {nom} with specified config. :: 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-work =. ..sh-work
(sh-act %create nom txt sec) (sh-act %create nom txt sec)
(join [[[self nom] ~] ~ ~]) (join [[[self nom] ~] ~ ~] gyf)
:: ::
++ delete ++ delete
:: %delete :: %delete
@ -1922,7 +1928,7 @@
$(dif [%filter fit.cof.dif]) $(dif [%filter fit.cof.dif])
?: ?=($remove -.dif) ?: ?=($remove -.dif)
(sh-note (weld "rip " (~(cr-show cr cir) ~))) (sh-note (weld "rip " (~(cr-show cr cir) ~)))
?: ?=($usage -.dif) +> ?: ?=(?($usage $read) -.dif) +>
%- sh-note %- sh-note
%+ weld %+ weld
(weld ~(cr-phat cr cir) ": ") (weld ~(cr-phat cr cir) ": ")
@ -1933,9 +1939,6 @@
:: ::
$caption $caption
"cap: {(trip cap.dif)}" "cap: {(trip cap.dif)}"
::
$read
""
:: ::
$filter $filter
;: weld ;: weld
@ -2314,7 +2317,15 @@
url+(crip (apix:en-purl:html url.sep)) url+(crip (apix:en-purl:html url.sep))
:: ::
$exp $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 $ire
=+ num=(~(get by known) top.sep) =+ num=(~(get by known) top.sep)
@ -2399,7 +2410,11 @@
== ==
:: ::
$exp $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 ~ ?~ res.sep ~
=- [' ' (tr-chow (dec wyd) ' ' -)]~ =- [' ' (tr-chow (dec wyd) ' ' -)]~
~(ram re (snag 0 `(list tank)`res.sep)) ~(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 +$ src
$% [%ship =ship ~] $% [%ship =ship ~]
[%node url=@t ~] [%app =term ~]
== ==
-- --
:- %say :- %say
|= [* [whos=(set ship) =src] ~] |= [* [whos=(list ship) =src] ~]
=/ =source:kale =/ =source:jael
?- -.src ?- -.src
%ship [%& ship.src] %ship [%& ship.src]
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da] %app [%| term.src]
== ==
[%azimuth-tracker-poke %listen whos source] [%azimuth-tracker-poke %listen whos source]

View File

@ -1,6 +1,6 @@
=> |% => |%
+$ config +$ config
[url=@ta =from=number:block:able:kale] [url=@ta =from=number:block:able:jael]
-- --
:- %say :- %say
|= [* config ~] |= [* 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 ~]) arg=$@(~ [top=path ~])
dub=_| dub=_|
== ==
:- %noun :- %pill
^- pill:pill
:: sys: root path to boot system, `/~me/[desk]/now/sys` :: sys: root path to boot system, `/~me/[desk]/now/sys`
:: ::
=/ sys=path =/ sys=path

View File

@ -65,7 +65,7 @@
++ lank ::: tank as string arr ++ lank ::: tank as string arr
|= a/tank |= a/tank
^- json ^- json
a+(turn (wash [0 1.024] a) tape) a+(turn (wash [0 80] a) tape)
:: ::
++ dank ::: tank ++ dank ::: tank
|= a/tank |= a/tank
@ -577,7 +577,7 @@
:+ ~ u.exp :+ ~ u.exp
=+ res=((ot res+(ar dank) ~) a) =+ res=((ot res+(ar dank) ~) a)
?^ res u.res ?^ 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 ++ atta ::: attache
^- $-(json (unit attache)) ^- $-(json (unit attache))

View File

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

View File

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

View File

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

View File

@ -6,6 +6,26 @@
:: ::
:: sys: full path to /sys directory :: 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 ++ module-ova
|= sys=path |= sys=path
^- (list [wire [%veer term path cord]]) ^- (list [wire [%veer term path cord]])
@ -54,7 +74,7 @@
=/ directories =/ directories
`(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web] `(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web]
|= bas=path |= bas=path
^- ovum ^- unix-event
:: ::
:: /app %gall applications :: /app %gall applications
:: /gen :dojo generators :: /gen :dojo generators
@ -71,7 +91,7 @@
|= :: sal: all spurs to load from |= :: sal: all spurs to load from
:: ::
sal/(list spur) sal/(list spur)
^- ovum ^- unix-event
:: ::
:: hav: all user files :: hav: all user files
:: ::
@ -97,7 +117,7 @@
=? hav ?=(^ fil.lon) =? hav ?=(^ fil.lon)
:: XX this whitelist needs to be reviewed :: 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 -.tyl
:: ::
:: install only files with whitelisted marks :: install only files with whitelisted marks

View File

@ -255,7 +255,7 @@
:: XX if active clam contracts only to abort transaction? :: XX if active clam contracts only to abort transaction?
:: ::
:: ~& [%tapp-reset dap.bowl] :: ~& [%tapp-reset dap.bowl]
:: `this-tapp :: `this-tapp
~| [%tapp-load-incompatible dap.bowl] ~| [%tapp-load-incompatible dap.bowl]
!! !!
:: ::
@ -412,10 +412,10 @@
^- (quip move _this-tapp) ^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding]) (take-async bowl `[wire %bound success binding])
:: ::
:: Receive source update from kale :: Receive source update from jael
:: ::
++ source ++ source
|= [=wire whos=(set ship) =source:kale] |= [=wire whos=(set ship) =source:jael]
^- (quip move _this-tapp) ^- (quip move _this-tapp)
=. waiting (~(put to waiting) ost.bowl [%take %source whos source]) =. waiting (~(put to waiting) ost.bowl [%take %source whos source])
?^ active ?^ active

View File

@ -35,6 +35,8 @@
;~(pfix col (more net (cook crip (star ;~(less net prn))))) ;~(pfix col (more net (cook crip (star ;~(less net prn)))))
== ==
listen-api+(su ;~(plug sym ;~(pfix col sym))) listen-api+(su ;~(plug sym ;~(pfix col sym)))
export+so
import+(ot app+so base64-jam+so ~)
as+(ot mark+(su sym) next+source ~) as+(ot mark+(su sym) next+source ~)
hoon+(ot code+so 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 ++ grow
=, enjs =, 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
^- ^json ^- ^json
?+ -.sef ?+ -.sef

View File

@ -10,12 +10,18 @@
:: Short names are simply the first letter of each word plus `s` if :: Short names are simply the first letter of each word plus `s` if
:: it's a list. :: it's a list.
:: ::
/+ pill
=, pill-lib=pill
|% |%
++ ph-event ++ ph-event
$% [%test-done p=?] $% [%test-done p=?]
aqua-event aqua-event
== ==
:: ::
+$ unix-event unix-event:pill-lib
+$ dawn-event dawn-event:pill-lib
+$ pill pill:pill-lib
::
+$ aqua-event +$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event)] $% [%init-ship who=ship keys=(unit dawn-event)]
[%pause-events who=ship] [%pause-events who=ship]
@ -40,16 +46,6 @@
:: ::
+$ unix-timed-event [tym=@da ue=unix-event] +$ 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 +$ unix-effect
%+ pair wire %+ pair wire
$% [%blit p=(list blit:dill)] $% [%blit p=(list blit:dill)]
@ -60,20 +56,8 @@
[%sleep ~] [%sleep ~]
[%restore ~] [%restore ~]
[%init ~] [%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 +$ vane-move
%+ pair bone %+ pair bone
$% [%peer wire dock path] $% [%peer wire dock path]

View File

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

View File

@ -15,10 +15,10 @@
[%connect wire binding:eyre term] [%connect wire binding:eyre term]
[%http-response =http-event:http] [%http-response =http-event:http]
[%rule wire %turf %put turf] [%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:kale] [%source wire whos=(set ship) src=source:jael]
[%sources wire ~] [%sources wire ~]
[%new-event wire =ship =udiff:point:able:kale] [%new-event wire =ship =udiff:point:able:jael]
[%listen wire whos=(set ship) =source:kale] [%listen wire whos=(set ship) =source:jael]
== ==
:: ::
:: Possible async responses :: Possible async responses
@ -30,7 +30,7 @@
[%reap =dock =path error=(unit tang)] [%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre] [%bound success=? =binding:eyre]
[%http-response response=client-response:iris] [%http-response response=client-response:iris]
[%source whos=(set ship) =source:kale] [%source whos=(set ship) =source:jael]
== ==
:: ::
:: Outstanding contracts :: Outstanding contracts

View File

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

View File

@ -15910,7 +15910,6 @@
|* tem=rule |* tem=rule
%- star %- star
;~ pose ;~ pose
whit
;~(pfix bas tem) ;~(pfix bas tem)
;~(less tem prn) ;~(less tem prn)
== ==
@ -17296,6 +17295,14 @@
=+ new=(~(mint ut sut) %noun gen) =+ new=(~(mint ut sut) %noun gen)
[new +>+<.$(mit (~(put by mit) [sut gen] new))] [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 ++ slap :: ++slap, cached
|= {vax/vase gen/hoon} |= {vax/vase gen/hoon}
^- {vase worm} ^- {vase worm}

View File

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

View File

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

View File

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

View File

@ -297,7 +297,6 @@
[[151 %noun] %j our %sein da+now /(scot %p who)] [[151 %noun] %j our %sein da+now /(scot %p who)]
:: ::
++ init :: initialize ++ init :: initialize
~& [%dill-init our ram]
^+ . ^+ .
=. moz =. moz
:_ moz :_ moz
@ -305,7 +304,6 @@
. .
:: ::
++ mere :: continue init ++ mere :: continue init
~& [%dill-mere our ram]
^+ . ^+ .
=/ myt (flop (fall tem ~)) =/ myt (flop (fall tem ~))
=/ can (clan:title our) =/ can (clan:title our)
@ -514,6 +512,8 @@
=/ boot =/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task) ((soft $>($?(%dawn %fake) task:able:jael)) p.task)
?~ boot ?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !! ~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %j u.boot]~) :_(..^$ [hen %pass / %j u.boot]~)
:: we are subsequently initialized. single-home :: we are subsequently initialized. single-home
@ -539,10 +539,6 @@
=? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~] =? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~]
:: ::
$(hen u.hey.all, wrapped-task p.task) $(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 :: a %vega notification on kernel upgrade comes in on an unfamiliar duct
:: ::
?: ?=(%vega -.task) ?: ?=(%vega -.task)

View File

@ -374,6 +374,9 @@
#topborder { #topborder {
border-top: 3px #fff solid; border-top: 3px #fff solid;
} }
#ship-name {
font-family: 'Source Code Pro', monospace, sans-serif;
}
h1 { h1 {
line-height: 77px; line-height: 77px;
font-size: 64px; font-size: 64px;
@ -425,7 +428,7 @@
;div#main ;div#main
;div#inner ;div#inner
;h1#topborder:"Welcome" ;h1#topborder:"Welcome"
;h1:"{(scow %p our)}" ;h1#ship-name:"{(scow %p our)}"
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded") ;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;input(type "password", name "password", placeholder "passcode", autofocus "true"); ;input(type "password", name "password", placeholder "passcode", autofocus "true");
;input(type "hidden", name "redirect", value redirect-str); ;input(type "hidden", name "redirect", value redirect-str);
@ -802,7 +805,7 @@
:: ::
:_ state :_ state
:_ ~ :_ ~
:^ duct %pass /run-app/[app.act] :^ duct %pass /run-app-request/[app.act]
^- note ^- note
:^ %g %deal [our our] :^ %g %deal [our our]
:: ::
@ -847,7 +850,7 @@
%app %app
:_ state :_ state
:_ ~ :_ ~
:^ duct %pass /run-app/[app.action] :^ duct %pass /run-app-request/[app.action]
^- note ^- note
:^ %g %deal [our our] :^ %g %deal [our our]
:: todo: i don't entirely understand gall; there's a way to make a gall :: todo: i don't entirely understand gall; there's a way to make a gall
@ -892,12 +895,9 @@
%app %app
:_ state :_ state
:_ ~ :_ ~
:^ duct %pass /run-app/[app.action.u.connection] :^ duct %pass /run-app-cancel/[app.action.u.connection]
^- note ^- note
:^ %g %deal [our our] :^ %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 ^- cush:gall
:* app.action.u.connection :* app.action.u.connection
@ -2029,13 +2029,14 @@
?+ i.wire ?+ i.wire
~|([%bad-take-wire wire] !!) ~|([%bad-take-wire wire] !!)
:: ::
%run-app run-app %run-app-request run-app-request
%run-build run-build %run-app-cancel run-app-cancel
%channel channel %run-build run-build
%acme acme-ack %channel channel
%acme acme-ack
== ==
:: ::
++ run-app ++ run-app-request
:: ::
?> ?=([%g %unto *] sign) ?> ?=([%g %unto *] sign)
:: ::
@ -2060,6 +2061,18 @@
=^ moves server-state.ax (handle-response http-event.p.sign) =^ moves server-state.ax (handle-response http-event.p.sign)
[moves http-server-gate] [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 ++ run-build
:: ::
?> ?=([%f %made *] sign) ?> ?=([%f %made *] sign)

View File

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

View File

@ -1334,21 +1334,18 @@
%keep `%f %keep `%f
%kill `%f %kill `%f
%look `%j %look `%j
%listen `%k %listen `%j
%merg `%c %merg `%c
%mint `%j
%mont `%c %mont `%c
%new-event `%k %moon `%j
%nuke `%a %nuke `%a
%ogre `%c %ogre `%c
%perm `%c %perm `%c
%rest `%b %rest `%b
%snap `%j %rekey `%j
%sources `%k
%wait `%b %wait `%b
%want `%a %want `%a
%warp `%c %warp `%c
%wind `%j
%wipe `%f %wipe `%f
:: ::
%request `%i %request `%i
@ -1381,8 +1378,6 @@
:: ::
$init $init
[~ ..^$(sys.mast.all hen)] [~ ..^$(sys.mast.all hen)]
::
$sunk [~ ..^$]
:: ::
$vega [~ ..^$] $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) :: boot completed (XX legacy)
:: ::
[%init p=ship] [%init p=ship]
:: peer discontinuity
::
[%sunk p=ship q=rift]
:: kernel upgraded :: kernel upgraded
:: ::
[%vega ~] [%vega ~]
@ -393,7 +390,6 @@
$>(%init vane-task) :: report install $>(%init vane-task) :: report install
{$kick p/@da} :: wake up {$kick p/@da} :: wake up
{$nuke p/@p} :: toggle auto-block {$nuke p/@p} :: toggle auto-block
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
{$wake ~} :: timer activate {$wake ~} :: timer activate
$>(%wegh vane-task) :: report memory $>(%wegh vane-task) :: report memory
@ -628,7 +624,6 @@
{$dirk des/desk} :: mark mount dirty {$dirk des/desk} :: mark mount dirty
{$ogre pot/$@(desk beam)} :: delete mount point {$ogre pot/$@(desk beam)} :: delete mount point
{$perm des/desk pax/path rit/rite} :: change permissions {$perm des/desk pax/path rit/rite} :: change permissions
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
{$warp wer/ship rif/riff} :: internal file req {$warp wer/ship rif/riff} :: internal file req
{$werp who/ship wer/ship rif/riff} :: external file req {$werp who/ship wer/ship rif/riff} :: external file req
@ -795,7 +790,6 @@
$>(%init vane-task) :: after gall ready $>(%init vane-task) :: after gall ready
{$lyra p/@t q/@t} :: upgrade kernel {$lyra p/@t q/@t} :: upgrade kernel
{$noop ~} :: no operation {$noop ~} :: no operation
$>(%sunk vane-task) :: report death
{$talk p/tank} :: {$talk p/tank} ::
{$text p/tape} :: {$text p/tape} ::
{$veer p/@ta q/path r/@t} :: install vane {$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: stop a build; send on same duct as original %build request
:: ::
[%kill ~] [%kill ~]
:: %sunk: receive a report that a foreign ship has lost continuity
::
$>(%sunk vane-task)
:: %vega: report kernel upgrade :: %vega: report kernel upgrade
:: ::
$>(%vega vane-task) $>(%vega vane-task)
@ -1879,7 +1870,6 @@
$% {$conf p/dock q/culm} :: configure app $% {$conf p/dock q/culm} :: configure app
$>(%init vane-task) :: set owner $>(%init vane-task) :: set owner
{$deal p/sock q/cush} :: full transmission {$deal p/sock q/cush} :: full transmission
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
$>(%west vane-task) :: network request $>(%west vane-task) :: network request
$>(%wegh vane-task) :: report memory $>(%wegh vane-task) :: report memory
@ -2061,257 +2051,48 @@
:: :::: :: ::::
++ able ^? ++ able ^?
=, pki =, pki
=, rights
|% |%
:: %jael has two general kinds of task: changes +$ public-keys-result
:: and change subscriptions. $% [%full points=(map ship point)]
:: [%diff who=ship =diff:point]
:: change tasks are designed to match high-level ==
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %jael only talks to %ames and %behn. we send messages
:: through %ames and use %behn timers.
::
++ logs :: on-chain changes
%+ map event-id:ethereum-types :: per event log
diff-azimuth:azimuth-types :: the change
++ action :: balance change
%+ pair ship :: partner
%+ each bump :: &/liability change
bump :: |/asset change
:: :: :: ::
++ balance :: balance sheet
%+ pair ::
(map ship safe) :: liabilities
(map ship safe) :: assets
:: ::
++ vent-result :: %vent result
$% [%snap snap=snapshot:jael] :: restore snapshot
[%chain can=chain] :: get new events
== ::
:: ::
++ chain :: batch of changes
%+ each logs :: & all events
logs :: | new events
++ change :: urbit change
$% [%ethe can=chain] :: on-chain change
[%meet who=ship =life =pass] :: meet in new era
$: %rite :: rights change
rex/ship :: issuer
pal/ship :: issued to
del/bump :: change
== == ::
++ gift :: out result <-$ ++ gift :: out result <-$
$% [%init p=ship] :: report install unix $% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report [%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack [%mack p=(unit tang)] :: message n/ack
[%pubs public] :: public keys
[%turf turf=(list turf)] :: domains [%turf turf=(list turf)] :: domains
[%vest p=tally] :: balance update [%private-keys =life vein=(map life ring)] :: private keys
[%vein =life vein=(map life ring)] :: private keys [%public-keys =public-keys-result] :: ethereum changes
[%vine p=(list change)] :: all raw changes
[%vent p=vent-result] :: ethereum changes
== :: == ::
:: ::
++ public :: public key state
$: life=life :: current key number
pubs=(map life pass) :: pubkeys by number
== ::
++ remote :: remote notification
%+ each safe :: &/addition
safe :: |/replacement
:: +seed: private boot parameters :: +seed: private boot parameters
:: ::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)] +$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
:: ::
++ tally :: balance update
%+ each balance :: complete
action :: change
::
+= task :: in request ->$ += task :: in request ->$
$~ [%vega ~] :: $~ [%vega ~] ::
$% [%burn p=ship q=safe] :: destroy rights $% $: %dawn :: boot from keys
[%hail p=ship q=remote] :: remote update
$: %dawn :: boot from keys
=seed:able:jael :: identity params =seed:able:jael :: identity params
spon=ship :: sponsor spon=[=ship point:azimuth-types] :: sponsor
czar=(map ship [=life =pass]) :: galaxy table czar=(map ship [=rift =life =pass]) :: galaxy table
turf=(list turf) :: domains turf=(list turf) :: domains
bloq=@ud :: block number bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== :: == ::
[%fake =ship] :: fake boot [%fake =ship] :: fake boot
[%look src=(each ship purl:eyre)] :: set ethereum source [%listen whos=(set ship) =source] :: set ethereum source
[%mint p=ship q=safe] :: create rights
[%move p=ship q=ship r=safe] :: transfer from=to
::TODO %next for generating/putting new private key ::TODO %next for generating/putting new private key
[%nuke ~] :: cancel tracker from
[%pubs =ship] :: view public keys
[%meet =ship =life =pass] :: met after breach [%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 [%turf ~] :: view domains
$>(%vega vane-task) :: report upgrade $>(%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 $>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote 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
=< block =< block
@ -2378,13 +2159,17 @@
:: ::
++ udiff-to-diff ++ udiff-to-diff
|= [=a=udiff =a=point] |= [=a=udiff =a=point]
^- diff ^- (unit diff)
?- +<.a-udiff ?- +<.a-udiff
%disavow ~|(%udiff-to-diff-disavow !!) %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 :^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])] [life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff [life crypto-suite pass]:a-udiff
== ==
@ -2431,71 +2216,17 @@
a-point(sponsor to.diff) 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 +$ source (each ship term)
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
::
+$ source (each ship node-src)
+$ source-id @udsourceid +$ source-id @udsourceid
+$ snapshot ~
:: ::
:: +state-eth-node: state of a connection to an ethereum node :: +state-eth-node: state of a connection to an ethereum node
:: ::
+$ state-eth-node :: node config + meta +$ 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=(map source-id source)
sources-reverse=(map source source-id) sources-reverse=(map source source-id)
default-source=source-id default-source=source-id
@ -2503,7 +2234,7 @@
ship-sources-reverse=(jug source-id ship) ship-sources-reverse=(jug source-id ship)
== :: == ::
:: :: :: ::
:::: ++pki:kale :: (1h2) certificates :::: ++pki:jael :: (1h2) certificates
:: :::: :: ::::
++ pki ^? ++ pki ^?
|% |%
@ -2525,7 +2256,7 @@
++ name (pair @ta @t) :: ascii / unicode ++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature ++ oath @ :: signature
-- :: pki -- :: pki
-- :: kale -- :: jael
:: :::: :: ::::
:::: ++xmas :: (1i) new network :::: ++xmas :: (1i) new network
:: :::: :: ::::
@ -7315,6 +7046,10 @@
=. size.queue +(size.queue) =. size.queue +(size.queue)
:: ::
[~ 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 :: we're at max capacity, so pop before pushing; size is unchanged
:: ::
=^ oldest queue.queue ~(get to queue.queue) =^ oldest queue.queue ~(get to queue.queue)
@ -7728,7 +7463,6 @@
{$g gift:able:gall} {$g gift:able:gall}
[%i gift:able:iris] [%i gift:able:iris]
{$j gift:able:jael} {$j gift:able:jael}
{$k gift:able:kale}
== ==
:: ::
+$ unix-task :: input from unix +$ unix-task :: input from unix
@ -7862,21 +7596,20 @@
:: # diffs :: # diffs
:: ::
++ update ++ 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))] [%difs dis=(list (pair event-id diff-azimuth))]
== ==
:: ::
:: # constants :: # constants
:: ::
:: contract addresses :: contract addresses
::TODO values below are for ropsten, update for mainnet ++ contracts mainnet-contracts
++ contracts ++ mainnet-contracts
|% |%
:: azimuth: data contract :: azimuth: data contract
:: ::
++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet ++ azimuth
:: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
:: ::
++ linear-star-release ++ linear-star-release
0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801 0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801
@ -7893,6 +7626,17 @@
++ public 7.033.765 ++ 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 :: hashes of ship event signatures
++ azimuth-events ++ azimuth-events
|% |%
@ -9071,7 +8815,7 @@
`(cat 3 'gal-' (scot %ud gal)) `(cat 3 'gal-' (scot %ud gal))
:+ %eth-call :+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-] =- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'getKeys(uint32)' [%uint gal]~) (encode-call 'points(uint32)' [%uint gal]~)
[%number boq] [%number boq]
:: +point:give:dawn: Eth RPC for ship's contract state :: +point:give:dawn: Eth RPC for ship's contract state
:: ::
@ -9132,7 +8876,7 @@
:: ::
++ czar ++ czar
|= rep=octs |= rep=octs
^- (unit (map ship [=life =pass])) ^- (unit (map ship [=rift =life =pass]))
=/ jon=(unit json) (de-json:html q.rep) =/ jon=(unit json) (de-json:html q.rep)
?~ jon ?~ jon
~&([%czar-take-dawn %invalid-json] ~) ~&([%czar-take-dawn %invalid-json] ~)
@ -9140,27 +8884,31 @@
((ar (ot id+so result+so ~)) u.jon) ((ar (ot id+so result+so ~)) u.jon)
?~ res ?~ res
~&([%czar-take-dawn %invalid-response rep] ~) ~&([%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) ~ (some p.out))
^= out %- mule |. ^= out %- mule |.
%+ turn u.res %+ turn u.res
|= [id=@t result=@t] |= [id=@t result=@t]
^- [who=ship enc=octs aut=octs sut=@ud rev=@ud] ^- [who=ship point:azimuth-types]
:- `@p`(slav %ud (rsh 3 4 id)) =/ who `@p`(slav %ud (rsh 3 4 id))
:- who
%+ point-from-eth
who
:_ *deed:eth-noun
%+ decode-results %+ decode-results
result result
~[[%bytes-n 32] [%bytes-n 32] %uint %uint] point:eth-type
?~ dat ?~ dat
~&([%bloq-take-dawn %invalid-galaxy-table] ~) ~&([%bloq-take-dawn %invalid-galaxy-table] ~)
:- ~ :- ~
%+ roll u.dat %+ roll u.dat
|= $: [who=ship enc=octs aut=octs sut=@ud rev=@ud] |= $: [who=ship =point:azimuth-types]
kyz=(map ship [=life =pass]) kyz=(map ship [=rift =life =pass])
== ==
^+ kyz ^+ kyz
=/ pub=pass ?~ net.point
(pass-from-eth enc aut sut) kyz
(~(put by kyz) who [rev pub]) (~(put by kyz) who [continuity-number life pass]:u.net.point)
:: +point:take:dawn: parse ship's contract state :: +point:take:dawn: parse ship's contract state
:: ::
++ point ++ point
@ -9225,56 +8973,6 @@
(~(put by tuf) q.i.dom p.i.dom) (~(put by tuf) q.i.dom p.i.dom)
$(dom t.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:dawn: validate keys, life, discontinuity, &c
:: ::
++ veri ++ veri
@ -9299,28 +8997,10 @@
[%& (^sein:title who.seed)] [%& (^sein:title who.seed)]
:: ::
%earl %earl
:: a moon must be signed by the parent
::
?~ sig.seed
[%| %missing-sig]
:: the parent must be launched :: the parent must be launched
:: ::
?~ net.point ?~ net.point
[%| %parent-not-keyed] [%| %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)] [%& (^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 ames-gate
now=~1234.5.6 now=~1234.5.6
call-args=[duct type=*type %soft %init ~nul] 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 results1
@ -56,7 +56,7 @@
%: ames-take %: ames-take
ames-gate ames-gate
now 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=~ expected-moves=~
== ==
:: ::
@ -67,7 +67,7 @@
ames-gate ames-gate
now now
call-args=[duct type=*type %soft [%want ~nul /foo 1]] 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] [duct %give %send *lane:ames pact1]
:: XX why ~s4 ?? :: XX why ~s4 ??
:: ::

View File

@ -208,12 +208,11 @@
%give %give
%response %response
%start %start
:- 404 ::
:~ ['content-type' 'text/html'] %+ complete-http-start-event
['content-length' '156'] :- 404
== ['content-type' 'text/html']~
[~ (error-page:http-server-gate 404 %.n '/' ~)] [~ (error-page:http-server-gate 404 %.n '/' ~)]
complete=%.y
== == == ==
== ==
:: ::
@ -272,7 +271,7 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -287,7 +286,7 @@
now=~1111.1.4 now=~1111.1.4
scry=scry-provides-code scry=scry-provides-code
^= take-args ^= take-args
:* wire=/run-app/app1 duct=~[/http-blah] :* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) ^- (hypo sign:http-server-gate)
:- *type :- *type
:* %g %unto %http-response :* %g %unto %http-response
@ -359,7 +358,7 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -374,7 +373,7 @@
now=~1111.1.4 now=~1111.1.4
scry=scry-provides-code scry=scry-provides-code
^= take-args ^= take-args
:* wire=/run-app/app1 duct=~[/http-blah] :* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) ^- (hypo sign:http-server-gate)
:- *type :- *type
:* %g %unto %coup ~ :* %g %unto %coup ~
@ -384,12 +383,11 @@
^= expected-move ^= expected-move
:~ :* duct=~[/http-blah] %give %response :~ :* duct=~[/http-blah] %give %response
%start %start
:- 500 ::
:~ ['content-type' 'text/html'] %+ complete-http-start-event
['content-length' '180'] :- 500
== ['content-type' 'text/html']~
[~ (internal-server-error:http-server-gate %.n '/' ~)] [~ (internal-server-error:http-server-gate %.n '/' ~)]
complete=%.y
== == == == == ==
:: ::
;: weld ;: weld
@ -449,7 +447,7 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -464,7 +462,7 @@
now=~1111.1.4 now=~1111.1.4
scry=scry-provides-code scry=scry-provides-code
^= take-args ^= take-args
:* wire=/run-app/app1 duct=~[/http-blah] :* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type ^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response :* %g %unto %http-response
%start %start
@ -485,7 +483,7 @@
now=~1111.1.4 now=~1111.1.4
scry=scry-provides-code scry=scry-provides-code
^= take-args ^= take-args
:* wire=/run-app/app1 duct=~[/http-blah] :* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type ^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response :* %g %unto %http-response
[%continue [~ (as-octs:mimes:html 'ya!')] %.y] [%continue [~ (as-octs:mimes:html 'ya!')] %.y]
@ -556,7 +554,7 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/~landscape/inner-path' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/~landscape/inner-path' ~ ~]])
@ -571,7 +569,7 @@
now=~1111.1.4 now=~1111.1.4
scry=scry-provides-code scry=scry-provides-code
^= take-args ^= take-args
:* wire=/run-app/app1 duct=~[/http-blah] :* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type ^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response :* %g %unto %http-response
[%start [307 ['location' '/~/login?redirect=/~landscape/inner-path']~] ~ %.y] [%start [307 ['location' '/~/login?redirect=/~landscape/inner-path']~] ~ %.y]
@ -624,7 +622,7 @@
:: expect authenticated=%.y in the handle below :: expect authenticated=%.y in the handle below
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!> :* !> :*
@ -736,14 +734,13 @@
== ==
^= expected-move ^= expected-move
:~ :* duct=~[/http-blah] %give %response :~ :* duct=~[/http-blah] %give %response
:* %start %start
:- 200 ::
:~ ['content-type' 'text/plain'] %+ complete-http-start-event
['content-length' '13'] :- 200
== ['content-type' 'text/plain']~
`[13 'one two three'] `[13 'one two three']
%.y == == ==
== == == ==
:: ::
;: weld ;: weld
results1 results1
@ -870,11 +867,10 @@
%give %give
%response %response
%start %start
:- 403
:~ ['content-type' 'text/html']
['content-length' '182']
==
:: ::
%+ complete-http-start-event
:- 403
['content-type' 'text/html']~
:- ~ :- ~
%- error-page:http-server-gate :* %- error-page:http-server-gate :*
403 403
@ -882,8 +878,6 @@
'/~/channel/1234567890abcdef' '/~/channel/1234567890abcdef'
~ ~
== ==
::
complete=%.y
== == == ==
== ==
:: ::
@ -1814,7 +1808,7 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-request/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-request :* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -1848,19 +1842,38 @@
(expect-eq !>(~[/http-blah]) !>(duct)) (expect-eq !>(~[/http-blah]) !>(duct))
:: ::
%+ expect-gall-deal %+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul] :+ /run-app-cancel/app1 [~nul ~nul]
^- cush:gall ^- cush:gall
:* %app1 %poke %handle-http-cancel :* %app1 %poke %handle-http-cancel
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]]) !>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
== ==
card 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 ;: weld
results1 results1
results2 results2
results3 results3
results4 results4
results5
== ==
:: ::
++ http-server-call ++ http-server-call
@ -2031,12 +2044,11 @@
%give %give
%response %response
%start %start
:- 200 ::
:~ ['content-type' 'text/html'] %+ complete-http-start-event
['content-length' '1752'] :- 200
== ['content-type' 'text/html']~
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)] [~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
complete=%.y
== == == ==
== ==
:: a response post redirects back to the application, setting cookie :: a response post redirects back to the application, setting cookie
@ -2182,4 +2194,12 @@
:: This is the default code for a fakeship. :: This is the default code for a fakeship.
:: ::
[~ ~ %noun !>(.~lidlut-tabwed-savheb-loslux)] [~ ~ %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 results1
results2 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 %- crip
%+ weld "0x" %+ weld "0x"
(render-hex-bytes:ethereum 20 `@`azimuth:contracts:^azimuth) (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 ++ test-give-bloq
=/ oct =/ oct
@ -116,16 +97,34 @@
'3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f' '3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f'
'0000000000000000000000000000000000000000000000000000000000000001' '0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001' '0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000002'
'"},{"id":"gal-1","jsonrpc":"2.0","result":"' '"},{"id":"gal-1","jsonrpc":"2.0","result":"'
'0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3' '0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3'
'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8' 'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8'
'0000000000000000000000000000000000000000000000000000000000000001' '0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001' '0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000003'
'"},{"id":"gal-2","jsonrpc":"2.0","result":"' '"},{"id":"gal-2","jsonrpc":"2.0","result":"'
'0x0000000000000000000000000000000000000000000000000000000000000000' '0x0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000' '0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000' '0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000' '0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000004'
'"}]' '"}]'
== ==
=/ kyz =/ kyz
@ -139,8 +138,8 @@
823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146 823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146
%+ expect-eq %+ expect-eq
!> :- ~ !> :- ~
%- ~(gas by *(map ship [=life =pass])) %- ~(gas by *(map ship [=rift =life =pass]))
[[~zod 1 zod.kyz] [~nec 1 nec.kyz] [~bud 0 'b'] ~] [[~zod 2 1 zod.kyz] [~nec 3 1 nec.kyz] [~bud 4 1 'b'] ~]
!> (czar:take:dawn oct) !> (czar:take:dawn oct)
:: ::
++ test-take-point ++ test-take-point
@ -186,26 +185,6 @@
!> [~ [/org/urbit ~]] !> [~ [/org/urbit ~]]
!> (turf:take:dawn oct) !> (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 ++ test-veri-good
=/ sed [~zod 1 sec ~] =/ sed [~zod 1 sec ~]
%+ expect-eq %+ expect-eq
@ -254,15 +233,6 @@
!> [%& (^sein:title who)] !> [%& (^sein:title who)]
!> (veri:dawn sed pot ~) !> (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 ++ test-veri-earl-parent-not-keyed
=/ cub (pit:nu:crub:crypto 24 %foo) =/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod =/ who ~simtel-mithet-dozzod-dozzod
@ -275,53 +245,6 @@
!> [%| %parent-not-keyed] !> [%| %parent-not-keyed]
!> (veri:dawn sed =>(pot .(net ~)) ~) !> (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 ++ test-veri-pawn-good
=/ cub (pit:nu:crub:crypto 24 %foo) =/ cub (pit:nu:crub:crypto 24 %foo)
=/ who=ship `@`fig:ex:cub =/ who=ship `@`fig:ex:cub

View File

@ -113,6 +113,33 @@ class sourceAction(argparse.Action):
else: else:
return {self.which: new_value} 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): class transformerAction(argparse.Action):
"""Handle transformer flag. """Handle transformer flag.
@ -310,6 +337,14 @@ parser.add_argument('-l', '--listen-api', which='listen-api',
metavar='api:event', metavar='api:event',
help='listen to event from api', help='listen to event from api',
action=sourceAction) 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', parser.add_argument('-m', '--mark', which='as',
metavar='mark', metavar='mark',
help='transform a source to another 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)) 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') print r.text[1:-1].encode('utf-8').decode('string_escape')
elif r.text[0] == '{': elif r.text[0] == '{':
# print r.text # print r.text

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -9,9 +9,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@joseph184/rollup-plugin-node-builtins": "^2.1.4",
"@sucrase/gulp-plugin": "^2.0.0", "@sucrase/gulp-plugin": "^2.0.0",
"autoprefixer": "^9.6.1",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-better-rollup": "^4.0.1", "gulp-better-rollup": "^4.0.1",
@ -21,10 +19,8 @@
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"rollup": "^1.6.0", "rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.0", "rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^4.0.0", "rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-root-import": "^0.2.3", "rollup-plugin-root-import": "^0.2.3",
"sucrase": "^3.8.0" "sucrase": "^3.8.0"
}, },
@ -32,11 +28,10 @@
"classnames": "^2.2.6", "classnames": "^2.2.6",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"moment": "^2.20.1", "moment": "^2.20.1",
"mousetrap": "^1.6.1", "mousetrap": "^1.6.3",
"react": "^16.5.2", "react": "^16.5.2",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-router-dom": "^5.0.0", "react-router-dom": "^5.0.0",
"rollup-plugin-postcss": "^2.0.3",
"urbit-ob": "^3.1.1", "urbit-ob": "^3.1.1",
"urbit-sigil-js": "^1.3.2" "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-before: unset;
-webkit-margin-after: unset; -webkit-margin-after: unset;
font-family: Inter, sans-serif; font-family: Inter, sans-serif;
padding: 0;
} }
textarea, select, input, button { textarea, select, input, button {
@ -87,6 +88,14 @@ h2 {
font-weight: bold; font-weight: bold;
} }
.fs-italic {
font-style: italic;
}
.td-underline {
text-decoration: underline;
}
.bg-v-light-gray { .bg-v-light-gray {
background-color: #f9f9f9; background-color: #f9f9f9;
} }
@ -115,6 +124,24 @@ h2 {
-webkit-box-orient: vertical; -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 { .lh-16 {
line-height: 16px; 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); .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 ( return (
<Message <Message
key={msg.gam.uid} key={msg.gam.uid}
msg={msg.gam} /> msg={msg.gam}
renderSigil={renderSigil}
paddingTop={paddingTop}
paddingBot={paddingBot} />
); );
}); });
let peers = props.peers[state.station] || [window.ship]; let peers = props.peers[state.station] || [window.ship];
return ( return (
@ -210,8 +226,8 @@ export class ChatScreen extends Component {
numPeers={peers.length} /> numPeers={peers.length} />
</div> </div>
<div <div
className="overflow-y-scroll pt3 flex flex-column-reverse" className="overflow-y-scroll pt3 pb2 flex flex-column-reverse"
style={{ height: 'calc(100% - 157px)' }} style={{ height: 'calc(100% - 157px)', resize: 'vertical' }}
onScroll={this.onScroll}> onScroll={this.onScroll}>
<div ref={ el => { this.scrollElement = el; }}></div> <div ref={ el => { this.scrollElement = el; }}></div>
{chatMessages} {chatMessages}

View File

@ -27,8 +27,34 @@ export class LandingScreen extends Component {
} }
onClickSubscribe() { onClickSubscribe() {
const { props } = this;
let station = props.match.params.ship + '/' + props.match.params.station; 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'); this.props.history.push('/~chat');
} }
@ -50,7 +76,7 @@ export class LandingScreen extends Component {
<br /> <br />
<button <button
onClick={this.onClickSubscribe.bind(this)} onClick={this.onClickSubscribe.bind(this)}
className="label-r" className="label-regular fw-bold pointer"
>Subscribe</button> >Subscribe</button>
</div> </div>
</div> </div>

View File

@ -54,7 +54,9 @@ export class ChatInput extends Component {
setTimeout(closure, 2000);*/ setTimeout(closure, 2000);*/
this.state = { this.state = {
message: "" message: '',
messageType: 'lin',
clipboard: null
}; };
this.textareaRef = React.createRef(); this.textareaRef = React.createRef();
@ -100,22 +102,165 @@ export class ChatInput extends Component {
} }
messageChange(event) { 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() { messageSubmit() {
const { props, state } = this; const { props, state } = this;
if (state.message === '') {
return;
}
let message = { let message = {
uid: uuid(), uid: uuid(),
aut: window.ship, aut: window.ship,
wen: Date.now(), wen: Date.now(),
aud: [props.station], aud: [props.station],
sep: { sep: this.speechFromInput(
lin: { state.message,
msg: state.message, state.messageType,
pat: false state.clipboard
} )
}
}; };
props.api.hall( props.api.hall(
@ -125,7 +270,8 @@ export class ChatInput extends Component {
); );
this.setState({ this.setState({
message: "" message: '',
messageType: 'lin'
}); });
} }
@ -151,7 +297,7 @@ export class ChatInput extends Component {
} }
return ( 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={{ <div className="fl" style={{
marginTop: 4, marginTop: 4,
flexBasis: 32, flexBasis: 32,
@ -159,9 +305,12 @@ export class ChatInput extends Component {
}}> }}>
<Sigil ship={window.ship} size={32} /> <Sigil ship={window.ship} size={32} />
</div> </div>
<div className="fr h-100 flex" style={{ flexGrow: 1, height: 40 }}> <div className="fr h-100 flex" style={{ flexGrow: 1 }}>
<input className="ml2 bn" <textarea
style={{ flexGrow: 1 }} className={'ml2 mt2 mr2 bn ' +
this.getSpeechStyle(state.messageType, state.clipboard)
}
style={{ flexGrow: 1, height: 40, resize: 'none' }}
ref={this.textareaRef} ref={this.textareaRef}
placeholder={props.placeholder} placeholder={props.placeholder}
value={state.message} value={state.message}

View File

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

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { Sigil } from '/components/lib/icons/sigil';
export class MemberElement extends Component { export class MemberElement extends Component {
@ -23,7 +24,7 @@ export class MemberElement extends Component {
`~${window.ship}` === props.host) { `~${window.ship}` === props.host) {
actionElem = ( actionElem = (
<a onClick={this.onRemove.bind(this)} <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 Remove
</a> </a>
); );
@ -34,10 +35,11 @@ export class MemberElement extends Component {
} }
return ( return (
<div> <div className="flex mb2">
<Sigil ship={props.ship} size={32} />
<p <p
className={ 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} {props.ship}
</p> </p>

View File

@ -6,92 +6,216 @@ import _ from 'lodash';
export class Message extends Component { 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 ( return (
<p className="body-regular-400 v-top"> <p className={`body-regular-400 v-top ${action ? 'fs-italic' : ''}`}>
{content} {content}
</p> </p>
); );
} }
renderContent() { renderUrl(url) {
const { props } = this;
let content = _.get(
props.msg,
'sep.lin.msg',
'<unknown message type>'
);
try { try {
let url = new URL(content); let urlObject = new URL(url);
let imgMatch = let imgMatch =
/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/ /(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/
.exec( .exec(
url.pathname urlObject.pathname
); );
if (imgMatch) { if (imgMatch) {
return ( return this.renderImageUrl(url);
<img
src={content}
style={{
width:"50%",
maxWidth: '250px'
}}
></img>
)
} else { } else {
let url = this.urlTransmogrifier(content); let localUrl = this.localizeUrl(url);
return this.renderAnchor(localUrl, url);
return (
<a className="body-regular"
href={url}
target="_blank">{url}</a>
)
} }
} catch(e) { } catch(e) {
return this.renderMessage(content); console.error('url render error', e);
return this.renderAnchor(url);
} }
} }
urlTransmogrifier(url) { renderImageUrl(url) {
if (typeof url !== 'string') { throw 'Only transmogrify strings!'; } return this.renderAnchor(url, (
const ship = window.ship; <img
if (url.indexOf('arvo://') === 0) { src={url}
return `http://${ship}.arvo.network` + url.split('arvo://')[1]; 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() { render() {
const { props } = this; const { props } = this;
let pending = !!props.msg.pending ? ' o-80' : ''; 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'); let datestamp = moment.unix(props.msg.wen / 1000).format('LL');
return ( let paddingTop = props.paddingTop ? 'pt3' : '';
<div className={"w-100 pl3 pr3 pt2 pb2 cf flex" + pending} let paddingBot = props.paddingBot ? 'pb2' : 'pb1';
style={{
minHeight: 'min-content' if (props.renderSigil) {
}}> let timestamp = moment.unix(props.msg.wen / 1000).format('hh:mm a');
<div className="fl mr2">
<Sigil ship={props.msg.aut} size={36} /> return (
</div> <div className={"w-100 pl3 pr3 cf flex " + paddingTop + " " + paddingBot + pending}
<div className="fr" style={{ flexGrow: 1, marginTop: -8 }}> style={{
<div className="hide-child"> minHeight: 'min-content'
<p className="v-top label-small-mono gray dib mr3"> }}>
~{props.msg.aut} <div className="fl mr2">
</p> <Sigil ship={props.msg.aut} size={36} />
<p className="v-top label-small-mono gray dib">{timestamp}</p> </div>
<p className="v-top label-small-mono ml2 gray dib child"> <div className="fr clamp-message" style={{ flexGrow: 1, marginTop: -8 }}>
{datestamp} <div className="hide-child">
</p> <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> </div>
{this.renderContent()}
</div> </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) { if (!this.state.error) {
inviteButtonClasses = inviteButtonClasses + ' black'; inviteButtonClasses = inviteButtonClasses + ' black';
} }
@ -113,16 +113,17 @@ export class MemberScreen extends Component {
</p> </p>
<textarea <textarea
ref={ e => { this.textarea = e; } } 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={{ style={{
resize: 'none', resize: 'none',
height: 150 height: 150
}} }}
spellCheck="false"
onChange={this.inviteMembersChange.bind(this)}></textarea> onChange={this.inviteMembersChange.bind(this)}></textarea>
<button <button
onClick={this.inviteMembers.bind(this)} onClick={this.inviteMembers.bind(this)}
className={inviteButtonClasses}> className={inviteButtonClasses}>
Invite -> Invite
</button> </button>
{errorElem} {errorElem}
{successElem} {successElem}

View File

@ -185,8 +185,9 @@ export class NewScreen extends Component {
</p> </p>
<textarea <textarea
ref={ e => { this.textarea = e; } } 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" placeholder="~zod, ~bus"
spellCheck="false"
style={{ style={{
resize: 'none', resize: 'none',
height: 150 height: 150

View File

@ -87,6 +87,18 @@ export class Root extends Component {
inviteConfig = configs[`~${window.ship}/i`]; inviteConfig = configs[`~${window.ship}/i`];
} }
const renderChannelsSidebar = (props) => (
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
);
return ( return (
<BrowserRouter> <BrowserRouter>
<div> <div>
@ -94,17 +106,7 @@ export class Root extends Component {
render={ (props) => { render={ (props) => {
return ( return (
<Skeleton <Skeleton
sidebar={ sidebar={renderChannelsSidebar(props)}>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<div className="w-100 h-100 fr" style={{ flexGrow: 1 }}> <div className="w-100 h-100 fr" style={{ flexGrow: 1 }}>
<div className="dt w-100 h-100"> <div className="dt w-100 h-100">
<div className="dtc center v-mid w-100 h-100 bg-white"> <div className="dtc center v-mid w-100 h-100 bg-white">
@ -119,17 +121,7 @@ export class Root extends Component {
return ( return (
<Skeleton <Skeleton
spinner={this.state.spinner} spinner={this.state.spinner}
sidebar={ sidebar={renderChannelsSidebar(props)}>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<NewScreen <NewScreen
setSpinner={this.setSpinner} setSpinner={this.setSpinner}
api={api} api={api}
@ -143,17 +135,7 @@ export class Root extends Component {
render={ (props) => { render={ (props) => {
return ( return (
<Skeleton <Skeleton
sidebar={ sidebar={renderDefaultSidebar(props)}>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<LandingScreen <LandingScreen
api={api} api={api}
configs={configs} configs={configs}
@ -171,17 +153,7 @@ export class Root extends Component {
let messages = state.messages[station] || []; let messages = state.messages[station] || [];
return ( return (
<Skeleton <Skeleton
sidebar={ sidebar={renderChannelsSidebar(props) }>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<ChatScreen <ChatScreen
api={api} api={api}
configs={configs} configs={configs}
@ -197,17 +169,7 @@ export class Root extends Component {
render={ (props) => { render={ (props) => {
return ( return (
<Skeleton <Skeleton
sidebar={ sidebar={renderChannelsSidebar(props) }>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<MemberScreen <MemberScreen
{...props} {...props}
api={api} api={api}
@ -221,17 +183,7 @@ export class Root extends Component {
return ( return (
<Skeleton <Skeleton
spinner={this.state.spinner} spinner={this.state.spinner}
sidebar={ sidebar={renderChannelsSidebar(props) }>
<Sidebar
circles={circles}
messagePreviews={messagePreviews}
invites={invites}
unreads={unreads}
api={api}
inviteConfig={inviteConfig}
{...props}
/>
}>
<SettingsScreen <SettingsScreen
{...props} {...props}
setSpinner={this.setSpinner} setSpinner={this.setSpinner}

View File

@ -83,6 +83,30 @@ export class Sidebar extends Component {
this.props.history.push('/~chat/new'); 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() { render() {
const { props, state } = this; const { props, state } = this;
let station = props.match.params.ship + '/' + props.match.params.station; let station = props.match.params.ship + '/' + props.match.params.station;
@ -93,7 +117,9 @@ export class Sidebar extends Component {
}) })
.map((cir) => { .map((cir) => {
let msg = props.messagePreviews[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 aut = !!msg ? msg.gam.aut : '';
let wen = !!msg ? msg.gam.wen : 0; let wen = !!msg ? msg.gam.wen : 0;
let datetime = let datetime =

View File

@ -127,7 +127,6 @@ class Clock extends Component {
} }
render() { render() {
console.log('hi')
return <div style={{position:'relative'}}> 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"> <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 cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup'); var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano'); var cssnano = require('cssnano');
var autoprefixer = require('autoprefixer');
var postcss = require('gulp-postcss') var postcss = require('gulp-postcss')
var sucrase = require('@sucrase/gulp-plugin'); var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify'); var minify = require('gulp-minify');
var exec = require('child_process').exec;
var rename = require('gulp-rename'); var rename = require('gulp-rename');
var resolve = require('rollup-plugin-node-resolve'); var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs'); 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 rootImport = require('rollup-plugin-root-import');
var globals = require('rollup-plugin-node-globals'); var globals = require('rollup-plugin-node-globals');
@ -29,7 +24,6 @@ var urbitrc = require('../urbitrc');
gulp.task('css-bundle', function() { gulp.task('css-bundle', function() {
let plugins = [ let plugins = [
autoprefixer({ browsers: ['last 1 version'] }),
cssnano() cssnano()
]; ];
return gulp return gulp
@ -57,17 +51,12 @@ gulp.task('js-imports', function(cb) {
'node_modules/react-is/index.js': [ 'isValidElementType' ], 'node_modules/react-is/index.js': [ 'isValidElementType' ],
} }
}), }),
replace({
'process.env.NODE_ENV': JSON.stringify('development')
}),
rootImport({ rootImport({
root: `${__dirname}/dist/js`, root: `${__dirname}/dist/js`,
useEntry: 'prepend', useEntry: 'prepend',
extensions: '.js' extensions: '.js'
}), }),
json(),
globals(), globals(),
builtins(),
resolve() resolve()
] ]
}, 'umd')) }, 'umd'))
@ -91,18 +80,6 @@ gulp.task('rename-index-min', function() {
.pipe(gulp.dest('../../arvo/app/launch/js/')); .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 () { gulp.task('urbit-copy', function () {
let ret = gulp.src('../../arvo/**/*'); let ret = gulp.src('../../arvo/**/*');

File diff suppressed because it is too large Load Diff

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

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