Files
Oxicloud/scripts/check-brand-drift.mjs
T
DioCrafts 81a93a489b feat: photo/video capture-date pipeline + premium UI/UX overhaul
Backend — Photos timeline now groups by real capture date instead of upload time. New MediaMetadataService (FileLifecycleHook) extracts EXIF DateTimeOriginal from images and container creation_time from videos (mov/mp4/mkv) via nom-exif, timezone-correct (OffsetTimeOriginal), persisting captured_at so the existing media_sort_date trigger takes over. Adds POST /admin/photos/metadata/reextract to backfill existing media. Falls back to upload date when no embedded date exists.

Frontend — premium grid cards: combined metadata line (relative date · size, owner avatar when shared), custom selection checkbox with a clear checked state, uniform full-width 4:3 thumbnail tiles independent of filename length, centered file-type icons, and a hit-test fix so checkbox/star/kebab clicks reach the controls (the decorative thumbnail no longer captures pointer events). Notification messages internationalised across all 16 locales. Broader polish: design tokens, a11y/focus-visible states, brand + PWA assets.

Chore — bump semver-compatible dependencies (cargo upgrade); add nom-exif 3.6.1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 00:24:27 +02:00

50 lines
2.2 KiB
JavaScript

#!/usr/bin/env node
// check-brand-drift.mjs — guard the brand mark against silent change.
//
// Fails (exit 1) if the canonical logo SVG or the logo gradient token drift
// from the locked baseline below. The brand is an ownable asset; an accidental
// recolour, a stretched glyph, or a "tweaked" gradient should never sneak in
// via an unrelated PR. If a change IS intentional, update LOCK deliberately
// (with design sign-off) — that diff is the audit trail.
//
// node scripts/check-brand-drift.mjs
import { readFileSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const repo = join(dirname(fileURLToPath(import.meta.url)), '..');
const sha16 = (s) => createHash('sha256').update(s).digest('hex').slice(0, 16);
// ── Locked baseline ─────────────────────────────────────────────────────────
// Update INTENTIONALLY when the brand changes (and only then).
const LOCK = {
logoHash: '7fbd2016e9caeac1', // sha256(static/logo/logo-plain.svg)[:16]
gradient: 'linear-gradient(135deg, #ff5e3a 0%, #ff8a5c 100%)' // --color-logo-gradient
};
const logo = readFileSync(join(repo, 'static/logo/logo-plain.svg'), 'utf8');
const vars = readFileSync(join(repo, 'static/css/base/variables.css'), 'utf8');
const gradMatch = vars.match(/--color-logo-gradient:\s*([^;]+);/);
const gradient = gradMatch ? gradMatch[1].trim().replace(/\s+/g, ' ') : '(token missing!)';
let failed = false;
const actualLogoHash = sha16(logo);
if (actualLogoHash !== LOCK.logoHash) {
console.error(`✖ Brand mark drift: logo-plain.svg hash ${actualLogoHash} ≠ locked ${LOCK.logoHash}`);
failed = true;
}
if (gradient !== LOCK.gradient) {
console.error(`✖ Logo gradient drift:\n actual: ${gradient}\n locked: ${LOCK.gradient}`);
failed = true;
}
if (failed) {
console.error(
'\nThe brand mark or logo gradient changed. If this is intentional, update' +
'\nLOCK in scripts/check-brand-drift.mjs (with design sign-off).'
);
process.exit(1);
}
console.log('✓ Brand mark + logo gradient match the locked baseline.');