Il Collegamento di Febe, con il sito di prova, apre /benvenuto come pagina di accesso, ma il sito rispondeva «Pagina non trovata»: la sessione si apriva lo stesso (il cookie arriva con ogni pagina), però chi prova vedeva un errore. Ora è una pagina di solo testo che dice di tornare a Febe e premere «Ho finito»; nessun modulo, nessuna password. Una prova senza browser lo controlla, con qualunque seme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
5.0 KiB
C#
104 lines
5.0 KiB
C#
using System.Globalization;
|
||
using System.Net;
|
||
|
||
namespace Febe.SitoDiProva;
|
||
|
||
/// <summary>The HTML of the site: plain pages, no branding, no login form. Data is filled in by <c>sito.js</c>.</summary>
|
||
internal static class Pages
|
||
{
|
||
public static string Home() => Layout("Inizio", "inizio", string.Empty, """
|
||
<h1>Inizio</h1>
|
||
<section aria-label="Storie"><div class="barra" id="barra"></div></section>
|
||
<section class="flusso" id="flusso" aria-label="Post recenti"></section>
|
||
<div class="sentinella" id="sentinella"></div>
|
||
""");
|
||
|
||
public static string Profile(string username, ProfileTab tab)
|
||
{
|
||
var u = Encode(username);
|
||
var tabName = tab switch { ProfileTab.Reels => "reel", ProfileTab.Tagged => "taggati", _ => "post" };
|
||
string Tab(string label, string path, ProfileTab which) =>
|
||
$"""<a role="tab" href="/profilo/{u}/{path}" aria-selected="{(tab == which ? "true" : "false")}">{label}</a>""";
|
||
return Layout($"Profilo di {username}", "profilo", $"""data-utente="{Html(username)}" data-scheda="{tabName}" """, $"""
|
||
<div class="testata" id="testata"></div>
|
||
<div class="raccolte" id="raccolte"></div>
|
||
<nav class="schede" aria-label="Schede del profilo" role="tablist">
|
||
{Tab("Post", string.Empty, ProfileTab.Posts)}
|
||
{Tab("Reel", "reel/", ProfileTab.Reels)}
|
||
{Tab("Taggati", "taggati/", ProfileTab.Tagged)}
|
||
</nav>
|
||
<div id="contenuto"><div class="griglia" id="griglia"></div></div>
|
||
<div class="sentinella" id="sentinella"></div>
|
||
""");
|
||
}
|
||
|
||
public static string ProfileNotFound(string username) => Layout("Profilo non trovato", "nessuna", string.Empty, $"""
|
||
<h1>Profilo non trovato</h1>
|
||
<p>Il profilo «{Html(username)}» non esiste o non è più disponibile.</p>
|
||
<p><a href="/">Torna all'inizio</a></p>
|
||
""");
|
||
|
||
public static string Following(string username) => Layout($"Profili seguiti da {username}", "seguiti", $"""data-utente="{Html(username)}" """, """
|
||
<h1>Profili seguiti</h1>
|
||
<ul class="elenco" id="elenco"></ul>
|
||
<div class="sentinella" id="sentinella"></div>
|
||
""");
|
||
|
||
public static string Post(string code) => Layout("Post", "post", $"""data-sigla="{Html(code)}" """, """
|
||
<div id="contenuto"></div>
|
||
""");
|
||
|
||
public static string Viewer(string kind, TimeSpan storyDuration) =>
|
||
$"""
|
||
<!doctype html>
|
||
<html lang="it">
|
||
<head><meta charset="utf-8"><title>{(kind == "storie" ? "Storie" : "Raccolta")}</title><link rel="stylesheet" href="/risorse/sito.css"></head>
|
||
<body class="visualizzatore" data-pagina="{kind}" data-durata="{((int)storyDuration.TotalMilliseconds).ToString(CultureInfo.InvariantCulture)}">
|
||
<div class="progressi" id="progressi"></div>
|
||
<div class="chi" id="chi"></div>
|
||
<div class="palco" id="palco"></div>
|
||
<button class="zona-avanti" id="avanti" aria-label="Storia successiva"></button>
|
||
<button class="chiudi" id="chiudi" aria-label="Chiudi">×</button>
|
||
<script src="/risorse/sito.js"></script>
|
||
</body>
|
||
</html>
|
||
""";
|
||
|
||
public static string Challenge() => Layout("Verifica", "nessuna", string.Empty, """
|
||
<h1>Verifica richiesta</h1>
|
||
<p>Il sito di prova chiede una verifica. Febe deve fermarsi e avvisare: qui non c'è niente da compilare.</p>
|
||
""");
|
||
|
||
public static string SessionEnded() => Layout("Sessione scaduta", "nessuna", string.Empty, """
|
||
<h1>Sessione scaduta</h1>
|
||
<p>La sessione del sito di prova è terminata. Febe deve fermarsi e non tentare di rientrare.</p>
|
||
""");
|
||
|
||
public static string NotFound() => Layout("Pagina non trovata", "nessuna", string.Empty, "<h1>Pagina non trovata</h1>");
|
||
|
||
/// <summary>What Febe opens as the login page of the test site: there is nothing to type, the visit opens the session.</summary>
|
||
public static string Welcome() => Layout("Benvenuto", "nessuna", string.Empty, """
|
||
<h1>Benvenuto nel sito di prova</h1>
|
||
<p>Qui non c'è nessuna password: il sito di prova ti considera entrato appena apri una sua pagina. Torna a Febe e
|
||
premi «Ho finito».</p>
|
||
""");
|
||
|
||
private static string Layout(string title, string page, string attributes, string main) => $"""
|
||
<!doctype html>
|
||
<html lang="it">
|
||
<head><meta charset="utf-8"><title>{Html(title)} · Sito di prova</title><link rel="stylesheet" href="/risorse/sito.css"></head>
|
||
<body data-pagina="{page}" {attributes}>
|
||
<header class="sito"><strong>Sito di prova di Febe</strong><a href="/">Inizio</a><a href="/profilo/alberto.prova/seguiti/">Seguiti</a></header>
|
||
<main>
|
||
{main}
|
||
</main>
|
||
<script src="/risorse/sito.js"></script>
|
||
</body>
|
||
</html>
|
||
""";
|
||
|
||
private static string Html(string text) => WebUtility.HtmlEncode(text);
|
||
|
||
private static string Encode(string text) => Uri.EscapeDataString(text);
|
||
}
|