First external portal!

This commit is contained in:
Tony Garnock-Jones 2023-01-31 17:56:27 +01:00
parent 63991388f3
commit 70436ffb01
2 changed files with 7 additions and 10 deletions

View File

@ -4,14 +4,12 @@
;
;---------------------------------------------------------------------------
; Expose the gatekeeper on port 9001:
<require-service <relay-listener <tcp "0.0.0.0" 9001> $gatekeeper>>
; Create a dataspace entity, and register it with the gatekeeper with name `"syndicate"` and an
; empty secret key:
; Create the main dataspace:
let ?ds = dataspace
<MainDataspace $ds>
<bind "syndicate" #x"" $ds>
; Expose the main dataspace directly on port 9001:
<require-service <relay-listener <tcp "0.0.0.0" 9001> $ds>>
$ds ?? <log ?ts ?detail> [
$log ! <log $ts $detail>

View File

@ -206,8 +206,6 @@ function bootApp(ds: Ref, runningEngine: RunningEngine) {
const id = uuid();
const url = wsurl();
const serverCap = Sturdy.asSturdyRef(new Reader<Ref>(
'<ref "syndicate" [] #[pkgN9TBmEd3Q04grVG4Zdw==]>').next());
const relayAddr = wsRelay.RelayAddress(Schemas.transportAddress.WebSocket(url));
field email: string = localStorage.getItem('userEmail') ?? id;
@ -221,11 +219,12 @@ function bootApp(ds: Ref, runningEngine: RunningEngine) {
field route: wsRelay.Noise.Route<Ref> = wsRelay.Noise.Route<Ref>({
"transports": [fromJS(relayAddr)],
"steps": [wsRelay.Noise.RouteStep.GatekeeperStep(serverCap)],
"steps": [],
});
during wsRelay.Resolved({
"route": route.value,
"addr": $addr: wsRelay.RelayAddress,
"resolved": $remoteDs_e: Embedded,
}) => {
const remoteDs = remoteDs_e.embeddedValue;
@ -234,7 +233,7 @@ function bootApp(ds: Ref, runningEngine: RunningEngine) {
log('connected');
on message wakeDetector.WakeEvent() => {
send message wsRelay.ForceRelayDisconnect(relayAddr);
send message wsRelay.ForceRelayDisconnect(addr);
}
react {