Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
gateway: sharing lists this network's addresses first, and names one on the internet
yetone581d64b7d0af
diff --git a/internal/gateway/lan.go b/internal/gateway/lan.goindex 437e5c223..b5a75bd1d 100644--- a/internal/gateway/lan.go+++ b/internal/gateway/lan.go@@ -179,14 +179,57 @@ func LANURLs() []string {// ISP assigns to the network card itself. The gateway's addresses and// `magpie web`'s links are both made from these, so the two list the// same computer the same way (a static public address was in one and not-// the other).+// the other). Private ones come first: in the interfaces' order the public+// one came first, and Settings offered it as the address under "Share on+// local network" (the same user, asking why sharing was on the internet).func LANHosts() []string {- var out []string+ var near, far []stringfor _, ip := range hostIPs() {if ip.To4() == nil || ip.IsLoopback() || ip.IsLinkLocalUnicast() {continue}- out = append(out, ip.String())+ if PublicIP(ip) {+ far = append(far, ip.String())+ } else {+ near = append(near, ip.String())+ }+ }+ return append(near, far...)+}++// sharedRanges are IPv4 ranges outside RFC 1918 that still aren't the+// internet: carrier-grade NAT, which Tailscale uses, and the benchmarking+// range proxies' TUN interfaces (Clash, Surge) take.+var sharedRanges = []*net.IPNet{+ {IP: net.IPv4(100, 64, 0, 0), Mask: net.CIDRMask(10, 32)},+ {IP: net.IPv4(198, 18, 0, 0), Mask: net.CIDRMask(15, 32)},+}++// PublicIP: ip is an internet address, which any computer online may+// reach, not one on a private network.+func PublicIP(ip net.IP) bool {+ if !ip.IsGlobalUnicast() || ip.IsPrivate() {+ return false+ }+ for _, n := range sharedRanges {+ if n.Contains(ip) {+ return false+ }+ }+ return true+}++// PublicURLs are those of urls (LANURLs) at an internet address.+func PublicURLs(urls []string) []string {+ var out []string+ for _, u := range urls {+ p, err := url.Parse(u)+ if err != nil {+ continue+ }+ if ip := net.ParseIP(p.Hostname()); ip != nil && PublicIP(ip) {+ out = append(out, u)+ }}return out}diff --git a/internal/gateway/lan_hosts_test.go b/internal/gateway/lan_hosts_test.goindex 12b19a4b4..6b85da90d 100644--- a/internal/gateway/lan_hosts_test.go+++ b/internal/gateway/lan_hosts_test.go@@ -8,7 +8,8 @@ import (// A computer whose ISP assigns a static public address to its network// card is reached there as well as at its private one: both are offered,-// in the interfaces' order. Loopback, link-local and IPv6 are not.+// private ones first, and the public ones are named. Loopback, link-local+// and IPv6 are not offered.func TestLANHostsKeepAPublicAddress(t *testing.T) {t.Setenv("MAGPIE_PUBLIC_URL", "")t.Setenv("MAGPIE_ADDR", "")@@ -16,12 +17,14 @@ func TestLANHostsKeepAPublicAddress(t *testing.T) {t.Cleanup(func() { hostIPs = was })hostIPs = func() []net.IP {var out []net.IP- for _, s := range []string{"203.236.50.70", "10.77.70.2", "100.64.0.1", "169.254.3.4", "127.0.0.2", "fe80::1", "2001:db8::5"} {+ for _, s := range []string{"203.236.50.70", "10.77.70.2", "100.64.0.1", "169.254.3.4", "127.0.0.2", "fe80::1", "2001:db8::5", "198.18.0.1", "8.8.4.4"} {out = append(out, net.ParseIP(s))}return out}- want := []string{"203.236.50.70", "10.77.70.2", "100.64.0.1"}+ // private ones first, so the address Settings offers by default is on+ // this network; the public ones after, in the interfaces' order+ want := []string{"10.77.70.2", "100.64.0.1", "198.18.0.1", "203.236.50.70", "8.8.4.4"}if got := LANHosts(); !slices.Equal(got, want) {t.Fatalf("LANHosts: %v, want %v", got, want)}@@ -32,4 +35,7 @@ func TestLANHostsKeepAPublicAddress(t *testing.T) {if got := LANURLs(); !slices.Equal(got, urls) {t.Errorf("LANURLs: %v, want %v", got, urls)}+ if got := PublicURLs(urls); !slices.Equal(got, urls[3:]) {+ t.Errorf("PublicURLs: %v, want %v", got, urls[3:])+ }}diff --git a/internal/gui/api.go b/internal/gui/api.goindex 0dd5de632..30bb9260a 100644--- a/internal/gui/api.go+++ b/internal/gui/api.go@@ -483,6 +483,9 @@ type settingsJSON struct {// LANURLs are a container's own addresses, not the host's: the page// offers the one it was opened at instead, or says how to set itLANContainer bool `json:"lanContainer,omitempty"`+ // those of LANURLs at an internet address, which anyone online can+ // reach, not only this network+ LANPublic []string `json:"lanPublic,omitempty"`// when the Codex warm-up last started an account's windowCodexWarmed *time.Time `json:"codexWarmed,omitempty"`// and the Claude warm-up@@ -667,6 +670,7 @@ func settingsState() settingsJSON {s.Login, s.LoginAllow = login != autostart.Off, login == autostart.NeedsAllowingif s.LAN {s.LANURLs, s.LANContainer = gateway.LANURLs(), gateway.ContainerAddrs()+ s.LANPublic = gateway.PublicURLs(s.LANURLs)}s.CodexWarmed, s.ClaudeWarmed = latest(provider.CodexWarmed()), latest(provider.ClaudeWarmed())s.CodexUsers = codexUsers()diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.jsindex 4c852de37..6d0a1ab9e 100644--- a/internal/gui/assets/i18n.js+++ b/internal/gui/assets/i18n.js@@ -2194,6 +2194,9 @@ const I18N = {"Web page origin": "网页来源","Web pages that may call magpie": "允许调用 magpie 的网页","Allowed addresses": "允许的地址",+ "On the internet": "在公网上",+ "An internet address: only the addresses under Allowed addresses get in": "公网地址:只有「允许的地址」里的地址能连入",+ "An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses": "公网地址:互联网上任何人凭网关密钥都能在这里连到 magpie。只想让这个局域网连入,请在「允许的地址」里填上它的网段","IP address or range": "IP 地址或网段","Set by MAGPIE_ALLOW_IPS. Other computers reach magpie only from these addresses, even with a gateway key; this computer always can": "由 MAGPIE_ALLOW_IPS 设置。其他电脑只能从这些地址访问 magpie,即使带着网关密钥也一样;本机始终可以","Other computers reach magpie only from these addresses or ranges (CIDR), even with a gateway key; this computer always can. None listed lets every address in": "其他电脑只能从这些地址或网段(CIDR)访问 magpie,即使带着网关密钥也一样;本机始终可以。一个都不填则所有地址都可访问",@@ -6230,6 +6233,9 @@ const I18N = {"Web page origin": "網頁來源","Web pages that may call magpie": "允許呼叫 magpie 的網頁","Allowed addresses": "允許的位址",+ "On the internet": "在網際網路上",+ "An internet address: only the addresses under Allowed addresses get in": "公網位址:只有「允許的位址」裡的位址能連入",+ "An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses": "公網位址:網際網路上任何人憑閘道金鑰都能在這裡連到 magpie。只想讓這個區域網連入,請在「允許的位址」裡填上它的網段","IP address or range": "IP 位址或網段","Set by MAGPIE_ALLOW_IPS. Other computers reach magpie only from these addresses, even with a gateway key; this computer always can": "由 MAGPIE_ALLOW_IPS 設定。其他電腦只能從這些位址連到 magpie,即使帶著閘道金鑰也一樣;本機一律可以","Other computers reach magpie only from these addresses or ranges (CIDR), even with a gateway key; this computer always can. None listed lets every address in": "其他電腦只能從這些位址或網段(CIDR)連到 magpie,即使帶著閘道金鑰也一樣;本機一律可以。一個都不填則所有位址都可連線",@@ -10245,6 +10251,9 @@ const I18N = {"Web page origin": "Web ページのオリジン","Web pages that may call magpie": "magpie を呼び出せる Web ページ","Allowed addresses": "許可するアドレス",+ "On the internet": "インターネット上",+ "An internet address: only the addresses under Allowed addresses get in": "インターネット上のアドレス:「許可するアドレス」にあるアドレスだけが接続できます",+ "An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses": "インターネット上のアドレス:ゲートウェイキーがあれば、インターネット上の誰でもここから magpie に接続できます。このネットワークだけにするには、その範囲を「許可するアドレス」に追加してください","IP address or range": "IP アドレスまたは範囲","Set by MAGPIE_ALLOW_IPS. Other computers reach magpie only from these addresses, even with a gateway key; this computer always can": "MAGPIE_ALLOW_IPS で設定されています。ほかのコンピュータは、ゲートウェイキーがあっても、これらのアドレスからしか magpie に接続できません。このコンピュータは常に接続できます","Other computers reach magpie only from these addresses or ranges (CIDR), even with a gateway key; this computer always can. None listed lets every address in": "ほかのコンピュータは、ゲートウェイキーがあっても、これらのアドレスまたは範囲(CIDR)からしか magpie に接続できません。このコンピュータは常に接続できます。何も登録しなければ、すべてのアドレスから接続できます",@@ -14290,6 +14299,9 @@ const I18N = {"Web page origin": "Herkunft der Webseite","Web pages that may call magpie": "Webseiten, die magpie aufrufen dürfen","Allowed addresses": "Erlaubte Adressen",+ "On the internet": "Im Internet",+ "An internet address: only the addresses under Allowed addresses get in": "Eine Internetadresse: Nur die Adressen unter „Erlaubte Adressen“ kommen herein",+ "An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses": "Eine Internetadresse: Jeder im Internet erreicht magpie hier mit einem Gateway-Schlüssel. Um es auf dieses Netzwerk zu beschränken, trage seinen Bereich unter „Erlaubte Adressen“ ein","IP address or range": "IP-Adresse oder Bereich","Set by MAGPIE_ALLOW_IPS. Other computers reach magpie only from these addresses, even with a gateway key; this computer always can": "Von MAGPIE_ALLOW_IPS festgelegt. Andere Computer erreichen magpie nur von diesen Adressen aus, auch mit einem Gateway-Schlüssel; dieser Computer immer","Other computers reach magpie only from these addresses or ranges (CIDR), even with a gateway key; this computer always can. None listed lets every address in": "Andere Computer erreichen magpie nur von diesen Adressen oder Bereichen (CIDR) aus, auch mit einem Gateway-Schlüssel; dieser Computer immer. Ist keine eingetragen, ist jede Adresse erlaubt",diff --git a/internal/gui/assets/plugins/gateway/client.js b/internal/gui/assets/plugins/gateway/client.jsindex f23ccb353..c138479f7 100644--- a/internal/gui/assets/plugins/gateway/client.js+++ b/internal/gui/assets/plugins/gateway/client.js@@ -209,7 +209,11 @@ function renderGatewayLan() {line(t(shown === g.url ? "This computer" : "Public address"), shown);if (g.lan) {const { urls, sub } = lanShown(g.lanURLs || [], prefs?.lanContainer);- urls.filter((u) => u !== shown).forEach((u, i) => line(i ? "" : t("Local network"), u));+ // an internet address on an interface (an ISP's static one) is said+ // to be one, not listed as this network's+ const far = new Set(g.lanPublic || []), rest = urls.filter((u) => u !== shown);+ rest.filter((u) => !far.has(u)).forEach((u, i) => line(i ? "" : t("Local network"), u));+ rest.filter((u) => far.has(u)).forEach((u, i) => line(i ? "" : t("On the internet"), u));if (!urls.length) list.append(el("div", "gw-url-none", t("This computer has no local network address right now")));if (sub) list.append(el("div", "gw-url-none", sub));}diff --git a/internal/gui/assets/plugins/gateway/settings.js b/internal/gui/assets/plugins/gateway/settings.jsindex eecbc6e31..db87d88c3 100644--- a/internal/gui/assets/plugins/gateway/settings.js+++ b/internal/gui/assets/plugins/gateway/settings.js@@ -267,6 +267,10 @@ function renderLAN(s) {if (!urls.length) row(t("Address"), t("This computer has no local network address right now"), "");else {lanSelectedURL = urls.includes(lanWant) ? lanWant : urls[0];+ // an interface can hold an internet address (an ISP's static one, a+ // VPN's): the gateway answers there too, so the row says so+ const far = new Set(s.lanPublic || []);+ const listed = (s.allowIPsEnv ? s.allowIPsFromEnv : s.allowIPs)?.length > 0;const controls = el("div", "lan-address-controls");const address = urls.length === 1 ? el("code", "lan-address-text") : el("button", "proto pick lan-interface");if (urls.length > 1) {@@ -276,7 +280,7 @@ function renderLAN(s) {e.stopPropagation();if (address.classList.contains("open")) return closeProtoMenu();const suffix = lanProtocol === "openai" ? "/v1" : "";- openProtoMenu(address, urls.map((u) => ({ v: u, name: u + suffix, note: "" })), lanSelectedURL,+ openProtoMenu(address, urls.map((u) => ({ v: u, name: u + suffix, note: far.has(u) ? t("On the internet") : "" })), lanSelectedURL,(v) => { lanSelectedURL = lanWant = v; keepPick("magpie.lanAddress", v); update(); }, "Address", "lan-address-menu");};}@@ -291,10 +295,17 @@ function renderLAN(s) {const button = copyBtn(url, what, t("Copied {label} address", { label }));button.setAttribute("aria-label", t("Copy") + " " + what);copyControl.replaceChildren(button);+ const who = addressRow?.querySelector(".who");+ if (!who) return;+ who.querySelector(".sub")?.remove();+ if (far.has(lanSelectedURL)) who.append(el("div", "sub", listed+ ? t("An internet address: only the addresses under Allowed addresses get in")+ : t("An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses")));};controls.append(segs([["openai", "OpenAI"], ["anthropic", "Anthropic"]], lanProtocol,(v) => { lanProtocol = v; update(); }), address, copyControl);- row(t("Address"), "", "", controls).classList.add("lan-address-row");+ const addressRow = row(t("Address"), "", "", controls);+ addressRow.classList.add("lan-address-row");update();}if (sub) row(t("In a container"), sub, "").classList.add("lan-container");diff --git a/internal/gui/providers.go b/internal/gui/providers.goindex 704dde7da..e4f17c54a 100644--- a/internal/gui/providers.go+++ b/internal/gui/providers.go@@ -432,6 +432,9 @@ type gatewayJSON struct {// PublicURL is MAGPIE_PUBLIC_URL when it is among LANURLs: Connect// starts there until the user picks an address (#1551)PublicURL string `json:"publicURL,omitempty"`+ // LANPublic are those of LANURLs at an internet address, which anyone+ // online reaches, not only this network+ LANPublic []string `json:"lanPublic,omitempty"`// OnNetwork: MAGPIE_ADDR puts it beyond loopback (a server, a Docker// image), so every caller is shown a gateway key, and LAN is true too:// callers from elsewhere, a container's host among them, need one@@ -913,6 +916,7 @@ func providersState() providersJSON {s.Gateway.LAN = settings.Load().LAN || s.Gateway.OnNetworkif s.Gateway.LAN {s.Gateway.LANURLs = gateway.LANURLs()+ s.Gateway.LANPublic = gateway.PublicURLs(s.Gateway.LANURLs)if u := gateway.PublicURL(); slices.Contains(s.Gateway.LANURLs, u) {s.Gateway.PublicURL = u}diff --git a/internal/gui/tests/fixtures/caller-keys.cjs b/internal/gui/tests/fixtures/caller-keys.cjsindex 8bb234c60..fad841045 100644--- a/internal/gui/tests/fixtures/caller-keys.cjs+++ b/internal/gui/tests/fixtures/caller-keys.cjs@@ -26,10 +26,12 @@ function fixture(lang, theme, events, options = {}) {const secrets = new Map([["laptop", "fixture-laptop"], ["server", "fixture-server"], ["work", "fixture-work"]]);// options.lanURLs is the test's own list, so it can take the network awayconst lanURLs = options.lanURLs || ["http://192.168.1.10:3999", "http://10.0.0.10:3999"];+ // options.lanPublic are those of them at an internet address+ const lanPublic = () => lan && options.lanPublic ? { lanPublic: options.lanPublic } : {};// options.publicURL is MAGPIE_PUBLIC_URL's, offered while shared (#1551)const publicURL = () => lan && options.publicURL ? { publicURL: options.publicURL } : {};const lanState = () => ({ lang, theme, lan,- lanURLs: lan ? lanURLs : [], fx: { rate: 7.2, at: new Date().toISOString() },+ lanURLs: lan ? lanURLs : [], ...lanPublic(), fx: { rate: 7.2, at: new Date().toISOString() },...(options.publicURL ? { gateway: "http://127.0.0.1:3999", ...publicURL() } : {}) });const rows = [{ callerKeyId: "laptop", callerKeyName: "Laptop", in: 100, out: 10, cost: 0.1 },@@ -66,7 +68,7 @@ function fixture(lang, theme, events, options = {}) {if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme } });if (url.pathname === "/api/providers") return json({providers: [{ id: "relay", name: "Relay", icon: "generic", models: [{ id: "m", name: "Model", on: true }], agents: [] }],- gateway: { running: true, window: true, mine: true, url: "http://127.0.0.1:3999", lan, lanURLs: lan ? lanURLs : [], ...publicURL(), calls: [], groups: [] },+ gateway: { running: true, window: true, mine: true, url: "http://127.0.0.1:3999", lan, lanURLs: lan ? lanURLs : [], ...lanPublic(), ...publicURL(), calls: [], groups: [] },});if (url.pathname === "/api/groups") return json({ groups: [], models: [] });if (url.pathname === "/api/settings/lan") {diff --git a/internal/gui/tests/lan-public.test.cjs b/internal/gui/tests/lan-public.test.cjsnew file mode 100644index 000000000..d1834039b--- /dev/null+++ b/internal/gui/tests/lan-public.test.cjs@@ -0,0 +1,132 @@+// Run with Node's test runner and Playwright on the module path; see README.md.+// Share on local network on a computer with an internet address (Discord,+// 10-28: 203.236.50.70 shown as the LAN address): the private addresses come+// first (gateway.LANURLs), and picking the internet one says anyone online+// can reach magpie there, and how to keep it to this network; with an+// allow list, that only those addresses get in. The Gateway page lists it+// under "On the internet", not "Local network". English and Chinese,+// Chromium and WebKit; no backend, the API is faked here.+const assert = require("node:assert/strict");+const fs = require("node:fs/promises");+const path = require("node:path");+const { test } = require("node:test");+const { chromium, webkit } = require("playwright");+const { watchSettingsReads, settingsDrawn } = require("./reader.cjs");+const { fixture } = require("./fixtures/caller-keys.cjs");++const assets = path.resolve(__dirname, "../assets");++function settingsPayload(over) {+ return {+ theme: "light", lang: "en", tray: "panel", quotaLeft: false, currency: "usd",+ dock: false, dockWindow: false, proxy: "", redact: false, redactPersonal: false, redactWords: [],+ codexWarmup: "", claudeWarmup: "", codexWarmAt: "", claudeWarmAt: "", workbuddyCheckin: false, noStats: false,+ trayUsage: "", trayUsageEvery: 3, vision: "", imageGen: "",+ version: "0.1.400", dir: "/config/magpie", gateway: "http://0.0.0.0:3425",+ proxyNow: "none", proxySource: "none", login: false,+ visionModels: [], imageGenModels: [], workbuddyCheckins: [],+ lan: true, lanKey: "sk-magpie-0123456789abcdef", lanURLs: ["http://192.168.1.5:3425", "http://203.236.50.70:3425"], lanPublic: ["http://203.236.50.70:3425"],+ fx: { rate: 7.2, at: new Date().toISOString(), stale: false },+ ...over,+ };+}++function server(lang, web, over) {+ const s = settingsPayload({ lang, ...over });+ return async (route) => {+ const url = new URL(route.request().url());+ const json = (data) => route.fulfill({ json: data });+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:${web}};` });+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });+ if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light" }, fx: s.fx });+ if (url.pathname === "/api/settings") return json(s);+ if (url.pathname === "/api/plugins") return json({ plugins: [] });+ if (url.pathname === "/api/usage/quotas") return json([]);+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });+ if (url.pathname.startsWith("/api/")) return json({});+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];+ await route.fulfill({ body: await fs.readFile(file), contentType });+ };+}++const words = {+ en: {+ open: "An internet address: anyone online can reach magpie here with a gateway key. To keep it to this network, list its range under Allowed addresses",+ listed: "An internet address: only the addresses under Allowed addresses get in",+ note: "On the internet",+ lan: "Local network", local: "This computer",+ },+ zh: {+ open: "公网地址:互联网上任何人凭网关密钥都能在这里连到 magpie。只想让这个局域网连入,请在「允许的地址」里填上它的网段",+ listed: "公网地址:只有「允许的地址」里的地址能连入",+ note: "在公网上",+ lan: "局域网", local: "本机",+ },+};++for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {+ test(engine + ": an internet address under Share on local network says so", async (t) => {+ assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit");+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));+ t.after(() => browser.close());+ const open = async (lang, over) => {+ const page = await (await browser.newContext({ viewport: { width: 900, height: 800 }, reducedMotion: "reduce" })).newPage();+ page.setDefaultTimeout(5000);+ const errors = [];+ page.on("pageerror", (e) => errors.push(e.message));+ await page.route("**/*", server(lang, false, over));+ await watchSettingsReads(page);+ await page.goto("http://localhost:3430/?view=settings&tab=network");+ await settingsDrawn(page);+ await page.locator("#lanList .lan-interface").waitFor();+ return { page, errors };+ };+ const row = (page) => page.locator("#lanList .lan-address-row");+ const pickFar = async (page) => {+ // in the middle of the view, away from Settings' search head, which+ // stays at the top and would take the click+ await page.locator("#lanList .lan-interface").evaluate((b) => b.scrollIntoView({ block: "center" }));+ await page.locator("#lanList .lan-interface").click();+ const menu = page.locator(".lan-address-menu");+ await menu.waitFor();+ const text = await menu.textContent();+ await menu.getByText("http://203.236.50.70:3425/v1").click();+ return text;+ };+ for (const lang of ["en", "zh"]) {+ const w = words[lang];+ await t.test(lang, async () => {+ {+ const { page, errors } = await open(lang);+ assert.equal((await page.locator("#lanList .lan-url").textContent()).trim(), "http://192.168.1.5:3425/v1");+ assert.equal(await row(page).locator(".sub").count(), 0, "a private address needs no note");+ assert((await pickFar(page)).includes(w.note), "the menu marks the internet address");+ assert.equal((await row(page).locator(".sub").textContent()).trim(), w.open);+ assert.deepEqual(errors, []);+ }+ {+ const { page, errors } = await open(lang, { allowIPs: ["192.168.1.0/24"] });+ await pickFar(page);+ assert.equal((await row(page).locator(".sub").textContent()).trim(), w.listed, "the allow list is named");+ assert.deepEqual(errors, []);+ }+ {+ const page = await (await browser.newContext({ viewport: { width: 900, height: 800 }, reducedMotion: "reduce" })).newPage();+ page.setDefaultTimeout(5000);+ const errors = [];+ page.on("pageerror", (e) => errors.push(e.message));+ await page.route("**/*", fixture(lang, "light", [], { lan: true,+ lanURLs: ["http://192.168.1.10:3999", "http://203.236.50.70:3999"], lanPublic: ["http://203.236.50.70:3999"] }));+ await page.goto("http://magpie.test/?view=gateway");+ const box = page.locator("#gatewayLan");+ await page.waitForFunction(() => document.querySelectorAll("#gatewayLan .gw-url").length === 3);+ assert.deepEqual((await box.locator(".gw-url code").allTextContents()).map((x) => x.trim()),+ ["http://127.0.0.1:3999", "http://192.168.1.10:3999", "http://203.236.50.70:3999"]);+ assert.deepEqual((await box.locator(".gw-url-label").allTextContents()).map((x) => x.trim()), [w.local, w.lan, w.note]);+ assert.deepEqual(errors, []);+ }+ });+ }+ });+}