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.

Palette: its catalog is /api/search-index (next to the colour /api/palettes), keys tested

Claudeb17324b29585
diff --git a/src/app/api/palette/route.ts b/src/app/api/search-index/route.ts
similarity index 100%
rename from src/app/api/palette/route.ts
rename to src/app/api/search-index/route.ts
diff --git a/src/components/command-palette.tsx b/src/components/command-palette.tsx
index a0a1acf6..7a108b16 100644
--- a/src/components/command-palette.tsx
+++ b/src/components/command-palette.tsx
@@ -125,7 +125,7 @@ function PaletteBody({ onPick, onOpenRecent }: { onPick: (e: PaletteEntry) => vo
// The apps, motions, effects and models load on first open (and stay for the session).
const index = useQuery({
queryKey: ["palette-index"],
- queryFn: async () => (await fetch("/api/palette")).json() as Promise<PaletteIndex>,
+ queryFn: async () => (await fetch("/api/search-index")).json() as Promise<PaletteIndex>,
staleTime: Infinity,
});
const recent = useGenerations({ q: dq || undefined, limit: 5, statuses: ["succeeded"] }, { keepPrevious: true });
diff --git a/src/lib/command-search.ts b/src/lib/command-search.ts
index 001d791a..644a022e 100644
--- a/src/lib/command-search.ts
+++ b/src/lib/command-search.ts
@@ -144,7 +144,7 @@ export function rankPalette(entries: PaletteEntry[], query: string, limits: Reco
.map(({ kind, label, entries }) => ({ kind, label, entries }));
}
-/** The slim catalog the palette loads on first open (GET /api/palette). */
+/** The slim catalog the palette loads on first open (GET /api/search-index). */
export interface PaletteIndex {
apps: PalettePreset[];
motions: PalettePreset[];
diff --git a/src/lib/palette-index.ts b/src/lib/palette-index.ts
index c514f10e..c3008350 100644
--- a/src/lib/palette-index.ts
+++ b/src/lib/palette-index.ts
@@ -1,5 +1,5 @@
/**
- * The slim catalog behind the ⌘K palette (GET /api/palette): names, categories and where each item
+ * The slim catalog behind the ⌘K palette (GET /api/search-index): names, categories and where each item
* opens. Built on the server from the catalog, so the palette never ships prompt templates or routes.
*/
import { APPS, EFFECTS, MODELS, MOTIONS } from "@/lib/catalog";
diff --git a/tests/keys.test.ts b/tests/keys.test.ts
new file mode 100644
index 00000000..d9c1a456
--- /dev/null
+++ b/tests/keys.test.ts
@@ -0,0 +1,20 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { isApplePlatform, modKey } from "@/lib/keys";
+
+describe("modifier key name", () => {
+ afterEach(() => vi.unstubAllGlobals());
+
+ it("says ⌘ on Apple devices and Ctrl elsewhere", () => {
+ for (const p of ["MacIntel", "iPhone", "iPad", "iPod touch"]) expect(isApplePlatform(p)).toBe(true);
+ for (const p of ["Win32", "Linux x86_64", "Linux armv8l", ""]) expect(isApplePlatform(p)).toBe(false);
+ });
+
+ it("reads the browser's platform, and says Ctrl where there is none (the server)", () => {
+ vi.stubGlobal("navigator", undefined);
+ expect(modKey()).toBe("Ctrl");
+ vi.stubGlobal("navigator", { platform: "MacIntel" });
+ expect(modKey()).toBe("⌘");
+ vi.stubGlobal("navigator", { platform: "Win32" });
+ expect(modKey()).toBe("Ctrl");
+ });
+});