Allow Tailscale host names on the dev server; IE_HOSTS adds more

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Fable 5.2 committed 2026-11-15 20:50:09 -05:00
1 parent 8923ba95f9
commit f86a06fa06
2 files changed
+5 -1

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ use on their own machine.
| `IE_LIBRARY` | `library` | Starter documents, each imported once. |
| `IE_USER` | your login name | The name on commits the server makes for you (the page lets you change yours with `/user`). |
| `IE_WIKI` | `live` | `mock`: built-in test articles, no network (the browser tests); `off`: every `/api/wiki/*` route answers 503. |
| `IE_HOSTS` | (none) | Extra host names the dev server answers to, comma-separated. `localhost` and `*.ts.net` (Tailscale) are always allowed. |
| `IE_WIKI_LANG` | `en` | Which Wikipedia. |
| `IE_WIKI_CONTACT` | unset | An email address, an `https://` URL or `User:Name` for the User-Agent of Wikipedia requests. Without it requests are spaced 6.5 s apart (the page says so once, the first time it is slow); with it, 1 s. Nothing else about you is sent. |
| `IE_WEB` | `on` when a model is configured | `off` takes web search and fetch away from the editor agent, whatever the page asks. |
+4 -1
View File
@@ -38,6 +38,9 @@ import { linkRoutes } from "./links/routes";
import { Linker } from "./links/scan";
const PORT = Number(process.env.PORT ?? 4747);
// Host names the dev server answers to besides localhost. Tailscale names are allowed so that
// `tailscale serve` works; IE_HOSTS adds more (comma-separated; a leading dot matches subdomains).
const ALLOWED_HOSTS = [".ts.net", ...(process.env.IE_HOSTS ?? "").split(",").map((h) => h.trim()).filter(Boolean)];
const DATA = dataDir();
const PROD = process.env.IE_PROD === "1";
const MODEL = process.env.IE_MODEL ?? "claude-opus-5-5";
@@ -446,7 +449,7 @@ function serveStatic(res: ServerResponse, path: string) {
const vite = PROD
? null
: await (await import("vite")).createServer({ root, server: { middlewareMode: true, hmr: { port: PORT + 1 } }, appType: "spa" });
: await (await import("vite")).createServer({ root, server: { middlewareMode: true, hmr: { port: PORT + 1 }, allowedHosts: ALLOWED_HOSTS }, appType: "spa" });
createServer(async (req, res) => {
const url = new URL(req.url ?? "/", "http://x");