Merge branch 'jb/release/vere' into jb/restage/chop-fast

This commit is contained in:
Joe Bryan 2022-11-18 10:41:23 -05:00
commit f78e6a5447
153 changed files with 42292 additions and 49622 deletions

View File

@ -34,7 +34,7 @@ jobs:
call-vere:
uses: ./.github/workflows/vere.yml
with:
pace: 'often'
pace: 'edge' # XX s/b once?
upload: >-
${{
(github.ref_name == 'next/vere' && github.ref_type == 'branch')

View File

@ -12,11 +12,13 @@ on:
pace:
description: 'release pace'
type: string
default: 'often'
default: 'edge'
required: false
secrets:
CACHIX_AUTH_TOKEN:
required: false
GCP_CREDENTIALS:
required: false
GCS_SERVICE_ACCOUNT_KEY:
required: false
GCS_PROJECT:
@ -33,7 +35,7 @@ on:
description: 'release pace'
type: choice
options:
- often
- edge
- soon
- live
@ -48,8 +50,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest }
- { os: macos-latest }
- { os: ubuntu-latest, type: linux }
- { os: macos-latest, type: macos }
- { os: buildjet-4vcpu-ubuntu-2204-arm, type: linux }
runs-on: ${{ matrix.os }}
@ -64,7 +67,7 @@ jobs:
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.type == 'linux' }}
- uses: cachix/install-nix-action@v16
if: ${{ matrix.os != 'ubuntu-latest' }}
@ -73,6 +76,11 @@ jobs:
name: ares
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# run unit tests early on linux (x-compilation will skip them)
- name: build dynamic binary (and run tests)
if: ${{ matrix.type == 'linux' }}
run: nix-build -A urbit
- name: build static binary
run: |
nix-build -A urbit \
@ -84,7 +92,7 @@ jobs:
cat ./urbit-derivation
- name: confirm binary is mostly static
if: matrix.os == 'macos-latest'
if: matrix.type == 'macos'
run: |
bin="${{ env.urbit_static }}/bin/urbit"
@ -117,19 +125,20 @@ jobs:
echo -n "$version" > ./version-string
- name: upload version string artifact
if: matrix.os == 'ubuntu-latest'
if: matrix.type == 'linux'
uses: actions/upload-artifact@v3
with:
name: version-string
path: version-string
- uses: google-github-actions/setup-gcloud@v0.2.0
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- uses: google-github-actions/setup-gcloud@v1
if: inputs.upload
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.GCS_PROJECT }}
export_default_credentials: true
- name: upload binary to bootstrap.urbit.org
if: inputs.upload
@ -174,6 +183,7 @@ jobs:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: mingw32-make build/urbit
- run: mingw32-make test
- run: >
build/urbit -l -d -B ../../bin/solid.pill -F bus &&
curl -f --data '{"source":{"dojo":"+hood/exit"},"sink":{"app":"hood"}}'
@ -232,9 +242,7 @@ jobs:
after:
runs-on: ubuntu-latest
needs: [urbit, mingw]
# XX disabled due to missing storage.objects.delete access
if: false
# if: inputs.upload
if: inputs.upload
steps:
- uses: google-github-actions/setup-gcloud@v0.2.0
with:

View File

@ -27,12 +27,12 @@ identity, use [Bridge][brid].
## Install
To install and run Urbit, please follow the instructions at
[urbit.org/using/install][start]. You'll be on the live network in a
[urbit.org/install][start]. You'll be on the live network in a
few minutes.
If you're interested in Urbit development, keep reading.
[start]: https://urbit.org/using/install/
[start]: https://urbit.org/install/
## Development

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c45166ff0f8ab8dc1552bcef519c77c0afa6ca52f8ed1ba31ed632012667d619
size 8674763
oid sha256:d737f88463f683173b5f6cbf41fc38705d4d3d67263c675d7e99841cd8485d81
size 6026086

View File

@ -57,7 +57,10 @@ let
if system == "x86_64-linux" && crossSystem == null && enableStatic then
"x86_64-unknown-linux-musl"
else
crossSystem;
if system == "aarch64-linux" && crossSystem == null && enableStatic then
"aarch64-unknown-linux-musl"
else
crossSystem;
};
# Use nixpkgs' top-level/static overlay if enableStatic = true.

View File

@ -25,6 +25,7 @@ let
(import ./overlays/native.nix)
# Specific overrides guarded by the host platform.
(import ./overlays/musl.nix)
(import ./overlays/arm.nix)
];
};

View File

@ -3,10 +3,11 @@ final: prev:
let
isAarch64 = prev.stdenv.hostPlatform.isAarch64;
isDarwin = prev.stdenv.isDarwin;
in prev.lib.optionalAttrs isAarch64 {
in prev.lib.optionalAttrs (isAarch64 && !isDarwin) {
libsigsegv = prev.libsigsegv.overrideAttrs (attrs: {
preConfigure = (old.preConfigure or "") + ''
preConfigure = (prev.preConfigure or "") + ''
sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-arm.h/' configure
'';
});

18
nix/sources-openssl.json Normal file
View File

@ -0,0 +1,18 @@
{
"openssl": {
"branch": "1_1_1n",
"homepage": "https://www.openssl.org/",
"pmnsh": {
"include": "build/include",
"lib": "build",
"prepare": "./config --prefix=`mkdir -p build && readlink -f ./build` --libdir=. no-shared no-tests",
"make": "install_dev"
},
"owner": "openssl",
"repo": "openssl",
"rev": "OpenSSL_1_1_1n",
"type": "tarball",
"url": "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1n.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/refs/tags/<rev>.tar.gz"
}
}

View File

@ -4,6 +4,11 @@
"description": "A command line tool and library for transferring data with URL syntax",
"homepage": "http://curl.se/",
"pmnsh": {
"compat": {
"openbsd": {
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl=`readlink -f ../openssl/build`"
}
},
"include": "include",
"lib": "lib/.libs",
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl",
@ -76,6 +81,13 @@
},
"urcrypt": {
"pmnsh": {
"compat": {
"openbsd": {
"make": "install prefix=`readlink -f .` exec_prefix=`readlink -f .`",
"include": "include",
"lib": "lib"
}
},
"prepare": "./autogen.sh && ./configure --disable-shared PKG_CONFIG_PATH=../secp256k1 CFLAGS=\"-I../secp256k1/include -I../libaes_siv\" LDFLAGS=-L../libaes_siv",
"make": "install"
}

View File

@ -8,6 +8,9 @@
"compat": {
"mingw": {
"prepare": "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=. ."
},
"openbsd": {
"prepare": "cmake -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
}
},
"include": "include",
@ -35,6 +38,10 @@
"mingw": {
"make": "aes_siv_static",
"prepare": "cmake -G\"MSYS Makefiles\" -DDISABLE_DOCS:BOOL=ON ."
},
"openbsd": {
"make": "aes_siv_static",
"prepare": "cmake -DDISABLE_DOCS:BOOL=ON -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
}
}
},
@ -98,6 +105,10 @@
"mingw": {
"lib": "build/Win64-MinGW-w64",
"make": "-C build/Win64-MinGW-w64 libsoftfloat3.a"
},
"openbsd": {
"lib": "build/template-FAST_INT64",
"make": "-C build/template-FAST_INT64 libsoftfloat3.a"
}
},
"include": "source/include"

View File

