Files
CollabTable/shared/scripts/media/audit-html-js.mjs
T
Gabriel20xxandClaude Sonnet 5 bbf5d8bb05
Lint / Lint (push) Successful in 1m5s
Tests / Go backend (push) Successful in 46s
Docker / Docker Build & Push (push) Failing after 2m1s
Tests / Dashboard checks (push) Successful in 49s
Add self-info endpoint for ProjectConfigurator discovery, sync shared updates
GET /api/info reports name/tabs/mount types (empty - state lives in Postgres,
no shared file mounts) so ProjectConfigurator's Projects workspace can
register this instance from just a URL.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:07:02 +02:00

30 lines
1.3 KiB
JavaScript

import { readFileSync, readdirSync, existsSync } from 'fs';
import { join } from 'path';
// TODO(shared extraction): this audits legacy pre-SvelteKit `<project>/public/*.html`
// script tags. this repo's webui/ is SvelteKit-based (no per-service `public/` HTML pages), and
// none of the sibling monorepo service directories below live inside this repo anymore (they're
// now separate repos: MediaModerator, MediaTools, MediaKiosk, MediaViewer). The existsSync guard
// below means this currently no-ops safely (nothing to audit) rather than erroring. Left as-is
// rather than guessing at a SvelteKit-equivalent audit — remove or repurpose if useful.
const projects = ['MediaModerator', 'MediaTools', 'MediaKiosk', 'MediaViewer'];
const scriptSrcRe = /<script[^>]+src="([^"]+)"[^>]*>/g;
projects.forEach(proj => {
const pubDir = join(proj, 'public');
if (!existsSync(pubDir)) return;
const htmlFiles = readdirSync(pubDir)
.filter(f => f.endsWith('.html'))
.sort();
console.log(`=== ${proj} ===`);
htmlFiles.forEach(htmlFile => {
const content = readFileSync(join(pubDir, htmlFile), 'utf8');
const scripts = [];
let m;
scriptSrcRe.lastIndex = 0;
while ((m = scriptSrcRe.exec(content)) !== null) scripts.push(m[1]);
console.log(` ${htmlFile} -> ${scripts.join(', ')}`);
});
console.log();
});