fix(version): move the finer geo state to the admin status

geoLookup and geoProviderChosen on the public /api/version added one
more way to tell instances apart. They now live on /api/admin/status
(requireAdmin, cookie only) as geo { lookup, providerChosen,
providerHost }, which both admin status views read. offlineGeoEnabled
and geoProviderHost stay public as before.
This commit is contained in:
Marc-André Bombeck committed 2026-10-09 10:44:18 +02:00
1 parent 0ea8d929d2
commit 470ddeedc4
11 files changed
+135 -128

No files matched your search

@@ -1,41 +1,24 @@
import { describe, expect, it } from "vitest";
import { geoLookupState, type PublicVersion } from "../_shared";
import { geoLookupState, type AdminGeoStatus } from "../_shared";
const base: PublicVersion = {
version: "1.42.0",
buildSha: null,
builtAt: null,
const base: AdminGeoStatus = {
lookup: "online",
providerChosen: false,
providerHost: "ipwho.is",
};
describe("geoLookupState", () => {
it("warns only about the unconfigured default provider", () => {
expect(
geoLookupState({
...base,
offlineGeoEnabled: false,
geoLookup: "online",
}),
).toBe("default");
expect(geoLookupState(base)).toBe("default");
});
it("treats a provider the operator named as a decision", () => {
expect(
geoLookupState({
...base,
offlineGeoEnabled: false,
geoLookup: "online",
geoProviderChosen: true,
}),
).toBe("chosen");
expect(geoLookupState({ ...base, providerChosen: true })).toBe("chosen");
});
it("reads a switched-off lookup and the offline databases as settled", () => {
expect(
geoLookupState({ ...base, offlineGeoEnabled: false, geoLookup: "off" }),
).toBe("off");
expect(geoLookupState({ ...base, offlineGeoEnabled: true })).toBe(
"offline",
);
expect(geoLookupState({ ...base, lookup: "off" })).toBe("off");
expect(geoLookupState({ ...base, lookup: "offline" })).toBe("offline");
});
});
@@ -50,6 +50,11 @@ vi.mock("@tanstack/react-query", () => ({
activeSessions: 1,
},
integrations: { umami: null, glitchtip: null, webPush: null },
geo: {
lookup: "offline",
providerChosen: false,
providerHost: "ipwho.is",
},
},
isLoading: false,
isError: false,