Add live hotspot network diagnostics

This commit is contained in:
2026-07-31 21:01:02 +02:00
parent d1239d66af
commit 37e2cb154e
19 changed files with 490 additions and 11 deletions
+6 -1
View File
@@ -21,7 +21,8 @@ function testConfig(): AppConfig {
enabled: false,
statusPath: `/tmp/pi-car-companion-test-${process.pid}-missing-network-status.json`,
commandPath: `/tmp/pi-car-companion-test-${process.pid}-network-command.json`,
configurationRequestPath: `/tmp/pi-car-companion-test-${process.pid}-network-configuration.json`
configurationRequestPath: `/tmp/pi-car-companion-test-${process.pid}-network-configuration.json`,
activityPath: `/tmp/pi-car-companion-test-${process.pid}-network-activity.json`
},
adb: { enabled: false, executable: "adb", serial: null, timeoutMs: 3_000 }
};
@@ -189,6 +190,7 @@ describe("authentication boundary", () => {
it("keeps network status and controls behind authentication and explicit configuration", async () => {
const app = await createApp();
expect((await app.inject({ method: "GET", url: "/api/network" })).statusCode).toBe(401);
expect((await app.inject({ method: "GET", url: "/api/network/activity" })).statusCode).toBe(401);
const token = await csrf(app);
await setup(app, token);
@@ -203,6 +205,9 @@ describe("authentication boundary", () => {
const status = await app.inject({ method: "GET", url: "/api/network", headers: { cookie } });
expect(status.statusCode).toBe(200);
expect(status.json()).toMatchObject({ supported: false, enabled: false, mode: "disabled" });
const activity = await app.inject({ method: "GET", url: "/api/network/activity", headers: { cookie } });
expect(activity.statusCode).toBe(200);
expect(activity.json()).toMatchObject({ supported: false, clients: [], dnsQueries: [], flows: [] });
const action = await app.inject({
method: "POST",