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:
Claude committed 2026-10-13 19:14:35 +00:00
1 parent 6ff11ac8e3
commit e33540246e
76 files changed
+12503 -17

No files matched your search

+236
View File
@@ -0,0 +1,236 @@
using Febe.Core.Engine;
namespace Febe.Web.Api;
// JSON shapes of the API. English names (camelCase on the wire); every text meant for Alberto is Italian.
// Times: milliseconds since the Unix epoch (UTC), plus local strings computed in Alberto's zone where the page shows a
// clock or a day, so the page never needs to know the zone of the server.
/// <summary>An error the page shows as it is.</summary>
public sealed record ProblemDto(string Message);
/// <summary>A short answer of a command.</summary>
public sealed record MessageDto(string Message);
/// <summary>An instant with its local day and clock time. <see cref="DayDelta"/>: 0 today, 1 tomorrow, -1 yesterday.</summary>
public sealed record LocalTimeDto(long Ms, string Day, string Clock, int DayDelta);
/// <summary>What this shell can do (the page adapts its buttons).</summary>
public sealed record CapabilitiesDto(
string Edition,
bool Demo,
string Access,
bool ShowInFolder,
bool PickFolder,
bool OpenUrlNative,
bool FoldersReadOnly,
bool Autostart,
bool BrowserWindow,
bool Notifications,
string Version,
string? Scene,
IReadOnlyList<string> Scenes,
long Now,
string Today);
public sealed record PreferencesDto(string Theme);
// ---------------------------------------------------------------- library
/// <summary>The cover of a tile. <see cref="Thumb"/> is the thumbnail key (null: neutral tile).</summary>
public sealed record CoverDto(long MediaId, string Kind, int? Width, int? Height, double? Duration, string? Thumb);
/// <summary>A tile of the mosaic: one entry.</summary>
public sealed record TileDto(
long Id,
long AccountId,
string Username,
string Kind,
long PublishedAt,
string Day,
string Time,
string Provenance,
string State,
int Files,
CoverDto? Cover);
/// <summary>A window of tiles; cursors continue it (null: nothing more that way).</summary>
public sealed record LibraryPageDto(IReadOnlyList<TileDto> Tiles, string? Older, string? Newer);
/// <summary>A day of the mosaic: its count and the cursor that starts at its end.</summary>
public sealed record DayDto(string Day, int Count, string Cursor);
public sealed record LibraryDaysDto(long Now, string Today, int Entries, int Accounts, IReadOnlyList<DayDto> Days);
public sealed record AccountBriefDto(long Id, string Username, string? DisplayName, bool IsPrivate, bool IsFollowed, bool IsMine, string State, string? Avatar);
public sealed record MediaDto(
long Id,
int Position,
string Kind,
int? Width,
int? Height,
double? Duration,
long? Bytes,
string? FileName,
string? Folder,
string? Thumb,
bool Available,
string State);
/// <summary>Everything the viewer shows of an entry.</summary>
public sealed record EntryDto(
long Id,
string Kind,
AccountBriefDto Account,
long PublishedAt,
string PublishedDay,
string PublishedTime,
string? Code,
string? InstagramId,
string? Caption,
string? Author,
string Provenance,
string State,
LocalTimeDto Discovered,
LocalTimeDto? Downloaded,
IReadOnlyList<string> Highlights,
string? InstagramUrl,
IReadOnlyList<MediaDto> Media);
public sealed record EntryIdsRequest(IReadOnlyList<long> Ids, string? Mode);
public sealed record DeleteResultDto(int Deleted, int FilesRemoved, IReadOnlyList<string> Problems, string Message);
/// <summary>Export by keys, or by the current filter when no keys are given.</summary>
public sealed record ExportRequest(IReadOnlyList<long>? Ids, string? Query);
public sealed record MediaActionRequest(long MediaId);
// ---------------------------------------------------------------- accounts
public sealed record ContentTypesDto(bool Photos, bool Videos, bool Stories, bool Highlights, bool Tagged, bool ProfilePicture);
/// <summary>A row of the accounts table (mockup 03).</summary>
public sealed record AccountRowDto(
long Id,
string Username,
string? DisplayName,
bool IsPrivate,
bool IsFollowed,
bool IsMine,
string State,
string? UnreachableReason,
bool NeedsAttention,
IReadOnlyList<string> Notices,
bool KeepUpdated,
bool KeptUpdated,
string Frequency,
ContentTypesDto Types,
int InLibrary,
int Posts,
int? PostCount,
int NewPostsToday,
int NewStoriesToday,
bool BackfillResumesTomorrow,
long? LastCheck,
LocalTimeDto? NextCheck,
LocalTimeDto? StateChanged,
long AddedAt,
string? Avatar,
string? PreviousUsername);
public sealed record AccountCountsDto(int All, int UpToDate, int Backfilling, int Paused, int ArchiveOnly, int NeedsAttention, int KeptUpdated);
public sealed record AccountListDto(long Now, AccountCountsDto Counts, IReadOnlyList<AccountRowDto> Accounts);
public sealed record AccountStatsDto(int Entries, int Posts, int Stories, int HighlightItems, int Tagged, int ProfilePictures, int Collections, long Bytes, int PendingFiles);
/// <summary>The editable settings of an account (mockup 05).</summary>
public sealed record AccountSettingsDto(
bool KeepUpdated,
string Frequency,
double? CustomPostHours,
double? CustomStoryHours,
ContentTypesDto Types,
string Depth,
int? LastPosts,
string? FromDate,
int BackfillPerDay,
double? MaxVideoMb,
bool StoryVideos,
string? Folder);
public sealed record PlanLineDto(string Key, string Title, string Text);
/// <summary>«Con queste impostazioni» (spec §4.4).</summary>
public sealed record PlanDto(
IReadOnlyList<PlanLineDto> Lines,
IReadOnlyList<string> Warnings,
double Share,
double OpensPerDay,
int DailyBudget,
bool OverBudget,
string FrequencyHint,
string? Note);
public sealed record HighlightDto(long Id, string Title, int Count, bool Removed, IReadOnlyList<long> EntryIds);
public sealed record AccountDetailDto(
AccountRowDto Account,
AccountStatsDto Stats,
AccountSettingsDto Settings,
PlanDto Plan,
string Folder,
bool FolderIsDefault,
string? InstagramUrl,
IReadOnlyList<HighlightDto> Highlights,
int MaxBackfillPerDay);
public sealed record HistoryItemDto(long Id, LocalTimeDto At, string Severity, string Code, string Message);
public sealed record HistoryDto(IReadOnlyList<HistoryItemDto> Items, long? Before);
public sealed record SwitchRequest(bool Value);
public sealed record CheckNowRequest(string? Token);
public sealed record CheckNowDto(string Status, string Message, string? Token);
public sealed record RemoveAccountRequest(bool DeleteFiles);
public sealed record RemoveAccountDto(string Outcome, int DeletedEntries, int Problems, string Message);
public sealed record ParseRequest(string Text);
public sealed record ParsedNameDto(int Line, string Username, bool Present, long? AccountId, bool Followed, string? DisplayName, bool? IsPrivate);
public sealed record ParseProblemDto(int Line, string Text, string Reason);
public sealed record ParseResultDto(IReadOnlyList<ParsedNameDto> Names, IReadOnlyList<ParseProblemDto> Problems);
public sealed record AddAccountsRequest(IReadOnlyList<string> Usernames, string Start, string? Depth, int? LastPosts);
public sealed record AddAccountsDto(int Added, IReadOnlyList<string> Skipped, string Message);
public sealed record FollowingProfileDto(string Username, string? DisplayName, bool? IsPrivate, long? AccountId);
/// <param name="BackfillPerDay">Default «Storico, massimo al giorno» of the caution profile, for the note of the dialog.</param>
public sealed record FollowingDto(long? ReadAt, string? ReadDay, bool InProgress, int ReadSoFar, int Total, IReadOnlyList<FollowingProfileDto> Profiles, int BackfillPerDay);
// ---------------------------------------------------------------- engine
/// <summary>The connected account at the bottom of the sidebar.</summary>
/// <param name="State">"connected", "notConnected", "verification", "disconnected".</param>
public sealed record ConnectionDto(string State, string? Username, string? DisplayName, string? Avatar);
/// <summary>The engine for the sidebar, the stop strip and the Attività page.</summary>
public sealed record EngineDto(long Now, EngineSnapshot Snapshot, ConnectionDto Connection, bool CanResume);
public sealed record ResumeDto(bool Resumed, string Message);
// ---------------------------------------------------------------- access
public sealed record LoginRequest(string? Password);
public sealed record LoginDto(bool Ok, string Message, long? LockedUntil);