Files
airc/config.example.json
Tommi Kyntola a111823bfc Give every tunnel its own switch, and put ngrok first
Tailscale Funnel has been the flaky one here: the public *.ts.net path goes
dead while every local tailscale check stays green, and it takes the advertised
URL down with it. ngrok has never done that. But `publicUrl` — one string,
outranking ngrok by construction — left no way to lean on ngrok without
deleting the Funnel URL, and no place to park a third tunnel while trying it
out.

So tunnels become a group, one entry each with its own `enabled` flag:

  "tunnels": {
    "prefer": ["ngrok", "tailscale", "external"],
    "ngrok":     { "enabled": false, "domain": ..., "binary": ..., "apiUrl": ... },
    "tailscale": { "enabled": false, "url": "" },
    "external":  { "enabled": false, "url": "" }
  }

`prefer` is precedence, not exclusivity. Every enabled tunnel still reaches the
server; the first one that can name a URL is merely what gets baked into
bookmarks, the pairing QR and /api/config. Swapping the advertised route is a
reorder of that list plus a restart, with the losing tunnel left configured and
live as a spare. `external` is the slot for whatever comes next — Cloudflare, a
reverse proxy — without another schema change. A partial `prefer` ranks the
rest last rather than hiding them; an unknown name in it is a load error, since
a typo there would otherwise silently re-point the advertised URL.

Only ngrok is supervised, as before: `tailscale` and `external` are URLs airc
advertises for tunnels somebody else keeps up, which is all `publicUrl` ever
was. Because a reserved ngrok domain is knowable before the agent is up, it is
now advertised from the first request instead of after the agent reports; the
live URL replaces it when it lands (the two differ only without a reserved
domain), and both paths log through one announce().

`--no-ngrok` now means only what it says — skip the agent, let the next tunnel
down the list take over. `--no-tunnels` is new and means LAN/loopback only;
`tools/airc local` and `npm run dev` use it, which is what keeps local mode
preferring a LAN URL in pairing payloads now that disabling ngrok no longer
implies disabling everything. /healthz and /api/status gained a `tunnels` block
listing the routes in preference order with the advertised one named, and
`tools/airc status` prints that name next to the URL.

Old configs load untouched: a top-level `ngrok` block becomes `tunnels.ngrok`,
a top-level `publicUrl` becomes `tunnels.external.url`, and a file still in
that shape keeps its old precedence — publicUrl over ngrok — so pulling this
cannot silently re-point an existing pairing at a different tunnel. Only a
config that opts into `tunnels` gets the new ngrok-first default.

test/tunnels.test.js covers the ordering, both migration paths and the two
flags. Checked live against both orderings on a scratch port before restarting
the real server; with ngrok advertised, both it and the still-enabled Funnel
answer 200. Worth naming the cost: ngrok's free-tier interstitial does not
render in the Tesla browser, so the car keeps its ts.net bookmark, which works
precisely because a demoted tunnel stays up.
2026-08-26 13:09:57 +03:00

47 lines
808 B
JSON

{
"productName": "AI Remote Control",
"host": "127.0.0.1",
"port": 8080,
"sessions": [
"*"
],
"pollMs": 700,
"pollIdleMaxMs": 2500,
"viewToken": "",
"controlToken": "",
"fontSizeDefault": 13,
"theme": "dark",
"resizeToViewport": false,
"attention": {
"enabled": true,
"scanMs": 1500,
"debounceScans": 2,
"maxPanes": 24
},
"dais": {
"enabled": false,
"socket": ""
},
"tunnels": {
"prefer": [
"ngrok",
"tailscale",
"external"
],
"ngrok": {
"enabled": false,
"domain": "your-domain.ngrok-free.dev",
"binary": "ngrok",
"apiUrl": "http://127.0.0.1:4040"
},
"tailscale": {
"enabled": false,
"url": ""
},
"external": {
"enabled": false,
"url": ""
}
}
}