- Rename MediaConfig -> ProjectConfigurator throughout; drop the Parameters
tab/page; rename the Mounts tab to Projects and restructure it into three
sections: Central services, Main services, Third-party services
- Add a self-describe contract (GET /api/info returning name/tabs/mountTypes)
and a server-side discovery proxy (POST /api/discover-service) so adding a
main service only requires a URL
- Add ProjectConfigurator HA: multiple instances now sync their settings with
each other (GET /api/settings/export, POST /api/settings/sync, a periodic
background puller), last-write-wins per key by updated_at
- Add a generic, project-agnostic file-storage API on CarrierNode
(GET/POST/DELETE /api/mount/{project}/{type}[/*]) driven by the same
configured_mounts data the Projects workspace already writes, usable by any
registered project, not just the media family
- Add last_login_at tracking to the shared auth Store/User (schema, queries,
UpdateLastLogin) and surface it through the shared web-ui ManagedUser type
and UserManagement component
- Retire the "MediaCollection" name: Go module -> repos.gfranz.ch/Gabriel20xx/shared/media-backend,
binary -> mediabackend, session cookie default -> "session", media-webui
merged into webui, media-shared-assets renamed to legacy-assets and pruned
to the one file MediaDesktop still uses
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
90 lines
2.5 KiB
JavaScript
90 lines
2.5 KiB
JavaScript
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
|
|
const repoRoot = process.cwd();
|
|
const strict = process.argv.includes('--strict');
|
|
|
|
const includeExt = new Set(['.js', '.ejs', '.html']);
|
|
const skipDirs = new Set(['node_modules', '.git', 'dist', 'release', 'coverage']);
|
|
|
|
const styleDisplayAssign = /style\.display\s*=\s*['"](?:flex|grid)['"]/gi;
|
|
const inlineDisplayStyle = /style\s*=\s*['"][^'"]*display\s*:\s*(?:flex|grid)[^'"]*['"]/gi;
|
|
|
|
async function walk(dir, out = []) {
|
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
for (const entry of entries) {
|
|
const full = path.join(dir, entry.name);
|
|
if (entry.isDirectory()) {
|
|
if (skipDirs.has(entry.name)) continue;
|
|
await walk(full, out);
|
|
continue;
|
|
}
|
|
if (!includeExt.has(path.extname(entry.name))) continue;
|
|
out.push(full);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
function lineNumberAt(content, index) {
|
|
let line = 1;
|
|
for (let i = 0; i < index; i += 1) {
|
|
if (content.charCodeAt(i) === 10) line += 1;
|
|
}
|
|
return line;
|
|
}
|
|
|
|
function collectMatches(content, regex, type) {
|
|
const rows = [];
|
|
regex.lastIndex = 0;
|
|
let match;
|
|
while ((match = regex.exec(content)) !== null) {
|
|
rows.push({
|
|
type,
|
|
line: lineNumberAt(content, match.index),
|
|
snippet: match[0],
|
|
});
|
|
}
|
|
return rows;
|
|
}
|
|
|
|
const allFiles = await walk(repoRoot);
|
|
const violations = [];
|
|
|
|
// After folding media-backend/webui directly into the shared repo, this filter targets
|
|
// the frontend directories where inline HTML/CSS layout violations are actually possible
|
|
// (the plain Go backend/ and Go media-backend/ have none; there is no more nested shared/).
|
|
const includedTopLevelDirs = ['webui/', 'scripts/media/'];
|
|
|
|
for (const filePath of allFiles) {
|
|
const rel = path.relative(repoRoot, filePath).replaceAll('\\', '/');
|
|
if (!includedTopLevelDirs.some(prefix => rel.startsWith(prefix))) continue;
|
|
const content = await fs.readFile(filePath, 'utf8');
|
|
const hits = [
|
|
...collectMatches(content, styleDisplayAssign, 'js-style-display'),
|
|
...collectMatches(content, inlineDisplayStyle, 'inline-style-display'),
|
|
];
|
|
if (hits.length) {
|
|
violations.push({ file: rel, hits });
|
|
}
|
|
}
|
|
|
|
const total = violations.reduce((sum, row) => sum + row.hits.length, 0);
|
|
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
ok: strict ? total === 0 : true,
|
|
strict,
|
|
files: violations.length,
|
|
violations: total,
|
|
entries: violations,
|
|
},
|
|
null,
|
|
2
|
|
)
|
|
);
|
|
|
|
if (strict && total > 0) {
|
|
process.exitCode = 1;
|
|
}
|