Immich: inspector shows why a request was refused; server.versionCheck documented

Inspect on a real Immich got data only from /server/about and /server/storage; the other four answered with a bare message, most likely a key without the permissions. The inspector now keeps the short message of any answer with HTTP 400 and up (never for a good answer) and shows it on the page and in the copied report. The permission list now includes server.versionCheck, and the docs say which endpoints have been seen live. Tests added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-17 19:39:43 +01:00
1 parent 76d6bfa85e
commit 6052595dea
7 files changed
+41 -7

No files matched your search

+16
View File
@@ -72,6 +72,18 @@ describe("where it is empty", () => {
});
});
describe("the reason in a refusal", () => {
test("a short message from an error answer is kept; nothing from a good answer, and nothing that is not text", () => {
assert.equal(insp.replyOf({ message: "Missing required permission: server.statistics", statusCode: 403 }), "Missing required permission: server.statistics");
assert.equal(insp.replyOf({ error: "invalid_token", error_description: "x" }), "invalid_token");
assert.equal(insp.replyOf({ message: ["name must be a string", "age must be a number"] }), "name must be a string; age must be a number");
assert.equal(insp.replyOf({ message: "a".repeat(500) })?.length, 160);
assert.equal(insp.replyOf({ data: [1] }), undefined);
assert.equal(insp.replyOf([{ message: "x" }]), undefined);
assert.equal(insp.replyOf(null), undefined);
});
});
describe("what an answer that is not JSON looks like", () => {
test("a web page, markup, metrics text, plain text or nothing — from its first characters only", () => {
assert.equal(insp.looksLike("<!DOCTYPE html><html><body>Not found</body></html>"), "an HTML page");
@@ -91,6 +103,7 @@ describe("the requests written down while a read runs", () => {
res.setHeader("content-type", "application/json");
if (req.url?.startsWith("/json")) return void res.end(JSON.stringify({ items: [{ id: 1, secret: "hidden-value" }], total: 1 }));
if (req.url?.startsWith("/html")) return void res.end("<html>nope</html>");
if (req.url?.startsWith("/denied")) return void ((res.statusCode = 403), res.end(JSON.stringify({ message: "Missing required permission: server.statistics" })));
res.statusCode = 404;
res.end("{}");
});
@@ -114,6 +127,9 @@ describe("the requests written down while a read runs", () => {
assert.deepEqual([calls[0].contentType, calls[0].looks], ["application/json", undefined]);
assert.deepEqual([calls[1].contentType, calls[1].looks], ["application/json", "an HTML page"], "what the text looks like, not what it says");
assert.doesNotMatch(JSON.stringify(calls), /nope/);
assert.equal(calls[0].reply, undefined, "nothing is said of a good answer");
const denied = (await insp.inspectCalls(async () => requestJson(`${url}/denied`))).calls[0];
assert.deepEqual([denied.status, denied.reply], [403, "Missing required permission: server.statistics"]);
assert.ok(calls[0].bytes > 10 && calls[0].ms >= 0);
assert.ok(calls[3].error);
assert.doesNotMatch(JSON.stringify(calls), /hidden-value|hidden/);