Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Photodump: an account's pack list reads its own packs

Adarsh7705139082ac
diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.ts
index 790473a3..2a841e5a 100644
--- a/src/lib/guest-access.ts
+++ b/src/lib/guest-access.ts
@@ -177,10 +177,10 @@ const ACCOUNT_CANVASES = /^\/api\/account\/canvases(\/[^/]+)?$/;
/**
* The Library's counts, its Uploads (its stored files), a zip of its runs (the Library's Download, a result's
- * Download all, Shorts' Download parts) and its own dubs (src/server/dub.ts): each route answers an account with its own
- * only.
+ * Download all, Shorts' Download parts), its own dubs (src/server/dub.ts) and its own Photodump packs (GET /api/photodump,
+ * the same list as /api/photodump/packs): each route answers an account with its own only.
*/
-const ACCOUNT_LISTS = new Set(["/api/generations/facets", "/api/assets", "/api/generations/zip", "/api/dub"]);
+const ACCOUNT_LISTS = new Set(["/api/generations/facets", "/api/assets", "/api/generations/zip", "/api/dub", "/api/photodump"]);
/**
* A signed-in account's zip of its own runs (/api/generations/zip; src/server/account-files.ts ACCOUNT_LIMITS): at most
diff --git a/tests/account-photo-apps.test.ts b/tests/account-photo-apps.test.ts
index afea47b1..8fd9b053 100644
--- a/tests/account-photo-apps.test.ts
+++ b/tests/account-photo-apps.test.ts
@@ -275,6 +275,14 @@ describe("an account runs every photo app on its own ComfyUI", () => {
const pack = (await r.json()) as { id: string };
expect(store.getAccountProject(a, PACK_KIND, pack.id)).not.toBeNull();
expect(((await (await packsRoute.GET(json("/api/photodump/packs", "GET", undefined, "a"))).json()) as { packs: { id: string }[] }).packs.map((p) => p.id)).toEqual([pack.id]);
+ // GET /api/photodump lists the same: the proxy lets the account's read through (never a guest's stand-in), and the
+ // route answers with its own packs; a guest still gets the empty list.
+ const list = viaProxy("/api/photodump", "GET", "a");
+ expect(passed(list)).toBe(true);
+ expect(list.headers.get(access.GUEST_HEADER)).toBeNull();
+ expect(((await (await photodumpRoute.GET(json("/api/photodump", "GET", undefined, "a"))).json()) as { packs: { id: string }[] }).packs.map((p) => p.id)).toEqual([pack.id]);
+ expect(await (await photodumpRoute.GET(json("/api/photodump", "GET", undefined, "b"))).json()).toEqual({ packs: [] });
+ expect(await viaProxy("/api/photodump").json()).toEqual({ packs: [] });
const { gens } = await runsAsOwn(() => photodumpRoute.POST(json("/api/photodump", "POST", photodump({ packId: pack.id, selfie }), "a")), "a", a);
expect(gens.length).toBe(1);
expect(gens[0].request.inputs?.images).toContain(ref);