Add data management, randomized HTML drip and public README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3671019e60
commit
f5d8ca7484
46 files changed
+1601
-172
No files matched your search
@@ -1,16 +1,16 @@
|
||||
@page "/settings"
|
||||
@using Flypaper.Core
|
||||
@using Flypaper.Core.Settings
|
||||
@using Flypaper.Core.Strategies
|
||||
@using Flypaper.Http
|
||||
@using Flypaper.Storage.Maintenance
|
||||
@using Flypaper.Storage.Settings
|
||||
@using Flypaper.Web.Auth
|
||||
@using System.Globalization
|
||||
@using Microsoft.Data.Sqlite
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject IOptionsMonitor<FlypaperOptions> Core
|
||||
@inject IOptionsMonitor<DripOptions> Drip
|
||||
@inject IOptionsMonitor<HttpTrapOptions> Http
|
||||
@inject IOptionsMonitor<RetentionOptions> Retention
|
||||
@inject IConfiguration Configuration
|
||||
@inject RuntimeSettingsStore Store
|
||||
@inject AdminAuthenticator Admin
|
||||
@@ -35,7 +35,7 @@ else if (Saved == "reset")
|
||||
<div class="banner ok">Auf Standard zurückgesetzt.</div>
|
||||
}
|
||||
|
||||
<EditForm Model="Model" FormName="settings" OnSubmit="Save" class="card form">
|
||||
<EditForm Model="Model" FormName="settings" OnSubmit="Save" action="/settings" class="card form">
|
||||
<h2>Anpassbar</h2>
|
||||
|
||||
<label for="trap-paths">Fallenpfade <span class="muted">(einer pro Zeile, mit / am Anfang, * am Ende als Präfix)</span></label>
|
||||
@@ -47,11 +47,6 @@ else if (Saved == "reset")
|
||||
<FieldError Errors="_errors" Field="@nameof(SettingsModel.ExtraKnownHosts)" />
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<label for="drip">Tröpfel-Intervall <span class="muted">(hh:mm:ss)</span></label>
|
||||
<InputText id="drip" @bind-Value="Model!.DripInterval" class="mono" />
|
||||
<FieldError Errors="_errors" Field="@nameof(SettingsModel.DripInterval)" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="hold">Maximale Haltedauer <span class="muted">(hh:mm:ss)</span></label>
|
||||
<InputText id="hold" @bind-Value="Model!.MaxHoldDuration" class="mono" />
|
||||
@@ -67,14 +62,24 @@ else if (Saved == "reset")
|
||||
<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)" />
|
||||
</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" class="card form">
|
||||
<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">
|
||||
@@ -82,6 +87,8 @@ else if (Saved == "reset")
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
<TrapDataSection />
|
||||
|
||||
<section class="card">
|
||||
<h2>Nur per Umgebungsvariable</h2>
|
||||
<p class="muted">Gelten ab Containerstart und lassen sich hier nicht ändern.</p>
|
||||
@@ -117,11 +124,12 @@ else if (Saved == "reset")
|
||||
{
|
||||
var result = RuntimeSettingsParser.Parse(new RuntimeSettingsInput(
|
||||
Model!.TrapPaths,
|
||||
Model.DripInterval,
|
||||
Model.MaxConnections,
|
||||
Model.MaxConnectionsPerIp,
|
||||
Model.MaxHoldDuration,
|
||||
Model.ExtraKnownHosts));
|
||||
Model.ExtraKnownHosts,
|
||||
Model.RetentionDays,
|
||||
Model.IgnorePrivateNetworks));
|
||||
|
||||
if (result.Settings is null)
|
||||
{
|
||||
@@ -147,10 +155,11 @@ else if (Saved == "reset")
|
||||
{
|
||||
TrapPaths = SettingsList.Join(http.TrapPaths),
|
||||
ExtraKnownHosts = SettingsList.Join(SettingsList.Split(http.ExtraKnownHosts)),
|
||||
DripInterval = Drip.CurrentValue.Interval.ToString("c", CultureInfo.InvariantCulture),
|
||||
MaxHoldDuration = core.MaxHoldDuration.ToString("c", CultureInfo.InvariantCulture),
|
||||
MaxConnections = core.MaxConnections.ToString(CultureInfo.InvariantCulture),
|
||||
MaxConnectionsPerIp = core.MaxConnectionsPerIp.ToString(CultureInfo.InvariantCulture)
|
||||
MaxConnectionsPerIp = core.MaxConnectionsPerIp.ToString(CultureInfo.InvariantCulture),
|
||||
RetentionDays = Retention.CurrentValue.Days.ToString(CultureInfo.InvariantCulture),
|
||||
IgnorePrivateNetworks = core.IgnorePrivateNetworks
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user