~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
main
52 lines · 2.2 KB Raw History
# atlibs-examples-spa-networking

`examples/marque-fedproxy-ingress`: serve from a browser tab through the fedproxy ingress, at the tab's did:key host; signed in, on a Marque domain too.

```sh
cargo install --locked --git https://knotless.dev/johnandersen777.bsky.social/atlibs --rev 88b2ba8 atlibs
git clone https://knotless.dev/johnandersen777.bsky.social/atlibs-examples-spa-networking
cd atlibs-examples-spa-networking
scripts/stage.sh
python3 -m http.server 8780 --bind 127.0.0.1 -d examples/marque-fedproxy-ingress/dist   # http://127.0.0.1:8780/
```

Signed out, http://127.0.0.1:8780/ serves at once at the URL it shows (its did:key stays in the browser's site data, so reloads keep it):

```sh
curl https://did-key-<key>.xrpc.fedproxy.com/   # hello world, from the tab
```

Signed in, pick a domain you registered at [Marque](https://marque.at), a name, Serve: it writes `<name> CNAME did-key-<key>.xrpc.fedproxy.com` and `_xrpc.<name> TXT did:key:<key>`, and the tab answers there too:

```sh
dig +short TXT _xrpc.<name>.<domain>   # did:key:<key>
curl https://<name>.<domain>/          # hello world, from the tab
```

| what | from |
|---|---|
| `@publicdomainrelay/atlibs` 0.3.0, `-code-mode` 0.3.0 | jsdelivr (`index.html` import map) |
| assemblyscript 0.28.20, binaryen 131.0.0-nightly.20260721, long 5.3.2 | jsdelivr |
| `@atproto/oauth-client-browser` 0.5.14, codemirror 6.0.2, `@codemirror/lang-javascript` 6.2.5 | esm.sh |
| `marque` module + session | `bafyreigtk2moowpnarynnlhle6seiod547wufbivliavdutljs3bydkhli` (bobvmbuilder.bsky.social, `atlibs.lock.json`) |
| `ingress` module | `bafyreidhsbptjjb4kbzdom2s6fgj47urcne56gcgl4hks254qertg7e3ja` |

Deploy (any static host):

```sh
scripts/stage.sh --origin https://you.example/serve/ && rsync -a examples/marque-fedproxy-ingress/dist/ you.example:/srv/serve/
```

Deploy https://atlibs-networking.socialweb.computer/ (`scripts/deploy.sh`: stage for that origin, back up the live dir, tar over ssh to the socialweb.computer gateway, a Caddy `file_server` site):

```sh
scripts/deploy.sh
```

Update a module: `(cd examples/marque-fedproxy-ingress && atlibs add bobvmbuilder.bsky.social/<module>)`, then `scripts/stage.sh`.

Test:

```sh
node --test examples/*/*.test.mjs
```