@ -6,22 +6,16 @@
default-agent,
verb,
dbug
:: Generally don't update the snapshot until we have clay tombstoning.
::
/* snap %azimuth-snapshot /app/azimuth/version-0/azimuth-snapshot
:: To update, run from dojo:
:: -azimuth-snap-state %default 'version-0'
::
:: To recreate from a full list of logs (at /app/azimuth/logs/eth-logs):
:: -azimuth-snap-logs %default 'version-0'
::
=/ snap=snap-state snap
=/ last-snap=@ number.id.snap
::
=, jael
|%
+$ app-state
$: %6
$: %7
url=@ta
=net
refresh=_~m5
@ -30,10 +24,14 @@
own=owners
spo=sponsors
logs=(list =event-log:rpc:ethereum)
sap=snap-state
==
::
+$ poke-data
$% :: %listen
$% :: %load: load snapshot
::
[%load snap=snap-state]
:: %listen
::
[%listen whos=(list ship) =source:jael]
:: %watch: configure node url and network
@ -75,14 +73,18 @@
==
::
++ init-timer
|= =bowl:gall
|= at=@da
^- card
[%pass /init %arvo %b %wait now.bowl]
[%pass /init %arvo %b %wait at]
::
++ start-log-retrieval
|= [=ship args=vase]
^- card
[%pass /wa %agent [ship %eth-watcher] %poke %eth-watcher-poke args]
::
++ start-azimuth-load
^- card
[%pass /al %arvo %k %fard %base %azimuth-load %noun !>(~)]
--
::
=<
@ -92,22 +94,10 @@
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card _this)
=/ points=@ud ~(wyt by points.nas.snap)
%- %- slog
[leaf+"ship: loading azimuth snapshot ({<points>} points)"]~
::
=: net.state %default
nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
url.state 'http://eth-mainnet.urbit.org:8545'
==
:_ this
?: .^(? %j /(scot %p our.bowl)/fake/(scot %da now.bowl))
~
~[(nuke-azimuth-tracker bowl) (init-timer bowl)]
::
~[(init-timer now.bowl)]
++ on-save !>(state)
++ on-load
|= old=vase
@ -122,7 +112,7 @@
`old-state
%- %- slog :_ ~
leaf+"ship: loading snapshot with {<(lent logs.old-state)>} events"
=. +.state +:(state-5-to-6 old-state)
=. +.state +:(state-6-to-7 (state-5-to-6 old-state))
=^ cards state
(%*(run-logs do nas.state *^state:naive) logs.state)
[(jael-update:do (to-udiffs:do cards)) state]
@ -130,12 +120,12 @@
?. ?=(%2 -.old-state)
`old-state
~& > '%azimuth: updating to state 3'
=. +.state +:(state-5-to-6 old-state)
=. +.state +:(state-6-to-7 (state-5-to-6 old-state))
:: replace naive state and indices with snapshot
::
=: nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
=: nas.state nas.sap.state
own.state owners.sap.state
spo.state sponsors.sap.state
logs.state ~
:: TODO: shouldn't be needed but have seen eth-watcher
:: threads use a url='' if this is not used
@ -144,8 +134,8 @@
==
=/ points=@ud ~(wyt by points.nas.state)
%- %- slog :_ ~
leaf+"ship: processing azimuth snapshot ({<points>} points)"
=/ snap-cards=udiffs:point (run-state:do id.snap points.nas.state)
leaf+"ship: processing azimuth snapshot (~{<points>} points)"
=/ snap-cards=udiffs:point (run-state:do id.sap.state points.nas.state)
:_ [%3 url net whos nas own spo logs]:state
%+ weld
(jael-update:do snap-cards)
@ -160,22 +150,30 @@
=^ cards-4 old-state
?. ?=(%4 -.old-state) [cards-3 old-state]
=^ cards this
%- %*(. on-poke +.state.this +:(state-5-to-6 old-state))
%- %*(. on-poke +.state.this +:(state-6-to-7 (state-5-to-6 old-state)))
[%azimuth-poke !>([%watch [url net]:old-state])]
~& > '%azimuth: updating to state 5'
[cards [%5 url net whos nas own spo logs]:state.this]
=? old-state ?=(%5 -.old-state)
(state-5-to-6 old-state)
?> ?=(%6 -.old-state)
=? old-state ?=(%6 -.old-state)
(state-6-to-7 old-state)
?> ?=(%7 -.old-state)
[cards-4 this(state old-state)]
::
++ app-states $%(state-0 state-1-2-3-4-5 app-state)
::
++ state-5-to-6
|= state-1-2-3-4-5
^- app-state
[%6 url net ~m5 whos nas own spo logs]
++ app-states $%(state-0 state-1-2-3-4-5 state-6 app-state)
::
+$ state-6
$: %6
url=@ta
=net
refresh=_~m5
whos=(set ship)
nas=^state:naive
own=owners
spo=sponsors
logs=(list =event-log:rpc:ethereum)
==
+$ state-1-2-3-4-5
$: ?(%1 %2 %3 %4 %5)
url=@ta
@ -196,6 +194,15 @@
own=owners
logs=(list =event-log:rpc:ethereum)
==
++ state-5-to-6
|= state-1-2-3-4-5
^- state-6
[%6 url net ~m5 whos nas own spo logs]
::
++ state-6-to-7
|= state-6
^- app-state
[%7 url net refresh whos nas own spo logs *snap-state]
--
::
++ on-poke
@ -219,9 +226,9 @@
[(subscribe-to-eth-watcher bowl)]~
::
%resnap
=: nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
=: nas.state nas.sap.state
own.state owners.sap.state
spo.state sponsors.sap.state
==
`this
==
@ -229,7 +236,23 @@
?. ?=(%azimuth-poke mark)
(on-poke:def mark vase)
=+ !<(poke=poke-data vase)
|-
?- -.poke
%load
=/ points=@ud ~(wyt by points.nas.snap.poke)
%- %- slog
[leaf+"ship: loading azimuth snapshot ({<points>} points)"]~
::
=: net.state %default
nas.state nas.snap.poke
own.state owners.snap.poke
spo.state sponsors.snap.poke
url.state 'http://eth-mainnet.urbit.org:8545'
sap.state snap.poke
logs.state ~
==
$(poke [%kick ~])
::
%listen
[[(listen-to-azimuth (silt whos.poke) source.poke)]~ this]
::
@ -237,8 +260,8 @@
=/ last-block=@
?^ logs.state
number:(last-block-id:dice logs.state)
~& >> %no-logs-in-azimuth-state
last-snap
:: ~& >> %no-logs-in-azimuth-state
number.id.sap.state
=+ [our=(scot %p our.bowl) now=(scot %da now.bowl)]
=+ .^(dudes=(set [dude:gall ?]) %ge our %base now /)
=/ running=? (~(has in dudes) [%eth-watcher &])
@ -246,12 +269,14 @@
|((~(has in dudes) [%eth-watcher &]) (~(has in dudes) [%eth-watcher |]))
:_ this
=/ cards=(list card)
:- :: %jael will re-subscribe to get all azimuth diffs
::
(listen-to-azimuth ~ [%| dap.bowl])
:: we poke eth-watcher to retrieve logs from the latest we have
?: installed
~
:: reinstall %base desk
::
%*(start do last-snap last-block)
=+ spo=(sein:title [our now our]:bowl)
~& >> re-installing-base-from+spo
=/ fresh=[desk ship desk] [%base spo %kids]
[%pass /fresh %agent [our.bowl %hood] %poke kiln-install+!>(fresh)]~
=? cards !running
:: restart %eth-watcher
::
@ -259,30 +284,29 @@
=/ rein=[desk rein] [%base %.y [%eth-watcher ~ ~] ~]
:_ cards
[%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)]
=? cards !installed
:: reinstall %base desk
=. cards
:: we poke eth-watcher to retrieve logs from the latest we have
::
=+ spo=(sein:title [our now our]:bowl)
~& >> re-installing-base-from+spo
=/ fresh=[desk ship desk] [%base spo %kids]
:_ cards
[%pass /fresh %agent [our.bowl %hood] %poke kiln-install+!>(fresh)]
:: resubscribe if we somehow get unsubscribed from eth-watcher
::
?: (~(has by wex.bowl) [/eth-watcher our.bowl %eth-watcher])
cards
~& >> %resubscribing-to-eth-watcher
[(subscribe-to-eth-watcher bowl) cards]
(weld %*(start do number.id.sap.state last-block) cards)
=? cards !(~(has by wex.bowl) [/eth-watcher our.bowl %eth-watcher])
:: resubscribe if we somehow get unsubscribed from eth-watcher
::
[(subscribe-to-eth-watcher bowl) cards]
=. cards
:: %jael will re-subscribe to get all azimuth diffs
::
[(listen-to-azimuth ~ [%| dap.bowl]) cards]
(flop cards)
::
%watch
=: nas.state ?:(?=(%default net.poke) nas.snap *^state:naive)
own.state ?:(?=(%default net.poke) owners.snap ~)
spo.state ?:(?=(%default net.poke) sponsors.snap ~)
=: nas.state ?:(?=(%default net.poke) nas.sap.state *^state:naive)
own.state ?:(?=(%default net.poke) owners.sap.state ~)
spo.state ?:(?=(%default net.poke) sponsors.sap.state ~)
net.state net.poke
url.state url.poke
logs.state ~
==
[start:do this]
`this
==
::
++ on-watch
@ -309,7 +333,7 @@
:- %leaf
"ship: processing azimuth snapshot ({<points>} points)"
=/ snap-cards=udiffs:point
(%*(run-state do logs.state ~) id.snap points.nas.state)
(%*(run-state do logs.state ~) id.sap.state points.nas.state)
[(weld (jael-update:do snap-cards) start:do) this]
::
++ on-leave on-leave:def
@ -318,13 +342,14 @@
^- (unit (unit cage))
|^
?+ path (on-peek:def path)
[%x %logs ~] ``noun+!>(logs.state)
[%x %nas ~] ``noun+!>(nas.state)
[%x %dns ~] ``noun+!>(dns.nas.state)
[%x %own ~] ``noun+!>(own.state)
[%x %spo ~] ``noun+!>(spo.state)
[%x %refresh ~] ``atom+!>(refresh.state)
[%x %point @ ~] ``noun+(point i.t.t.path)
[%x %logs ~] ``noun+!>(logs.state)
[%x %nas ~] ``noun+!>(nas.state)
[%x %dns ~] ``noun+!>(dns.nas.state)
[%x %own ~] ``noun+!>(own.state)
[%x %spo ~] ``noun+!>(spo.state)
[%x %refresh ~] ``atom+!>(refresh.state)
[%x %point @ ~] ``noun+(point i.t.t.path)
[%x %last-snap ~] ``noun+!>(sap.state)
==
::
++ point
@ -369,19 +394,24 @@
::
++ on-arvo
|= [=wire =sign-arvo]
?: &(=(/al wire) ?=(%arow +<.sign-arvo))
?- -.p.sign-arvo
%& `this
%|
%- (slog 'loading azimuth snapshot failed! still trying' p.p.sign-arvo)
[~[(init-timer (add ~s10 now.bowl))] this]
==
?. &(=(/init wire) ?=(%wake +<.sign-arvo))
(on-arvo:def wire sign-arvo)
?^ error.sign-arvo
%- (slog 'azimuth: failed to initialize!' ~)
`this
:_ this
~[(subscribe-to-eth-watcher bowl) (listen-to-azimuth ~ [%| dap.bowl])]
~[start-azimuth-load]
::
++ on-fail on-fail:def
--
|_ =bowl:gall
:: TODO: maybe flop the endianness here so metamask signs it in normal
:: order?
::
++ verifier
^- ^verifier:naive
@ -514,7 +544,7 @@
:+ %watch /[dap.bowl]
^- config:eth-watcher
:* url.state =(%czar (clan:title our.bowl)) refresh.state ~h30
(max launch.net ?:(=(net.state %default) +(last-snap) 0))
(max launch.net ?:(=(net.state %default) +(number.id.sap.state) 0))
~
~[azimuth.net]
~[naive.net]

View File

@ -532,10 +532,11 @@
?: ?=([%show %3] -.mad)
(dy-rash %tan (dy-show-source q.mad) ~)
?: ?=(%brev -.mad)
?: ?=(?(%eny %now %our) p.mad)
(dy-rash %tan (cat 3 p.mad ' is immutable') ~)
=. var (~(del by var) p.mad)
=< dy-amok
?+ p.mad .
$?(%eny %now %our) !!
%lib .(lib ~)
%sur .(sur ~)
%dir .(dir [[our.hid %base ud+0] /])
@ -543,13 +544,12 @@
=+ cay=(~(got by rez) p.q.mad)
?- -.p.mad
%verb
?: ?=(?(%eny %now %our) p.p.mad)
(dy-rash %tan (cat 3 p.p.mad ' is immutable') ~)
=. var (~(put by var) p.p.mad cay)
~| bad-set+[p.p.mad p.q.cay]
=< dy-amok
?+ p.p.mad .
%eny ~|(%entropy-is-eternal !!)
%now ~|(%time-is-immutable !!)
%our ~|(%self-is-immutable !!)
%lib
%_ .
lib
@ -568,6 +568,8 @@
?: ?=([@ ~] pax) ~[i.pax %base '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
?: =(~ .^((list path) %ct pax))
+(..dy (he-diff %tan 'dojo: dir does not exist' ~))
=. dir (need (de-beam pax))
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
@ -735,9 +737,9 @@
^+ +>+>
=^ dat say (~(transceive sole say) cal)
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
~& %dy-edit-busy
=^ lic say (~(transmit sole say) dat)
(dy-diff %mor [%det lic] [%bel ~] ~)
=/ tip=@t 'dojo: busy (press backspace to abort)'
(dy-diff %mor [%det lic] [%bel ~] [%tan [tip ~]] ~)
=> .(per `dat)
=/ res (mule |.((slam u.pro !>((tufa buf.say)))))
?: ?=(%| -.res)

View File

@ -469,6 +469,10 @@
[~ this(dogs.state (~(put by dogs.state) path u.dog(running ~)))]
::
%thread-done
:: if empty, that means we cancelled this thread
::
?: =(*vase q.cage.sign)
`this
=+ !<([vows=disavows pup=watchpup] q.cage.sign)
=. u.dog
%_ u.dog

View File

@ -0,0 +1,46 @@
:: print [len] %ames flows, sorted by number-per-ship
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] arg=$@(~ [len=@ ~]) ~]
:- %noun
::
=; flows
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
=/ len ?^(arg len.arg 50)
(scag len (sort flows |=([[@ [a=@ud *] *] @ [b=@ud *] *] (gth a b))))
::
=/ peers-map
.^ (map ship ?(%alien %known))
%ax /(scot %p p.bec)//(scot %da now)/peers
==
=/ peers=(list ship)
%+ murn ~(tap by peers-map)
|= [=ship val=?(%alien %known)]
?: =(ship p.bec)
~ :: this is weird, but we saw it
?- val
%alien ~
%known (some ship)
==
::
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
%+ turn peers
|= =ship
=+ .^ =ship-state:ames
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
==
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
=/ corked ~(wyt in corked.peer-state)
=- [ship - corked]
::
=+ %+ roll ~(tap in ~(key by snd.peer-state))
|= [b=bone [out=(list bone) in=(list bone) nax=(list bone)]]
=/ m (mod b 4)
?+ m ~|([%odd-bone b] !!)
%0 [[b out] in nax]
%1 [out [b in] nax]
%3 [out in [b nax]]
==
=/ [out-closing=(list bone) out-open=(list bone)]
(skid out ~(has ^in closing.peer-state))
[(lent out-open) (lent out-closing) (lent in) (lent nax)]

View File

@ -0,0 +1,20 @@
:: print [len] %ames message-pump timers, sorted by number-per-ship
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] arg=$@(~ [len=@ ~]) ~]
:- %noun
::
=; who
^- (list [@ta @ud])
=/ len ?^(arg len.arg 50)
(scag len (sort ~(tap by who) |=([[@ a=@ud] @ b=@ud] (gth a b))))
::
=| who=(map @ta @ud)
=/ tim .^((list (pair @da duct)) bx+/(scot %p p.bec)//(scot %da now)/debug/timers)
|- ^+ who
?~ tim who
?. &(?=(^ q.i.tim) ?=([%ames %pump ^] i.q.i.tim))
$(tim t.tim)
=* her i.t.t.i.q.i.tim
=/ i (~(gut by who) her 0)
$(tim t.tim, who (~(put by who) her +(i)))

View File

@ -1,5 +0,0 @@
:: Kick azimuth
::
:- %say
|= *
[%azimuth-poke %kick ~]

View File

@ -0,0 +1,10 @@
:: +gall-nonces: print %gall agent subscription nonces, highest-last
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
:- %noun
^- (list [dude:gall @ud])
%+ sort
%~ tap by
.^((map dude:gall @ud) %gf /(scot %p p.bec)//(scot %da now))
|=([[* a=@ud] [* b=@ud]] (lth a b))

View File

@ -0,0 +1,8 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~
[dude=_`dude:gall`%$ ship=_`@p`(bex 128)]
==
=/ darg=(unit dude:gall) ?:(=(%$ dude) ~ `dude)
=/ sarg=(unit ^ship) ?:(=((bex 128) ship) ~ `ship)
[%helm-doff darg sarg]

View File

@ -0,0 +1,8 @@
:: Helm: Set Gall Verbosity by Agent
::
/? 310
::
:- %say
|= [^ dudes=(list dude:gall) ~]
:- %helm-gall-sift
dudes

View File

@ -0,0 +1,11 @@
:: Helm: Adjust Gall verbosity
::
:: List of diagnostic flags is in verb:gall in zuse.hoon, documented in
:: gall.hoon
::
/? 310
::
:- %say
|= [^ veb=(list verb:gall) ~]
:- %helm-gall-verb
veb

View File

@ -9,7 +9,9 @@
:- %kiln-rein
:- desk
%+ roll arg
=| =rein:hood
=/ =rein:hood
=< rein.arak
.^(vat:hood %gx /(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun)
|: [*[on=? =dude:gall] rein=rein(liv liv)]
?: on
rein(add (~(put in add.rein) dude))

View File

@ -77,7 +77,8 @@
::
++ de-gill :: gill from wire
|= way=wire ^- gill:gall
?>(?=([@ @ ~] way) [(slav %p i.way) i.t.way])
~| way
?>(?=([@ @ *] way) [(slav %p i.way) i.t.way])
--
:: TODO: remove .ost
::

View File

@ -230,6 +230,14 @@
|= veb=(list verb:ames) =< abet
(emit %pass /helm %arvo %a %spew veb)
::
++ poke-gall-sift
|= dudes=(list dude:gall) =< abet
(emit %pass /helm %arvo %g %sift dudes)
::
++ poke-gall-verb
|= veb=(list verb:gall) =< abet
(emit %pass /helm %arvo %g %spew veb)
::
++ poke-ames-wake
|= ~ =< abet
(emit %pass /helm %arvo %a %stir '')
@ -252,6 +260,11 @@
=< abet
(emit %pass /helm/cors/reject %arvo %e %reject-origin origin)
::
++ poke-doff
|= [dude=(unit dude:gall) ship=(unit ship)]
=< abet
(emit %pass /helm/doff %arvo %g %doff dude ship)
::
++ poke
|= [=mark =vase]
?> ?| ?=(%helm-hi mark)
@ -269,6 +282,9 @@
%helm-code =;(f (f !<(_+<.f vase)) poke-code)
%helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve)
%helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject)
%helm-doff =;(f (f !<(_+<.f vase)) poke-doff)
%helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift)
%helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb)
%helm-hi =;(f (f !<(_+<.f vase)) poke-hi)
%helm-knob =;(f (f !<(_+<.f vase)) poke-knob)
%helm-pans =;(f (f !<(_+<.f vase)) poke-pans)

View File

@ -0,0 +1,203 @@
/+ *test, test-pub, test-sub
/= ames-raw /sys/vane/ames
/= gall-raw /sys/vane/gall
::
=/ ames-bunt (ames-raw ~zod)
=/ gall-bunt (gall-raw ~zod)
:: basic helpers
::
|%
++ make-gall
|= =ship
=/ gall-pupa (gall-raw ship)
=/ gall-core (gall-pupa now=~1111.1.1 eny=`@`0xdead.beef scry=*roof)
=+ [out adult]=(call:gall-core duct=~[/init] dud=~ task=[%init ~])
adult
::
++ ames-nec-bud
:: create ~nec
::
=/ nec (ames-raw ~nec)
=. now.nec ~1111.1.1
=. eny.nec 0xdead.beef
=. life.ames-state.nec 2
=. rof.nec |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
=/ nec-pub pub:ex:crypto-core.ames-state.nec
=/ nec-sec sec:ex:crypto-core.ames-state.nec
:: create ~bud
::
=/ bud (ames-raw ~bud)
=. now.bud ~1111.1.1
=. eny.bud 0xbeef.dead
=. life.ames-state.bud 3
=. rof.bud |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
=/ bud-pub pub:ex:crypto-core.ames-state.bud
=/ bud-sec sec:ex:crypto-core.ames-state.bud
::
=/ nec-sym (derive-symmetric-key:ames-raw bud-pub nec-sec)
=/ bud-sym (derive-symmetric-key:ames-raw nec-pub bud-sec)
?> =(nec-sym bud-sym)
:: tell ~nec about ~bud
::
=. peers.ames-state.nec
%+ ~(put by peers.ames-state.nec) ~bud
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=bud-sym
life=3
rift=0
public-key=bud-pub
sponsor=~bud
==
=. route.peer-state `[direct=%.y `lane:ames`[%& ~bud]]
[%known peer-state]
:: tell ~bud about ~nec
::
=. peers.ames-state.bud
%+ ~(put by peers.ames-state.bud) ~nec
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=nec-sym
life=2
rift=0
public-key=nec-pub
sponsor=~nec
==
=. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]]
[%known peer-state]
:: metamorphose
::
=> .(nec +:(call:(nec) ~[//unix] ~ %born ~))
=> .(bud +:(call:(bud) ~[//unix] ~ %born ~))
::
[nec=nec bud=bud]
--
:: forward-declare to avoid repeated metamorphoses
=/ gall-adult (make-gall ~zod)
=/ ames-adult nec:ames-nec-bud
:: main core
::
|%
+$ gall-gate _gall-adult
+$ ames-gate _ames-adult
::
++ nec-bud
=/ a ames-nec-bud
=/ gall-nec (make-gall ~nec)
=. gall-nec (load-agent ~nec gall-nec %sub test-sub)
=/ gall-bud (make-gall ~bud)
=. gall-bud (load-agent ~bud gall-bud %pub test-pub)
:* nec=[ames=nec.a gall=gall-nec]
bud=[ames=bud.a gall=gall-bud]
==
:: +gall-check-call: run gall task, assert produces expected-moves
::
++ gall-check-call
|= $: =gall-gate
[now=@da eny=@ =roof]
[=duct task=(hobo task:gall)]
expected-moves=(list move:gall-bunt)
==
^- [tang ^gall-gate]
=/ gall-core (gall-gate now eny roof)
=^ moves gall-gate (call:gall-core duct dud=~ task)
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
::
++ gall-call
|= [=gall-gate =duct task=(hobo task:gall) =roof]
%. [duct dud=~ task]
call:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +gall-check-take: run gall sign, assert produces expected-moves
::
++ gall-check-take
|= $: =gall-gate
[now=@da eny=@ =roof]
[=wire =duct =sign-arvo]
expected-moves=(list move:gall-bunt)
==
^- [tang ^gall-gate]
=/ gall-core (gall-gate now eny roof)
=^ moves gall-gate (take:gall-core wire duct dud=~ sign-arvo)
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
::
++ gall-take
|= [=gall-gate =wire =duct =sign-arvo =roof]
%. [wire duct dud=~ sign-arvo]
take:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +ames-check-call: run gall task, assert produces expected-moves
::
++ ames-check-call
|= $: =ames-gate
[now=@da eny=@ =roof]
[=duct task=(hobo task:ames)]
expected-moves=(list move:ames-bunt)
==
^- [tang ^ames-gate]
=/ ames-core (ames-gate now eny roof)
=^ moves ames-gate (call:ames-core duct dud=~ task)
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
::
++ ames-call
|= [=ames-gate =duct task=(hobo task:ames) =roof]
%. [duct dud=~ task]
call:(ames-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +ames: run ames sign, assert produces expected-moves
::
++ ames-check-take
|= $: =ames-gate
[now=@da eny=@ =roof]
[=wire =duct =sign:ames-bunt]
expected-moves=(list move:ames-bunt)
==
^- [tang ^ames-gate]
=/ ames-core (ames-gate now eny roof)
=^ moves ames-gate (take:ames-core wire duct dud=~ sign)
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
::
++ ames-scry-peer
|= $: =ames-gate
[now=@da eny=@ =roof]
our=ship
her=ship
==
^- peer-state:ames
=- ?>(?=(%known -<) ->)
!< ship-state:ames
=< q
%- need %- need
%- scry:(ames-gate now eny roof)
[~ %x [[our %$ da+now] /peers/(scot %p her)]]
::
++ gall-scry-nonce
|= $: =gall-gate
[now=@da eny=@ =roof]
our=ship
=dude:gall
sub=[=ship =term =wire]
==
^- @ud
!< @ud
=< q
%- need %- need
%- scry:(gall-gate now eny roof)
[~ %n [[our dude da+now] [(scot %p ship.sub) [term wire]:sub]]]
::
++ load-agent
|= [=ship =gall-gate =dude:gall =agent:gall]
=^ * gall-gate
(gall-call gall-gate ~[/jolt] [%jolt %base dude] *roof)
=^ * gall-gate
=/ =sign-arvo
:+ %clay %writ
`[[%a da+~1111.1.1 %base] /app/[dude]/hoon vase+!>(!>(agent))]
%: gall-take
gall-gate
/sys/cor/[dude]/(scot %p ship)/base/(scot %da ~1111.1.1)
~[/jolt]
sign-arvo
*roof
==
gall-gate
--

View File

@ -0,0 +1,36 @@
/+ default-agent, verb, dbug
::
=| state=~
%- agent:dbug
%+ verb &
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-poke
|= [=mark =vase]
(on-poke:def +<)
::
++ on-watch
|= =path
`this
::
++ on-agent
|= [=wire =sign:agent:gall]
(on-agent:def +<)
::
++ on-fail
|= [=term =tang]
(mean ':pub +on-fail' term tang)
::
++ on-leave
|= =path
`this
::
++ on-init `this
++ on-save !>(state)
++ on-load |=(old=vase `this(state !<(_state old)))
++ on-arvo on-arvo:def
++ on-peek on-peek:def
--

View File

@ -0,0 +1,47 @@
/+ default-agent, verb, dbug
::
=| state=~
%- agent:dbug
%+ verb &
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-poke
|= [=mark =vase]
=+ !<(=ship vase)
:_ this
?+ mark !!
%leave [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %leave ~]~
%watch [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~
==
::
++ on-watch
|= =path
(on-watch:def +<)
::
++ on-agent
|= [=wire =sign:agent:gall]
=/ =ship (slav %p &2.wire)
?+ -.sign !!
%fact `this
%watch-ack `this
%kick
[[%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~ this]
==
::
++ on-fail
|= [=term =tang]
(mean ':sub +on-fail' term tang)
::
++ on-leave
|= =path
`this
::
++ on-init `this
++ on-save !>(state)
++ on-load |=(old=vase `this(state !<(_state old)))
++ on-arvo on-arvo:def
++ on-peek on-peek:def
--

View File

@ -0,0 +1,12 @@
/- *aquarium
|_ af=aqua-effect
++ grad %noun
++ grow
|%
++ noun af
--
++ grab
|%
++ noun aqua-effect
--
--

View File

@ -1,21 +0,0 @@
::
:::: /hoon/css/mar
::
/? 310
=, eyre
=, mimes:html
|_ mud=@t
++ grow :: convert to
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
++ elem ;style :: convert to %hymn
;- (trip mud)
==
++ hymn ;html:(head:"{elem}" body)
--
++ grab
|% :: convert from
++ mime |=([p=mite q=octs] (@t q.q))
++ noun @t :: clam from %noun
--
++ grad %mime
--

1
pkg/arvo/mar/css.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/css.hoon

View File

@ -8,5 +8,14 @@
++ grab
|%
+$ noun [ship binding]
++ json
=, dejs:format
|= jon=json
%. jon
%- ot
:~ [%ship |=(j=json ?>(?=([%s *] j) (rash +.j fed:ag)))]
[%address |=(j=json ?>(?=([%s *] j) [%if (rash +.j ip4:eyre)]))]
[%turf (ar so)]
==
--
--

View File

@ -0,0 +1,16 @@
/- *dns
|_ r=request
++ grad %noun
++ grow
|%
++ json
%- pairs:enjs:format
:~ ['ship' (ship:enjs:format ship.r)]
['address' s+(rsh 3 (scot %if +.address.r))]
==
--
++ grab
|%
++ noun request
--
--

View File

@ -7,6 +7,7 @@
+$ owners (jug owner ship)
+$ sponsors (map ship [residents=(set ship) requests=(set ship)])
+$ history (map address:ethereum (tree hist-tx))
+$ events (list event-log:rpc:ethereum)
+$ net ?(%mainnet %ropsten %local %default)
+$ snap-state [%0 =id:block:jael nas=^state:naive =owners =sponsors]
::

View File

@ -351,6 +351,7 @@
:: %hear: packet from unix
:: %heed: track peer's responsiveness; gives %clog if slow
:: %jilt: stop tracking peer's responsiveness
:: %cork: request to delete message flow
:: %plea: request to send message
::
:: System and Lifecycle Tasks
@ -367,6 +368,7 @@
$% [%hear =lane =blob]
[%heed =ship]
[%jilt =ship]
[%cork =ship]
$>(%plea vane-task)
::
$>(%born vane-task)
@ -511,6 +513,9 @@
:: entry and emit a nack to the local vane that asked us to send
:: the message.
:: heeds: listeners for %clog notifications
:: closing: bones closed on the sender side
:: corked: bones closed on both sender and receiver
:: krocs: bones that need to be sent again to the publisher
::
+$ peer-state
$: $: =symmetric-key
@ -526,6 +531,9 @@
rcv=(map bone message-sink-state)
nax=(set [=bone =message-num])
heeds=(set duct)
closing=(set bone)
corked=(set bone)
krocs=(set bone)
==
:: $qos: quality of service; how is our connection to a peer doing?
::
@ -1651,15 +1659,18 @@
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
[%nuke =dude] :: delete agent
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
[%rake dude=(unit dude) all=?] :: reclaim old subs
$>(%init vane-task) :: set owner
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
$>(%plea vane-task) :: network request
[%spew veb=(list verb)] :: set verbosity
[%sift dudes=(list dude)] :: per agent
== ::
+$ bitt (map duct (pair ship path)) :: incoming subs
+$ boat :: outgoing subs
%+ map [=wire =ship =term] ::
[acked=? =path] ::
+$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs
+$ boar (map [=wire =ship =term] nonce=@) :: and their nonces
+$ bowl :: standard app state
$: $: our=ship :: host
src=ship :: guest
@ -1695,6 +1706,9 @@
$% [%raw-fact =mark =noun]
sign:agent
==
:: TODO: add more flags?
::
+$ verb ?(%odd)
::
:: +agent: app core
::

File diff suppressed because it is too large Load Diff

View File

@ -45,161 +45,112 @@
|= [[now=@da =duct] state=behn-state]
::
|%
:: %entry-points
::
:: +born: urbit restarted; refresh :next-wake and store wakeup timer duct
+| %helpers
::
++ born set-unix-wake(next-wake.state ~, unix-duct.state duct)
:: +crud: handle failure of previous arvo event
::
++ crud
|= [tag=@tas error=tang]
++ this .
++ emit |=(m=move this(moves [m moves]))
++ abet
^+ [moves state]
:: behn must get activated before other vanes in a %wake
:: moves are statefully pre-flopped to ensure that
:: any prepended %doze is emitted first
::
?. =(%wake tag)
~& %behn-crud-not-wake^tag
[[duct %slip %d %flog %crud tag error]~ state]
=. moves (flop moves)
=/ new=(unit @da) (bind (pry:timer-map timers.state) head)
:: emit %doze if needed
::
?: =(~ timers.state)
~|(%behn-crud-no-timer^tag^error !!)
=? ..this
?~ unix-duct.state |
=/ dif=[old=(unit @da) new=(unit @da)] [next-wake.state new]
?+ dif ~|([%unpossible dif] !!)
[~ ~] | :: no-op
[~ ^] & :: set
[^ ~] & :: clear
[^ ^] !=(u.old.dif u.new.dif) :: set if changed
==
(emit(next-wake.state new) [unix-duct.state %give %doze new])
::
(wake `error)
:: +rest: cancel the timer at :date, then adjust unix wakeup
:: +wait: set a new timer at :date, then adjust unix wakeup
[moves state]
::
++ rest |=(date=@da set-unix-wake(timers.state (unset-timer [date duct])))
++ wait |=(date=@da set-unix-wake(timers.state (set-timer [date duct])))
:: +huck: give back immediately
+| %entry-points
::
:: Useful if you want to continue working after other moves finish.
++ call
|= [=task error=(unit tang)]
^+ this
?: ?& ?=(^ error)
!?=(%wake -.task)
==
:: XX more and better error handling
::
~& %behn-crud-not-wake^-.task
(emit [duct %slip %d %flog %crud -.task u.error])
::
?- -.task
%born this(next-wake.state ~, unix-duct.state duct)
%drip (drip p.task)
%huck (emit [duct %give %heck syn.task])
%rest this(timers.state (unset-timer [p.task duct]))
%trim this
%vega this
%wait this(timers.state (set-timer [p.task duct]))
%wake (wake(next-wake.state ~) error)
==
::
++ huck
|= syn=sign-arvo
=< [moves state]
event-core(moves [duct %give %heck syn]~)
:: +drip: XX
::
++ drip
|= mov=vase
=< [moves state]
^+ event-core
=. moves
[duct %pass /drip/(scot %ud count.drips.state) %b %wait +(now)]~
=. movs.drips.state
(~(put by movs.drips.state) count.drips.state mov)
=. count.drips.state +(count.drips.state)
event-core
:: +take-drip: XX
:: +take-drip: the future is now, %give the deferred move
::
++ take-drip
|= [num=@ud error=(unit tang)]
=< [moves state]
^+ event-core
^+ this
=/ drip (~(got by movs.drips.state) num)
=. movs.drips.state (~(del by movs.drips.state) num)
=/ =move
=/ card [%give %meta drip]
?~ error
[duct card]
=/ =tang
(weld u.error `tang`[leaf/"drip failed" ~])
:: XX should be
:: [duct %hurl fail/tang card]
::
[duct %pass /drip-slog %d %flog %crud %drip-fail tang]
event-core(moves [move moves])
:: +trim: in response to memory pressue
%- emit(movs.drips.state (~(del by movs.drips.state) num))
=/ card [%give %meta drip]
?~ error
[duct card]
=/ =tang
(weld u.error `tang`[leaf/"drip failed" ~])
:: XX should be
:: [duct %hurl fail/tang card]
::
[duct %pass /drip-slog %d %flog %crud %drip-fail tang]
::
++ trim [moves state]
:: +vega: learn of a kernel upgrade
+| %tasks
::
++ vega [moves state]
:: +wake: unix says wake up; process the elapsed timer and set :next-wake
:: +drip: enqueue a future gift (as a vase), %pass ourselves a %wait
::
++ drip
|= vax=vase
^+ this
%. [duct %pass /drip/(scot %ud count.drips.state) %b %wait +(now)]
%= emit
movs.drips.state (~(put by movs.drips.state) count.drips.state vax)
count.drips.state +(count.drips.state)
==
::
:: +wake: unix says wake up; process the elapsed timer (or forward error)
::
++ wake
|= error=(unit tang)
^+ [moves state]
:: no-op on spurious but innocuous unix wakeups
::
^+ this
?: =(~ timers.state)
:: no-op on spurious but innocuous unix wakeups
::
~? ?=(^ error) %behn-wake-no-timer^u.error
[moves state]
:: if we errored, pop the timer and notify the client vane of the error
::
?^ error
=< set-unix-wake
=^ =timer timers.state pop-timer
(emit-vane-wake duct.timer error)
:: if unix woke us too early, retry by resetting the unix wakeup timer
::
this
=/ [=timer later-timers=_timers.state] pop-timer
?: (gth date.timer now)
set-unix-wake(next-wake.state ~)
:: pop first timer, tell vane it has elapsed, and adjust next unix wakeup
:: no-op if timer is early, (+abet will reset)
::
this
:: pop the first timer and notify client vane,
:: forwarding error if present
::
=< set-unix-wake
(emit-vane-wake(timers.state later-timers) duct.timer ~)
:: %utilities
:: XX %wake errors should be signaled out-of-band
:: [duct.timer %hurl goof %give %wake ~]
::
(emit(timers.state later-timers) [duct.timer %give %wake error])
::
::+|
+| %implementation
::
++ event-core .
:: +emit-vane-wake: produce a move to wake a vane; assumes no prior moves
::
++ emit-vane-wake
|= [=^duct error=(unit tang)]
event-core(moves [duct %give %wake error]~)
:: +emit-doze: set new unix wakeup timer in state and emit move to unix
::
:: We prepend the unix %doze event so that it is handled first. Arvo must
:: handle this first because the moves %behn emits will get handled in
:: depth-first order. If we're handling a %wake which causes a move to a
:: different vane and a %doze event to send to unix, Arvo needs to process
:: the %doze first because otherwise if the move to the other vane calls
:: back into %behn and emits a second %doze, the second %doze would be
:: handled by unix first which is incorrect.
::
++ emit-doze
|= =date=(unit @da)
^+ event-core
:: no-op if .unix-duct has not yet been set
::
?~ unix-duct.state
event-core
:: make sure we don't try to wake up in the past
::
=? date-unit ?=(^ date-unit) `(max now u.date-unit)
::
%_ event-core
next-wake.state date-unit
moves [[unix-duct.state %give %doze date-unit] moves]
==
:: +set-unix-wake: set or unset next unix wakeup timer based on :i.timers
::
++ set-unix-wake
=< [moves state]
~% %set-unix-wake ..part ~ |-
^+ event-core
::
=* next-wake next-wake.state
=* timers timers.state
:: if no timers, cancel existing wakeup timer or no-op
::
=/ first=(unit [date=@da *]) (pry:timer-map timers.state)
?~ first
?~ next-wake
event-core
(emit-doze ~)
:: if :next-wake is in the past or not soon enough, reset it
::
?^ next-wake
?: &((gte date.u.first u.next-wake) (lte now u.next-wake))
event-core
(emit-doze `date.u.first)
:: there was no unix wakeup timer; set one
::
(emit-doze `date.u.first)
:: +pop-timer: dequeue and produce earliest timer
::
++ pop-timer
@ -267,27 +218,10 @@
wrapped-task=(hobo task)
==
^- [(list move) _behn-gate]
::
=/ =task ((harden task) wrapped-task)
=/ event-core (per-event [now hen] state)
::
=^ moves state
::
:: handle error notifications
::
?^ dud
(crud:event-core -.task tang.u.dud)
::
?- -.task
%born born:event-core
%rest (rest:event-core date=p.task)
%drip (drip:event-core move=p.task)
%huck (huck:event-core syn.task)
%trim trim:event-core
%vega vega:event-core
%wait (wait:event-core date=p.task)
%wake (wake:event-core error=~)
==
abet:(call:event-core task ?~(dud ~ `tang.u.dud))
[moves behn-gate]
:: +load: migrate an old state to a new behn version
::
@ -378,6 +312,6 @@
?> ?=([%drip @ ~] tea)
=/ event-core (per-event [now hen] state)
=^ moves state
(take-drip:event-core (slav %ud i.t.tea) error.hin)
abet:(take-drip:event-core (slav %ud i.t.tea) error.hin)
[moves behn-gate]
--

View File

@ -251,7 +251,7 @@
;meta(charset "utf-8");
;meta(name "viewport", content "width=device-width, initial-scale=1, shrink-to-fit=no");
;link(rel "icon", type "image/svg+xml", href (weld "data:image/svg+xml;utf8," favicon));
;title:"OS1"
;title:"Urbit"
;style:'''
@import url("https://rsms.me/inter/inter.css");
@font-face {
@ -2178,7 +2178,7 @@
:: XX cancel active too if =(0 trim-priority) ?
::
?: ?=(%trim -.task)
=/ event-args [[eny duct now rof] server-state.ax]
=* event-args [[eny duct now rof] server-state.ax]
=* by-channel by-channel:(per-server-event event-args)
=* channel-state channel-state.server-state.ax
::

File diff suppressed because it is too large Load Diff

View File

@ -306,28 +306,6 @@
%^ poke-watch hen %azimuth
%+ fall node.tac
(need (de-purl:html 'http://eth-mainnet.urbit.org:8545'))
=. +>.$
:: get everything from /app/azimuth because jael subscriptions
:: seem to be flaky for now
::
?: &
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
::
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
::
*
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen now pki etn)
(silt (turn spon-points head))
[%| %azimuth]
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%& (need spon-ship)])
==
::
=. moz
%+ weld moz
@ -391,7 +369,7 @@
:: [%listen whos=(set ship) =source]
::
%listen
~& [%jael-listen whos source]:tac
:: %- (slog leaf+"jael: listen {<whos.tac>} {<source.tac>}" ~)
%- curd =< abet
(sources:~(feel su hen now pki etn) [whos source]:tac)
::

View File

@ -0,0 +1,15 @@
/- spider, *dice
/+ strand, strandio, naive, dice
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=/ url=tape
?~ lur=!<((unit tape) arg)
"https://bootstrap.urbit.org/mainnet.azimuth-snapshot"
u.lur
;< =cord bind:m (fetch-cord:strandio url)
=+ ;;(snap=snap-state (cue cord))
;< ~ bind:m (poke-our:strandio %azimuth %azimuth-poke !>([%load snap]))
(pure:m !>(~))

View File

@ -25,17 +25,17 @@
|= if=@if
=/ m (strand ,~)
^- form:m
=/ collector-app `dock`[~zod %dns-collector]
=/ collector-app `dock`[~deg %dns-collector]
;< good=? bind:m (self-check-http:libdns |+if 2)
?. good
%+ strand-fail:strandio %bail-early-self-check
[>"couldn't access ship on port 80"< ~]
;< our=@p bind:m get-our:strandio
;< ~ bind:m (watch:strandio /response collector-app /(scot %p our))
;< ~ bind:m (poke:strandio collector-app %dns-address !>([%if if]))
=/ msg=cord
(cat 3 'request for DNS sent to ' (scot %p p:collector-app))
;< ~ bind:m (app-message:strandio %dns msg ~)
;< our=@p bind:m get-our:strandio
;< ~ bind:m (watch:strandio /sub collector-app /(scot %p our))
=/ msg=cord
(cat 3 'awaiting response from ' (scot %p p:collector-app))
;< ~ bind:m (app-message:strandio %dns msg ~)
@ -45,7 +45,7 @@
=/ m (strand ,~)
^- form:m
;< our=ship bind:m get-our:strandio
;< =cage bind:m (take-fact:strandio /(scot %p our))
;< =cage bind:m (take-fact:strandio /response)
?> ?=(%dns-binding p.cage)
=/ =binding:dns !<(binding:dns q.cage)
;< good=? bind:m (turf-confirm-install:libdns turf.binding)

View File

@ -1,21 +1,33 @@
:: Test that these hints do not crash the runtime
:: there is no need to include the hints for dynamic %bout
:: there is no need to include a test for dynamic %bout
:: since all hoon tests exersize dynamic %bout
|%
:: these test that the hilt-trace hints
:: test that these trace hints
:: are safe to run or ignore
++ test-hela-hilt
++ test-hilt-hela
~> %hela
~
++ test-nara-hilt
++ test-hint-hela
~> %hela.[1 leaf+"test-hint-hela ~"]
~
++ test-hilt-nara
~> %nara
~
:: these test that the hint-trace hints
:: are safe to run or ignore
++ test-hela-hint
~> %hela.[1 leaf+"test-hela-trace-hint"]
++ test-hint-nara
~> %nara.[1 leaf+"test-hint-nara ~"]
~
++ test-nara-hint
~> %nara.[1 leaf+"test-nara-trace-hint"]
:: test that theses bytecode-report hints
:: are safe to run or ignore
++ test-hilt-xray
~> %xray
~
++ test-hint-xray
~> %xray.[1 leaf+"test-hint-xray ~"]
~
:: test that the hilt bout hint
:: is safe to run or ignore
++ test-hilt-bout
~> %bout
~
--

504
pkg/arvo/tests/sys/grq.hoon Normal file
View File

@ -0,0 +1,504 @@
:: test gall subscription nonce incrementation and ames flow killing
::
/+ *test, v=test-ames-gall
|%
++ test-watch
%- run-chain
|. :- %|
=+ nec-bud:v
:: uncomment to turn on verbose debug output
::=^ * ames.nec
:: (ames-call:v ames.nec ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
::=^ * ames.bud
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
:: poke %sub to tell it to subscribe
=/ =task:gall [%deal [~nec ~nec] %sub %poke watch+!>(~bud)]
=^ t1 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.1 0xdead.beef *roof]
[~[/foo] task]
:~ :- ~[/foo] [%give %unto %poke-ack ~]
:- ~[/init]
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
[%g %deal [~nec ~bud] %pub %watch /foo]
== ==
==
:- t1 |. :- %|
:: handle gall passing the %watch to itself, which passes to ames
=^ t2 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.1 0xdead.beef *roof]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%deal [~nec ~bud] %pub %watch /foo]
:~ :- ~[/init] [%pass /sys/lag %a %heed ~bud]
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
==
==
:- t2 |. :- %|
:: subscriber ames handles %plea from gall, gives a packet to vere
=^ t3 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
:- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%plea ~bud %g /ge/pub [%0 %s /foo]]
:~ :- ~[//unix]
:* %give %send [%& ~bud]
0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
8a00.0200.0132.8fd4.f000
==
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.1..00.00.01]
==
==
:- t3 |. :- %|
:: publisher ames hears %watch, passes to gall
=^ t4 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.2 0xbeef.dead *roof]
:- ~[//unix]
:* %hear [%& ~nec]
0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
8a00.0200.0132.8fd4.f000
==
:~ :- ~[//unix] [%pass /qos %d %flog %text "; ~nec is your neighbor"]
:- ~[//unix]
[%pass /bone/~nec/0/1 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
==
==
:- t4 |. :- %|
:: publisher gall hears %watch from ames, passes to itself
=^ t5 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
:- ~[/bone/~nec/0/1 //unix]
[%plea ~nec %g /ge/pub [%0 %s /foo]]
:~ :- ~[/init] [%pass /sys/lag %a %heed ~nec]
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
:- ~[/bone/~nec/0/1 //unix]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
==
==
:- t5 |. :- %|
:: publisher gall runs %pub with %watch, gives ack to itself
=^ t6 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
:- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
[%deal [~nec ~bud] %pub %watch /foo]
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
[%give %unto %watch-ack ~]
==
==
:- t6 |. :- %|
:: gall gives ack to ames
=^ t7 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
:+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
[%gall %unto %watch-ack ~]
:~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
==
==
:- t7 |. :- %|
:: publisher ames hears ack from gall, sends over the network
=^ t8 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.2 0xbeef.dead *roof]
:+ /bone/~nec/0/1 ~[//unix]
[%gall %done ~]
:~ :- ~[//unix]
:* %give %send [%& ~nec]
0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
2d9d.076e.6d00.0100.0223.9ae9.5000
== ==
==
:- t8 |. :- %|
:: subscriber ames hears watch-ack packet, gives to gall
=^ t9 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.3 0xdead.beef *roof]
:- ~[//unix]
:* %hear [%& ~bud]
0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
2d9d.076e.6d00.0100.0223.9ae9.5000
==
:~ :- ~[//unix] [%pass /qos %d %flog %text "; ~bud is your neighbor"]
:- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%give %done ~]
:- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.01]
==
==
:- t9 |. :- %|
:: gall gives %done to itself
=^ t10 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.3 0xdead.beef *roof]
:+ /sys/way/~bud/pub
~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%ames %done ~]
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%give %unto %watch-ack ~]
==
==
:- t10 |. :- %|
:: gall gives watch-ack to itself
=^ t11 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.3 0xdead.beef *roof]
:+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
~[/init]
[%gall %unto %watch-ack ~]
~
==
:- t11 |. :- %|
:: start the clog and kick process; give clog to publisher gall
=^ t12 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.4 0xbeef.dead *roof]
:+ /sys/lag ~[/init]
[%ames %clog ~nec]
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
[%give %unto %kick ~]
==
==
:- t12 |. :- %|
:: gall gives %kick %boon to ames
=^ t13 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.4 0xbeef.dead *roof]
:+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
[%gall %unto %kick ~]
:~ :- ~[/bone/~nec/0/1 //unix] [%give %boon %x ~]
==
==
:- t13 |. :- %|
:: ames gives kick over the network
=^ t14 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.4 0xbeef.dead *roof]
:+ /bone/~nec/0/1 ~[//unix]
[%gall %boon %x ~]
:~ :- ~[//unix]
:* %give %send [%& ~nec]
0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
4ca0.801d.3ddc.d400.0100.0223.bc18.1000
==
:- ~[/ames] [%pass /pump/~nec/1 %b %wait ~1111.1.4..00.00.01]
==
==
:- t14 |. :- %|
:: subscriber ames receives kick, gives to gall and gives ack to unix
=^ t15 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
:- ~[//unix]
:* %hear [%& ~bud]
0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
4ca0.801d.3ddc.d400.0100.0223.bc18.1000
==
:~ :- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%give %boon %x ~]
:- ~[//unix]
:* %give %send [%& ~bud]
0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
9de0.3906.b678.6e00.0200.0132.e55d.5000
== ==
==
:- t15 |. :- %|
:: subscriber gall receives kick %boon from ames, gives to self
=^ t16 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.5 0xdead.beef *roof]
:+ /sys/way/~bud/pub
~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%ames %boon %x ~]
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%give %unto %kick ~]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%pass /sys/way/~bud/pub %a %cork ~bud]
==
==
:: subscriber gall receives %kick from itself
=^ t17 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.5 0xdead.beef *roof]
:+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
~[/init]
[%gall %unto %kick ~]
:~ :- ~[/init]
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
[%g %deal [~nec ~bud] %pub %watch /foo]
== ==
==
:- t17 |. :- %|
:: gall receives %deal %watch from itself, passes to ames
=^ t18 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.5 0xdead.beef *roof]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
[%deal [~nec ~bud] %pub %watch /foo]
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
==
==
:- t18 |. :- %|
:: subscriber ames sends new %watch
=^ t19 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
:- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
/init
==
[%plea ~bud %g /ge/pub [%0 %s /foo]]
:~ :- ~[//unix]
:* %give %send [%& ~bud]
0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
==
:- ~[/ames] [%pass /pump/~bud/4 %b %wait ~1111.1.5..00.00.01]
==
==
:- t19 |. :- %|
:: subscriber ames sends %cork
=^ t20 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
:- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%cork ~bud]
:~ :- ~[//unix]
:* %give %send [%& ~bud]
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
==
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.5..00.02.00]
==
==
:: publisher ames hears %kick ack
:- t20 |. :- %|
=^ t21 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.6 0xbeef.dead *roof]
:- ~[//unix]
:* %hear [%& ~nec]
0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
9de0.3906.b678.6e00.0200.0132.e55d.5000
==
:~ :- ~[/ames] [%pass /pump/~nec/1 %b %rest ~1111.1.4..00.00.01]
==
==
:: publisher ames hears new %watch
:- t21 |. :- %|
=^ t22 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.7 0xbeef.dead *roof]
:- ~[//unix]
:* %hear [%& ~nec]
0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
==
:~ :- ~[//unix]
[%pass /bone/~nec/0/5 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
==
==
:: publisher gall hears new %watch, passes to self
:- t22 |. :- %|
=^ t23 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.7 0xbeef.dead *roof]
:- ~[/bone/~nec/0/5 //unix]
[%plea ~nec %g /ge/pub [%0 %s /foo]]
:~ :- ~[/bone/~nec/0/5 //unix]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
==
==
:: publisher gall runs :pub's +on-watch, gives ack to self
:- t23 |. :- %|
=^ t24 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.7 0xbeef.dead *roof]
:- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
[%deal [~nec ~bud] %pub %watch /foo]
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
[%give %unto %watch-ack ~]
==
==
:: publisher gall hears %watch-ack, gives to ames
:- t24 |. :- %|
=^ t25 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.7 0xbeef.dead *roof]
:+ /sys/req/~nec/pub ~[/bone/~nec/0/5 //unix]
[%gall %unto %watch-ack ~]
:~ :- ~[/bone/~nec/0/5 //unix] [%give %done ~]
==
==
:: publisher ames hears done from gall, sends over the network
:- t25 |. :- %|
=^ t26 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.7 0xbeef.dead *roof]
:+ /bone/~nec/0/5 ~[//unix]
[%gall %done ~]
:~ :- ~[//unix]
:* %give %send [%& ~nec]
0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
49f4.4848.bfa6.f600.0100.0223.c98c.8800
== ==
==
:: publisher ames hears %cork, passes to itself
:- t26 |. :- %|
=^ t27 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.8 0xbeef.dead *roof]
:- ~[//unix]
:* %hear [%& ~nec]
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
==
:~ :- ~[//unix] [%pass /bone/~nec/0/1 %a %plea ~nec [%a /close ~]]
==
==
:- t27 |. :- %|
:: publisher ames hear cork plea from self, give %done to self
=^ t28 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.8 0xbeef.dead *roof]
:- ~[/bone/~nec/0/1 //unix]
[%plea ~nec [%a /close ~]]
:~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
==
==
:: publisher ames hears cork done from self, sends ack packet
:- t28 |. :- %|
=^ t29 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.8 0xbeef.dead *roof]
:+ /bone/~nec/0/1
~[//unix]
[%ames %done ~]
:~ :- ~[//unix]
:* %give %send [%& ~nec]
0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
== ==
==
:: subscriber ames hears %watch-ack, gives to gall
:- t29 |. :- %|
=^ t30 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.9 0xdead.beef *roof]
:- ~[//unix]
:* %hear [%& ~bud]
0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
49f4.4848.bfa6.f600.0100.0223.c98c.8800
==
:~ :- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
/init
==
[%give %done ~]
:- ~[/ames] [%pass /pump/~bud/4 %b %rest ~1111.1.5..00.00.01]
==
==
:: subscriber gall hears new %watch-ack from ames, gives to self
:- t30 |. :- %|
=^ t31 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.9 0xdead.beef *roof]
:+ /sys/way/~bud/pub
:~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
/init
==
[%ames %done ~]
:~ :- :~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
/init
==
[%give %unto %watch-ack ~]
==
==
:: subscriber gall hears new %watch-ack from self, tells :sub
:- t31 |. :- %|
=^ t32 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.9 0xdead.beef *roof]
:+ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
~[/init]
[%gall %unto %watch-ack ~]
~
==
:: subscriber ames hears %cork ack
:- t32 |. :- %|
=^ t33 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.10 0xdead.beef *roof]
:- ~[//unix]
:* %hear [%& ~bud]
0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
==
:~ :- :~ /sys/way/~bud/pub
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%give %done ~]
:- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.5..00.02.00]
==
==
:: subscriber gall hears %cork ack from ames
:- t33 |. :- %|
=^ t34 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.10 0xdead.beef *roof]
:+ /sys/way/~bud/pub
:~ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
/init
==
[%ames %done ~]
~
==
:- t34 |. :- %&
;: weld
%+ expect-eq
!> (sy 0 ~)
!> =< corked
%: ames-scry-peer:v
ames.nec
[~1111.1.10 0xdead.beef *roof]
[~nec ~bud]
==
::
%+ expect-eq
!> (sy 1 ~)
!> =< corked
%: ames-scry-peer:v
ames.bud
[~1111.1.8 0xbeef.dead *roof]
[~bud ~nec]
==
::
%+ expect-eq
!> 2
!> %: gall-scry-nonce:v
gall.nec
[~1111.1.10 0xdead.beef *roof]
~nec %sub
[~bud %pub /sub-foo/~bud]
==
==
--

View File

@ -353,10 +353,14 @@
!> [~[/g/talk] %give %boon [%post 'first1']]
!> (snag 0 `(list move:ames)`moves6)
==
:: +test-comet-message-flow: galaxy<->comet comms
::
:: same as test-message-flow, but ~nec will send a sendkeys packet to
:: request comet's self-attestation directly
::
++ test-comet-message-flow ^- tang
:: same as test-message-flow, but ~nec will send a sendkeys packet to request
:: comet's self-attestation directly
::=^ * nec (call nec ~[//nemo] %spew ~[%snd %rcv %odd %msg])
::=^ * comet (call comet ~[//nemo] %spew ~[%snd %rcv %odd %msg])
::
=^ moves0 nec (call nec ~[/g/talk] %plea our-comet %g /talk [%get %post])
=^ moves1 comet (call comet ~[//unix] %hear (snag-packet 0 moves0))
@ -371,27 +375,34 @@
:^ comet /public-keys ~[//unix]
^- sign:ames
[%jael %public-keys %full [n=[~nec point] ~ ~]]
:: give comet's self-attestation to ~nec; at this point, we have established
:: a channel, and can proceed as usual
:: give comet's self-attestation to ~nec; at this point, we have
:: established a channel, and can proceed as usual
::
=/ post [%post 'first1!!']
=^ moves3 nec (call nec ~[//unix] %hear (snag-packet 0 moves2))
%+ weld
%- expect-fail |.
(call nec ~[//unix] %hear (snag-packet 1 moves2))
::
=^ moves4 comet (call comet ~[//unix] %hear (snag-packet 0 moves3))
=^ moves5 comet (take comet /bone/~nec/0/1 ~[//unix] %g %done ~)
=^ moves5 comet (take comet /bone/~nec/1/1 ~[//unix] %g %done ~)
=^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5))
=^ moves7 comet (take comet /bone/~nec/0/1 ~[//unix] %g %boon [%post 'first1!!'])
=^ moves7 comet (take comet /bone/~nec/1/1 ~[//unix] %g %boon post)
=^ moves8 nec (call nec ~[//unix] %hear (snag-packet 0 moves7))
::
;: weld
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
!> =- [~[//unix] %pass /qos %d %flog %text -]
"; ~nec is your neighbor"
!> (snag 0 `(list move:ames)`moves4)
::
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
!> =- [~[//unix] %pass /qos %d %flog %text -]
"; {<our-comet>} is your neighbor"
!> (snag 0 `(list move:ames)`moves6)
::
%+ expect-eq
!> [~[/g/talk] %give %boon [%post 'first1!!']]
!> [~[/g/talk] %give %boon post]
!> (snag 0 `(list move:ames)`moves8)
==
::

View File

@ -0,0 +1,234 @@
/+ *test
/= behn-raw /sys/vane/behn
=/ behn-gate (behn-raw ~bus)
=/ scry *roof
=* move move:behn-gate
::
|%
++ test-wake-no
^- tang
=/ wen ~1111.1.1
=/ arg [~[/vere] [%wake ~]]
-:(call ~ wen arg ~)
::
++ test-wake-no-wait
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%wake ~]]
=/ b-out ~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-wake-no-born
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/foo] [%wait +(wen)]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%wake ~]]
=/ b-out ~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-wake
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate
(call ~ wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/vere] [%wake ~]]
=/ c-out=(list move) [~[/foo] [%give [%wake ~]]]~
=^ c behn-gate (call `%c +(wen) c-arg c-out)
::
:(weld a b c)
::
++ test-born
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/foo] [%wait +(wen)]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%born ~]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-many-ordered
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 3 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-many-ordered-lag
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 3 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e +(wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-many-unordered
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 3 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait +(wen)]]
=/ d-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-same-ordered-lag
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 2 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 3 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-rest
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 3 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%rest (add 2 wen)]]
=/ d-out=(list move) [~[/vere] [%give [%doze `(add 3 wen)]]]~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move) [~[/foo] [%give [%wake ~]]]~
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ call
=| lac=?
|= $: label=(unit @tas)
now=@da
args=[=duct task=(hobo task:behn)]
expected-moves=(list move)
==
=/ behn-core (behn-gate now=now eny=`@`0xdead.beef scry=scry)
=^ moves behn-gate
(call:behn-core duct.args dud=~ task.args)
::
~? !lac moves
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
[?~(label output ?~(output ~ [u.label output])) behn-gate]
--

View File

@ -66,7 +66,7 @@
::
++ rest
|= p=@da
(arvo %b %wait p)
(arvo %b %rest p)
::
++ warp
|= [wer=ship =riff:clay]

View File

@ -11,7 +11,7 @@
|%
++ prefixes
^- (map network tape)
(my [[%main "bc"] [%testnet "tb"] ~])
(my [[%main "bc"] [%testnet "tb"] [%regtest "bcrt"] ~])
++ charset "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
+$ raw-decoded [hrp=tape data=(list @) checksum=(list @)]
:: below is a port of: https://github.com/bitcoinjs/bech32/blob/master/index.js

View File

@ -56,6 +56,8 @@
1^0x0
%testnet
1^0x1
%regtest
1^0x1
==
:- (cat:byt ~[1^typ pubkey.h])
%- cat:byt

View File

@ -433,7 +433,6 @@
%- pure:m
?~ full-file.client-response ''
q.data.u.full-file.client-response
::
++ fetch-cord
|= url=tape

View File

@ -38,7 +38,37 @@
=/ b (mule a)
?- -.b
%| ~
%& [leaf+"expected failure - succeeded" ~]
%& ['expected failure - succeeded' ~]
==
:: +expect-runs: kicks a trap, expecting success; returns trace on failure
::
++ expect-success
|= a=(trap)
^- tang
=/ b (mule a)
?- -.b
%& ~
%| ['expected success - failed' p.b]
==
:: $test-chain: a sequence of tests to be run
::
+$ test-chain
$_
|?
?: =(0 0)
[%& p=*tang]
[%| p=[tang=*tang next=^?(..$)]]
:: +run-chain: run a sequence of tests, stopping at first failure
::
++ run-chain
|= seq=test-chain
^- tang
=/ res $:seq
?- -.res
%& p.res
%| ?. =(~ tang.p.res)
tang.p.res
$(seq next.p.res)
==
:: +category: prepends a name to an error result; passes successes unchanged
::

21
pkg/base-dev/mar/css.hoon Normal file
View File

@ -0,0 +1,21 @@
::
:::: /hoon/css/mar
::
/? 310
=, eyre
=, mimes:html
|_ mud=@t
++ grow :: convert to
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
++ elem ;style :: convert to %hymn
;- (trip mud)
==
++ hymn ;html:(head:"{elem}" body)
--
++ grab
|% :: convert from
++ mime |=([p=mite q=octs] (@t q.q))
++ noun @t :: clam from %noun
--
++ grad %mime
--

View File

@ -4,7 +4,7 @@
:: chyg: whether account is (non-)change. 0 or 1
:: bytc: "btc-byts" with dat cast to @ux
|%
+$ network ?(%main %testnet)
+$ network ?(%main %testnet %regtest)
+$ hexb [wid=@ dat=@ux] :: hex byts
+$ bits [wid=@ dat=@ub]
+$ xpub @ta

View File

@ -169,12 +169,17 @@
%+ req-card act
^- action:rpc-types
?- -.act
%address-info [%get-address-info address.act]
%tx-info [%get-tx-vals txid.act]
%raw-tx [%get-raw-tx txid.act]
%broadcast-tx [%broadcast-tx rawtx.act]
%ping [%get-block-info ~]
%block-info [%get-block-info block.act]
%address-info [%get-address-info address.act]
%tx-info [%get-tx-vals txid.act]
%raw-tx [%get-raw-tx txid.act]
%broadcast-tx [%broadcast-tx rawtx.act]
%ping [%get-block-info ~]
%block-info [%get-block-info block.act]
%histogram [%get-histogram ~]
%block-headers [%get-block-headers start.act count.act cp.act]
%tx-from-pos [%get-tx-from-pos height.act pos.act merkle.act]
%fee [%get-fee block.act]
%psbt [%update-psbt psbt.act]
==
::
++ req-card
@ -309,6 +314,31 @@
?> ?=([%get-block-info *] r)
:_ state
~[(send-update:hc [%.y %block-info network.host-info +.r] ship)]
::
%histogram
?> ?=([%get-histogram *] r)
:_ state
~[(send-update:hc [%.y %histogram +.r] ship)]
::
%block-headers
?> ?=([%get-block-headers *] r)
:_ state
~[(send-update:hc [%.y %block-headers +.r] ship)]
::
%tx-from-pos
?> ?=([%get-tx-from-pos *] r)
:_ state
~[(send-update:hc [%.y %tx-from-pos +.r] ship)]
::
%fee
?> ?=([%get-fee *] r)
:_ state
~[(send-update:hc [%.y %fee +.r] ship)]
::
%psbt
?> ?=([%update-psbt *] r)
:_ state
~[(send-update:hc [%.y %psbt +.r] ship)]
==
::
++ connection-error

View File

@ -900,7 +900,7 @@
?: =(~ prov) `state
?. =(host:(need prov) src.bowl) `state
?. ?=(%.y -.upd) `state
?- -.p.upd
?+ -.p.upd `state
%address-info
:: located in the helper in Scan Logic to keep all of that unified
::

View File

@ -5,7 +5,7 @@
glob-http+['https://bootstrap.urbit.org/glob-0v3.7b5q1.gn30e.cpfem.abmqg.qh77v.glob' 0v3.7b5q1.gn30e.cpfem.abmqg.qh77v]
image+'https://urbit.ewr1.vultrobjects.com/hastuc-dibtux/2021.8.24..02.57.38-bitcoin.svg'
base+'bitcoin'
version+[0 0 1]
version+[0 0 2]
license+'MIT'
website+'https://tlon.io'
==

View File

@ -74,6 +74,7 @@
:- ?- network
%main 1^0x0
%testnet 1^0x6f
%regtest 1^0x6f
==
~[(hash-160:bcu pubkey)]
::
@ -84,6 +85,7 @@
:~ ?- network
%main 1^0x5
%testnet 1^0xc4
%regtest 1^0xc4
==
%- hash-160:bcu
(cat:byt:bcu ~[2^0x14 (hash-160:bcu pubkey)])
@ -109,7 +111,8 @@
++ is-base58
|= at=tape
^- ?
?| =("m" (scag 1 at))
?| =("n" (scag 1 at))
=("m" (scag 1 at))
=("1" (scag 1 at))
=("3" (scag 1 at))
=("2" (scag 1 at))
@ -120,6 +123,7 @@
^- ?
?| =("bc1" (scag 3 at))
=("tb1" (scag 3 at))
=("bcrt1" (scag 5 at))
==
--
::

View File

@ -423,6 +423,21 @@
::
%get-block-info
[id.res (block-info res.res)]
::
%get-histogram
[id.res ((ar (ar ni)) res.res)]
::
%get-block-headers
[id.res (block-headers res.res)]
::
%get-tx-from-pos
[id.res (tx-from-pos res.res)]
::
%get-fee
[id.res (ne res.res)]
::
%update-psbt
[id.res (so res.res)]
==
::
++ address-info
@ -433,7 +448,7 @@
[%block ni]
==
++ utxo
%- ot
%- ot
:~ ['tx_pos' ni]
['tx_hash' (cu from-cord:hxb:bcu so)]
[%height ni]
@ -474,11 +489,25 @@
[%blockhash (cu from-cord:hxb:bcu so)]
[%blockfilter (cu from-cord:hxb:bcu so)]
==
++ block-headers
%- ot
:~ [%count ni]
[%hex (cu from-cord:hxb:bcu so)]
[%max ni]
[%root (cu:dejs-soft:format from-cord:hxb:bcu so:dejs-soft:format)]
[%branch (ar (cu from-cord:hxb:bcu so))]
==
++ tx-from-pos
%- ot
:~ [%tx-hash (cu from-cord:hxb:bcu so)]
[%merkle (ar (cu from-cord:hxb:bcu so))]
==
--
--
::
++ rpc-action-to-http
|= [endpoint=@t ract=action:rpc-types:bp]
=, enjs:format
|^ ^- request:http
?- -.ract
%get-address-info
@ -510,6 +539,39 @@
?~(block.ract '' (rsh [3 2] (scot %ui u.block.ract)))
%- get-request
(mk-url '/getblockinfo/' param)
::
%get-histogram
%- get-request
(mk-url '/feehistogram' '')
::
%get-block-headers
%+ post-request
%+ mk-url '/blockheaders' ''
%- pairs
:~ [%start (numb start.ract)]
[%count (numb count.ract)]
[%cp (numb (fall cp.ract 0))]
==
::
%get-tx-from-pos
%+ post-request
%+ mk-url '/txfrompos' ''
%- pairs
:~ [%height (numb height.ract)]
[%pos (numb pos.ract)]
[%merkle %b merkle.ract]
==
::
%get-fee
%- get-request
%+ mk-url '/estimatefee/'
%- crip
%+ scow %ud block.ract
::
%update-psbt
%- get-request
%+ mk-url '/updatepsbt/'
%- en:base64:mimes:html [(lent (trip psbt.ract)) psbt.ract]
==
++ mk-url
|= [base=@t params=@t]

View File

@ -33,6 +33,11 @@
[%broadcast-tx rawtx=hexb]
[%ping ~]
[%block-info block=(unit @ud)]
[%histogram ~]
[%block-headers start=@ud count=@ud cp=(unit @ud)]
[%tx-from-pos height=@ud pos=@ud merkle=?]
[%fee block=@ud]
[%psbt psbt=@t]
==
::
+$ result
@ -41,6 +46,11 @@
[%raw-tx txid=hexb rawtx=hexb]
[%broadcast-tx txid=hexb broadcast=? included=?]
[%block-info =network block=@ud fee=(unit sats) blockhash=hexb blockfilter=hexb]
[%histogram hist=(list (list @ud))]
[%block-headers count=@ud hex=hexb max=@ud root=(unit hexb) branch=(list hexb)]
[%tx-from-pos tx-hash=hexb merkle=(list hexb)]
[%fee fee=@rd]
[%psbt psbt=@t]
==
+$ error
$% [%not-connected status=@ud]
@ -64,6 +74,11 @@
[%broadcast-tx rawtx=hexb]
[%get-block-count ~]
[%get-block-info block=(unit @ud)]
[%get-histogram ~]
[%get-block-headers start=@ud count=@ud cp=(unit @ud)]
[%get-tx-from-pos height=@ud pos=@ud merkle=?]
[%get-fee block=@ud]
[%update-psbt psbt=@t]
==
::
+$ result
@ -74,7 +89,11 @@
[%broadcast-tx txid=hexb broadcast=? included=?]
[%get-block-count block=@ud]
[%get-block-info block=@ud fee=(unit sats) blockhash=hexb blockfilter=hexb]
[%get-histogram hist=(list (list @ud))]
[%get-block-headers count=@ud hex=hexb max=@ud root=(unit hexb) branch=(list hexb)]
[%get-tx-from-pos tx-hash=hexb merkle=(list hexb)]
[%get-fee fee=@rd]
[%update-psbt psbt=@t]
==
--
--

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
:~ title+'System'
info+'An app launcher for Urbit.'
color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0v2.p3f6i.19q8d.lsgcb.mckg7.dtu8f.glob' 0v2.p3f6i.19q8d.lsgcb.mckg7.dtu8f]
glob-http+['https://bootstrap.urbit.org/glob-0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk.glob' 0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk]
::glob-ames+~zod^0v0
base+'grid'
version+[1 1 3]
version+[1 1 6]
website+'https://tlon.io'
license+'MIT'
==

1
pkg/garden/mar/css.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/css.hoon

View File

@ -18,7 +18,7 @@
"@radix-ui/react-toggle": "^0.0.10",
"@tlon/sigil-js": "^1.4.4",
"@types/lodash": "^4.14.172",
"@urbit/api": "^2.1.0",
"@urbit/api": "^2.1.1",
"@urbit/http-api": "^2.1.0",
"big-integer": "^1.6.48",
"classnames": "^2.3.1",
@ -1468,9 +1468,9 @@
}
},
"node_modules/@urbit/api": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@urbit/api/-/api-2.1.0.tgz",
"integrity": "sha512-2njwpvZ2s23gp5C4v9uDynU1wxrN33+vloqpvlErUhMR/4R6mXE4cMvsZzj/fCGOa0J3LRV/If7XmgG+kY69Tg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@urbit/api/-/api-2.1.1.tgz",
"integrity": "sha512-QRlqhtJ73q+pgMdSwuOO62HlxA7/2c5ylCcOUT01LXkJ2LTVCl5u+QnejdDvUmqjOuN2PyZk7df30xJVg6rC2A==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"big-integer": "^1.6.48",
@ -8257,9 +8257,9 @@
}
},
"@urbit/api": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@urbit/api/-/api-2.1.0.tgz",
"integrity": "sha512-2njwpvZ2s23gp5C4v9uDynU1wxrN33+vloqpvlErUhMR/4R6mXE4cMvsZzj/fCGOa0J3LRV/If7XmgG+kY69Tg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@urbit/api/-/api-2.1.1.tgz",
"integrity": "sha512-QRlqhtJ73q+pgMdSwuOO62HlxA7/2c5ylCcOUT01LXkJ2LTVCl5u+QnejdDvUmqjOuN2PyZk7df30xJVg6rC2A==",
"requires": {
"@babel/runtime": "^7.16.0",
"big-integer": "^1.6.48",

View File

@ -15,8 +15,8 @@
"tsc": "tsc --noEmit"
},
"dependencies": {
"@radix-ui/react-checkbox": "^0.1.5",
"@fingerprintjs/fingerprintjs": "^3.3.3",
"@radix-ui/react-checkbox": "^0.1.5",
"@radix-ui/react-dialog": "^0.0.20",
"@radix-ui/react-dropdown-menu": "^0.0.23",
"@radix-ui/react-icons": "^1.1.0",
@ -25,7 +25,7 @@
"@radix-ui/react-toggle": "^0.0.10",
"@tlon/sigil-js": "^1.4.4",
"@types/lodash": "^4.14.172",
"@urbit/api": "^2.1.0",
"@urbit/api": "^2.1.1",
"@urbit/http-api": "^2.1.0",
"big-integer": "^1.6.48",
"classnames": "^2.3.1",

View File

@ -72,7 +72,6 @@ export const Leap = React.forwardRef(
useEffect(() => {
const newMatch = getMatch(rawInput);
if (newMatch && rawInput) {
useLeapStore.setState({ selectedMatch: newMatch });
}
@ -112,7 +111,10 @@ export const Leap = React.forwardRef(
const navigateByInput = useCallback(
(input: string) => {
const normalizedValue = input.trim().replace(/(~?[\w^_-]{3,13})\//, '$1/apps/');
const normalizedValue = input
.trim()
.replace('%', '')
.replace(/(~?[\w^_-]{3,13})\//, '$1/apps/$1/');
push(`/leap/${menu}/${normalizedValue}`);
},
[menu]

View File

@ -7,6 +7,7 @@ module.exports = {
// Because we use styled system, and use
// the convention of each prop on a new line
// we probably shouldn't keep this on
'max-lines-per-function': ['off', {}]
'max-lines-per-function': ['off', {}],
'max-lines': ['off', {}]
}
};

View File

@ -1 +1 @@
16.14.0
14.19.0

View File

@ -0,0 +1 @@
nodejs 14.19.0

View File

@ -1,66 +1,71 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
const webpack = require('webpack');
const { execSync } = require('child_process');
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const MomentLocalesPlugin = require("moment-locales-webpack-plugin");
const webpack = require("webpack");
const { execSync } = require("child_process");
const GIT_DESC = execSync('git describe --always', { encoding: 'utf8' }).trim();
const GIT_DESC = execSync("git describe --always", { encoding: "utf8" }).trim();
module.exports = {
mode: 'production',
mode: "production",
entry: {
app: './src/index.tsx',
serviceworker: './src/serviceworker.js'
app: "./src/index.tsx",
serviceworker: "./src/serviceworker.js",
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
use: {
loader: 'babel-loader',
loader: "babel-loader",
options: {
presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'],
presets: [
"@babel/preset-env",
"@babel/typescript",
"@babel/preset-react",
],
plugins: [
'lodash',
'@babel/transform-runtime',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-class-properties'
]
}
"lodash",
"@babel/transform-runtime",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-class-properties",
],
},
},
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light|@tlon\/indigo-react|@urbit\/api)\/).*/
exclude:
/node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light|@tlon\/indigo-react|@urbit\/api)\/).*/,
},
{
test: /\.css$/i,
test: /\.css$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
"style-loader",
// Translates CSS into CommonJS
'css-loader',
"css-loader",
// Compiles Sass to CSS
'sass-loader'
]
"sass-loader",
],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
loader: "file-loader",
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
]
}
]
name: "[name].[ext]",
outputPath: "fonts/",
},
},
],
},
],
},
resolve: {
extensions: ['.js', '.ts', '.tsx']
extensions: [".js", ".ts", ".tsx"],
},
devtool: 'source-map',
devtool: "source-map",
// devServer: {
// contentBase: path.join(__dirname, './'),
// hot: true,
@ -71,26 +76,30 @@ module.exports = {
new MomentLocalesPlugin(),
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.LANDSCAPE_STREAM': JSON.stringify(process.env.LANDSCAPE_STREAM),
'process.env.LANDSCAPE_SHORTHASH': JSON.stringify(GIT_DESC),
'process.env.LANDSCAPE_STORAGE_VERSION': Date.now().toString(),
'process.env.LANDSCAPE_LAST_WIPE': '2021-10-20',
"process.env.LANDSCAPE_STREAM": JSON.stringify(
process.env.LANDSCAPE_STREAM
),
"process.env.LANDSCAPE_SHORTHASH": JSON.stringify(GIT_DESC),
"process.env.LANDSCAPE_STORAGE_VERSION": Date.now().toString(),
"process.env.LANDSCAPE_LAST_WIPE": "2021-10-20",
}),
new HtmlWebpackPlugin({
title: 'Groups',
template: './public/index.html',
favicon: './src/assets/img/Favicon.png'
})
title: "Groups",
template: "./public/index.html",
favicon: "./src/assets/img/favicon.png",
}),
],
output: {
filename: (pathData) => {
return pathData.chunk.name === 'app' ? 'index.[contenthash].js' : '[name].js';
return pathData.chunk.name === "app"
? "index.[contenthash].js"
: "[name].js";
},
path: path.resolve(__dirname, '../dist'),
publicPath: '/apps/landscape/'
path: path.resolve(__dirname, "../dist"),
publicPath: "/apps/landscape/",
},
optimization: {
minimize: true,
usedExports: true
}
usedExports: true,
},
};

