Contratto condiviso per collegamento, vista remota e problemi di configurazione
verifica / prove (push) Successful in 5m40s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 19:20:19 +00:00
1 parent d8b181eb16
commit 0515776b04
3 files changed
+127

No files matched your search

@@ -0,0 +1,60 @@
namespace Febe.Web.Connection;
/// <summary>State of the link to Instagram shown at the bottom of the sidebar and on the Collegamento page (spec §4.1).</summary>
public enum ConnectionState
{
/// <summary>No session in the browser profile: «Non collegato».</summary>
NotConnected,
/// <summary>Session cookie present: «Collegato».</summary>
Connected,
/// <summary>The engine stopped for a challenge or a disconnection: «Verifica richiesta».</summary>
VerificationRequired,
/// <summary>The browser is not available (starting, crashed, demo without browser).</summary>
BrowserUnavailable,
}
/// <summary>What the interface knows about the link to Instagram.</summary>
/// <param name="State">Current state.</param>
/// <param name="Username">Connected account (from the data the page received, hypothesis H10), when known.</param>
/// <param name="DisplayName">Display name, when known.</param>
/// <param name="UserIsDriving">True while Alberto is using the browser (login page, remote view, browser window): the engine is still.</param>
/// <param name="CurrentUrl">Address shown in the remote view's address bar, without query string.</param>
public sealed record ConnectionStatus(
ConnectionState State,
string? Username,
string? DisplayName,
bool UserIsDriving,
string? CurrentUrl);
/// <summary>Result of «Ho finito» on the Collegamento page.</summary>
/// <param name="Connected">True when the session cookie now exists.</param>
/// <param name="Message">Italian message for the page (what happened, what Febe did, what Alberto should do).</param>
public sealed record FinishResult(bool Connected, string Message);
/// <summary>
/// The link to Instagram (spec §4.1, §10.3 «Collegamento» and «Browser» pages). Implemented by the server/desktop
/// composition over the real browser host, and by the demo mode with a fake driven by the scene.
/// Opening the login page here is not an engine action (rule 7): Alberto is using the browser and the engine is still.
/// </summary>
public interface IConnectionService
{
Task<ConnectionStatus> GetStatusAsync(CancellationToken ct);
/// <summary>
/// Alberto starts using the browser: the engine stops acting (UserIsDriving), and when <paramref name="openLogin"/>
/// is true the browser loads the real Instagram login page. Windows: the browser window is brought to the front.
/// </summary>
Task BeginUserDrivingAsync(bool openLogin, CancellationToken ct);
/// <summary>«Ho finito»: checks that the session cookie exists (value never read), hides the browser, ends user driving.</summary>
Task<FinishResult> FinishAsync(CancellationToken ct);
/// <summary>«Annulla»: ends user driving and puts the browser on the empty rest page.</summary>
Task CancelAsync(CancellationToken ct);
/// <summary>«Scollega» (after confirmation in the UI): stops the engine and deletes the browser profile.</summary>
Task DisconnectAsync(CancellationToken ct);
}