diff --git a/docs/sites/colony/shill/containers/middleman.md b/docs/sites/colony/shill/containers/middleman.md index a24ec6c..7f47957 100644 --- a/docs/sites/colony/shill/containers/middleman.md +++ b/docs/sites/colony/shill/containers/middleman.md @@ -52,6 +52,9 @@ app, in place of Paseo's hosted relay. `paseo-relay.nul.ie`. It keeps no state, so a restart only drops connections. - The relay can't read or forge messages, so the vhost is open to the world. Its Prometheus `/metrics` is not exposed; `/health` and `/ready` are. +- `paseo.nul.ie` serves Paseo's web app as static files, taken from the same patched Paseo package + as the daemon. Pairing links from our daemon point there, and the app connects through the relay, + so nothing from `paseo.sh` is needed in the browser. ## Network assignments @@ -90,6 +93,7 @@ all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`gene | `speed.nul.ie` | `localhost:8989` | librespeed | | `librespeed.ams1.int.nul.ie` | `localhost:8989` | librespeed on the internal domain (internal wildcard cert) | | `paseo-relay.nul.ie` | `localhost:4000` | Paseo relay; websockets with long timeouts; `/metrics` blocked | +| `paseo.nul.ie` | static Paseo web app | falls back to `index.html`; precompressed files served as-is | | `md.nul.ie` | `object-ctr:3000` | HedgeDoc; websockets | | `pb.nul.ie` | `object-ctr:8088` | wastebin | | `photos.nul.ie` | `jackflix-ctr:2342` | PhotoPrism; websockets | diff --git a/docs/sites/home/sfh/containers/slop-cannon.md b/docs/sites/home/sfh/containers/slop-cannon.md index d34c857..1c02e1c 100644 --- a/docs/sites/home/sfh/containers/slop-cannon.md +++ b/docs/sites/home/sfh/containers/slop-cannon.md @@ -67,18 +67,21 @@ from the app don't survive a restart. It: ### Connectivity -- The daemon listens on `127.0.0.1:6767` only. The phone app and the hosted web app at - `https://app.paseo.sh` reach it through our relay on - [`middleman`](../../../colony/shill/containers/middleman.md#paseo-relay) (`paseo-relay.nul.ie`). +- The daemon listens on `127.0.0.1:6767` only. The phone app and the browser reach it through our + relay on [`middleman`](../../../colony/shill/containers/middleman.md#paseo-relay) + (`paseo-relay.nul.ie`). - Traffic through the relay is end-to-end encrypted between the app and the daemon; the relay sees only addresses, timing and sizes. The pairing QR code or link is the trust anchor; treat it like a password. Switching relays means re-pairing. - Push notifications go from the daemon to Expo's push service (`exp.host`), one outbound request per notification carrying its text. -- In a browser, open the link `paseo daemon pair` prints: it loads the hosted web app with our - relay's address. The daemon's own web UI is off (`features.webUi.enabled` defaults to `false`); - if enabled, it needs a secure context, so it would be reached through an SSH tunnel to - `localhost` (`ssh -L 6767:127.0.0.1:6767 slop-cannon`). +- In a browser, open the link `paseo daemon pair` prints. `app.baseUrl` points it at our copy of + the web app on `paseo.nul.ie`, served by `middleman`, instead of `app.paseo.sh`. The daemon's own + web UI stays off, so nothing needs to reach the daemon directly. +- Opening a pairing link in the address bar adds the host without asking for the daemon password, + and the host page then shows "Password required" with no way to enter it. Instead, use the app's + option to paste a pairing link, which prompts for the password; remove a host added the other way + first. ### State diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix index defb117..347dde6 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix @@ -38,6 +38,11 @@ let })) ]; }; + # Paseo's web app, which connects to daemons through the relay + paseoWebUi = pkgs.runCommand "paseo-web-ui-${pkgs.paseo.version}" { } '' + cp -r ${pkgs.paseo}/lib/paseo/packages/server/dist/server/web-ui "$out" + ''; + wellKnown = { "/.well-known/" = { alias = "${wellKnownRoot}/"; @@ -393,6 +398,23 @@ in }; useACMEHost = pubDomain; }; + "paseo.${pubDomain}" = { + root = paseoWebUi; + extraConfig = '' + gzip_static on; + brotli_static on; + ''; + locations = { + "/".tryFiles = "$uri $uri/ /index.html"; + "= /index.html".extraConfig = '' + add_header Cache-Control "no-store"; + ''; + "/_expo/".extraConfig = '' + add_header Cache-Control "public, max-age=31536000, immutable"; + ''; + }; + useACMEHost = pubDomain; + }; "md.${pubDomain}" = { locations."/" = { diff --git a/nixos/boxes/home/palace/vms/sfh/containers/slop-cannon.nix b/nixos/boxes/home/palace/vms/sfh/containers/slop-cannon.nix index 67f9f12..36a1f25 100644 --- a/nixos/boxes/home/palace/vms/sfh/containers/slop-cannon.nix +++ b/nixos/boxes/home/palace/vms/sfh/containers/slop-cannon.nix @@ -48,12 +48,6 @@ in "Bash(slop-ssh:*)" ]; - # TODO: Drop the override once getpaseo/paseo#7673 is fixed. The build runs npm with - # `--ignore-scripts`, so the web UI's `postinstall` patch is never applied. - paseo = inputs.paseo.packages.${pkgs.stdenv.hostPlatform.system}.default.overrideAttrs (old: { - preBuild = (old.preBuild or "") + "\nnpm run postinstall\n"; - }); - slopClone = pkgs.writeShellApplication { name = "slop-clone"; runtimeInputs = with pkgs; [ jujutsu openssh paseo ]; @@ -176,7 +170,7 @@ in services.paseo = { enable = true; - package = paseo; + package = pkgs.paseo; user = agentUser; group = agentUser; listenAddress = "127.0.0.1"; @@ -193,6 +187,8 @@ in # Rewritten on every start, so changes made from the app don't survive a restart settings = { version = 1; + # Pairing links open our copy of the web app (served by `middleman`) + app.baseUrl = "https://paseo.${lib.my.c.pubDomain}"; daemon = { # Keep agents from changing modes, answering prompts or opening terminals mcp.injectIntoAgents = false; diff --git a/nixos/modules/common.nix b/nixos/modules/common.nix index 5a2d4d3..0312e02 100644 --- a/nixos/modules/common.nix +++ b/nixos/modules/common.nix @@ -84,6 +84,13 @@ in inputs.copyparty.overlays.default inputs.hass-west-wood.overlays.default # inputs.pi-agent.overlays.default + (final: prev: { + # TODO: Drop the override once getpaseo/paseo#7673 is fixed. The build runs npm with + # `--ignore-scripts`, so the web UI's `postinstall` patch is never applied. + paseo = inputs.paseo.packages.${prev.stdenv.hostPlatform.system}.default.overrideAttrs (old: { + preBuild = (old.preBuild or "") + "\nnpm run postinstall\n"; + }); + }) ]; config = { allowUnfree = true;