File diff suppressed because it is too large Load Diff

View File

@ -5,22 +5,19 @@
"main": "index.js",
"private": true,
"engines": {
"node": "16.14.0"
"node": "14.19.0"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@fingerprintjs/fingerprintjs": "^3.3.3",
"@radix-ui/react-dialog": "^0.1.0",
"@reach/disclosure": "^0.10.5",
"@reach/menu-button": "^0.10.5",
"@reach/tabs": "^0.10.5",
"@react-spring/web": "^9.1.1",
"@tlon/indigo-dark": "^1.0.6",
"@tlon/indigo-light": "^1.0.7",
"@tlon/indigo-react": "^1.2.27",
"@tlon/sigil-js": "^1.4.3",
"@urbit/api": "^2.1.0",
"@urbit/http-api": "^2.1.0",
"@tlon/sigil-js": "^1.4.5",
"@urbit/api": "^2.1.1",
"@urbit/http-api": "2.1.1",
"any-ascii": "^0.1.7",
"aws-sdk": "^2.830.0",
"big-integer": "^1.6.48",
@ -36,15 +33,15 @@
"mousetrap": "^1.6.5",
"mousetrap-global-bind": "^1.1.0",
"normalize-wheel": "1.0.1",
"oembed-parser": "^1.4.5",
"oembed-parser": "^3.0.4",
"prop-types": "^15.7.2",
"querystring": "^0.2.0",
"react": "^17.0.2",
"react-codemirror2": "^6.0.1",
"react-codemirror2-react-17": "^1.0.0",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-markdown": "^4.3.1",
"react-oembed-container": "^1.0.0",
"react-markdown": "^5.0.3",
"react-oembed-container": "^1.0.1",
"react-router-dom": "^5.2.0",
"react-use-gesture": "^9.1.3",
"react-virtuoso": "^0.20.3",
@ -107,6 +104,7 @@
"lint-staged": "^11.0.0",
"loki": "^0.28.1",
"moment-locales-webpack-plugin": "^1.2.0",
"patch-package": "^6.4.7",
"react-refresh": "^0.11.0",
"sass": "^1.32.5",
"sass-loader": "^8.0.2",
@ -131,7 +129,8 @@
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"chromatic": "chromatic --exit-zero-on-changes",
"hook-lint": "eslint --cache --fix"
"hook-lint": "eslint --cache --fix",
"postinstall": "patch-package"
},
"author": "",
"license": "MIT",

