Redesign settings page with sectioned layout, side navigation and choice cards
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b9bf3cd5f
commit
de22f035dc
11 files changed
+934
-294
No files matched your search
@@ -9,80 +9,83 @@
|
||||
@inject RuntimeSettingsStore Store
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<section class="card form" id="hold-method">
|
||||
<header class="section-head">
|
||||
<h2>Haltemethode</h2>
|
||||
@if (_hasOverrides)
|
||||
{
|
||||
<span class="badge">Überschrieben</span>
|
||||
}
|
||||
</header>
|
||||
|
||||
<SettingsSection Id="hold-method" Title="Haltemethode" Description="Womit Flypaper gefangene Bots beschäftigt und wie langsam es antwortet. Änderungen gelten ab dem nächsten Fang." Badge="@(_hasOverrides ? "Angepasst" : null)">
|
||||
@if (Saved == "saved")
|
||||
{
|
||||
<div class="banner ok">Gespeichert. Gilt ab dem nächsten Fang.</div>
|
||||
<Notice>Gespeichert. Gilt ab dem nächsten Fang.</Notice>
|
||||
}
|
||||
else if (Saved == "reset")
|
||||
{
|
||||
<div class="banner ok">Haltemethode auf Standard zurückgesetzt.</div>
|
||||
<Notice>Haltemethode auf Standard zurückgesetzt.</Notice>
|
||||
}
|
||||
|
||||
<EditForm Model="Model" FormName="hold-method" OnSubmit="SaveAsync" action="/settings" class="form">
|
||||
<label for="drip-content">Inhalt</label>
|
||||
<InputSelect id="drip-content" @bind-Value="Model!.Content">
|
||||
<option value="@DripContent.Html">HTML-Fülltext</option>
|
||||
<option value="@DripContent.Text">Zufallstext (plain text)</option>
|
||||
<option value="@DripContent.Alternating">Wechselnd (pro Fang zufällig)</option>
|
||||
</InputSelect>
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.Content)" />
|
||||
<EditForm Model="Model" FormName="hold-method" OnSubmit="SaveAsync" action="/settings#hold-method" id="hold-method-form">
|
||||
<div class="s-body">
|
||||
<fieldset class="choices">
|
||||
<legend>Inhalt</legend>
|
||||
<InputRadioGroup @bind-Value="Model!.Content">
|
||||
<div class="choice-grid">
|
||||
@foreach (var choice in Choices)
|
||||
{
|
||||
<label class="choice">
|
||||
<InputRadio Value="@choice.Value" />
|
||||
<span class="choice-body">
|
||||
<strong>@choice.Title</strong>
|
||||
<span>@choice.Text</span>
|
||||
</span>
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
</InputRadioGroup>
|
||||
@if (_errors.TryGetValue(nameof(HoldMethodModel.Content), out var contentError))
|
||||
{
|
||||
<p class="field-error">@contentError</p>
|
||||
}
|
||||
</fieldset>
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<label for="drip-min-delay">Pause min. <span class="muted">(ms)</span></label>
|
||||
<InputText id="drip-min-delay" @bind-Value="Model!.MinDelayMs" class="mono" inputmode="numeric" data-bandwidth-input />
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MinDelayMs)" />
|
||||
<div class="fields">
|
||||
<SettingsField Label="Pause min." For="drip-min-delay" Unit="ms" Hint="10 bis 30000" Errors="_errors" Key="@nameof(HoldMethodModel.MinDelayMs)">
|
||||
<InputText id="drip-min-delay" @bind-Value="Model!.MinDelayMs" inputmode="numeric" data-bandwidth-input />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Pause max." For="drip-max-delay" Unit="ms" Hint="Zufällig zwischen min. und max." Errors="_errors" Key="@nameof(HoldMethodModel.MaxDelayMs)">
|
||||
<InputText id="drip-max-delay" @bind-Value="Model!.MaxDelayMs" inputmode="numeric" data-bandwidth-input />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Paket min." For="drip-min-chunk" Unit="Bytes" Hint="1 bis 4096" Errors="_errors" Key="@nameof(HoldMethodModel.MinChunkSize)">
|
||||
<InputText id="drip-min-chunk" @bind-Value="Model!.MinChunkSize" inputmode="numeric" data-bandwidth-input />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Paket max." For="drip-max-chunk" Unit="Bytes" Hint="Zufällig zwischen min. und max." Errors="_errors" Key="@nameof(HoldMethodModel.MaxChunkSize)">
|
||||
<InputText id="drip-max-chunk" @bind-Value="Model!.MaxChunkSize" inputmode="numeric" data-bandwidth-input />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Maximale Haltedauer" For="hold" Hint="hh:mm:ss, höchstens 7 Tage" Errors="_errors" Key="@nameof(HoldMethodModel.MaxHoldDuration)">
|
||||
<InputText id="hold" @bind-Value="Model!.MaxHoldDuration" />
|
||||
</SettingsField>
|
||||
</div>
|
||||
<div>
|
||||
<label for="drip-max-delay">Pause max. <span class="muted">(ms)</span></label>
|
||||
<InputText id="drip-max-delay" @bind-Value="Model!.MaxDelayMs" class="mono" inputmode="numeric" data-bandwidth-input />
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxDelayMs)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="drip-min-chunk">Paket min. <span class="muted">(Bytes)</span></label>
|
||||
<InputText id="drip-min-chunk" @bind-Value="Model!.MinChunkSize" class="mono" inputmode="numeric" data-bandwidth-input />
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MinChunkSize)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="drip-max-chunk">Paket max. <span class="muted">(Bytes)</span></label>
|
||||
<InputText id="drip-max-chunk" @bind-Value="Model!.MaxChunkSize" class="mono" inputmode="numeric" data-bandwidth-input />
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxChunkSize)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="hold">Maximale Haltedauer <span class="muted">(hh:mm:ss)</span></label>
|
||||
<InputText id="hold" @bind-Value="Model!.MaxHoldDuration" class="mono" />
|
||||
<FieldError Errors="_errors" Field="@nameof(HoldMethodModel.MaxHoldDuration)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="muted">
|
||||
Pause 10 ms bis 30 s, Paket 1 bis 4096 Bytes. Ø ca. <strong id="drip-bandwidth">@Bandwidth</strong> Bytes/s pro gefangener Verbindung.
|
||||
</p>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit">Speichern</button>
|
||||
<div class="estimate">
|
||||
<span class="estimate-value">Ø <strong id="drip-bandwidth">@Bandwidth</strong> Bytes/s</span>
|
||||
<span class="muted">pro gefangener Verbindung, berechnet aus Pausen und Paketgrößen</span>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
<EditForm Model="_resetModel" FormName="hold-method-reset" OnSubmit="ResetAsync" action="/settings" class="danger-zone">
|
||||
<div class="actions">
|
||||
<button type="submit" class="secondary" disabled="@(!_hasOverrides)" onclick="return confirm('Haltemethode auf Standard zurücksetzen?')">Auf Standard zurücksetzen</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
</section>
|
||||
<footer class="s-foot">
|
||||
<EditForm Model="_resetModel" FormName="hold-method-reset" OnSubmit="ResetAsync" action="/settings#hold-method">
|
||||
<button type="submit" class="ghost" disabled="@(!_hasOverrides)" onclick="return confirm('Haltemethode auf Standard zurücksetzen?')">Auf Standard zurücksetzen</button>
|
||||
</EditForm>
|
||||
<button type="submit" form="hold-method-form">Speichern</button>
|
||||
</footer>
|
||||
</SettingsSection>
|
||||
|
||||
<script src="@Assets["settings.js"]" defer></script>
|
||||
|
||||
@code {
|
||||
private static readonly (string Value, string Title, string Text)[] Choices =
|
||||
[
|
||||
(nameof(DripContent.Html), "HTML-Fülltext", "Eine endlose Webseite mit Überschriften, Absätzen und Links. Wirkt auf Crawler am echtesten."),
|
||||
(nameof(DripContent.Text), "Zufallstext", "Schlichter Text ohne Markup, ausgeliefert als text/plain."),
|
||||
(nameof(DripContent.Alternating), "Wechselnd", "Pro Fang zufällig eine der beiden. Gut, um zu vergleichen, was Bots länger hält.")
|
||||
];
|
||||
|
||||
private readonly object _resetModel = new();
|
||||
private IReadOnlyDictionary<string, string> _errors = new Dictionary<string, string>();
|
||||
private bool _hasOverrides;
|
||||
|
||||
@@ -5,74 +5,76 @@
|
||||
@inject McpTokenStore Store
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<section class="card form" id="mcp">
|
||||
<h2>MCP-Zugriff</h2>
|
||||
<p class="muted">
|
||||
KI-Assistenten wie Claude lesen die Fänge über <code>@Endpoint</code> (nur lesend, nur im LAN).
|
||||
Jeder Zugriff braucht einen Token im Header <code>Authorization: Bearer …</code>.
|
||||
</p>
|
||||
|
||||
<SettingsSection Id="mcp" Title="MCP-Zugriff" Description="KI-Assistenten wie Claude lesen die Fänge über das Model Context Protocol. Nur lesend und nur im LAN.">
|
||||
@if (Revoked == "revoked")
|
||||
{
|
||||
<div class="banner ok">Token widerrufen.</div>
|
||||
<Notice>Token widerrufen.</Notice>
|
||||
}
|
||||
|
||||
@if (_newToken is not null)
|
||||
{
|
||||
<div class="banner ok">
|
||||
<strong>Token für „@_newTokenName“ erstellt.</strong> Jetzt kopieren, er wird nicht noch einmal angezeigt:
|
||||
<Notice>
|
||||
<strong>Token für „@_newTokenName“ erstellt.</strong> Jetzt kopieren, er wird nicht noch einmal angezeigt.
|
||||
<code class="token">@_newToken</code>
|
||||
</div>
|
||||
</Notice>
|
||||
}
|
||||
|
||||
@if (Tokens.UsesEnvironmentToken)
|
||||
{
|
||||
<p class="muted">Zusätzlich gilt ein fester Token aus der Umgebungsvariable <code>Flypaper__Mcp__Token</code>.</p>
|
||||
}
|
||||
<div class="s-body">
|
||||
<dl class="kv">
|
||||
<div><dt>Endpunkt</dt><dd class="mono">@Endpoint</dd></div>
|
||||
<div><dt>Header</dt><dd class="mono">Authorization: Bearer <Token></dd></div>
|
||||
@if (Tokens.UsesEnvironmentToken)
|
||||
{
|
||||
<div><dt>Fester Token</dt><dd>per Umgebungsvariable <code>Flypaper__Mcp__Token</code></dd></div>
|
||||
}
|
||||
</dl>
|
||||
|
||||
@if (_tokens.Count > 0)
|
||||
{
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Zuletzt genutzt</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var token in _tokens)
|
||||
{
|
||||
@if (_tokens.Count > 0)
|
||||
{
|
||||
<table class="s-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>@token.Name</td>
|
||||
<td class="nowrap">@token.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</td>
|
||||
<td class="nowrap">@(token.LastUsedAt?.ToLocalTime().ToString("dd.MM.yyyy HH:mm") ?? "nie")</td>
|
||||
<td class="num">
|
||||
<form method="post" action="/mcp-tokens/@token.Id/revoke" onsubmit="return confirm('Token „@token.Name“ widerrufen?')">
|
||||
<AntiforgeryToken />
|
||||
<button type="submit" class="secondary">Widerrufen</button>
|
||||
</form>
|
||||
</td>
|
||||
<th>Name</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Zuletzt genutzt</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="muted">Noch keine Tokens.</p>
|
||||
}
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var token in _tokens)
|
||||
{
|
||||
<tr>
|
||||
<td>@token.Name</td>
|
||||
<td class="nowrap">@token.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</td>
|
||||
<td class="nowrap">@(token.LastUsedAt?.ToLocalTime().ToString("dd.MM.yyyy HH:mm") ?? "nie")</td>
|
||||
<td class="num">
|
||||
<form method="post" action="/mcp-tokens/@token.Id/revoke" onsubmit="return confirm('Token „@token.Name“ widerrufen?')">
|
||||
<AntiforgeryToken />
|
||||
<button type="submit" class="ghost danger-text">Widerrufen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p class="empty">Noch keine Tokens.</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
<EditForm Model="Model" FormName="mcp-create" OnSubmit="CreateAsync" action="/settings" class="danger-zone">
|
||||
<label for="mcp-token-name">Neuer Token <span class="muted">(Name, z. B. Claude Desktop)</span></label>
|
||||
<InputText id="mcp-token-name" @bind-Value="Model!.Name" autocomplete="off" maxlength="100" />
|
||||
<FieldError Errors="_errors" Field="@nameof(McpTokenModel.Name)" />
|
||||
<div class="actions">
|
||||
<button type="submit">Token erzeugen</button>
|
||||
<EditForm Model="Model" FormName="mcp-create" OnSubmit="CreateAsync" action="/settings#mcp" class="s-foot">
|
||||
<div class="inline-field">
|
||||
<InputText id="mcp-token-name" @bind-Value="Model!.Name" autocomplete="off" maxlength="100" placeholder="Name, z. B. Claude Code" aria-label="Name des neuen Tokens" />
|
||||
@if (_errors.TryGetValue(nameof(McpTokenModel.Name), out var nameError))
|
||||
{
|
||||
<span class="field-error">@nameError</span>
|
||||
}
|
||||
</div>
|
||||
<button type="submit">Token erzeugen</button>
|
||||
</EditForm>
|
||||
</section>
|
||||
</SettingsSection>
|
||||
|
||||
@code {
|
||||
private IReadOnlyList<McpTokenEntity> _tokens = [];
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="notice @Kind" role="status">@ChildContent</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Kind { get; set; } = "ok";
|
||||
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
}
|
||||
@@ -2,38 +2,31 @@
|
||||
@inject AdminAuthenticator Admin
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<section class="card form">
|
||||
<h2>Admin-Passwort</h2>
|
||||
|
||||
<SettingsSection Id="password" Title="Admin-Passwort" Description="Das Passwort für dieses Dashboard. Gespeichert wird nur ein gesalzener Hash.">
|
||||
@if (Changed == "changed")
|
||||
{
|
||||
<div class="banner ok">Passwort geändert.</div>
|
||||
<Notice>Passwort geändert.</Notice>
|
||||
}
|
||||
|
||||
@if (Admin.UsesEnvironmentPassword)
|
||||
{
|
||||
<p class="muted">Das Passwort kommt aus der Umgebungsvariable <code>Flypaper__Admin__Password</code> und lässt sich nur dort ändern.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<EditForm Model="Model" FormName="password" OnSubmit="ChangeAsync" action="/settings" class="form">
|
||||
<label for="current-password">Aktuelles Passwort</label>
|
||||
<InputText id="current-password" type="password" autocomplete="current-password" @bind-Value="Model!.Current" />
|
||||
<FieldError Errors="_errors" Field="@nameof(PasswordModel.Current)" />
|
||||
|
||||
<label for="new-password">Neues Passwort <span class="muted">(mindestens @AdminAuthenticator.MinimumPasswordLength Zeichen)</span></label>
|
||||
<InputText id="new-password" type="password" autocomplete="new-password" @bind-Value="Model!.New" />
|
||||
|
||||
<label for="confirm-password">Neues Passwort wiederholen</label>
|
||||
<InputText id="confirm-password" type="password" autocomplete="new-password" @bind-Value="Model!.Confirmation" />
|
||||
<FieldError Errors="_errors" Field="@nameof(PasswordModel.New)" />
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit">Passwort ändern</button>
|
||||
<EditForm Model="Model" FormName="password" OnSubmit="ChangeAsync" action="/settings#password" id="password-form">
|
||||
<div class="s-body">
|
||||
<div class="fields">
|
||||
<SettingsField Label="Aktuelles Passwort" For="current-password" Errors="_errors" Key="@nameof(PasswordModel.Current)">
|
||||
<InputText id="current-password" type="password" autocomplete="current-password" @bind-Value="Model!.Current" />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Neues Passwort" For="new-password" Hint="@($"Mindestens {AdminAuthenticator.MinimumPasswordLength} Zeichen")" Errors="_errors" Key="@nameof(PasswordModel.New)">
|
||||
<InputText id="new-password" type="password" autocomplete="new-password" @bind-Value="Model!.New" />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Neues Passwort wiederholen" For="confirm-password">
|
||||
<InputText id="confirm-password" type="password" autocomplete="new-password" @bind-Value="Model!.Confirmation" />
|
||||
</SettingsField>
|
||||
</div>
|
||||
</EditForm>
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
</EditForm>
|
||||
<footer class="s-foot">
|
||||
<button type="submit" form="password-form">Passwort ändern</button>
|
||||
</footer>
|
||||
</SettingsSection>
|
||||
|
||||
@code {
|
||||
private readonly Dictionary<string, string> _errors = [];
|
||||
@@ -58,6 +51,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
Navigation.NavigateTo("/settings?password=changed");
|
||||
Navigation.NavigateTo("/settings?password=changed#password");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="field@(Wide ? " wide" : "")">
|
||||
<label for="@For">@Label</label>
|
||||
<div class="field-control@(Unit is null ? "" : " has-unit")">
|
||||
@ChildContent
|
||||
@if (Unit is not null)
|
||||
{
|
||||
<span class="field-unit">@Unit</span>
|
||||
}
|
||||
</div>
|
||||
@if (Errors is not null && Key is not null && Errors.TryGetValue(Key, out var error))
|
||||
{
|
||||
<p class="field-error">@error</p>
|
||||
}
|
||||
else if (Hint is not null)
|
||||
{
|
||||
<p class="field-hint">@Hint</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public required string Label { get; set; }
|
||||
|
||||
[Parameter, EditorRequired] public required string For { get; set; }
|
||||
|
||||
[Parameter] public string? Unit { get; set; }
|
||||
|
||||
[Parameter] public string? Hint { get; set; }
|
||||
|
||||
[Parameter] public IReadOnlyDictionary<string, string>? Errors { get; set; }
|
||||
|
||||
[Parameter] public string? Key { get; set; }
|
||||
|
||||
[Parameter] public bool Wide { get; set; }
|
||||
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
}
|
||||
@@ -18,87 +18,103 @@
|
||||
|
||||
<PageTitle>Flypaper · Einstellungen</PageTitle>
|
||||
|
||||
<header class="top">
|
||||
<h1>Einstellungen</h1>
|
||||
@if (_hasOverrides)
|
||||
{
|
||||
<span class="badge">Überschrieben</span>
|
||||
}
|
||||
</header>
|
||||
<div class="settings">
|
||||
<header class="settings-head">
|
||||
<h1>Einstellungen</h1>
|
||||
<p>Änderungen gelten sofort, ohne Neustart. Werte aus Umgebungsvariablen dienen als Standard.</p>
|
||||
</header>
|
||||
|
||||
@if (Saved == "1")
|
||||
{
|
||||
<div class="banner ok">Gespeichert. Die Änderungen gelten sofort.</div>
|
||||
}
|
||||
else if (Saved == "reset")
|
||||
{
|
||||
<div class="banner ok">Auf Standard zurückgesetzt.</div>
|
||||
}
|
||||
<div class="settings-layout">
|
||||
<nav class="settings-nav" aria-label="Abschnitte">
|
||||
<a href="settings#hold-method">Haltemethode</a>
|
||||
<a href="settings#connections">Verbindungen & Speicherung</a>
|
||||
<a href="settings#data">Daten</a>
|
||||
@if (!Admin.UsesEnvironmentPassword)
|
||||
{
|
||||
<a href="settings#password">Admin-Passwort</a>
|
||||
}
|
||||
<a href="settings#mcp">MCP-Zugriff</a>
|
||||
<a href="settings#system">System</a>
|
||||
</nav>
|
||||
|
||||
<HoldMethodSection />
|
||||
<div class="settings-sections">
|
||||
<HoldMethodSection />
|
||||
|
||||
<EditForm Model="Model" FormName="settings" OnSubmit="Save" action="/settings" class="card form">
|
||||
<h2>Allgemein</h2>
|
||||
<SettingsSection Id="connections" Title="Verbindungen & Speicherung" Description="Wie viele Bots gleichzeitig festgehalten werden und wie lange Fänge gespeichert bleiben." Badge="@(_generalOverrides ? "Angepasst" : null)">
|
||||
@if (Saved == "1")
|
||||
{
|
||||
<Notice>Gespeichert. Gilt ab sofort.</Notice>
|
||||
}
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<label for="max">Max. Verbindungen gesamt</label>
|
||||
<InputText id="max" @bind-Value="Model!.MaxConnections" class="mono" />
|
||||
<FieldError Errors="_errors" Field="@nameof(SettingsModel.MaxConnections)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="per-ip">Max. Verbindungen pro IP</label>
|
||||
<InputText id="per-ip" @bind-Value="Model!.MaxConnectionsPerIp" class="mono" />
|
||||
<FieldError Errors="_errors" Field="@nameof(SettingsModel.MaxConnectionsPerIp)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="retention">Fänge aufbewahren <span class="muted">(Tage, 0 = unbegrenzt)</span></label>
|
||||
<InputText id="retention" @bind-Value="Model!.RetentionDays" class="mono" />
|
||||
<FieldError Errors="_errors" Field="@nameof(SettingsModel.RetentionDays)" />
|
||||
<EditForm Model="Model" FormName="settings" OnSubmit="Save" action="/settings#connections" id="connections-form">
|
||||
<div class="s-body">
|
||||
<div class="fields">
|
||||
<SettingsField Label="Verbindungen gesamt" For="max" Hint="Höchstens so viele Bots gleichzeitig" Errors="_errors" Key="@nameof(SettingsModel.MaxConnections)">
|
||||
<InputText id="max" @bind-Value="Model!.MaxConnections" inputmode="numeric" />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Verbindungen pro IP" For="per-ip" Hint="Damit ein Scanner nicht alle Plätze belegt" Errors="_errors" Key="@nameof(SettingsModel.MaxConnectionsPerIp)">
|
||||
<InputText id="per-ip" @bind-Value="Model!.MaxConnectionsPerIp" inputmode="numeric" />
|
||||
</SettingsField>
|
||||
<SettingsField Label="Fänge aufbewahren" For="retention" Unit="Tage" Hint="0 = unbegrenzt" Errors="_errors" Key="@nameof(SettingsModel.RetentionDays)">
|
||||
<InputText id="retention" @bind-Value="Model!.RetentionDays" inputmode="numeric" />
|
||||
</SettingsField>
|
||||
</div>
|
||||
|
||||
<label class="switch-row">
|
||||
<InputCheckbox class="switch" @bind-Value="Model!.IgnorePrivateNetworks" />
|
||||
<span>
|
||||
<strong>Fänge aus privaten Netzen nicht speichern</strong>
|
||||
<span class="muted">Die Falle greift trotzdem. Praktisch, damit eigene Tests die Statistik nicht verfälschen.</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</EditForm>
|
||||
<footer class="s-foot">
|
||||
<button type="submit" form="connections-form">Speichern</button>
|
||||
</footer>
|
||||
</SettingsSection>
|
||||
|
||||
<TrapDataSection />
|
||||
|
||||
@if (!Admin.UsesEnvironmentPassword)
|
||||
{
|
||||
<PasswordSection />
|
||||
}
|
||||
|
||||
<McpSection />
|
||||
|
||||
<SettingsSection Id="system" Title="System" Description="Werte aus Umgebungsvariablen. Sie gelten ab Containerstart und lassen sich hier nicht ändern.">
|
||||
@if (Saved == "reset")
|
||||
{
|
||||
<Notice>Alle gespeicherten Einstellungen wurden zurückgesetzt.</Notice>
|
||||
}
|
||||
|
||||
<div class="s-body">
|
||||
<dl class="kv">
|
||||
<div><dt>Version</dt><dd class="mono">@AppVersion.Current</dd></div>
|
||||
<div><dt>Ports</dt><dd class="mono">Falle @Ports.Value.Trap · Dashboard @Ports.Value.Dashboard</dd></div>
|
||||
<div><dt>Datenbank</dt><dd class="mono">@DatabasePath</dd></div>
|
||||
<div><dt>Vertrauenswürdige Proxies</dt><dd class="mono">@TrustedProxies</dd></div>
|
||||
<div><dt>Admin-Passwort</dt><dd>@(Admin.UsesEnvironmentPassword ? "per Umgebungsvariable" : "im Dashboard festgelegt")</dd></div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<footer class="s-foot">
|
||||
<span class="s-foot-text">Alle im Dashboard gespeicherten Einstellungen löschen. Danach gelten wieder die Standardwerte.</span>
|
||||
<EditForm Model="_resetModel" FormName="reset" OnSubmit="Reset" action="/settings#system">
|
||||
<button type="submit" class="secondary" disabled="@(!_hasOverrides)" onclick="return confirm('Alle gespeicherten Einstellungen zurücksetzen?')">Alles zurücksetzen</button>
|
||||
</EditForm>
|
||||
</footer>
|
||||
</SettingsSection>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="check">
|
||||
<InputCheckbox @bind-Value="Model!.IgnorePrivateNetworks" />
|
||||
Fänge aus privaten Netzen nicht speichern <span class="muted">(die Falle greift trotzdem)</span>
|
||||
</label>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit">Speichern</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
<EditForm Model="_resetModel" FormName="reset" OnSubmit="Reset" action="/settings" class="card form">
|
||||
<h2>Standard</h2>
|
||||
<p class="muted">Löscht alle gespeicherten Änderungen. Danach gelten wieder die Werte aus Umgebungsvariablen und appsettings.</p>
|
||||
<div class="actions">
|
||||
<button type="submit" class="secondary" disabled="@(!_hasOverrides)" onclick="return confirm('Gespeicherte Einstellungen wirklich löschen?')">Auf Standard zurücksetzen</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
<TrapDataSection />
|
||||
|
||||
<PasswordSection />
|
||||
|
||||
<McpSection />
|
||||
|
||||
<section class="card">
|
||||
<h2>Nur per Umgebungsvariable</h2>
|
||||
<p class="muted">Gelten ab Containerstart und lassen sich hier nicht ändern.</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><th>Datenbank</th><td class="mono">@DatabasePath</td></tr>
|
||||
<tr><th>Vertrauenswürdige Proxies</th><td class="mono">@(Configuration.GetSection("Flypaper:Http:TrustedProxies").Get<string[]>()?.Where(p => !string.IsNullOrWhiteSpace(p)).ToArray() is { Length: > 0 } proxies ? string.Join(", ", proxies) : "private Netze (Standard)")</td></tr>
|
||||
<tr><th>Admin-Passwort</th><td>@(Admin.UsesEnvironmentPassword ? "per Umgebungsvariable" : "im Dashboard festgelegt")</td></tr>
|
||||
<tr><th>Ports</th><td class="mono">Falle @Ports.Value.Trap, Dashboard @Ports.Value.Dashboard</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private readonly object _resetModel = new();
|
||||
private IReadOnlyDictionary<string, string> _errors = new Dictionary<string, string>();
|
||||
private bool _hasOverrides;
|
||||
private bool _generalOverrides;
|
||||
|
||||
[SupplyParameterFromForm(FormName = "settings")] private SettingsModel? Model { get; set; }
|
||||
|
||||
@@ -111,6 +127,7 @@ else if (Saved == "reset")
|
||||
{
|
||||
Model ??= CurrentValues();
|
||||
_hasOverrides = await Store.HasOverridesAsync();
|
||||
_generalOverrides = await Store.HasOverridesAsync(SettingKeys.General.ToArray());
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
@@ -128,13 +145,13 @@ else if (Saved == "reset")
|
||||
}
|
||||
|
||||
await Store.SaveAsync(result.Settings);
|
||||
Navigation.NavigateTo("/settings?saved=1");
|
||||
Navigation.NavigateTo("/settings?saved=1#connections");
|
||||
}
|
||||
|
||||
private async Task Reset()
|
||||
{
|
||||
await Store.ResetAsync();
|
||||
Navigation.NavigateTo("/settings?saved=reset");
|
||||
Navigation.NavigateTo("/settings?saved=reset#system");
|
||||
}
|
||||
|
||||
private SettingsModel CurrentValues()
|
||||
@@ -149,5 +166,8 @@ else if (Saved == "reset")
|
||||
};
|
||||
}
|
||||
|
||||
private static string Format(string[]? values) => values is { Length: > 0 } ? string.Join(", ", values) : "–";
|
||||
private string TrustedProxies =>
|
||||
Configuration.GetSection("Flypaper:Http:TrustedProxies").Get<string[]>()?.Where(p => !string.IsNullOrWhiteSpace(p)).ToArray() is { Length: > 0 } proxies
|
||||
? string.Join(", ", proxies)
|
||||
: "private Netze (Standard)";
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<section class="s-section@(Danger ? " danger" : "")" id="@Id">
|
||||
<header class="s-head">
|
||||
<h2>
|
||||
@Title
|
||||
@if (Badge is not null)
|
||||
{
|
||||
<span class="s-badge">@Badge</span>
|
||||
}
|
||||
</h2>
|
||||
@if (Description is not null)
|
||||
{
|
||||
<p>@Description</p>
|
||||
}
|
||||
</header>
|
||||
@ChildContent
|
||||
</section>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public required string Id { get; set; }
|
||||
|
||||
[Parameter, EditorRequired] public required string Title { get; set; }
|
||||
|
||||
[Parameter] public string? Description { get; set; }
|
||||
|
||||
[Parameter] public string? Badge { get; set; }
|
||||
|
||||
[Parameter] public bool Danger { get; set; }
|
||||
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
}
|
||||
@@ -2,46 +2,57 @@
|
||||
@inject TrapDataMaintenance Maintenance
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<section class="card form">
|
||||
<h2>Daten</h2>
|
||||
|
||||
<SettingsSection Id="data" Title="Daten" Description="Gespeicherte Fänge. Einstellungen und GeoIP-Dateien bleiben beim Löschen erhalten.">
|
||||
@if (Deleted is { } deleted)
|
||||
{
|
||||
<div class="banner ok">@deleted.ToString("N0") @(deleted == 1 ? "Fang" : "Fänge") gelöscht.</div>
|
||||
<Notice>@deleted.ToString("N0") @(deleted == 1 ? "Fang" : "Fänge") gelöscht.</Notice>
|
||||
}
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><th>Fänge</th><td>@_stats?.Count.ToString("N0")</td></tr>
|
||||
<tr><th>Ältester Fang</th><td>@(_stats?.Oldest?.ToLocalTime().ToString("dd.MM.yyyy HH:mm") ?? "–")</td></tr>
|
||||
<tr><th>Größe der Datenbank</th><td>@Formatting.Bytes(_stats?.DatabaseBytes)</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="muted">Einstellungen und GeoIP-Dateien bleiben beim Löschen erhalten.</p>
|
||||
|
||||
<EditForm Model="DeletePrivate" FormName="delete-private" OnSubmit="DeletePrivateAsync" action="/settings" class="danger-zone">
|
||||
<h3>Fänge aus privaten Netzen löschen</h3>
|
||||
<p class="muted">Loopback, 10/8, 172.16/12, 192.168/16, Link-Local und ULA, zum Beispiel lokale Testaufrufe.</p>
|
||||
<label class="check">
|
||||
<InputCheckbox @bind-Value="DeletePrivate!.Confirmed" />
|
||||
Ich bin sicher
|
||||
</label>
|
||||
<FieldError Errors="_errors" Field="@nameof(DeletePrivateModel.Confirmed)" />
|
||||
<div class="actions">
|
||||
<button type="submit" class="secondary">Private Fänge löschen</button>
|
||||
<div class="s-body">
|
||||
<div class="stat-row">
|
||||
<div class="stat"><span class="stat-label">Fänge</span><span class="stat-value">@(_stats?.Count.ToString("N0") ?? "–")</span></div>
|
||||
<div class="stat"><span class="stat-label">Ältester Fang</span><span class="stat-value">@(_stats?.Oldest?.ToLocalTime().ToString("dd.MM.yyyy") ?? "–")</span></div>
|
||||
<div class="stat"><span class="stat-label">Datenbank</span><span class="stat-value">@Formatting.Bytes(_stats?.DatabaseBytes)</span></div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
|
||||
<EditForm Model="DeleteAll" FormName="delete-all" OnSubmit="DeleteAllAsync" action="/settings" class="danger-zone">
|
||||
<h3>Alle Fänge löschen</h3>
|
||||
<label for="delete-all-confirmation">Zum Bestätigen <strong>LÖSCHEN</strong> eingeben</label>
|
||||
<InputText id="delete-all-confirmation" @bind-Value="DeleteAll!.Confirmation" autocomplete="off" />
|
||||
<FieldError Errors="_errors" Field="@nameof(DeleteAllModel.Confirmation)" />
|
||||
<div class="actions">
|
||||
<button type="submit" class="danger">Alle Fänge löschen</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
</section>
|
||||
<div class="danger-box">
|
||||
<h3>Gefahrenzone</h3>
|
||||
|
||||
<EditForm Model="DeletePrivate" FormName="delete-private" OnSubmit="DeletePrivateAsync" action="/settings#data" class="action-row">
|
||||
<div class="action-text">
|
||||
<strong>Fänge aus privaten Netzen löschen</strong>
|
||||
<span class="muted">Loopback, 10/8, 172.16/12, 192.168/16, Link-Local und ULA, etwa eigene Testaufrufe.</span>
|
||||
@if (_errors.TryGetValue(nameof(DeletePrivateModel.Confirmed), out var privateError))
|
||||
{
|
||||
<span class="field-error">@privateError</span>
|
||||
}
|
||||
</div>
|
||||
<div class="action-controls">
|
||||
<label class="inline-check">
|
||||
<InputCheckbox @bind-Value="DeletePrivate!.Confirmed" />
|
||||
Ich bin sicher
|
||||
</label>
|
||||
<button type="submit" class="secondary">Private löschen</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
<EditForm Model="DeleteAll" FormName="delete-all" OnSubmit="DeleteAllAsync" action="/settings#data" class="action-row">
|
||||
<div class="action-text">
|
||||
<strong>Alle Fänge löschen</strong>
|
||||
<span class="muted">Zum Bestätigen <strong>LÖSCHEN</strong> eingeben. Lässt sich nicht rückgängig machen.</span>
|
||||
@if (_errors.TryGetValue(nameof(DeleteAllModel.Confirmation), out var allError))
|
||||
{
|
||||
<span class="field-error">@allError</span>
|
||||
}
|
||||
</div>
|
||||
<div class="action-controls">
|
||||
<InputText id="delete-all-confirmation" @bind-Value="DeleteAll!.Confirmation" autocomplete="off" placeholder="LÖSCHEN" aria-label="Bestätigung" />
|
||||
<button type="submit" class="danger">Alle löschen</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</SettingsSection>
|
||||
|
||||
@code {
|
||||
private const string ConfirmationWord = "LÖSCHEN";
|
||||
@@ -91,6 +102,6 @@
|
||||
await Maintenance.VacuumAsync();
|
||||
}
|
||||
|
||||
Navigation.NavigateTo($"/settings?deleted={deleted}");
|
||||
Navigation.NavigateTo($"/settings?deleted={deleted}#data");
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public static class McpExtensions
|
||||
}
|
||||
|
||||
await store.RevokeAsync(id, context.RequestAborted);
|
||||
return Results.LocalRedirect("/settings?mcp=revoked");
|
||||
return Results.LocalRedirect("/settings?mcp=revoked#mcp");
|
||||
});
|
||||
|
||||
return app;
|
||||
|
||||
@@ -382,7 +382,7 @@ tr.open .clip {
|
||||
gap: 0 16px;
|
||||
}
|
||||
|
||||
input,
|
||||
input:not([type="radio"], [type="checkbox"]),
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
@@ -393,12 +393,18 @@ textarea {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
input:not([type="radio"], [type="checkbox"]):focus,
|
||||
textarea:focus {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
input[type="radio"]:focus-visible,
|
||||
input[type="checkbox"]:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
@@ -586,36 +592,6 @@ tr.open .detail {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.check input {
|
||||
width: auto;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
.danger-zone {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.danger-zone h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.danger-zone p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
button.danger {
|
||||
background: var(--bad);
|
||||
}
|
||||
@@ -626,6 +602,478 @@ button.danger {
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.settings-head {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.settings-head h1 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.settings-head p {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.settings-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 200px minmax(0, 1fr);
|
||||
gap: 32px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.settings-nav {
|
||||
position: sticky;
|
||||
top: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.settings-nav a {
|
||||
padding: 7px 12px;
|
||||
border-radius: 6px;
|
||||
color: var(--muted);
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.settings-nav a:hover,
|
||||
.settings-nav a.active {
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.settings-nav a.active {
|
||||
box-shadow: inset 2px 0 0 var(--accent);
|
||||
}
|
||||
|
||||
.settings-sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.s-section {
|
||||
scroll-margin-top: 24px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.s-head {
|
||||
padding: 20px 24px 0;
|
||||
}
|
||||
|
||||
.s-head h2 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.s-head p {
|
||||
max-width: 60ch;
|
||||
margin: 6px 0 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.s-badge {
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--accent);
|
||||
border-radius: 999px;
|
||||
color: var(--accent);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.s-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
padding: 20px 24px 24px;
|
||||
}
|
||||
|
||||
.s-foot {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
padding: 14px 24px;
|
||||
border-top: 1px solid var(--border);
|
||||
background: color-mix(in srgb, var(--bg) 45%, var(--surface));
|
||||
border-radius: 0 0 10px 10px;
|
||||
}
|
||||
|
||||
.s-foot > form:first-child:not(:only-child) {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.s-foot-text {
|
||||
margin-right: auto;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.s-section > .notice {
|
||||
margin: 16px 24px 0;
|
||||
}
|
||||
|
||||
.notice {
|
||||
padding: 10px 14px;
|
||||
border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--border));
|
||||
border-left: 3px solid var(--ok);
|
||||
border-radius: 6px;
|
||||
background: color-mix(in srgb, var(--ok) 8%, var(--surface));
|
||||
}
|
||||
|
||||
.notice.bad {
|
||||
border-color: color-mix(in srgb, var(--bad) 45%, var(--border));
|
||||
border-left-color: var(--bad);
|
||||
background: color-mix(in srgb, var(--bad) 8%, var(--surface));
|
||||
}
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
||||
gap: 18px 20px;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field label,
|
||||
.choices legend {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.field-control {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.field-control.has-unit input {
|
||||
padding-right: 52px;
|
||||
}
|
||||
|
||||
.field-unit {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 12px;
|
||||
transform: translateY(-50%);
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.field-hint,
|
||||
.field-error {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.field-hint {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.field-error {
|
||||
color: var(--bad);
|
||||
}
|
||||
|
||||
.field:has(.field-error) input {
|
||||
border-color: var(--bad);
|
||||
}
|
||||
|
||||
.settings input {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.choices {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.choices legend {
|
||||
margin-bottom: 8px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.choice-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.choice {
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.choice:hover {
|
||||
border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
|
||||
}
|
||||
|
||||
.choice:has(input:checked) {
|
||||
border-color: var(--accent);
|
||||
background: color-mix(in srgb, var(--accent) 8%, var(--bg));
|
||||
}
|
||||
|
||||
.choice input {
|
||||
flex: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 2px 0 0;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
.choice-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.choice-body span {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.estimate {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 6px 12px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.estimate-value {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.estimate-value strong {
|
||||
color: var(--accent);
|
||||
font-size: 20px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.switch-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch-row > span {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.switch-row .muted {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input.switch {
|
||||
flex: none;
|
||||
position: relative;
|
||||
width: 38px;
|
||||
height: 22px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
background: var(--bg);
|
||||
appearance: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
input.switch::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
background: var(--muted);
|
||||
transition: transform 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
input.switch:checked {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
input.switch:checked::after {
|
||||
background: #fff;
|
||||
transform: translateX(16px);
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.danger-box {
|
||||
margin: 0 24px 24px;
|
||||
border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--border));
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.danger-box h3 {
|
||||
margin: 0;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--bad) 25%, var(--border));
|
||||
color: var(--bad);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px 20px;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.action-row + .action-row {
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.action-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
flex: 1 1 280px;
|
||||
}
|
||||
|
||||
.action-text .muted {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.action-controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.action-controls input[type="text"],
|
||||
.action-controls input:not([type]) {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.inline-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inline-check input {
|
||||
width: auto;
|
||||
accent-color: var(--bad);
|
||||
}
|
||||
|
||||
.inline-field {
|
||||
display: flex;
|
||||
flex: 1 1 240px;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.kv {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.kv > div {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
padding: 9px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.kv > div:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.kv dt {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.kv dd {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.s-table th {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin: 0;
|
||||
padding: 14px;
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 8px;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.token {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
@@ -637,22 +1085,68 @@ button.danger {
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
button.ghost {
|
||||
padding: 8px 12px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.section-head h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--bg);
|
||||
button.ghost:hover:not(:disabled) {
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button.danger-text {
|
||||
color: var(--bad);
|
||||
}
|
||||
|
||||
@media (max-width: 899px) {
|
||||
.settings-layout {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.settings-nav {
|
||||
position: static;
|
||||
flex-direction: row;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.settings-nav a {
|
||||
flex: none;
|
||||
border: 1px solid var(--border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.settings-nav a.active {
|
||||
border-color: var(--accent);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.s-head,
|
||||
.s-body {
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
.s-foot {
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
.s-section > .notice {
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.danger-box {
|
||||
margin-left: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.kv > div {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 2px;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,47 @@
|
||||
(() => {
|
||||
const links = new Map([...document.querySelectorAll(".settings-nav a")].map(link => [link.hash.slice(1), link]));
|
||||
if (links.size === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastId = [...links.keys()].at(-1);
|
||||
const atBottom = () => window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 4;
|
||||
const activate = id => {
|
||||
links.forEach(link => link.classList.toggle("active", link === links.get(id)));
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
if (atBottom()) {
|
||||
activate(lastId);
|
||||
return;
|
||||
}
|
||||
|
||||
const visible = entries.find(entry => entry.isIntersecting);
|
||||
if (visible) {
|
||||
activate(visible.target.id);
|
||||
}
|
||||
}, { rootMargin: "-20% 0px -70% 0px" });
|
||||
|
||||
links.forEach((link, id) => {
|
||||
const section = document.getElementById(id);
|
||||
if (section) {
|
||||
observer.observe(section);
|
||||
}
|
||||
|
||||
link.addEventListener("click", () => activate(id));
|
||||
});
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
if (atBottom()) {
|
||||
activate(lastId);
|
||||
}
|
||||
}, { passive: true });
|
||||
|
||||
if (location.hash && links.has(location.hash.slice(1))) {
|
||||
activate(location.hash.slice(1));
|
||||
}
|
||||
})();
|
||||
|
||||
(() => {
|
||||
const value = id => Number.parseInt(document.getElementById(id)?.value ?? "", 10);
|
||||
const output = document.getElementById("drip-bandwidth");
|
||||
|
||||
Reference in new issue
Block a user