Hero: grote foto's in de achtergrond robuust en sneller, voortgang en opnieuw proberen; admin zonder inline script

- Een decode voor de hele set, per breedte eenmaal geschaald voor WebP en AVIF (6000x4000: 21,1 s -> 6,4 s per set)
- Eigen limiet per set (Media:RenderSetTimeoutSeconds 600), harde limiet rond een foto, de renderer stopt nooit door een uitzondering, een mislukte foto wacht tot de volgende ronde en houdt de rij niet op
- Logging per foto (start, per variant, einde, fout); voortgang per variant in de admin; nieuwe uitsnede na focuswijziging zichtbaar (oude afbeelding blijft, shimmer); knop Opnieuw proberen
- Thema-script als /theme-init.js (CSP script-src 'self'), test en smoke-controle op inline scripts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 22:23:15 +01:00
co-authored by Claude Sonnet 5.5
parent 9d647bb049
commit 1b542dee98
22 changed files with 567 additions and 54 deletions
+28
View File
@@ -0,0 +1,28 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
// The host sends Content-Security-Policy "script-src 'self'": an inline script in the admin page is blocked there, so the
// page must have none (the theme is set by /theme-init.js, a file of its own).
describe('the admin page and the Content-Security-Policy', () => {
const html = readFileSync(resolve(__dirname, '../index.html'), 'utf-8');
it('has no inline script', () => {
const inline = [...html.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)].filter(([, attributes]) => !/\bsrc\s*=/.test(attributes));
expect(inline).toEqual([]);
});
it('sets the theme from a file of its own, before the app', () => {
expect(html.indexOf('src="/theme-init.js"')).toBeGreaterThan(-1);
expect(html.indexOf('src="/theme-init.js"')).toBeLessThan(html.indexOf('src="/src/main.tsx"'));
const script = readFileSync(resolve(__dirname, '../public/theme-init.js'), 'utf-8');
expect(script).toContain("localStorage.getItem('cms-theme')");
expect(script).toContain('classList.add');
});
it('has no inline event handlers or javascript: links either', () => {
expect(html).not.toMatch(/\son[a-z]+\s*=/i);
expect(html).not.toMatch(/javascript:/i);
});
});