View File

@ -4,7 +4,7 @@ export interface Suspender<T> {
read: () => T;
}
export function suspend<T>(awaiting: Promise<T>): Suspender<T> {
export function suspend<T>(awaiting: Promise<T>, defaultValue?: any): Suspender<T> {
let state: SuspendState = 'pending';
let result: T | null = null;
@ -22,8 +22,10 @@ export function suspend<T>(awaiting: Promise<T>): Suspender<T> {
read: () => {
if (state === 'result') {
return result!;
} else if (state === 'error') {
} else if (state === 'error' && typeof defaultValue === 'undefined') {
throw result;
} else if (state === 'error' && typeof defaultValue !== 'undefined') {
return defaultValue;
} else {
throw promise;
}

View File

@ -34,7 +34,8 @@ const useStorage = ({ accept = '*' } = { accept: '*' }): IuseStorage => {
}
client.current = new S3Client({
credentials: s3.credentials,
endpoint: s3.credentials.endpoint
endpoint: s3.credentials.endpoint,
signatureVersion: 'v4'
});
}
}, [gcp.token, s3.credentials]);

View File

@ -11,8 +11,7 @@ export function getTitleFromWorkspace(
case 'messages':
return 'Messages';
case 'group':
const association = associations.groups[workspace.group];
return association?.metadata?.title || '';
return associations.groups[workspace.group]?.metadata?.title || 'Groups';
}
}

