Sessione salvata: copia alla chiusura della finestra e alla fine della guida, «Serve «Ho finito»», scelta per la copia incompleta e stato in Collegamento (#36, S4b)
Risposte 1, 5, 6, 9 e 10 di Alberto a S4. I valori __spin_r, __spin_b e __spin_t si copiano dalla pagina come gli altri (su Instagram da SiteData, ipotesi H23, operazioni ancora non configurate; nel sito di prova dal modulo GiroProva). La sessione si copia anche quando si chiude la finestra del browser su Windows e quando il permesso di guida finisce, sempre prima che la pagina torni al motore e con le garanzie di «Ho finito». Con «richieste» «Collegato» vuole una sessione salvata leggibile, altrimenti lo stato è «Serve «Ho finito»» e il motore aspetta. Nuova impostazione sessione.copia-incompleta (sostituisci, predefinita, o tieni-completa) e riquadro della sessione salvata nella pagina Collegamento, con soli conteggi e nomi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9958745e53
commit
883ea4683c
41 files changed
+1349
-101
No files matched your search
@@ -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}
|
||||
|
||||
@@ -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,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) {
|
||||
@@ -120,6 +122,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 +148,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 +166,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 +175,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 +243,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 +296,57 @@ 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')));
|
||||
}
|
||||
|
||||
const choose = async (value) => {
|
||||
try {
|
||||
await api('/api/connection/settings', { method: 'PUT', body: { incompleteCopy: value } });
|
||||
toast(k('salvato'));
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
}
|
||||
};
|
||||
const replace = radio({ name: 'copia-incompleta', value: 'sostituisci', checked: true, 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'))) });
|
||||
api('/api/connection/settings', { signal: page && page.signal }).then((settings) => {
|
||||
keep.input.checked = settings.incompleteCopy === 'tieni-completa';
|
||||
replace.input.checked = !keep.input.checked;
|
||||
}).catch(() => {});
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/** «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,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,31 @@
|
||||
"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 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."
|
||||
},
|
||||
"come": "Come collegarti",
|
||||
"passi": [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user