Correzioni della revisione di C6: installatore, CI senza jq, caratteri e schermate senza Node

Le 14 osservazioni della revisione di funzione/senza-terzi, ciascuna con la prova che l'avrebbe trovata.

Installatore: un aggiornamento senza /D= va nella cartella già installata (InstallLocation)
invece che in quella predefinita, che lasciava la vecchia copia. Una cartella senza permessi
non sembra più «Febe aperto». La dimensione in «App installate» conta solo i due file
dell'installatore. I file in sola lettura si sostituiscono e si tolgono. «Febe» in Esegui
all'avvio si toglie solo se avvia quella copia, non un Febe portatile. Febe parte alla fine
solo con «Fine» e la casella spuntata. /PROVA= rifiuta la radice di un disco.

CI: jq non c'era ed era un componente esterno. JSON letto e scritto con .gitea/scripts/json.sh
(json-campi.awk e json-stringa.awk sul lettore json.awk) per gitleaks, Trivy e la release.
Le credenziali del registro stanno solo in un DOCKER_CONFIG temporaneo della pubblicazione,
con plugin, contesti e contesto corrente del runner, tolto alla fine. Le prove del rilascio
girano in debian:trixie con Chromium, come la verifica, senza prove saltate. Ogni flusso usa
shell: bash.

Caratteri: tolti fonts-liberation e fonts-noto-color-emoji dall'immagine e dalle prove della
CI, perché Chromium non li chiede. Resta fonts-dejavu-core.

Icone: la prova della griglia legge davvero i percorsi SVG (tutti i comandi, archi e curve) e
i punti. La lettura dei nomi delle icone vede ogni forma con cui l'interfaccia li chiede.

Schermate: tools/schermate (Node) diventa tools/Febe.Schermate, in C# con ClientWebSocket e
System.Text.Json, nessun pacchetto, solo verso indirizzi di questo computer. Provato contro
una dimostrazione con Edge su Windows.

Documenti: CLAUDE.md, processo, guida, LEGGIMI e docker.md aggiornati. Righe nuove in
decisioni.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-18 16:04:39 +01:00
1 parent 525d7dfdaa
commit be662f2d28
46 files changed
+2091 -283

No files matched your search

-119
View File
@@ -1,119 +0,0 @@
// node tools/schermate/schermata.mjs <indirizzo> <file.png> [larghezza] [altezza] [attesa-ms] [passo.js]
//
// Screenshot of Febe's own interface (spec §10.7) through the DevTools protocol of a Chromium without window:
// exact viewport at scale 1.25 (like the mockups), console errors printed, an optional step (a JS file evaluated in
// the page and awaited; when it returns { hover: [x, y] } the pointer is moved there, so :hover styles show).
//
// Only for Febe's own interface: the address must be on this computer (127.0.0.1 or localhost). Instagram is never
// opened this way (spec §2, rule 4). Needs Node 22 or later (global WebSocket) and a Chromium: set FEBE_CHROMIUM, or
// the Playwright build under /opt/pw-browsers is used.
import { spawn } from 'node:child_process';
import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const [address, out, width = '1440', height = '900', wait = '3000', step] = process.argv.slice(2);
if (!address || !out) {
console.error('Uso: node tools/schermate/schermata.mjs <indirizzo> <file.png> [larghezza] [altezza] [attesa-ms] [passo.js]');
process.exit(2);
}
const target = new URL(address);
if (!['127.0.0.1', 'localhost', '[::1]'].includes(target.hostname)) {
console.error('Solo l\'interfaccia di Febe su questo computer (127.0.0.1 o localhost).');
process.exit(2);
}
function findChromium() {
if (process.env.FEBE_CHROMIUM) return process.env.FEBE_CHROMIUM;
const root = '/opt/pw-browsers';
if (existsSync(root)) {
for (const name of readdirSync(root).filter((n) => /^chromium-\d+$/.test(n)).sort().reverse()) {
const candidate = join(root, name, 'chrome-linux', 'chrome');
if (existsSync(candidate)) return candidate;
}
}
console.error('Chromium non trovato: indica il percorso in FEBE_CHROMIUM.');
process.exit(2);
}
const profile = mkdtempSync(join(tmpdir(), 'febe-schermata-'));
const port = 9300 + Math.floor(Math.random() * 500);
const chrome = spawn(findChromium(), [
'--headless', '--no-sandbox', '--disable-gpu', '--hide-scrollbars', '--disable-background-networking',
'--disable-component-update', '--no-first-run', '--no-default-browser-check', '--disable-extensions',
`--user-data-dir=${profile}`, `--remote-debugging-port=${port}`, '--remote-debugging-address=127.0.0.1', 'about:blank',
], { stdio: 'ignore' });
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function finish(code) {
chrome.kill('SIGKILL');
setTimeout(() => {
try {
rmSync(profile, { recursive: true, force: true });
} catch {
// the profile stays in the temporary folder
}
process.exit(code);
}, 300);
}
let ws;
for (let i = 0; i < 50 && !ws; i++) {
try {
const list = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json();
const page = list.find((t) => t.type === 'page');
if (page) ws = new WebSocket(page.webSocketDebuggerUrl);
} catch {
// Chromium is still starting
}
if (!ws) await sleep(200);
}
if (!ws) {
console.error('Chromium non risponde.');
finish(1);
} else {
await new Promise((r) => ws.addEventListener('open', r));
let id = 0;
const pending = new Map();
ws.addEventListener('message', (e) => {
const msg = JSON.parse(e.data);
if (msg.id && pending.has(msg.id)) {
pending.get(msg.id)(msg);
pending.delete(msg.id);
} else if (msg.method === 'Runtime.consoleAPICalled' && ['error', 'warning'].includes(msg.params.type)) {
console.log(`console.${msg.params.type}:`, msg.params.args.map((a) => a.value ?? a.description).join(' '));
} else if (msg.method === 'Runtime.exceptionThrown') {
console.log('eccezione:', msg.params.exceptionDetails.exception?.description || msg.params.exceptionDetails.text);
} else if (msg.method === 'Log.entryAdded' && msg.params.entry.level === 'error') {
console.log('errore:', msg.params.entry.text, msg.params.entry.url || '');
}
});
const send = (method, params = {}) => new Promise((resolve) => {
const n = ++id;
pending.set(n, resolve);
ws.send(JSON.stringify({ id: n, method, params }));
});
await send('Runtime.enable');
await send('Log.enable');
await send('Page.enable');
await send('Emulation.setDeviceMetricsOverride', { width: Number(width), height: Number(height), deviceScaleFactor: 1.25, mobile: false });
await send('Page.navigate', { url: target.href });
await sleep(Number(wait));
if (step) {
const code = readFileSync(step, 'utf8');
const r = await send('Runtime.evaluate', { expression: `(async () => { ${code} })()`, awaitPromise: true, returnByValue: true });
const value = r.result?.result?.value;
if (r.result?.exceptionDetails) console.log('errore nel passo:', r.result.exceptionDetails.exception?.description);
else if (value !== undefined) console.log('passo:', JSON.stringify(value));
if (value && typeof value === 'object' && Array.isArray(value.hover)) {
await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: value.hover[0], y: value.hover[1] });
}
await sleep(800);
}
const shot = await send('Page.captureScreenshot', { format: 'png' });
writeFileSync(out, Buffer.from(shot.result.data, 'base64'));
console.log('salvata', out);
ws.close();
finish(0);
}