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
@@ -57,12 +57,14 @@ public sealed record ValueSource(ValueSourceKind Kind, string? Argument)
|
||||
/// <c>page</c> section of the catalog says where to read (<see cref="PageSources"/>): <c>lsd</c>, <c>fb_dtsg</c>,
|
||||
/// <c>app_id</c>, <c>account_id</c>, and since S4 <c>rev</c> (<c>__rev</c>), <c>hs</c> (<c>__hs</c>), <c>hsi</c>
|
||||
/// (<c>__hsi</c>), <c>dpr</c>, <c>ccg</c> (<c>__ccg</c>), <c>comet_req</c> (<c>__comet_req</c>) and
|
||||
/// <c>entry_nonce</c> (<c>x-fb-entry-nonce</c>).
|
||||
/// <c>entry_nonce</c> (<c>x-fb-entry-nonce</c>), and since S4b <c>spin_r</c>, <c>spin_b</c> and <c>spin_t</c>
|
||||
/// (<c>__spin_r</c>, <c>__spin_b</c>, <c>__spin_t</c>: a snapshot of the page at «Ho finito», decision of 18 November
|
||||
/// 2026).
|
||||
/// </summary>
|
||||
public static IReadOnlySet<string> SessionFields { get; } = new[]
|
||||
{
|
||||
"user_agent", "lsd", "fb_dtsg", "app_id", "claim", "account_id", "doc_id",
|
||||
"rev", "hs", "hsi", "dpr", "ccg", "comet_req", "entry_nonce",
|
||||
"rev", "hs", "hsi", "dpr", "ccg", "comet_req", "entry_nonce", "spin_r", "spin_b", "spin_t",
|
||||
}.ToFrozenSet(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>The session fields that need no <c>page</c> entry: the browser's user agent and the claim the site sets (H13).</summary>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
using Febe.Core.Storage;
|
||||
|
||||
namespace Febe.Core.Collection.Requests;
|
||||
|
||||
/// <summary>What a copy of the browser's session does when some value the requests need is missing (issue #36, S4b).</summary>
|
||||
public enum IncompleteCopyChoice
|
||||
{
|
||||
/// <summary>
|
||||
/// «Sostituisci comunque» (the default): the new copy replaces the saved one all the same, because keeping an older
|
||||
/// copy could keep the cookies of another login (§6.0).
|
||||
/// </summary>
|
||||
Replace,
|
||||
|
||||
/// <summary>
|
||||
/// «Tieni la copia completa»: when the saved copy has every value the configured operations need and the new one
|
||||
/// does not, the saved one stays and the message says so.
|
||||
/// </summary>
|
||||
KeepComplete,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The settings of the copy of the session (issue #36, S4b; decision of Alberto of 18 November 2026, answer 9), in the
|
||||
/// <c>setting</c> table like the other settings. Read at every copy: a change holds from the next copy, no restart.
|
||||
/// </summary>
|
||||
/// <param name="IncompleteCopy">What an incomplete copy does.</param>
|
||||
public sealed record SessionCopySettings(IncompleteCopyChoice IncompleteCopy)
|
||||
{
|
||||
/// <summary>The key of <see cref="IncompleteCopy"/>: <c>sostituisci</c> or <c>tieni-completa</c>.</summary>
|
||||
public const string IncompleteCopyKey = "sessione.copia-incompleta";
|
||||
|
||||
/// <summary>The text of <see cref="IncompleteCopyChoice.Replace"/> in the table and in the API.</summary>
|
||||
public const string ReplaceText = "sostituisci";
|
||||
|
||||
/// <summary>The text of <see cref="IncompleteCopyChoice.KeepComplete"/> in the table and in the API.</summary>
|
||||
public const string KeepCompleteText = "tieni-completa";
|
||||
|
||||
/// <summary>The settings of a database that never stored them: an incomplete copy replaces the saved one.</summary>
|
||||
public static SessionCopySettings Default { get; } = new(IncompleteCopyChoice.Replace);
|
||||
|
||||
/// <summary>The text of <paramref name="choice"/>.</summary>
|
||||
public static string ToText(IncompleteCopyChoice choice) => choice == IncompleteCopyChoice.KeepComplete ? KeepCompleteText : ReplaceText;
|
||||
|
||||
/// <summary>The choice of <paramref name="text"/>; null for any other text.</summary>
|
||||
public static IncompleteCopyChoice? Parse(string? text) => text switch
|
||||
{
|
||||
ReplaceText => IncompleteCopyChoice.Replace,
|
||||
KeepCompleteText => IncompleteCopyChoice.KeepComplete,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary>The stored settings; an unknown or missing value is the default.</summary>
|
||||
public static async Task<SessionCopySettings> LoadAsync(ISettingsStore settings, CancellationToken ct)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
var text = await settings.GetAsync(IncompleteCopyKey, ct).ConfigureAwait(false);
|
||||
return Parse(text) is { } choice ? new SessionCopySettings(choice) : Default;
|
||||
}
|
||||
|
||||
/// <summary>Stores these settings.</summary>
|
||||
public Task SaveAsync(ISettingsStore settings, CancellationToken ct)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
return settings.SetAsync(IncompleteCopyKey, ToText(IncompleteCopy), ct);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user