Interfaccia web, parte 1: ospite, sicurezza, API, modalità dimostrativa, libreria, visualizzatore e account
Febe.Web: AddFebeWeb/UseFebe/FebeWebHost per le due vesti, interfaccia incorporata con IFileProvider proprio, indirizzi italiani, API JSON con contesto generato, eventi SSE, controlli di Host/Origin, gettone del desktop e password con blocco (§13.1), INativeShell e capacità per veste. Modalità --demo con 38 account e circa 18.000 elementi finti e scene del motore. Pagine Libreria, Visualizzatore, Account, Aggiungi account e Scheda account (contenuti, impostazioni con piano, cronologia); schermate in docs/schermate con le differenze dai mockup; prove delle API, della sicurezza, dell'esportazione CSV e dei dati dimostrativi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
76 files changed
+12503
-17
No files matched your search
@@ -0,0 +1,91 @@
|
||||
namespace Febe.Web.Native;
|
||||
|
||||
/// <summary>
|
||||
/// Native functions the shell offers to the interface (spec §12): folder picker, «Mostra nella cartella», opening an
|
||||
/// address in Alberto's default browser, notifications, start with the system. The desktop implements it with
|
||||
/// Windows APIs; in Docker and in a plain browser <see cref="BrowserShell"/> says that none is available and the
|
||||
/// interface falls back (download instead of «Mostra nella cartella», links instead of native opening).
|
||||
/// The web layer never passes paths or addresses that come from the page: it resolves them itself.
|
||||
/// </summary>
|
||||
public interface INativeShell
|
||||
{
|
||||
/// <summary>A folder picker exists («Cambia…» of the folders).</summary>
|
||||
bool CanPickFolder { get; }
|
||||
|
||||
/// <summary>The file manager can show a file («Mostra nella cartella»).</summary>
|
||||
bool CanShowInFolder { get; }
|
||||
|
||||
/// <summary>Addresses open in the default browser through the shell (otherwise the page opens them as links).</summary>
|
||||
bool CanOpenUrl { get; }
|
||||
|
||||
/// <summary>System notifications are available (Windows).</summary>
|
||||
bool CanNotify { get; }
|
||||
|
||||
/// <summary>«Avvia Febe all'accensione del computer» exists (Windows only).</summary>
|
||||
bool SupportsAutostart { get; }
|
||||
|
||||
/// <summary>Asks Alberto for a folder; null when he cancels.</summary>
|
||||
Task<string?> PickFolderAsync(string title, string? initialFolder, CancellationToken ct);
|
||||
|
||||
/// <summary>Opens the file manager on a file. False when not possible.</summary>
|
||||
Task<bool> ShowInFolderAsync(string fullPath, CancellationToken ct);
|
||||
|
||||
/// <summary>Opens an address in the default browser (Alberto's browser, never Febe's). False when not possible.</summary>
|
||||
Task<bool> OpenUrlAsync(Uri address, CancellationToken ct);
|
||||
|
||||
/// <summary>Shows a system notification (spec §13.3).</summary>
|
||||
Task NotifyAsync(string title, string message, CancellationToken ct);
|
||||
|
||||
Task<bool> GetAutostartAsync(CancellationToken ct);
|
||||
|
||||
Task SetAutostartAsync(bool enabled, CancellationToken ct);
|
||||
}
|
||||
|
||||
/// <summary>No native functions: Docker and plain browsers.</summary>
|
||||
public sealed class BrowserShell : INativeShell
|
||||
{
|
||||
public static BrowserShell Instance { get; } = new();
|
||||
|
||||
public bool CanPickFolder => false;
|
||||
|
||||
public bool CanShowInFolder => false;
|
||||
|
||||
public bool CanOpenUrl => false;
|
||||
|
||||
public bool CanNotify => false;
|
||||
|
||||
public bool SupportsAutostart => false;
|
||||
|
||||
public Task<string?> PickFolderAsync(string title, string? initialFolder, CancellationToken ct) => Task.FromResult<string?>(null);
|
||||
|
||||
public Task<bool> ShowInFolderAsync(string fullPath, CancellationToken ct) => Task.FromResult(false);
|
||||
|
||||
public Task<bool> OpenUrlAsync(Uri address, CancellationToken ct) => Task.FromResult(false);
|
||||
|
||||
public Task NotifyAsync(string title, string message, CancellationToken ct) => Task.CompletedTask;
|
||||
|
||||
public Task<bool> GetAutostartAsync(CancellationToken ct) => Task.FromResult(false);
|
||||
|
||||
public Task SetAutostartAsync(bool enabled, CancellationToken ct) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The browser of Febe as the interface sees it: on Windows a separate window brought to the front by «Apri il
|
||||
/// browser»; in Docker the «Browser» page with the remote view. Implemented by the shells (M5, M6).
|
||||
/// </summary>
|
||||
public interface IBrowserWindow
|
||||
{
|
||||
/// <summary>True when the browser is a window of its own (Windows): «Apri il browser» calls <see cref="ShowAsync"/>.</summary>
|
||||
bool IsSeparateWindow { get; }
|
||||
|
||||
/// <summary>Brings the browser window to the front (Windows). The engine stays still while Alberto uses it.</summary>
|
||||
Task ShowAsync(CancellationToken ct);
|
||||
}
|
||||
|
||||
/// <summary>No browser window (Docker uses the Browser page; the demo has no browser).</summary>
|
||||
public sealed class NoBrowserWindow : IBrowserWindow
|
||||
{
|
||||
public bool IsSeparateWindow => false;
|
||||
|
||||
public Task ShowAsync(CancellationToken ct) => Task.CompletedTask;
|
||||
}
|
||||
Reference in new issue
Block a user