View File

@ -1,6 +1,6 @@
import { useCallback } from 'react';
import create from 'zustand';
import { suspend, Suspender , suspendWithResult } from '../lib/suspend';
import { suspend, Suspender } from '../lib/suspend';
import { jsonFetch } from '~/logic/lib/util';
export interface EmbedState {
@ -23,17 +23,19 @@ const useEmbedState = create<EmbedState>((set, get) => ({
const search = new URLSearchParams({
url
});
const embed = await jsonFetch(`${OEMBED_PROVIDER}?${search.toString()}`);
const { embeds: es } = get();
set({ embeds: { ...es, [url]: embed } });
return embed;
},
getEmbed: (url: string): Suspender<any> => {
const { fetch, embeds } = get();
if(url in embeds) {
return suspendWithResult(embeds[url]);
return embeds[url];
}
return suspend(fetch(url));
const { embeds: es } = get();
const embed = suspend(fetch(url), {});
set({ embeds: { ...es, [url]: embed } });
return embed;
}
}));

View File

@ -1,5 +1,6 @@
import { acceptDm, cite, Content, declineDm, deSig, Post } from '@urbit/api';
import React, { useCallback, useEffect } from 'react';
import Helmet from 'react-helmet';
import _ from 'lodash';
import bigInt from 'big-integer';
import { Box, Row, Col, Text, Center } from '@tlon/indigo-react';
@ -49,6 +50,21 @@ function quoteReply(post: Post) {
return `${reply}\n\n~${post.author}:`;
}
export function DmHelmet(props: DmHelmetProps) {
const { ship } = props;
const hark = useHarkDm(ship);
const unreadCount = hark.count;
const contact = useContact(ship);
const { hideNicknames } = useSettingsState(selectCalmState);
const showNickname = !hideNicknames && Boolean(contact);
const nickname = showNickname ? contact!.nickname : cite(ship) ?? ship;
return(
<Helmet defer={false}>
<title>{unreadCount ? `(${String(unreadCount)}) ` : ''}{ nickname }</title>
</Helmet>
);
}
export function DmResource(props: DmResourceProps) {
const { ship } = props;
const dm = useDM(ship);

View File

@ -5,7 +5,7 @@ import 'codemirror/addon/hint/show-hint';
import 'codemirror/lib/codemirror.css';
import 'codemirror/mode/markdown/markdown';
import React, { useRef, ClipboardEvent, useEffect, useImperativeHandle } from 'react';
import { Controlled as CodeEditor } from 'react-codemirror2';
import { Controlled as CodeEditor } from 'react-codemirror2-react-17';
import styled from 'styled-components';
import { MOBILE_BROWSER_REGEX } from '~/logic/lib/util';
import useSettingsState from '~/logic/state/settings';

View File

@ -1,18 +1,17 @@
import React from 'react';
import {
Icon,
Center,
Row,
Text,
Col,
Box,
CenterProps
} from '@tlon/indigo-react';
import { hasProvider } from 'oembed-parser';
import { AUDIO_REGEX, IMAGE_REGEX } from '~/views/components/RemoteContent';
import { AUDIO_REGEX, IMAGE_REGEX, validOembedCheck } from '~/views/components/RemoteContent';
import { AudioPlayer } from '~/views/components/AudioPlayer';
import { useHistory } from 'react-router';
import { useHovering } from '~/logic/lib/util';
import { useEmbed } from '~/logic/state/embed';
import Author from '~/views/components/Author';
import {
GraphNode,
@ -38,8 +37,32 @@ export interface LinkBlockItemProps {
summary?: boolean;
}
export function LinkBlockItem(props: LinkBlockItemProps & CenterProps) {
const { node, summary, size, m, border = 1, objectFit, ...rest } = props;
export const LinkBlockItem = (props: LinkBlockItemProps & CenterProps) => {
const { node, ...rest } = props;
const { post } = node;
const { contents } = post;
const [{ text: title }, ...content] = contents as [
TextContent,
UrlContent | ReferenceContent
];
let url = '';
if ('url' in content?.[0]) {
url = content[0].url;
}
return(
<AsyncFallback fallback={<RemoteContentEmbedFallback url={url} />}>
<LinkBlockItemInner
node={node}
{...rest}
/>
</AsyncFallback>
);
}
function LinkBlockItemInner(props: LinkBlockItemProps & CenterProps) {
const { node, summary, m, border = 1, objectFit, ...rest } = props;
const { post, children } = node;
const { contents, index, author } = post;
@ -56,8 +79,9 @@ export function LinkBlockItem(props: LinkBlockItemProps & CenterProps) {
const isImage = IMAGE_REGEX.test(url);
const isAudio = AUDIO_REGEX.test(url);
const oembed = useEmbed(url);
const isOembed = validOembedCheck(oembed, url);
const isOembed = hasProvider(url);
const history = useHistory();
const { hovering, bind } = useHovering();
const onClick = () => {
@ -65,70 +89,67 @@ export function LinkBlockItem(props: LinkBlockItemProps & CenterProps) {
history.push(`${pathname}/index${index}${search}`);
};
return (
<Center
<Box
onClick={onClick}
position="relative"
m={m}
border={border}
borderColor="lightGray"
position="relative"
borderRadius="1"
height={size}
width={size}
m={m}
maxHeight="100%"
{...rest}
{...bind}
>
<AsyncFallback fallback={<RemoteContentEmbedFallback url={url} />}>
{isReference ? (
summary ? (
<RemoteContentPermalinkEmbed
reference={content[0] as ReferenceContent}
/>
) : (
<PermalinkEmbed
link={referenceToPermalink(content[0] as ReferenceContent).link}
transcluded={0}
/>
)
) : isImage ? (
<RemoteContentImageEmbed
url={url}
tall
stretch
objectFit={objectFit ? objectFit : "cover"}
/>
) : isAudio ? (
<AudioPlayer title={title} url={url} />
) : isOembed ? (
<RemoteContentOembed tall={!summary} renderUrl={false} url={url} thumbnail={summary} />
) : (
<RemoteContentEmbedFallback url={url} />
)}
</AsyncFallback>
<Box
backgroundColor="white"
display={summary && hovering ? 'block' : 'none'}
width="100%"
height="64px"
position="absolute"
left="0"
bottom="0"
>
<Col width="100%" height="100%" p="2" justifyContent="space-between">
<Row justifyContent="space-between" width="100%">
<Text textOverflow="ellipsis" whiteSpace="nowrap" overflow="hidden">
{title}
</Text>
<Row gapX="1" alignItems="center">
<Icon icon="Chat" color="black" />
<Text>{children.size}</Text>
<Col height="100%" justifyContent="center" alignItems="center">
{isReference ? (
summary ? (
<RemoteContentPermalinkEmbed
reference={content[0] as ReferenceContent}
/>
) : (
<PermalinkEmbed
link={referenceToPermalink(content[0] as ReferenceContent).link}
transcluded={0}
/>
)
) : isImage ? (
<RemoteContentImageEmbed
url={url}
tall
stretch
objectFit={objectFit ? objectFit : "cover"}
/>
) : isAudio ? (
<AudioPlayer title={title} url={url} />
) : isOembed ? (
<RemoteContentOembed tall={!summary} renderUrl={false} url={url} thumbnail={summary} oembed={oembed} />
) : (
<RemoteContentEmbedFallback url={url} />
)}
<Box
backgroundColor="white"
display={summary && hovering ? 'block' : 'none'}
width="100%"
height="64px"
position="absolute"
left="0"
bottom="0"
>
<Col width="100%" height="100%" p="2" justifyContent="space-between">
<Row justifyContent="space-between" width="100%">
<Text textOverflow="ellipsis" whiteSpace="nowrap" overflow="hidden">
{title}
</Text>
<Row gapX="1" alignItems="center">
<Icon icon="Chat" color="black" />
<Text>{children.size}</Text>
</Row>
</Row>
</Row>
<Row width="100%">
<Author ship={author} date={post['time-sent']} showImage></Author>
</Row>
</Col>
</Box>
</Center>
<Row width="100%">
<Author ship={author} date={post['time-sent']} showImage></Author>
</Row>
</Col>
</Box>
</Col>
</Box>
);
}

View File

@ -1,4 +1,4 @@
import { Col, Row, RowProps } from '@tlon/indigo-react';
import { Center, Col, Row, RowProps } from '@tlon/indigo-react';
import { Association, GraphNode, markEachAsRead, TextContent, UrlContent } from '@urbit/api';
import React, { useEffect } from 'react';
import { useGroup } from '~/logic/state/group';
@ -27,21 +27,13 @@ export function LinkDetail(props: LinkDetailProps) {
return (
/* @ts-ignore indio props?? */
<Row height="100%" width="100%" flexDirection={['column', 'column', 'row']} {...rest}>
<LinkBlockItem
minWidth="0"
minHeight="0"
height={["50%", "50%", "100%"]}
width={["100%", "100%", "calc(100% - 350px)"]}
flexGrow={0}
border={0}
node={node}
objectFit="contain"
/>
<Center flex="3 1 75%" overflowY="scroll" >
<LinkBlockItem maxHeight="100%" border={0} node={node} objectFit="contain" />
</Center>
<Col
minHeight="0"
flexShrink={1}
width={['100%', '100%', '350px']}
flexGrow={0}
flex="1 25%"
maxWidth={['auto', 'auto', '45ch']}
maxHeight={['50%', '50%', 'unset']}
gapY={[2,4]}
borderLeft={[0, 0, 1]}
borderTop={[1, 1, 0]}

View File

@ -90,33 +90,33 @@ export function EditProfile(props: any): ReactElement {
const onSubmit = async (values: any, actions: any) => {
try {
Object.keys(values).forEach((key) => {
for (const key in values) {
const newValue = key !== 'color' ? values[key] : uxToHex(values[key]);
if (newValue !== contact[key]) {
if (key === 'isPublic') {
airlock.poke(setPublic(newValue));
return;
} else if (key === 'groups') {
const toRemove: string[] = _.difference(
contact?.groups || [],
newValue
);
const toAdd: string[] = _.difference(
newValue,
contact?.groups || []
);
toRemove.forEach(e =>
airlock.poke(editContact(ship, { 'remove-group': resourceFromPath(e) }))
);
toAdd.forEach(e =>
airlock.poke(editContact(ship, { 'add-group': resourceFromPath(e) }))
);
} else if (key !== 'last-updated' && key !== 'isPublic') {
airlock.poke(editContact(ship, { [key]: newValue }));
return;
if (newValue === contact[key] || key === 'last-updated') {
continue;
} else if (key === 'isPublic') {
await airlock.poke(setPublic(newValue));
} else if (key === 'groups') {
const toRemove: string[] = _.difference(
contact?.groups || [],
newValue
);
const toAdd: string[] = _.difference(
newValue,
contact?.groups || []
);
for (const i in toRemove) {
const group = resourceFromPath(toRemove[i]);
await airlock.poke(editContact(ship, { 'remove-group': group }));
}
for (const i in toAdd) {
const group = resourceFromPath(toAdd[i]);
await airlock.poke(editContact(ship, { 'add-group': group }));
}
} else {
await airlock.poke(editContact(ship, { [key]: newValue }));
}
});
}
history.push(`/~profile/${ship}`);
} catch (e) {
console.error(e);

View File

@ -6,7 +6,7 @@ import 'codemirror/lib/codemirror.css';
import 'codemirror/mode/markdown/markdown';
import { useFormikContext } from 'formik';
import React, { useCallback, useRef } from 'react';
import { UnControlled as CodeEditor } from 'react-codemirror2';
import { UnControlled as CodeEditor } from 'react-codemirror2-react-17';
import { Prompt } from 'react-router-dom';
import { useFileUpload } from '~/logic/lib/useFileUpload';
import { IuseStorage } from '~/logic/lib/useStorage';
@ -23,6 +23,7 @@ interface MarkdownEditorProps {
value: string;
onChange: (s: string) => void;
onBlur?: (e: any) => void;
disabled?: boolean;
}
const PromptIfDirty = () => {
@ -39,7 +40,7 @@ const PromptIfDirty = () => {
export function MarkdownEditor(
props: MarkdownEditorProps & PropFunc<typeof Box>
) {
const { onBlur, placeholder, value, onChange, ...boxProps } = props;
const { onBlur, placeholder, value, onChange, disabled, ...boxProps } = props;
const options = {
mode: MARKDOWN_CONFIG,
@ -56,7 +57,9 @@ export function MarkdownEditor(
const handleChange = useCallback(
(_e, _d, v: string) => {
onChange(v);
if (!disabled) {
onChange(v);
}
},
[onChange]
);
@ -93,6 +96,7 @@ export function MarkdownEditor(
p={1}
border={1}
borderColor="lightGray"
backgroundColor={disabled ? 'lightGray' : 'white'}
borderRadius={2}
height={['calc(100% - 22vh)', '100%']}
{...boxProps}

View File

@ -6,14 +6,17 @@ import { MarkdownEditor } from './MarkdownEditor';
export const MarkdownField = ({
id,
disabled,
...rest
}: { id: string } & Parameters<typeof Box>[0]) => {
}: { id: string; disabled?: boolean } & Parameters<typeof Box>[0]) => {
const [{ value, onBlur }, { error, touched }, { setValue }] = useField(id);
const handleBlur = useCallback(
(e: any) => {
_.set(e, 'target.id', id);
onBlur && onBlur(e);
if (!disabled) {
_.set(e, 'target.id', id);
onBlur && onBlur(e);
}
},
[onBlur, id]
);
@ -23,7 +26,7 @@ export const MarkdownField = ({
return (
<Box
overflowY="hidden"
height='100%'
height="100%"
width="100%"
display="flex"
flexDirection="column"
@ -35,6 +38,7 @@ export const MarkdownField = ({
onBlur={handleBlur}
value={value}
onChange={setValue}
disabled={disabled}
/>
<ErrorLabel mt={2} hasError={Boolean(error && touched)}>
{error}

View File

@ -1,5 +1,7 @@
import {
Button, Col, ManagedTextInputField as Input,
Button,
Col,
ManagedTextInputField as Input,
Row
} from '@tlon/indigo-react';
import { Form, Formik, FormikHelpers } from 'formik';
@ -31,7 +33,8 @@ export interface PostFormSchema {
}
export function PostForm(props: PostFormProps) {
const { initial, onSubmit, submitLabel, loadingText, cancel, history } = props;
const { initial, onSubmit, submitLabel, loadingText, cancel, history } =
props;
return (
<Col width="100%" height="100%" p={[2, 4]}>
@ -40,30 +43,49 @@ export function PostForm(props: PostFormProps) {
initialValues={initial}
onSubmit={onSubmit}
>
<Form style={{ display: 'contents' }}>
<Row flexShrink={0} flexDirection={['column-reverse', 'row']} mb={4} gapX={4} justifyContent='space-between'>
<Input maxWidth='40rem' width='100%' flexShrink={[0, 1]} placeholder="Post Title" id="title" />
<Row flexDirection={['column', 'row']} mb={[4,0]}>
<AsyncButton
ml={[0,2]}
flexShrink={0}
primary
loadingText={loadingText}
>
{submitLabel}
</AsyncButton>
{cancel && <Button
ml={[0,2]}
mt={[2,0]}
onClick={() => {
history.goBack();
}}
type="button"
>Cancel</Button>}
{({ isSubmitting }) => (
<Form style={{ display: 'contents' }}>
<Row
flexShrink={0}
flexDirection={['column-reverse', 'row']}
mb={4}
gapX={4}
justifyContent="space-between"
>
<Input
maxWidth="40rem"
width="100%"
flexShrink={[0, 1]}
placeholder="Post Title"
id="title"
disabled={isSubmitting}
/>
<Row flexDirection={['column', 'row']} mb={[4, 0]}>
<AsyncButton
ml={[0, 2]}
flexShrink={0}
primary
loadingText={loadingText}
>
{submitLabel}
</AsyncButton>
{cancel && (
<Button
ml={[0, 2]}
mt={[2, 0]}
onClick={() => {
history.goBack();
}}
type="button"
>
Cancel
</Button>
)}
</Row>
</Row>
</Row>
<MarkdownField flexGrow={1} id="body" />
</Form>
<MarkdownField flexGrow={1} id="body" disabled={isSubmitting} />
</Form>
)}
</Formik>
</Col>
);

View File

@ -3,7 +3,7 @@ import moment from 'moment';
import React, { ReactElement, ReactNode } from 'react';
import { Sigil } from '~/logic/lib/sigil';
import { useCopy } from '~/logic/lib/useCopy';
import { cite, uxToHex } from '~/logic/lib/util';
import { cite, deSig, uxToHex } from '~/logic/lib/util';
import { useContact } from '~/logic/state/contact';
import { useDark } from '~/logic/state/join';
import useSettingsState, { selectCalmState, useShowNickname } from '~/logic/state/settings';
@ -52,7 +52,7 @@ function Author(props: AuthorProps & PropFunc<typeof Box>): ReactElement {
const { hideAvatars } = useSettingsState(selectCalmState);
const name = showNickname && contact ? contact.nickname : cite(ship);
const stamp = moment(date);
const { copyDisplay, doCopy } = useCopy(`~${ship}`, name);
const { copyDisplay, doCopy } = useCopy(`~${deSig(ship)}`, name);
const sigil = fullNotIcon ? (
<Sigil ship={ship} size={size} color={color} padding={sigilPadding} />

View File

@ -28,7 +28,7 @@ import { Link } from 'react-router-dom';
import { AppPermalink, referenceToPermalink } from '~/logic/lib/permalinks';
import useMetadataState from '~/logic/state/metadata';
import { RemoteContentWrapper } from './wrapper';
import { useEmbed } from '~/logic/state/embed';
import { Suspender } from '~/logic/lib/suspend';
import { IS_SAFARI } from '~/logic/lib/platform';
import useDocketState, { useTreaty } from '~/logic/state/docket';
import { AppTile } from '~/views/apps/permalinks/embed';
@ -97,6 +97,7 @@ export function RemoteContentImageEmbed(
objectFit="cover"
borderRadius={2}
onError={onError}
style={{ imageRendering: '-webkit-optimize-contrast' }}
{...props}
/>
</Box>
@ -319,6 +320,7 @@ type RemoteContentOembedProps = {
renderUrl?: boolean;
thumbnail?: boolean;
tall?: boolean;
oembed: Suspender<any>;
} & RemoteContentEmbedProps &
PropFunc<typeof Box>;
@ -332,10 +334,9 @@ export const RemoteContentOembed = React.forwardRef<
HTMLDivElement,
RemoteContentOembedProps
>((props, ref) => {
const { url, renderUrl = false, thumbnail = false, ...rest } = props;
const oembed = useEmbed(url);
const { url, oembed, renderUrl = false, thumbnail = false, ...rest } = props;
const embed = oembed.read();
const fallbackError = new Error('fallback');
const [aspect, width, height] = useMemo(() => {
if(!('height' in embed && typeof embed.height === 'number'
@ -373,11 +374,9 @@ export const RemoteContentOembed = React.forwardRef<
dangerouslySetInnerHTML={{ __html: embed.html }}
></EmbedBox>
</EmbedContainer>
) : renderUrl ? (
) : (
<RemoteContentEmbedFallback url={url} />
) : (() => {
throw fallbackError;
})()
)
}
</Col>
);

View File

@ -1,12 +1,17 @@
import { hasProvider } from 'oembed-parser';
import {
Box
} from '@tlon/indigo-react';
import React from 'react';
import useSettingsState from '~/logic/state/settings';
import {
RemoteContentAudioEmbed,
RemoteContentImageEmbed,
RemoteContentOembed,
RemoteContentVideoEmbed
RemoteContentVideoEmbed,
RemoteContentEmbedFallback
} from './embed';
import { useEmbed } from '~/logic/state/embed';
import { Suspender } from '~/logic/lib/suspend';
import { TruncatedText } from '~/views/components/TruncatedText';
import { RemoteContentWrapper } from './wrapper';
import AsyncFallback from '../AsyncFallback';
@ -43,8 +48,34 @@ export const IMAGE_REGEX = new RegExp(
export const AUDIO_REGEX = new RegExp(/(\.mp3|\.wav|\.ogg|\.m4a)$/i);
export const VIDEO_REGEX = new RegExp(/(\.mov|\.mp4|\.ogv)$/i);
// This is used to prevent our oembed parser from
// trying to embed facebook/instagram links, which require an API key
const isFacebookGraphDependent = (url: string) => {
const caseDesensitizedURL = url.toLowerCase()
return (caseDesensitizedURL.includes('facebook.com') || caseDesensitizedURL.includes('instagram.com'))
}
export const validOembedCheck = (embed: Suspender<any>, url: string) => {
if (!isFacebookGraphDependent(url)) {
if (!embed.read().hasOwnProperty("error")) {
return true
}
}
return false
}
export const RemoteContent = (props: RemoteContentProps) => {
const {url, ...rest} = props
return(
<AsyncFallback fallback={<RemoteContentEmbedFallback url={url} />}>
<RemoteContentInner url={url} {...rest}/>
</AsyncFallback>
)
}
const emptyRef = () => {};
export function RemoteContent(props: RemoteContentProps) {
function RemoteContentInner(props: RemoteContentProps) {
const {
url,
embedRef = emptyRef,
@ -57,45 +88,51 @@ export function RemoteContent(props: RemoteContentProps) {
const isImage = IMAGE_REGEX.test(url);
const isAudio = AUDIO_REGEX.test(url);
const isVideo = VIDEO_REGEX.test(url);
const isOembed = hasProvider(url);
const oembed = useEmbed(url);
const isOembed = validOembedCheck(oembed, url);
const wrapperProps = {
url,
tall,
embedOnly: !renderUrl || tall
};
const fallback = !renderUrl ? null : (
<RemoteContentWrapper {...wrapperProps}>
<TruncatedText>{url}</TruncatedText>
</RemoteContentWrapper>
);
const fallback = null;
if (isImage && remoteContentPolicy.imageShown) {
return (
<RemoteContentWrapper {...wrapperProps} noOp={transcluded} replaced>
<RemoteContentImageEmbed url={url} />
</RemoteContentWrapper>
<Box mt={1} mb={2} flexShrink={0}>
<RemoteContentWrapper {...wrapperProps} noOp={transcluded} replaced>
<RemoteContentImageEmbed url={url} stretch={tall} />
</RemoteContentWrapper>
</Box>
);
} else if (isAudio && remoteContentPolicy.audioShown) {
return (
<RemoteContentWrapper {...wrapperProps}>
<RemoteContentAudioEmbed url={url} />
</RemoteContentWrapper>
<Box mt={1} mb={2} flexShrink={0}>
<RemoteContentWrapper {...wrapperProps}>
<RemoteContentAudioEmbed url={url} />
</RemoteContentWrapper>
</Box>
);
} else if (isVideo && remoteContentPolicy.videoShown) {
return (
<RemoteContentWrapper
{...wrapperProps}
detail={<RemoteContentVideoEmbed url={url} />}
>
<TruncatedText>{url}</TruncatedText>
</RemoteContentWrapper>
<Box mt={1} mb={2} flexShrink={0}>
<RemoteContentWrapper
{...wrapperProps}
detail={<RemoteContentVideoEmbed url={url} />}
>
<TruncatedText>{url}</TruncatedText>
</RemoteContentWrapper>
</Box>
);
} else if (isOembed && remoteContentPolicy.oembedShown) {
return (
<AsyncFallback fallback={fallback}>
<RemoteContentOembed ref={embedRef} url={url} renderUrl={renderUrl} />
</AsyncFallback>
<Box mt={1} mb={2} flexShrink={0}>
<AsyncFallback fallback={fallback}>
<RemoteContentOembed ref={embedRef} url={url} renderUrl={renderUrl} oembed={oembed} />
</AsyncFallback>
</Box>
);
}
return fallback;

View File

@ -2,26 +2,12 @@ import { Anchor, Text } from '@tlon/indigo-react';
import { Contact, Group } from '@urbit/api';
import React from 'react';
import ReactMarkdown, { ReactMarkdownProps } from 'react-markdown';
import RemarkDisableTokenizers from 'remark-disable-tokenizers';
import { isValidPatp } from 'urbit-ob';
import { deSig } from '~/logic/lib/util';
import { PermalinkEmbed } from '~/views/apps/permalinks/embed';
import { Mention } from '~/views/components/MentionText';
import RemoteContent from '~/views/components/RemoteContent';
const DISABLED_BLOCK_TOKENS = [
'indentedCode',
'atxHeading',
'thematicBreak',
'list',
'setextHeading',
'html',
'definition',
'table'
];
const DISABLED_INLINE_TOKENS = [];
type RichTextProps = ReactMarkdownProps & {
disableRemoteContent?: boolean;
contact?: Contact;
@ -110,10 +96,6 @@ const RichText = React.memo(({ disableRemoteContent = false, ...props }: RichTex
return <Text display={props.inline ? 'inline' : 'block'} mb={2} {...props}>{paraProps.children}</Text>;
}
}}
plugins={[[
RemarkDisableTokenizers,
{ block: DISABLED_BLOCK_TOKENS, inline: DISABLED_INLINE_TOKENS }
]]}
/>
));

View File

@ -74,7 +74,7 @@ export function GraphPermissions(props: GraphPermissionsProps) {
const writers = _.get(
group?.tags,
['graph', association.resource, 'writers'],
new Set()
[]
);
let [, , hostShip] = association.resource.split('/');
@ -91,7 +91,7 @@ export function GraphPermissions(props: GraphPermissionsProps) {
const initialValues = {
writePerms,
writers: Array.from(writers)
writers: [...writers]
.filter(x => x !== hostShip),
readerComments: association.metadata.vip === 'reader-comments'
};
@ -104,7 +104,7 @@ export function GraphPermissions(props: GraphPermissionsProps) {
resource: association.resource,
tag: 'writers'
};
const allWriters = Array.from(writers).map(w => `~${w}`);
const allWriters = [...writers].map(w => `~${w}`);
if (values.readerComments !== readerComments) {
await airlock.poke(metadataEdit(association, {
vip: values.readerComments ? 'reader-comments' : ''
@ -170,7 +170,7 @@ export function GraphPermissions(props: GraphPermissionsProps) {
<Col>
<Label mb={2}>Permissions Summary</Label>
<PermissionsSummary
writersSize={writers.size}
writersSize={writers.length}
vip={association.metadata.vip}
/>
</Col>

View File

@ -34,26 +34,30 @@ interface GraphMentionNode {
ship: string;
}
const addEmphasisToMention = (contents: Content[], content: Content, index: number) => {
const addEmphasisToMention = (
contents: Content[],
content: Content,
index: number
) => {
const prevContent = contents[index - 1];
const nextContent = contents[index + 1];
if (
'text' in content &&
(content.text.trim() === '**' || content.text.trim() === '*' )
) {
(content.text.trim() === '**' || content.text.trim() === '*')
) {
return {
text: ''
};
}
if(
if (
'text' in content &&
content.text.endsWith('*') &&
!content.text.startsWith('*') &&
nextContent !== undefined &&
'mention' in nextContent
) {
if (content.text.charAt((content.text.length - 2)) === '*') {
if (content.text.charAt(content.text.length - 2) === '*') {
return { text: content.text.slice(0, content.text.length - 2) };
}
return { text: content.text.slice(0, content.text.length - 1) };
@ -116,78 +120,99 @@ const codeToMdAst = (content: CodeContent) => {
};
};
const contentToMdAst = (tall: boolean) => (
content: Content
): [StitchMode, any] => {
if ('text' in content) {
if (content.text.toString().trim().length === 0) {
const contentToMdAst =
(tall: boolean) =>
(content: Content): [StitchMode, any] => {
if ('text' in content) {
if (content.text.toString().trim().length === 0) {
return [
'merge',
{ type: 'root', children: [{ type: 'paragraph', children: [] }] }
];
}
return [
'merge',
{ type: 'root', children: [{ type: 'paragraph', children: [] }] }
tall ? parseTall(content.text) : parseWide(content.text)
] as [StitchMode, any];
} else if ('code' in content) {
return ['block', codeToMdAst(content)];
} else if ('reference' in content) {
return [
'block',
{
type: 'root',
children: [
{
type: 'graph-reference',
reference: content.reference
}
]
}
];
} else if ('url' in content) {
const images = ['.jpg', '.jpeg', '.png', '.gif', '.webp'];
return [
'inline',
{
type: 'root',
children: [
{
type: 'link',
url: content.url,
children: [
{
type: 'text',
value: !images.some(i => content.url.includes(i))
? content.url
: ''
}
]
}
]
}
];
} else if ('mention' in content) {
return [
'inline',
{
type: 'root',
children: [
{
type: 'graph-mention',
ship: content.mention,
emphasis: content.emphasis
}
]
}
];
}
return [
'merge',
tall ? parseTall(content.text) : parseWide(content.text)
] as [StitchMode, any];
} else if ('code' in content) {
return ['block', codeToMdAst(content)];
} else if ('reference' in content) {
return [
'block',
{
type: 'root',
children: [
{
type: 'graph-reference',
reference: content.reference
}
]
}
];
} else if ('url' in content) {
return [
'block',
{
type: 'root',
children: [
{
type: 'graph-url',
url: content.url
}
]
}
];
} else if ('mention' in content) {
return [
'inline',
{
type: 'root',
children: [
{
type: 'graph-mention',
ship: content.mention,
emphasis: content.emphasis
}
]
children: []
}
];
}
return [
'inline',
{
type: 'root',
children: []
}
];
};
};
function stitchInline(a: any, b: any) {
if (!a?.children) {
throw new Error('Bad stitchInline call: missing root');
}
const lastParaIdx = a.children.length - 1;
const last = a.children[lastParaIdx];
// wrap bare link in list-item inside a p node
// for better typography consistency
if (last?.type === 'listItem') {
if (last?.children.length === 0) {
last.children.push({
type: 'paragraph',
children: []
});
}
}
if (last?.children) {
const ros = {
...a,
@ -217,9 +242,14 @@ function getChildren<T extends unknown>(node: T): AstContent[] {
}
export function asParent<T extends BlockContent>(node: T): Parent | undefined {
return ['paragraph', 'heading', 'list', 'listItem', 'table'].includes(
node.type
)
return [
'paragraph',
'heading',
'list',
'listItem',
'table',
'blockquote'
].includes(node.type)
? (node as Parent)
: undefined;
}
@ -241,6 +271,7 @@ function stitchMerge(a: Root, b: Root) {
children: [...aChildren.slice(0, -1), mergedPara, ...bChildren.slice(1)]
};
}
return { ...a, children: [...aChildren, ...bChildren] };
}
@ -256,10 +287,10 @@ function stitchInlineAfterBlock(a: Root, b: GraphMentionNode[]) {
}
function stitchAsts(asts: [StitchMode, GraphAstNode][]) {
return _.reduce(
const t = _.reduce(
asts,
([prevMode, ast], [mode, val]): [StitchMode, GraphAstNode] => {
if (prevMode === 'block') {
if (prevMode === 'block' || prevMode === 'inline') {
if (mode === 'inline') {
return [mode, stitchInlineAfterBlock(ast, val?.children ?? [])];
}
@ -283,6 +314,46 @@ function stitchAsts(asts: [StitchMode, GraphAstNode][]) {
},
['block', { type: 'root', children: [] }] as [StitchMode, GraphAstNode]
);
t[1].children.map((c, idx) => {
const links = [];
function addRichEmbedURL(nodes) {
if (nodes?.children) {
nodes.children.filter(k => {
if (k.type === 'link') {
links.push({
type: 'root',
children: [
{
type: 'graph-url',
url: k.url
}
]
});
} else if (k?.children) {
k.children.filter(o => {
if (o.type === 'link') {
links.push({
type: 'root',
children: [
{
type: 'graph-url',
url: o.url
}
]
});
}
});
}
});
nodes.children.push(...links);
}
}
addRichEmbedURL(c);
});
return t;
}
const header = ({ children, depth, ...rest }) => {
const level = depth;
@ -392,7 +463,7 @@ const renderers = {
);
return tall ? <Box mb={2}>{inner}</Box> : inner;
},
link: (props) => {
link: props => {
return (
<Anchor
display="inline"
@ -408,9 +479,13 @@ const renderers = {
);
},
list: ({ depth, ordered, children }) => {
return ordered ? <Ol>{children}</Ol> : <Ul>{children}</Ul>;
return ordered ? (
<Ol fontSize="1">{children}</Ol>
) : (
<Ul fontSize="1">{children}</Ul>
);
},
'graph-mention': (obj) => {
'graph-mention': obj => {
return <Mention ship={obj.ship} emphasis={obj.emphasis} />;
},
image: ({ url, tall }) => (
@ -419,19 +494,13 @@ const renderers = {
</Box>
),
'graph-url': ({ url, tall }) => (
<Box mt={1} mb={2} flexShrink={0}>
<RemoteContent key={url} url={url} tall={tall} />
</Box>
<RemoteContent key={url} url={url} tall={tall} />
),
'graph-reference': ({ reference, transcluded }) => {
const { link } = referenceToPermalink({ reference });
return (
<Box my={2} flexShrink={0}>
<PermalinkEmbed
link={link}
transcluded={transcluded}
showOurContact
/>
<PermalinkEmbed link={link} transcluded={transcluded} showOurContact />
</Box>
);
},
@ -499,19 +568,13 @@ export type GraphContentProps = PropFunc<typeof Box> & {
showOurContact: boolean;
};
export const GraphContent = React.memo((
props: GraphContentProps
) => {
const {
contents,
tall = false,
transcluded = 0,
...rest
} = props;
export const GraphContent = React.memo((props: GraphContentProps) => {
const { contents, tall = false, transcluded = 0, ...rest } = props;
const [, ast] = stitchAsts(
contents
.map((content, index) => addEmphasisToMention(contents, content, index))
.map(contentToMdAst(tall)));
.map((content, index) => addEmphasisToMention(contents, content, index))
.map(contentToMdAst(tall))
);
return (
<Box {...rest}>
<Graphdown transcluded={transcluded} ast={ast} tall={tall} />

View File

@ -1,128 +1,126 @@
/* eslint-disable */
/** pulled from remark-parse
*
*
* critical change is that blockquotes require a newline to be continued, see
* the `if(!prefixed) conditional
*/
'use strict'
"use strict";
var trim = require('trim')
var interrupt = require('remark-parse/lib/util/interrupt')
var trim = require("trim");
module.exports = blockquote
module.exports = blockquote;
var lineFeed = '\n'
var tab = '\t'
var space = ' '
var greaterThan = '>'
var lineFeed = "\n";
var tab = "\t";
var space = " ";
var greaterThan = ">";
function blockquote(eat, value, silent) {
var self = this
var offsets = self.offset
var tokenizers = self.blockTokenizers
var interruptors = self.interruptBlockquote
var now = eat.now()
var currentLine = now.line
var length = value.length
var values = []
var contents = []
var indents = []
var add
var index = 0
var character
var rest
var nextIndex
var content
var line
var startIndex
var prefixed
var exit
var self = this;
var offsets = self.offset;
var tokenizers = self.blockTokenizers;
var interruptors = self.interruptBlockquote;
var now = eat.now();
var currentLine = now.line;
var length = value.length;
var values = [];
var contents = [];
var indents = [];
var add;
var index = 0;
var character;
var rest;
var nextIndex;
var content;
var line;
var startIndex;
var prefixed;
var exit;
while (index < length) {
character = value.charAt(index)
character = value.charAt(index);
if (character !== space && character !== tab) {
break
break;
}
index++
index++;
}
if (value.charAt(index) !== greaterThan) {
return
return;
}
if (silent) {
return true
return true;
}
index = 0
index = 0;
while (index < length) {
nextIndex = value.indexOf(lineFeed, index)
startIndex = index
prefixed = false
nextIndex = value.indexOf(lineFeed, index);
startIndex = index;
prefixed = false;
if (nextIndex === -1) {
nextIndex = length
nextIndex = length;
}
while (index < length) {
character = value.charAt(index)
character = value.charAt(index);
if (character !== space && character !== tab) {
break
break;
}
index++
index++;
}
if (value.charAt(index) === greaterThan) {
index++
prefixed = true
index++;
prefixed = true;
if (value.charAt(index) === space) {
index++
index++;
}
} else {
index = startIndex
index = startIndex;
}
content = value.slice(index, nextIndex)
content = value.slice(index, nextIndex);
if (!prefixed && !trim(content)) {
index = startIndex
break
index = startIndex;
break;
}
if (!prefixed) {
break;
}
line = startIndex === index ? content : value.slice(startIndex, nextIndex)
line = startIndex === index ? content : value.slice(startIndex, nextIndex);
indents.push(index - startIndex)
values.push(line)
contents.push(content)
indents.push(index - startIndex);
values.push(line);
contents.push(content);
index = nextIndex + 1
index = nextIndex + 1;
}
const trailingNewline = value.charAt(nextIndex) === '\n';
const trailingNewline = value.charAt(nextIndex) === "\n";
index = -1
length = indents.length
add = eat(values.join(lineFeed))
index = -1;
length = indents.length;
add = eat(values.join(lineFeed));
while (++index < length) {
offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]
currentLine++
offsets[currentLine] = (offsets[currentLine] || 0) + indents[index];
currentLine++;
}
exit = self.enterBlock()
contents = self.tokenizeBlock(contents.join(lineFeed), now)
console.log(values);
exit()
exit = self.enterBlock();
contents = self.tokenizeBlock(contents.join(lineFeed), now);
exit();
const added = add({type: 'blockquote', children: contents})
return trailingNewline ? add({ type: 'paragraph', children: [] }) : added;
const added = add({ type: "blockquote", children: contents });
return trailingNewline ? add({ type: "paragraph", children: [] }) : added;
}

View File

@ -8,7 +8,7 @@ import {
} from 'react-router-dom';
import { useShortcut } from '~/logic/state/settings';
import { useLocalStorageState } from '~/logic/lib/useLocalStorageState';
import { getGroupFromWorkspace } from '~/logic/lib/workspace';
import { getGroupFromWorkspace, getTitleFromWorkspace } from '~/logic/lib/workspace';
import useGroupState from '~/logic/state/group';
import useHarkState from '~/logic/state/hark';
import useMetadataState from '~/logic/state/metadata';
@ -22,7 +22,7 @@ import { Skeleton } from './Skeleton';
import { EmptyGroupHome } from './Home/EmptyGroupHome';
import { Join } from './Join/Join';
import { Resource } from './Resource';
import { DmResource } from '~/views/apps/chat/DmResource';
import { DmResource, DmHelmet } from '~/views/apps/chat/DmResource';
import { UnjoinedResource } from '~/views/components/UnjoinedResource';
import { NewChannel } from './NewChannel';
import { GroupHome } from './Home/GroupHome';
@ -126,16 +126,18 @@ export function GroupsPane(props: GroupsPaneProps) {
const { ship } = match.params as Record<string, string>;
return (
<Skeleton
mobileHide
recentGroups={recentGroups}
selected={ship}
{...props}
baseUrl={match.path}
> <DmResource ship={ship} />
</Skeleton>
<>
<DmHelmet ship={ship} />
<Skeleton
mobileHide
recentGroups={recentGroups}
selected={ship}
{...props}
baseUrl={match.path}
> <DmResource ship={ship} />
</Skeleton>
</>
);
}}
/>
@ -180,7 +182,7 @@ export function GroupsPane(props: GroupsPaneProps) {
const appPath = `/ship/${host}/${name}`;
const association = associations.graph[appPath];
const resourceUrl = `${baseUrl}/join/${app}${appPath}`;
let title = groupAssociation?.metadata?.title ?? 'Groups';
let title = getTitleFromWorkspace(associations, workspace);
if (!association) {
return <Loading />;
@ -252,7 +254,7 @@ export function GroupsPane(props: GroupsPaneProps) {
render={(routeProps) => {
const shouldHideSidebar =
routeProps.location.pathname.includes('/feed');
const title = groupAssociation?.metadata?.title ?? 'Groups';
const title = getTitleFromWorkspace(associations, workspace);
return (
<>
<Helmet defer={false}>

View File

@ -352,7 +352,7 @@ function Participant(props: {
</Link>
</Action>
<Action bg="transparent">
<Link to={`/~landscape/dm/${contact.patp}`}>
<Link to={`/~landscape/messages/dm/~${contact.patp}`}>
<Text color="green">Send Message</Text>
</Link>
</Action>

View File

@ -679,20 +679,19 @@
=/ update-log
(~(get by update-logs) [ship term])
:- ~ :- ~ :- %noun
!>
?+ t.t.t.t.path (on-peek:def path)
~
^- update-log:store
!> ^- update-log:store
?~(update-log *update-log:store u.update-log)
::
[%latest ~]
^- (unit time)
!> ^- (unit time)
%+ biff update-log
|= =update-log:store
(bind (pry:orm-log:store update-log) head)
::
[%subset @ @ ~]
^- update-log:store
!> ^- update-log:store
?~ update-log *update-log:store
=* start i.t.t.t.t.t.path
=* end i.t.t.t.t.t.t.path

View File

@ -190,6 +190,11 @@
|%
++ pull-action pull-hook-action+!>([%add ship rid])
::
++ listen-hark
|= gr=resource
%+ poke-our:pass:io %hark-graph-hook
hark-graph-hook-action+!>([%listen gr /])
::
++ watch-md (watch-our:(jn-pass-io /md) %metadata-store /updates)
++ watch-groups (watch-our:(jn-pass-io /groups) %group-store /groups)
++ watch-md-nacks (watch-our:(jn-pass-io /md-nacks) %metadata-pull-hook /nack)
@ -436,6 +441,9 @@
=? jn-core |(hidden autojoin.request)
%- emit-many
(turn graphs pull-gra:pass)
=? jn-core hidden
%- emit-many
(turn graphs listen-hark:pass)
jn-core
::
++ feed-rid

View File

@ -1,10 +1,10 @@
:~ title+'Groups'
info+'A suite of applications to communicate on Urbit'
color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0v7.bmftr.90ktq.cma0h.da190.bs8b1.glob' 0v7.bmftr.90ktq.cma0h.da190.bs8b1]
glob-http+['https://bootstrap.urbit.org/glob-0v7.2rpmd.966js.dt2sj.ggv4a.n15nq.glob' 0v7.2rpmd.966js.dt2sj.ggv4a.n15nq]
base+'landscape'
version+[1 0 11]
version+[1 1 0]
website+'https://tlon.io'
license+'MIT'
==

View File

@ -35,6 +35,8 @@
(poke-our %group-store group-update-0+!>([%add-members rid (sy our.bowl ~)]))
;< ~ bind:m
(poke-our %group-push-hook push-hook-act)
;< ~ bind:m
(poke-our %hark-graph-hook hark-graph-hook-action+!>([%listen rid /]))
(pure:m rid)
--
::

View File

@ -38,4 +38,6 @@
(raw-poke-our %contact-pull-hook pull-hook-act)
;< ~ bind:m
(raw-poke-our %group-store remove)
;< ~ bind:m
(raw-poke-our %group-view group-view-action+!>([%done rid]))
(pure:m !>(~))

View File

@ -22,3 +22,5 @@ export * as hood from './hood';
export * from './hood';
export * as docket from './docket';
export * from './docket';
export * as term from './term';
export * from './term';

View File

@ -1,12 +1,12 @@
{
"name": "@urbit/api",
"version": "2.1.0",
"version": "2.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@urbit/api",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.16.0",

View File

@ -8,8 +8,12 @@
"directory": "pkg/npm/api"
},
"type": "module",
"main": "dist/cjs/index.js",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.js",
"exports": {
"require": "./dist/cjs/index.cjs",
"import": "./dist/esm/index.js"
},
"jsdelivr": "dist/urbit-api.min.js",
"unpkg": "dist/urbit-api.min.js",
"types": "dist/index.d.ts",

View File

@ -60,13 +60,13 @@ export default [
],
output: [
{
dir: 'dist/esm',
file: 'dist/esm/index.js',
format: 'esm',
exports: 'named',
sourcemap: true
sourcemap: true,
},
{
dir: 'dist/cjs',
file: 'dist/cjs/index.cjs',
format: 'cjs',
exports: 'named',
sourcemap: true

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