Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 1dc4c364d8e9bed938116ee53b2e9f4349da07e9
parent 899b56d0759f126a82d35565981084d80dba53df
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 12:20:40 -0500

sites: the site form's channel picker leaves remote-only channels out (demo epic D1 review follow-up)

It offered them and the site writer refused the save. Both site pages
(new and an existing site) now list channels through siteChannelOptions,
which skips a remote-only channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Diffstat:
Meditor/app/sites/[siteId]/page.tsx | 7++-----
Aeditor/app/sites/lib/channelOptions.test.ts | 24++++++++++++++++++++++++
Aeditor/app/sites/lib/channelOptions.ts | 13+++++++++++++
Meditor/app/sites/new/page.tsx | 7++-----
4 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/editor/app/sites/[siteId]/page.tsx b/editor/app/sites/[siteId]/page.tsx @@ -1,6 +1,6 @@ import { notFound } from "next/navigation"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; -import { listChannelConfigs } from "yt-dlp-transcript-common/controller/channels"; +import { siteChannelOptions } from "../lib/channelOptions"; import { listSites } from "yt-dlp-transcript-common/lib/site"; import { SiteForm, @@ -21,10 +21,7 @@ export default async function EditSitePage({ const paths = getPaths(); const site = getSiteCached(siteId); if (!site) notFound(); - const channels: ChannelOption[] = (await listChannelConfigs(paths)).map((c) => ({ - slug: c.slug, - name: c.config.name ?? c.slug, - })); + const channels: ChannelOption[] = await siteChannelOptions(paths); const allSites: SiteOption[] = listSites(paths) .filter((s) => s.siteId !== siteId) .map((s) => ({ siteId: s.siteId, siteTitle: s.siteTitle })); diff --git a/editor/app/sites/lib/channelOptions.test.ts b/editor/app/sites/lib/channelOptions.test.ts @@ -0,0 +1,24 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; +import os from "node:os"; +import path from "node:path"; +import type { Paths } from "yt-dlp-transcript-common/lib/paths"; +import { siteChannelOptions } from "./channelOptions"; + +// Run with: pnpm -C editor exec tsx --test "app/sites/lib/channelOptions.test.ts" + +test("the site form's channel picker leaves remote-only channels out", async () => { + const root = await mkdtemp(path.join(os.tmpdir(), "site-channel-options-")); + try { + const put = async (slug: string, config: Record<string, unknown>) => { + await mkdir(path.join(root, slug), { recursive: true }); + await writeFile(path.join(root, slug, "config.json"), JSON.stringify({ handling: "youtube", ...config })); + }; + await put("own", { name: "Own", url: "https://www.youtube.com/@own" }); + await put("remote", { name: "Remote", platform: "youtube", remoteOnly: true, remoteArchive: "https://stub.test", downloadMode: "manual" }); + assert.deepEqual(await siteChannelOptions({ channelsDir: root } as unknown as Paths), [{ slug: "own", name: "Own" }]); + } finally { + await rm(root, { recursive: true, force: true }); + } +}); diff --git a/editor/app/sites/lib/channelOptions.ts b/editor/app/sites/lib/channelOptions.ts @@ -0,0 +1,13 @@ +import type { Paths } from "yt-dlp-transcript-common/lib/paths"; +import { isRemoteOnlyChannel } from "yt-dlp-transcript-common/lib/channelConfig"; +import { listChannelConfigs } from "yt-dlp-transcript-common/controller/channels"; +import type { ChannelOption } from "../components/SiteForm"; + +// The channels a site form offers: every channel but a REMOTE-ONLY one (demo +// epic D1) — it holds a connected archive's clip windows, has no corpus to +// publish, and the site writer refuses it anyway (lib/site.ts). +export async function siteChannelOptions(paths: Paths): Promise<ChannelOption[]> { + return (await listChannelConfigs(paths)) + .filter((c) => !isRemoteOnlyChannel(c.config)) + .map((c) => ({ slug: c.slug, name: c.config.name ?? c.slug })); +} diff --git a/editor/app/sites/new/page.tsx b/editor/app/sites/new/page.tsx @@ -1,7 +1,7 @@ import type { Metadata } from "next"; import Link from "next/link"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; -import { listChannelConfigs } from "yt-dlp-transcript-common/controller/channels"; +import { siteChannelOptions } from "../lib/channelOptions"; import { DEFAULT_GROUP_FALLBACK_ID, FALLBACK_GROUP, @@ -18,10 +18,7 @@ export const metadata: Metadata = { title: "New site — Sites" }; export default async function NewSitePage() { const paths = getPaths(); - const channels: ChannelOption[] = (await listChannelConfigs(paths)).map((c) => ({ - slug: c.slug, - name: c.config.name ?? c.slug, - })); + const channels: ChannelOption[] = await siteChannelOptions(paths); const allSites: SiteOption[] = listSites(paths).map((s) => ({ siteId: s.siteId, siteTitle: s.siteTitle,