Remove the research page, its MCP write tools and token write permission
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f8a3ae882
commit
119dafa505
30 files changed
+264
-1310
No files matched your search
@@ -4,7 +4,6 @@
|
||||
<nav class="nav">
|
||||
<a href="/" class="brand"><span class="brand-mark" aria-hidden="true"></span>Flypaper</a>
|
||||
<NavLink href="/" Match="NavLinkMatch.All">Dashboard</NavLink>
|
||||
<NavLink href="/erkenntnisse">Erkenntnisse</NavLink>
|
||||
<NavLink href="/settings">Einstellungen</NavLink>
|
||||
<form method="post" action="/auth/logout" class="logout">
|
||||
<AntiforgeryToken />
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
@using Flypaper.Storage.Entities
|
||||
|
||||
<div class="table-scroll">
|
||||
<table class="idea-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Idee</th>
|
||||
<th>Aufwand</th>
|
||||
<th>Effizienz</th>
|
||||
<th>Status</th>
|
||||
<th>Umgesetzt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var idea in Ideas)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<strong>@idea.Title</strong>
|
||||
<div class="markdown muted">@MarkdownRenderer.Render(idea.Rationale)</div>
|
||||
</td>
|
||||
<td class="nowrap">@Level(idea.Effort)</td>
|
||||
<td class="nowrap">@Level(idea.Efficiency)</td>
|
||||
<td class="nowrap"><span class="badge status-@idea.Status.ToString().ToLowerInvariant()">@StatusLabel(idea.Status)</span></td>
|
||||
<td class="nowrap">
|
||||
@if (idea.ImplementedOn is { } date)
|
||||
{
|
||||
@date.ToString("dd.MM.yyyy")
|
||||
}
|
||||
@if (idea.Commit is { } commit)
|
||||
{
|
||||
<code title="@commit">@(commit.Length > 8 ? commit[..8] : commit)</code>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public required IReadOnlyList<IdeaEntity> Ideas { get; set; }
|
||||
|
||||
private static string Level(IdeaLevel level) => level switch
|
||||
{
|
||||
IdeaLevel.Low => "Gering",
|
||||
IdeaLevel.Medium => "Mittel",
|
||||
_ => "Hoch"
|
||||
};
|
||||
|
||||
private static string StatusLabel(IdeaStatus status) => status switch
|
||||
{
|
||||
IdeaStatus.Open => "Offen",
|
||||
IdeaStatus.InProgress => "In Arbeit",
|
||||
IdeaStatus.Done => "Umgesetzt",
|
||||
_ => "Verworfen"
|
||||
};
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
@page "/erkenntnisse"
|
||||
@using Flypaper.Storage.Entities
|
||||
@using Flypaper.Storage.Research
|
||||
@inject ResearchStore Store
|
||||
|
||||
<PageTitle>Flypaper · Erkenntnisse</PageTitle>
|
||||
|
||||
<header class="page-head">
|
||||
<h1>Erkenntnisse</h1>
|
||||
<p>Laborbuch und Ideen zur Optimierung der Falle. Einträge werden per MCP fortgeschrieben.</p>
|
||||
</header>
|
||||
|
||||
<section class="card" id="laborbuch">
|
||||
<div class="card-head">
|
||||
<h2>Laborbuch</h2>
|
||||
<span class="hint">@_entries.Count @(_entries.Count == 1 ? "Eintrag" : "Einträge")</span>
|
||||
</div>
|
||||
|
||||
<nav class="chips" aria-label="Art filtern">
|
||||
<a class="chip @(_kind is null ? "active" : null)" href="erkenntnisse@(Query(null, ShowClosed))#laborbuch">Alle</a>
|
||||
@foreach (var kind in Enum.GetValues<LabEntryKind>())
|
||||
{
|
||||
<a class="chip @(_kind == kind ? "active" : null)" href="erkenntnisse@(Query(kind, ShowClosed))#laborbuch">@KindLabel(kind)</a>
|
||||
}
|
||||
</nav>
|
||||
|
||||
@if (_entries.Count == 0)
|
||||
{
|
||||
<p class="empty">Noch keine Einträge.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="lab-entries">
|
||||
@foreach (var entry in _entries)
|
||||
{
|
||||
<article class="lab-entry">
|
||||
<header>
|
||||
<time class="mono" datetime="@entry.Date.ToString("yyyy-MM-dd")">@entry.Date.ToString("dd.MM.yyyy")</time>
|
||||
<span class="badge kind-@entry.Kind.ToString().ToLowerInvariant()">@KindLabel(entry.Kind)</span>
|
||||
<h3>@entry.Title</h3>
|
||||
</header>
|
||||
@if (entry.StrategyList.Count > 0 || entry.Commit is not null)
|
||||
{
|
||||
<p class="lab-meta">
|
||||
@foreach (var strategy in entry.StrategyList)
|
||||
{
|
||||
<code title="@StrategyNames.Describe(strategy).Tooltip">@StrategyNames.Display(strategy)</code>
|
||||
}
|
||||
@if (entry.Commit is { } commit)
|
||||
{
|
||||
<span class="muted">Commit</span>
|
||||
<code title="@commit">@Short(commit)</code>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<div class="markdown">@MarkdownRenderer.Render(entry.Text)</div>
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
|
||||
<section class="card" id="ideen">
|
||||
<div class="card-head">
|
||||
<h2>Ideen</h2>
|
||||
<span class="hint">nach Aufwand sortiert</span>
|
||||
</div>
|
||||
|
||||
@if (_open.Count == 0)
|
||||
{
|
||||
<p class="empty">Keine offenen Ideen.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<IdeaTable Ideas="_open" />
|
||||
}
|
||||
|
||||
@if (_closed.Count > 0)
|
||||
{
|
||||
<p class="more">
|
||||
<a href="erkenntnisse@(Query(_kind, !ShowClosed))#ideen">
|
||||
@(ShowClosed ? "Umgesetzte und verworfene ausblenden" : $"{_closed.Count} umgesetzte oder verworfene anzeigen")
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@if (ShowClosed)
|
||||
{
|
||||
<IdeaTable Ideas="_closed" />
|
||||
}
|
||||
}
|
||||
</section>
|
||||
|
||||
@code {
|
||||
private IReadOnlyList<LabEntryEntity> _entries = [];
|
||||
private IReadOnlyList<IdeaEntity> _open = [];
|
||||
private IReadOnlyList<IdeaEntity> _closed = [];
|
||||
private LabEntryKind? _kind;
|
||||
|
||||
[SupplyParameterFromQuery(Name = "art")] private string? Art { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery(Name = "erledigt")] private string? Closed { get; set; }
|
||||
|
||||
private bool ShowClosed => Closed == "1";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_kind = Enum.TryParse<LabEntryKind>(Art, ignoreCase: true, out var kind) && Enum.IsDefined(kind) ? kind : null;
|
||||
_entries = await Store.ListEntriesAsync(_kind);
|
||||
var ideas = await Store.ListIdeasAsync();
|
||||
_open = ideas.Where(idea => !idea.IsClosed).ToList();
|
||||
_closed = ideas.Where(idea => idea.IsClosed).ToList();
|
||||
}
|
||||
|
||||
private static string Query(LabEntryKind? kind, bool showClosed)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
if (kind is { } value)
|
||||
{
|
||||
parts.Add("art=" + value.ToString().ToLowerInvariant());
|
||||
}
|
||||
|
||||
if (showClosed)
|
||||
{
|
||||
parts.Add("erledigt=1");
|
||||
}
|
||||
|
||||
return parts.Count == 0 ? "" : "?" + string.Join('&', parts);
|
||||
}
|
||||
|
||||
private static string Short(string commit) => commit.Length > 8 ? commit[..8] : commit;
|
||||
|
||||
internal static string KindLabel(LabEntryKind kind) => kind switch
|
||||
{
|
||||
LabEntryKind.Experiment => "Experiment",
|
||||
LabEntryKind.Observation => "Beobachtung",
|
||||
LabEntryKind.Hypothesis => "Hypothese",
|
||||
_ => "Messmethode"
|
||||
};
|
||||
}
|
||||
@@ -5,19 +5,11 @@
|
||||
@inject McpTokenStore Store
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<SettingsSection Id="mcp" Title="MCP-Zugriff" Description="KI-Assistenten wie Claude lesen die Fänge über das Model Context Protocol und führen die Erkenntnisse fort. Schreiben dürfen nur Tokens mit Schreibrecht. Nur im LAN.">
|
||||
<SettingsSection Id="mcp" Title="MCP-Zugriff" Description="KI-Assistenten wie Claude lesen die Fänge über das Model Context Protocol Nur im LAN.">
|
||||
@if (Revoked == "revoked")
|
||||
{
|
||||
<Notice>Token widerrufen.</Notice>
|
||||
}
|
||||
else if (Revoked == "write-on")
|
||||
{
|
||||
<Notice>Schreibrecht erteilt.</Notice>
|
||||
}
|
||||
else if (Revoked == "write-off")
|
||||
{
|
||||
<Notice>Schreibrecht entzogen.</Notice>
|
||||
}
|
||||
|
||||
@if (_newToken is not null)
|
||||
{
|
||||
@@ -45,7 +37,6 @@
|
||||
<th>Name</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Zuletzt genutzt</th>
|
||||
<th>Zugriff</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -56,14 +47,6 @@
|
||||
<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="nowrap">
|
||||
<form method="post" action="/mcp-tokens/@token.Id/write" class="inline-form">
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="enabled" value="@(token.CanWrite ? "false" : "true")" />
|
||||
<span>@(token.CanWrite ? "Lesen und schreiben" : "Nur lesen")</span>
|
||||
<button type="submit" class="ghost">@(token.CanWrite ? "Schreibrecht entziehen" : "Schreibrecht erteilen")</button>
|
||||
</form>
|
||||
</td>
|
||||
<td class="num">
|
||||
<form method="post" action="/mcp-tokens/@token.Id/revoke" onsubmit="return confirm('Token „@token.Name“ widerrufen?')">
|
||||
<AntiforgeryToken />
|
||||
@@ -89,10 +72,6 @@
|
||||
<span class="field-error">@nameError</span>
|
||||
}
|
||||
</div>
|
||||
<label class="inline-check">
|
||||
<InputCheckbox @bind-Value="Model!.CanWrite" />
|
||||
<span>Mit Schreibrecht</span>
|
||||
</label>
|
||||
<button type="submit">Token erzeugen</button>
|
||||
</EditForm>
|
||||
</SettingsSection>
|
||||
@@ -124,10 +103,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
_newToken = await Tokens.CreateAsync(name, Model.CanWrite);
|
||||
_newToken = await Tokens.CreateAsync(name);
|
||||
_newTokenName = name;
|
||||
Model.Name = null;
|
||||
Model.CanWrite = false;
|
||||
_tokens = await Store.ListAsync();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,4 @@ namespace Flypaper.Web.Components.Pages.Settings;
|
||||
public sealed class McpTokenModel
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public bool CanWrite { get; set; }
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Markdig.Syntax.Inlines;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Flypaper.Web.Components.Shared;
|
||||
|
||||
public static class MarkdownRenderer
|
||||
{
|
||||
private static readonly string[] SafeSchemes = ["http", "https", "mailto"];
|
||||
|
||||
private static readonly MarkdownPipeline Pipeline = new MarkdownPipelineBuilder()
|
||||
.DisableHtml()
|
||||
.UseAutoLinks()
|
||||
.UsePipeTables()
|
||||
.UseEmphasisExtras()
|
||||
.Build();
|
||||
|
||||
public static MarkupString Render(string? markdown)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(markdown))
|
||||
{
|
||||
return new MarkupString("");
|
||||
}
|
||||
|
||||
var document = Markdown.Parse(markdown, Pipeline);
|
||||
foreach (var link in document.Descendants<LinkInline>().Where(link => !IsSafe(link.Url)).ToList())
|
||||
{
|
||||
link.Url = "#";
|
||||
}
|
||||
|
||||
foreach (var link in document.Descendants<AutolinkInline>().Where(link => !IsSafe(link.Url)).ToList())
|
||||
{
|
||||
link.Url = "#";
|
||||
}
|
||||
|
||||
return new MarkupString(document.ToHtml(Pipeline));
|
||||
}
|
||||
|
||||
private static bool IsSafe(string? url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var trimmed = url.Trim();
|
||||
var colon = trimmed.IndexOf(':');
|
||||
var firstSeparator = trimmed.IndexOfAny(['/', '?', '#']);
|
||||
if (colon < 0 || firstSeparator >= 0 && firstSeparator < colon)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return SafeSchemes.Contains(trimmed[..colon], StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user