Deploy implemented Videoreg interface and persistent theme cycle

This commit is contained in:
huncode committed 2026-10-27 15:49:46 +03:00
1 parent 6405a8d101
commit a12eefa1de
98 files changed
+4094 -2319

No files matched your search

+3 -100
View File
@@ -1,100 +1,3 @@
import { z } from "zod";
import recovered from "./v2-articles.json";
import community from "./v2-community.json";
import externalApprovals from "./v2-link-approvals.json";
const localPath = z.string().regex(/^\/(?!\/)[a-zA-Z0-9/_.-]*$/);
const approvedHref = z.string().refine(value => localPath.safeParse(value).success || externalApprovals.some(item => item.destination === value), "Unreviewed outbound URL");
const sectionSchema = z.object({
gallery: z
.array(
z.object({
src: localPath,
filename: z.string(),
width: z.number().positive(),
height: z.number().positive(),
}),
)
.optional(),
heading: z.string().min(1),
paragraphs: z.array(z.string().min(1)),
list: z.array(z.string()).optional(),
note: z.string().optional(),
code: z.string().optional(),
links: z.array(z.object({ href: approvedHref, label: z.string() })).optional(),
figure: z
.object({
src: localPath,
alt: z.string().min(12),
caption: z.string(),
diagram: z.boolean().optional(),
small: z.boolean().optional(),
})
.optional(),
table: z
.object({
caption: z.string(),
head: z.array(z.string()).min(2),
rows: z.array(z.array(z.string())),
})
.optional(),
});
const articleSchema = z.object({
path: localPath,
title: z.string().min(3),
category: z.string(),
summary: z.string(),
date: z.string(),
kind: z.enum(["recovered", "linked-source", "recovered-media"]),
sourcePaths: z.array(z.string()),
rawFiles: z.array(z.string()),
sections: z.array(sectionSchema).min(1),
related: z.array(localPath),
});
export const articles = z
.array(articleSchema)
.parse([...recovered, ...community]);
export type LibraryArticle = z.infer<typeof articleSchema>;
export function findArticle(path: string) {
return articles.find((article) => article.path === path);
}
export function articleText(article: LibraryArticle) {
return article.sections
.map((s) =>
[
s.heading,
...s.paragraphs,
...(s.list ?? []),
s.note ?? "",
s.code ?? "",
...(s.links ?? []).map((link) => link.label),
s.table?.head.join(" ") ?? "",
s.table?.rows.flat().join(" ") ?? "",
].join(" "),
)
.join(" ");
}
export const searchIndex = articles.map((article) => ({
path: article.path,
title: article.title,
summary: article.summary,
category: article.category,
date: article.date,
text: articleText(article),
}));
if (new Set(articles.map((x) => x.path)).size !== articles.length)
throw new Error("Duplicate article path");
for (const article of articles) {
for (const section of article.sections) {
for (const link of section.links ?? []) {
if (link.href.startsWith("http") && !externalApprovals.some(item => item.sourcePage === article.path && item.destination === link.href && item.anchor === link.label && item.reviewed)) throw new Error("Unreviewed page/link context: " + article.path);
}
}
for (const section of article.sections) {
if (
section.table?.rows.some(
(row) => row.length !== section.table!.head.length,
)
)
throw new Error("Invalid table: " + article.path);
}
}
// Compatibility API; active domain ownership is fsd/entities/article.
export { articles, findArticle, articleText, searchIndex } from "@/fsd/entities/article";
export type { LibraryArticle } from "@/fsd/entities/article";
@@ -83,5 +83,22 @@
"playbackWatched": false
},
"reason": "Specific original technical demonstration, not a paid insertion; direct link only, no remote player/script/pixel loaded by this site."
},
{
"sourcePage": "/metrika.js",
"destination": "https://mc.yandex.ru/metrika/tag.js",
"anchor": "nction () { (window.ym.a = window.ym.a || []).push(arguments); };\n window.ym.l = Number(new Date());\n var tag = document.createElement(\"script\");\n tag.async = true;\n tag.src = \"https://mc.yandex.ru/metrika/tag.js\";\n document.head.appendChild(tag);\n window.ym(counter, \"init\", {\n webvisor: false, clickmap: true, trackLinks: true,\n accurateTrackBounce: true, trackHash: false\n });\n fu",
"purpose": "Authorized first-party integration of existing counter109268682; one async official vendor tag on exactpublichosts only",
"decision": "keep",
"reviewed": true,
"verification": {
"method": "ActualofficialYandexinitialization+CSPdocs andsourcehostguard review",
"officialDocs": [
"https://yandex.com/support/metrica/en/code/counter-initialize",
"https://yandex.ru/support/metrica/ru/code/install-counter-csp"
],
"projectContract": "docs/metrika/counters-and-contract.json"
},
"reason": "Authorized analytics infrastructure, not recovered editorial content; webvisorfalse/default15s accuratebounce/noextra hit, no customquery or PII; localhost disabled. Runtime request interception tested separately."
}
]