Archilyzer · Source

archilyzer

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

commit 4dab1d7b597b6e1663b261efed0b147e429b51ae
parent 64f5b916120bcc88b1b933da04145dd649ea62d7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 12:06:39 -0500

corpus: a channel's url is published only as a plain page -- no query, fragment or userinfo (demo epic D1 review, blocker 1)

channelFactsOf took any http(s) config.url into corpus.json and llms.txt. On
the live corpus two carry a query (a playlist id, a single-video id), and a
feed url with a token in its query would have been published the same way.
publicChannelUrl now refuses a url with a query, a fragment or credentials;
the channel's platform is still said. Test: a playlist, a feed with a token,
a fragment, credentials, and the plain shapes.

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

Diffstat:
Mcommon/bin/compose-site.channelFacts.test.ts | 15++++++++++++++-
Mcommon/bin/compose-site.ts | 27++++++++++++++++++++++-----
2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/common/bin/compose-site.channelFacts.test.ts b/common/bin/compose-site.channelFacts.test.ts @@ -18,11 +18,24 @@ test("channel facts: the configured platform, else the URL's; the URL only when put("rum", { url: "https://rumble.com/c/beta", platform: "rumble" }); put("mix", {}); // a curated mix: no url, no platform put("odd", { url: "file:///x" }); - const facts = await channelFactsOf({ channelsDir: root } as Parameters<typeof channelFactsOf>[0], ["yt", "rum", "mix", "odd", "missing"]); + // Not a channel's page to publish (review of 9fddc3bb): a playlist, a feed + // with a token, a fragment, credentials. The platform is still said. + put("playlist", { url: "https://www.youtube.com/playlist?list=PLabc" }); + put("feed", { url: "https://feeds.example.test/rss", platform: "youtube" }); + put("tokenfeed", { url: "https://feeds.example.test/rss?token=s3cret", platform: "youtube" }); + put("frag", { url: "https://www.youtube.com/@gamma#videos" }); + put("creds", { url: "https://user:pw@www.youtube.com/@delta" }); + const facts = await channelFactsOf({ channelsDir: root } as Parameters<typeof channelFactsOf>[0], ["yt", "rum", "mix", "odd", "missing", "playlist", "feed", "tokenfeed", "frag", "creds"]); assert.deepEqual(facts, { yt: { platform: "youtube", url: "https://www.youtube.com/@alpha" }, rum: { platform: "rumble", url: "https://rumble.com/c/beta" }, + playlist: { platform: "youtube" }, + feed: { platform: "youtube", url: "https://feeds.example.test/rss" }, + tokenfeed: { platform: "youtube" }, + frag: { platform: "youtube" }, + creds: { platform: "youtube" }, }); + assert.equal(JSON.stringify(facts).includes("s3cret"), false); } finally { rmSync(root, { recursive: true, force: true }); } diff --git a/common/bin/compose-site.ts b/common/bin/compose-site.ts @@ -220,9 +220,25 @@ async function composeCitedSite( export const ALLOW_MISSING_MEDIA_ENV = "REPORTS_ALLOW_MISSING_MEDIA"; // corpus.json's per-channel `platform` and `url` (spec 6): the configured -// platform, else the one its URL names; the URL only when it is a public -// http(s) page. Read from each channel's config.json; an unreadable one is -// simply unknown. +// platform, else the one its URL names; the URL only when it is a plain public +// http(s) page — NO query, fragment or userinfo (publicChannelUrl): a config's +// url may be a playlist or a single video (`?list=`, `?v=`), or a feed with a +// token in its query, and none of that is a channel's page to publish. The +// platform is kept either way. Read from each channel's config.json; an +// unreadable one is simply unknown. +/** A config url fit to publish as a channel's page: http(s), no userinfo, query or fragment; else undefined. */ +export function publicChannelUrl(raw: string): string | undefined { + let u: URL; + try { + u = new URL(raw); + } catch { + return undefined; + } + if (u.protocol !== "https:" && u.protocol !== "http:") return undefined; + if (u.username || u.password || u.search || u.hash || raw.includes("?") || raw.includes("#")) return undefined; + return raw; +} + export async function channelFactsOf( paths: Parameters<typeof readChannelConfig>[0], slugs: readonly string[], @@ -231,8 +247,9 @@ export async function channelFactsOf( for (const slug of slugs) { const config = await readChannelConfig(paths, slug).catch(() => null); if (!config) continue; - const url = typeof config.url === "string" && /^https?:\/\//i.test(config.url.trim()) ? config.url.trim() : undefined; - const platform = config.platform ?? detectPlatform(url) ?? undefined; + const raw = typeof config.url === "string" ? config.url.trim() : ""; + const url = publicChannelUrl(raw); + const platform = config.platform ?? detectPlatform(raw || undefined) ?? undefined; if (platform || url) out[slug] = { ...(platform ? { platform } : {}), ...(url ? { url } : {}) }; } return out;