fix(control): followers update live, phones use the page address, master is visible (1.77.2)

This commit is contained in:
larssand committed 2026-11-07 18:09:34 +01:00
1 parent 0589fe5f65
commit a4e734dd74
13 files changed
+119 -22

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import test from "node:test";
import assert from "node:assert/strict";
import { resolveBackendUrl } from "../src/backend_url.js";
const phone = { protocol: "http:", hostname: "192.168.1.46", origin: "http://192.168.1.46:8081" };
const laptop = { protocol: "http:", hostname: "localhost", origin: "http://localhost:8081" };
test("a phone on the laptop's IP ignores the laptop's saved localhost address", () => {
assert.equal(resolveBackendUrl("http://localhost:8081", phone), "http://192.168.1.46:8081");
assert.equal(resolveBackendUrl("http://127.0.0.1:8081/", phone), "http://192.168.1.46:8081");
assert.equal(resolveBackendUrl("http://localhost:8081", laptop), "http://localhost:8081", "the laptop keeps it");
assert.equal(resolveBackendUrl("http://10.0.0.5:8081", phone), "http://10.0.0.5:8081", "a real address set on purpose is kept");
assert.equal(resolveBackendUrl("", phone), "http://192.168.1.46:8081");
assert.equal(resolveBackendUrl("", { protocol: "file:" }), "http://127.0.0.1:8081");
});