Unione di funzione/sessione-s4b in funzione/codec-immagini (catena della 0.3.0)

Porta nel ramo dei codec le regole e le risposte del 25 novembre (ramo dei
documenti) e la tappa S4b della sessione salvata, così che il ramo si unisca
in main dopo i due precedenti senza conflitti da risolvere di nuovo.

Conflitti risolti tenendo le due intenzioni:
- Directory.Packages.props: il commento «Niente componenti esterni» dei
  documenti, senza le righe di SkiaSharp, che questo ramo ha già tolto (C1).
- docs/decisioni.md: tutte le righe aggiunte dai due lati, prima le 39 della
  catena (documenti e S4b), poi le 23 dei codec.
- docs/docker.md: ffmpeg «fino alla tappa C3» dei documenti più la riga dei
  codec «Nessuna libreria per le immagini».
- docs/guida/Sviluppo.md: la regola «Niente componenti esterni» dei
  documenti, con SkiaSharp detto già uscito con la tappa C1 e i codec e il
  disegnatore di casa che lo sostituiscono.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-25 10:57:54 +01:00
commit a0e7404297
62 files changed
+2944 -242

No files matched your search

+9
View File
@@ -802,6 +802,15 @@ input[type=range].cursore.lungo::-webkit-slider-thumb{border-color:var(--accento
.collega-destra h2.sez{margin-bottom:12px}
.collega-destra .avviso{font-size:13.5px;line-height:1.5;padding:13px 16px}
.nota-password{background:var(--accento-tinta)}
.sessione-salvata{padding:14px 16px;font-size:13.5px;line-height:1.5}
.sessione-salvata p{margin:0 0 6px}
.sessione-salvata h2.sez{margin-bottom:8px}
.sessione-salvata h3.sez{font-size:13.5px;font-weight:650;margin:12px 0 8px}
.sessione-salvata .avviso{margin:4px 0 8px}
.sessione-salvata .scelte{display:flex;flex-direction:column;gap:10px}
.sessione-salvata .scelte .voce{align-items:flex-start}
.sessione-salvata .scelte .voce .tondo{margin-top:2px}
.sessione-salvata .scelte small{display:block;color:var(--testo-2);font-size:12.5px}
.passi-collegamento{list-style:none;margin:0 0 8px;padding:0;display:flex;flex-direction:column;gap:18px}
.passi-collegamento li{display:flex;gap:14px}
.passi-collegamento .numero{width:24px;height:24px;border-radius:50%;flex:none;display:inline-flex;align-items:center;justify-content:center;background:var(--accento-tinta);color:var(--accento-scuro);font-weight:650;font-size:12.5px;margin-top:1px}
+1 -1
View File
@@ -63,7 +63,7 @@ function renderStatus(state) {
const s = state.snapshot;
const meter = s.profilesOpenedToday;
const connection = state.connection;
const linkState = t(connection.state === 'verification' ? 'stato.verifica' : connection.state === 'disconnected' ? 'stato.scollegato' : 'stato.collegato');
const linkState = t(connection.state === 'verification' ? 'stato.verifica' : connection.state === 'disconnected' ? 'stato.scollegato' : connection.state === 'copyMissing' ? 'stato.copiaMancante' : 'stato.collegato');
// The own account is known only after the first sweep (a verification can come before it): no «@null».
const who = connection.state === 'notConnected'
? h('div.chi', h('span.av.segnaposto', icon('user', 's')),
+2 -2
View File
@@ -1,8 +1,8 @@
// Browser (spec §10.3 «Apri il browser»; mockup 10 without the steps column): in Docker the remote view of the
// server's browser and «Ho finito»; on Windows the browser is its own window. While Alberto uses the browser the
// engine is still; «Ho finito» lets «Riprendi» become active after a verification. Leaving the page without «Ho finito»
// (another page, a reload, closing the tab) gives the browser back, like «Annulla» (on Windows the window stays as it
// is until Alberto closes it). A browser at rest opens its start page; «?accesso=1» (the red strip of a disconnection)
// (another page, a reload, closing the tab) gives the browser back, like closing the window on Windows: the server copies
// the session if no view opens again within a moment (on Windows the window stays as it is until Alberto closes it). A browser at rest opens its start page; «?accesso=1» (the red strip of a disconnection)
// opens the login page, once: the parameter leaves the address straight away.
import { api } from '../core/api.js';
+95 -10
View File
@@ -2,7 +2,9 @@
// the steps «Come collegarti», the note that the password goes only to Instagram (keys pass through the server without
// being recorded), the risk note, Annulla and «Ho finito». Windows: the browser is the separate window «Browser di
// Febe» and the large area says so, with «Portalo in primo piano». When connected: the account, «Usa il browser» and
// «Scollega» with its confirmation. While Alberto uses the browser the engine is still.
// «Scollega» with its confirmation. While Alberto uses the browser the engine is still. With the raccolta «richieste»
// (issue #36, S4b) the page also shows the saved session in counts and names (never values), the choice for an
// incomplete copy, and «Serve «Ho finito»» when the browser is connected but the copy is missing.
import { api } from '../core/api.js';
import { caps } from '../core/context.js';
@@ -10,10 +12,10 @@ import { h, icon, fill } from '../core/dom.js';
import { engineState, refreshEngine } from '../core/engine.js';
import { navigate } from '../core/shell.js';
import { t } from '../core/text.js';
import { avatar, confirmDialog, label, showError, toast } from '../core/ui.js';
import { avatar, confirmDialog, label, radio, showError, toast } from '../core/ui.js';
import { remoteView } from './remote-view.js';
const STATE_KIND = { notConnected: 'ambra', connected: 'verde', verificationRequired: 'rosso', browserUnavailable: '' };
const STATE_KIND = { notConnected: 'ambra', connected: 'verde', copyMissing: 'ambra', verificationRequired: 'rosso', browserUnavailable: '' };
/** True while the engine waits for «Riprendi» (the stop strip of a verification or a disconnection). */
function waitsForResume(state) {
@@ -40,9 +42,10 @@ export async function beginDriving(openLogin) {
/**
* The browser as a page uses it (spec §4.1, §10.3: the engine is still only while Alberto uses the browser). begin()
* takes it; «Ho finito», «Annulla» and «Scollega» give it back on the server, and the page calls settled(). Leaving the
* page in any other way — another page, a reload, closing the tab — gives it back too: in Docker like «Annulla» (the
* browser goes back to the empty page and the engine may work again); on Windows the window «Browser di Febe» stays as
* it is, on screen until Alberto closes it (issue #52), and only the page's hold ends.
* page in any other way — another page, a reload, closing the tab — gives it back too: in Docker like closing the
* window on Windows, not like «Annulla» (answer of 25 November 2026: if no view opens again within a moment, the
* server copies the session and the engine may work again; a reload opens the view again); on Windows the window
* «Browser di Febe» stays as it is, on screen until Alberto closes it (issue #52), and only the page's hold ends.
*/
export function drivingLease(page) {
let held = false;
@@ -120,6 +123,7 @@ export async function mountConnection(page) {
fill(stateLabel, label(t(`impostazioni.collegamento.stati.${status.state}`), STATE_KIND[status.state] || ''));
if (status.state === 'connected') drawConnected();
else if (status.state === 'browserUnavailable') drawUnavailable();
else if (status.state === 'copyMissing') drawLogin({ copyMissing: true });
else drawLogin();
}
@@ -145,15 +149,17 @@ export async function mountConnection(page) {
});
// ------------------------------------------------------------------------------------------- login or verification
function drawLogin() {
function drawLogin({ copyMissing = false } = {}) {
const verification = status.state === 'verificationRequired';
// Connected but without the copy for the requests: the start page (the site's home), never the login page.
const login = !verification && !copyMissing;
waitingResume = false;
closeView();
lease.begin(!verification);
lease.begin(login);
if (windows) {
fill(left, windowPanel());
} else {
view = remoteView(page, { url: status.currentUrl, login: !verification });
view = remoteView(page, { url: status.currentUrl, login });
fill(left, view.element);
}
const steps = t(windows ? 'impostazioni.collegamento.passiWindows' : 'impostazioni.collegamento.passi');
@@ -161,6 +167,8 @@ export async function mountConnection(page) {
fill(right,
verification
? h('div.avviso.rosso', icon('octagon-alert', 's'), h('span', h('b', t('impostazioni.collegamento.verificaTitolo')), ' ', t('impostazioni.collegamento.verificaTesto')))
: copyMissing
? h('div.avviso.ambra', icon('triangle-alert', 's'), h('span', h('b', t('impostazioni.collegamento.copiaMancanteTitolo')), ' ', t('impostazioni.collegamento.copiaMancanteTesto')))
: h('div',
h('h2.sez', t('impostazioni.collegamento.come')),
h('ol.passi-collegamento', (Array.isArray(steps) ? steps : []).map((s, i) => h('li', h('span.numero', String(i + 1)), h('div', h('b', s.titolo), h('p', s.testo)))))),
@@ -168,6 +176,7 @@ export async function mountConnection(page) {
h('div.avviso.ambra', icon('triangle-alert', 's'), h('span', t('impostazioni.collegamento.rischio'))),
// Windows: one engine per account (spec §5) said before the login too; Docker keeps mockup 10 as it is.
windows ? h('div.avviso', icon('info', 's'), h('span', t('impostazioni.collegamento.unMotore'))) : null,
copyMissing ? savedSessionBox(status.savedSession, page) : null,
message,
h('div.molla'),
h('div.bottoni-collegamento',
@@ -235,7 +244,8 @@ export async function mountConnection(page) {
fill(right,
passwordNote(windows),
h('div.avviso.ambra', icon('triangle-alert', 's'), h('span', t('impostazioni.collegamento.rischio'))),
h('div.avviso', icon('info', 's'), h('span', t('impostazioni.collegamento.unMotore'))));
h('div.avviso', icon('info', 's'), h('span', t('impostazioni.collegamento.unMotore'))),
savedSessionBox(status.savedSession, page));
}
async function useBrowser() {
@@ -287,6 +297,81 @@ export async function mountConnection(page) {
await draw();
}
/**
* The saved session of the raccolta «richieste» (issue #36, S4b): when it was copied, the values and doc_id present
* and the names of the missing ones — counts and names only, the server never sends a value — and the choice for an
* incomplete copy. Nothing without a saved session in this start («pagine»).
*/
export function savedSessionBox(saved, page) {
if (!saved) return null;
const k = (key, vars) => t(`impostazioni.collegamento.salvata.${key}`, vars);
const lines = [];
if (saved.state === 'present') {
if (saved.copiedAt) {
const when = new Date(saved.copiedAt).toLocaleString('it-IT', { dateStyle: 'medium', timeStyle: 'short' });
lines.push(h('p', k('copiata', { quando: when })));
}
lines.push(h('p.muto', [
k('valori', { presenti: String(saved.valuesPresent), attesi: String(saved.valuesExpected) }),
k('docId', { presenti: String(saved.docIdsPresent), attesi: String(saved.docIdsExpected) }),
k('cookie', { n: String(saved.cookies) }),
].join(' ')));
const missing = [...(saved.missingValues || []), ...(saved.missingDocIds || [])];
if (missing.length) lines.push(h('p', k('mancano', { nomi: missing.join(', ') })));
lines.push(saved.neededMissing
? h('div.avviso.ambra', icon('triangle-alert', 's'), h('span', k('servono', { n: String(saved.neededMissing) })))
: h('p', k('completa')));
} else {
lines.push(h('p', k(saved.state === 'unreadable' ? 'illeggibile' : 'nessuna')));
}
// Neither choice is shown as chosen, and neither can be picked, until the server says which one is stored: the page
// never claims a choice the next copy will not follow. Once Alberto picks one, a late answer no longer changes it;
// a choice the server did not save goes back to the one before.
let saved = null;
let chosen = false;
const show = (value) => {
keep.input.checked = value === 'tieni-completa';
replace.input.checked = value === 'sostituisci';
};
const choose = async (value) => {
chosen = true;
const before = saved;
try {
const settings = await api('/api/connection/settings', { method: 'PUT', body: { incompleteCopy: value } });
saved = settings && settings.incompleteCopy ? settings.incompleteCopy : value;
unknown.hidden = true;
toast(k('salvato'));
} catch (error) {
show(before);
showError(error);
}
};
const replace = radio({ name: 'copia-incompleta', value: 'sostituisci', onchange: choose, labelNode: h('span', h('b', k('sostituisci')), h('small', k('sostituisciAiuto'))) });
const keep = radio({ name: 'copia-incompleta', value: 'tieni-completa', onchange: choose, labelNode: h('span', h('b', k('tieni')), h('small', k('tieniAiuto'))) });
const unknown = h('p.aiuto.piccolo.scelta-ignota', { hidden: true }, k('sceltaIgnota'));
for (const choice of [replace, keep]) choice.input.disabled = true;
api('/api/connection/settings', { signal: page && page.signal }).then((settings) => {
if (chosen) return;
saved = settings.incompleteCopy;
show(saved);
}).catch(() => {
if (page && page.signal && page.signal.aborted) return; // the page was left
if (!chosen) unknown.hidden = false;
}).finally(() => {
if (page && page.signal && page.signal.aborted) return;
for (const choice of [replace, keep]) choice.input.disabled = false;
});
return h('div.pannello.sessione-salvata',
h('h2.sez', k('titolo')),
...lines,
h('p.aiuto.piccolo', k('nota')),
h('h3.sez', k('incompleta')),
h('div.scelte', { role: 'radiogroup', 'aria-label': k('incompleta') }, replace, keep),
unknown);
}
/** «La password va solo a Instagram», with the true wording of each shell (spec §10.3). */
export function passwordNote(windows) {
return h('div.avviso.nota-password', icon('shield-check', 's'),
+24
View File
@@ -24,6 +24,7 @@
"nessunAccount": "Nessun account",
"verifica": "Verifica richiesta",
"scollegato": "Sessione chiusa",
"copiaMancante": "Serve «Ho finito»",
"accountDaLeggere": "Nome non ancora noto",
"nonDisponibile": "Stato del motore non disponibile"
},
@@ -690,9 +691,32 @@
"stati": {
"notConnected": "Non collegato",
"connected": "Collegato",
"copyMissing": "Serve «Ho finito»",
"verificationRequired": "Verifica richiesta",
"browserUnavailable": "Browser non disponibile"
},
"copiaMancanteTitolo": "Manca la copia della sessione",
"copiaMancanteTesto": "Il browser è collegato, ma Febe non ha ancora una copia della sessione per le richieste (o non riesce a leggerla). Apri la tua pagina iniziale nel browser e premi «Ho finito»: fino ad allora il motore aspetta.",
"salvata": {
"titolo": "Sessione salvata per le richieste",
"copiata": "Copiata {quando}.",
"nessuna": "Nessuna copia: premi «Ho finito» sulla tua pagina iniziale.",
"illeggibile": "C'è un file, ma Febe non riesce a leggerlo (un'altra chiave o un file rovinato): conta come nessuna copia. Il prossimo «Ho finito» lo sostituisce.",
"valori": "Valori della pagina: {presenti} su {attesi}.",
"docId": "doc_id: {presenti} su {attesi}.",
"cookie": "Cookie: {n}.",
"mancano": "Mancano: {nomi}.",
"servono": "{n} di questi serve alle richieste configurate: le richieste che lo usano non partono e, alla prima, Febe si ferma come disconnessione.|{n} di questi servono alle richieste configurate: quelle richieste non partono e, alla prima, Febe si ferma come disconnessione.",
"completa": "Nulla di ciò che le richieste configurate mandano manca.",
"nota": "Qui ci sono solo conteggi e nomi, mai i valori.",
"incompleta": "Se una copia nuova è incompleta",
"sostituisci": "Sostituisci comunque (consigliato)",
"sostituisciAiuto": "La copia nuova prende sempre il posto di quella salvata: una copia più vecchia potrebbe avere i cookie di un altro accesso.",
"tieni": "Tieni la copia completa",
"tieniAiuto": "Se alla copia nuova manca qualcosa che le richieste usano e quella salvata è completa, Febe tiene quella salvata e te lo dice.",
"salvato": "Scelta salvata: vale dalla prossima copia.",
"sceltaIgnota": "Febe non è riuscito a leggere la scelta salvata: scegline una per salvarla di nuovo."
},
"come": "Come collegarti",
"passi": [
{