Add tabbed settings and system shell

This commit is contained in:
2026-07-31 21:30:51 +02:00
parent d663979ebb
commit c36e5e811f
20 changed files with 698 additions and 29 deletions
+23
View File
@@ -179,6 +179,29 @@ describe("authentication boundary", () => {
});
expect(update.statusCode).toBe(503);
expect(update.json()).toMatchObject({ error: { code: "UPDATES_UNAVAILABLE" } });
const check = await app.inject({
method: "POST",
url: "/api/system/update/check",
headers: {
...mutationHeaders(token),
cookie: `${CSRF_COOKIE}=${token}; ${SESSION_COOKIE}=${sessionCookie?.value ?? ""}`
}
});
expect(check.statusCode).toBe(503);
expect(check.json()).toMatchObject({ error: { code: "UPDATES_UNAVAILABLE" } });
const invalidPower = await app.inject({
method: "POST",
url: "/api/system/power",
headers: {
...mutationHeaders(token),
cookie: `${CSRF_COOKIE}=${token}; ${SESSION_COOKIE}=${sessionCookie?.value ?? ""}`
},
payload: { action: "factory-reset" }
});
expect(invalidPower.statusCode).toBe(400);
expect(invalidPower.json()).toMatchObject({ error: { code: "INVALID_POWER_ACTION" } });
});
it("does not expose update state without authentication", async () => {
+26
View File
@@ -58,6 +58,32 @@ describe("system update status", () => {
});
});
it("reports a check-only result when a newer revision is available", async () => {
const directory = await mkdtemp(join(tmpdir(), "pi-car-update-test-"));
temporaryDirectories.push(directory);
const statusPath = join(directory, "status.json");
const versionPath = join(directory, "REVISION");
await writeFile(
statusPath,
JSON.stringify({
state: "available",
message: "A newer release is available.",
fromRevision: "a".repeat(40),
toRevision: "b".repeat(40),
updatedAt: "2026-07-31T18:00:00.000Z"
})
);
await writeFile(versionPath, `${"a".repeat(40)}\n`);
await expect(readUpdateStatus(config(statusPath, versionPath))).resolves.toMatchObject({
state: "available",
fromRevision: "a".repeat(40),
toRevision: "b".repeat(40),
installedRevision: "a".repeat(40),
supported: true
});
});
it("treats missing or malformed status files as unsupported", async () => {
const directory = await mkdtemp(join(tmpdir(), "pi-car-update-test-"));
temporaryDirectories.push(directory);