R1 cleanup: collAnon and dead code gone, no IndexedDB, honest PWA files
Build / Build (push) Successful in 51s
Build / Build (push) Successful in 51s
Starts the completion program (SocialPub docs/ROADMAP.md, "Owner decisions on finishing everything", 2026-10-17). - The localizer's namespace is decePubClient.Services; collAnon is gone from the repo. - Dead code: PagesBase, VConstants, SettingsOptions, ViewLanguage, unused APIs routes, InstanceService.Self, RequestStats.LastOf/AverageMs, PostAnon/DeleteTotallyAnon, unused AppStatusService methods and their main.js helpers (the app badge stays for Web Push), ExtensionMethods/SUtility leftovers (Markdig and BlazorZXingJs packages go), unused PublicCacheData/PageSettings/AppConfiguration fields, commented-out code. - The client log in IndexedDB, which nothing ever read, goes with the whole IndexedDB layer (DnetIndexedDb, IStorage): logs go to the browser console; main.js deletes the old "data" database once. - The solution names the real ClientModels project. Unused vendor assets (fontawesome, solid, open-iconic, rxjs) go. - robots.txt disallows everything; manifest.json and index.html say decePub; the service worker's cache name follows each publish's assets version, so old caches are purged. - MessageType is Visibility (member names kept: they are resx keys); ExpandMessage.razor is Thread.razor (same route). - i18n: dead keys removed, Italian "camera" is "punto di vista", DInputBase/DCalendar validation messages come from ErrorMessages, DataTransfer's spinner has its label. - CLAUDE.md follows: client storage, JS interop, PWA, the D fields' messages. Verified: dotnet build decePubClient.csproj and decePubClient.sln -c Release (0 errors, no new warnings); a Pasture publish served by the pasture's decepub peer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
1 parent
e4414f1ac9
commit
fd2f2e7c65
79 files changed
+155
-6673
No files matched your search
@@ -1,22 +1,15 @@
|
||||
using Blazored.LocalStorage;
|
||||
|
||||
using collAnon.Client.Services;
|
||||
|
||||
using decePubClient.Helpers;
|
||||
using decePubClient.Models;
|
||||
using decePubClient.Models.Mastodon;
|
||||
using decePubClient.Services;
|
||||
|
||||
using Markdig;
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
|
||||
using PrivaPub.ClientModels;
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
@@ -28,24 +21,6 @@ namespace decePubClient.Extensions
|
||||
{
|
||||
public static partial class ExtensionMethods
|
||||
{
|
||||
#region Navigation Manager
|
||||
|
||||
public static NameValueCollection QueryString(this NavigationManager navigationManager) =>
|
||||
HttpUtility.ParseQueryString(new Uri(navigationManager.Uri).Query);
|
||||
|
||||
public static string QueryString(this NavigationManager navigationManager, string key) =>
|
||||
navigationManager.QueryString()[key];
|
||||
|
||||
public static T QueryString<T>(this NavigationManager navigationManager, string key)
|
||||
{
|
||||
var value = navigationManager.QueryString()[key];
|
||||
if (!TypeDescriptor.GetConverter(typeof(T)).IsValid(value))
|
||||
return default;
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
|
||||
#endregion Navigation Manager
|
||||
|
||||
#region Setups
|
||||
|
||||
/// <summary>The languages with resources (Resources/AllStrings.*.resx); any other browser language gets English.</summary>
|
||||
@@ -82,30 +57,6 @@ namespace decePubClient.Extensions
|
||||
|
||||
#endregion Setups
|
||||
|
||||
public static string GetLogLevelClass(this string logType) => logType switch
|
||||
{
|
||||
"Debug" => "text-base-content/60",
|
||||
"Information" => "text-info",
|
||||
"Warning" => "text-warning",
|
||||
"Error" => "text-error",
|
||||
"Fatal" => "text-error font-bold",
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
|
||||
#region Formats
|
||||
|
||||
public static MarkdownPipeline Pipeline =>
|
||||
new MarkdownPipelineBuilder().UseGenericAttributes().Build();
|
||||
|
||||
public static string ToJson(this object value) =>
|
||||
JsonSerializer.Serialize(value);
|
||||
|
||||
public static string ToBase64PngImage(this string base64Image) =>
|
||||
$"data:image/png;base64,{base64Image}";
|
||||
|
||||
#endregion Formats
|
||||
|
||||
#region Models
|
||||
|
||||
public static string ToString(this WebResult webResult, CoalescingStringLocalizer localizer) =>
|
||||
@@ -240,25 +191,6 @@ namespace decePubClient.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static string Timeframe(this DateTime creationDate, CoalescingStringLocalizer localizer)
|
||||
{
|
||||
var timeframe = DateTime.Now - creationDate.ToLocalTime();
|
||||
switch ((int)timeframe.TotalHours)
|
||||
{
|
||||
case >= 24:
|
||||
return localizer["{0} day/s", (int)timeframe.TotalDays];
|
||||
|
||||
case >= 1 and < 24:
|
||||
return localizer["{0} hour/s", (int)timeframe.TotalHours];
|
||||
|
||||
case 0:
|
||||
return localizer["{0} minute/s", (int)timeframe.TotalMinutes];
|
||||
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static AuthorizationPolicy IsAdminPolicy() =>
|
||||
new AuthorizationPolicyBuilder().RequireAuthenticatedUser()
|
||||
.RequireClaim(Policies.IsAdmin, "true")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using collAnon.Client.Services;
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
@@ -12,12 +11,6 @@ using decePubClient.Models.Types;
|
||||
using decePubClient.Resources;
|
||||
using decePubClient.Services;
|
||||
|
||||
using DnetIndexedDb;
|
||||
using DnetIndexedDb.Fluent;
|
||||
using DnetIndexedDb.Models;
|
||||
|
||||
using Markdig;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.Extensions.Localization;
|
||||
@@ -26,26 +19,6 @@ namespace decePubClient.Extensions;
|
||||
|
||||
public static class GenericExtensions
|
||||
{
|
||||
public static IServiceCollection AddIndexedDb(this IServiceCollection services)
|
||||
{
|
||||
return services.AddIndexedDbDatabase<IndexedDb>(options =>
|
||||
{
|
||||
var model = new IndexedDbDatabaseModel()
|
||||
.WithName("data")
|
||||
.WithVersion(3)
|
||||
.WithModelId(1);
|
||||
|
||||
// IStorage.AddLog numbers entries itself (max key + 1), so the key is Id rather than generated. Version 2
|
||||
// added this store; version 3 left the mock feed's Message store out of the model.
|
||||
model.AddStore(nameof(ClientLogs))
|
||||
.WithKey(nameof(ClientLogs.Id))
|
||||
.AddUniqueIndex(nameof(ClientLogs.Id))
|
||||
.AddIndex(nameof(ClientLogs.TimeStamp));
|
||||
|
||||
options.UseDatabase(model);
|
||||
});
|
||||
}
|
||||
|
||||
public static string GetPassedTime(this DateTime dateTime, CoalescingStringLocalizer localizer)
|
||||
{
|
||||
var timeframe = DateTime.Now - dateTime.ToLocalTime();
|
||||
@@ -72,17 +45,17 @@ public static class GenericExtensions
|
||||
_ => localizer["{0}KB", size / 1_024]
|
||||
};
|
||||
|
||||
public static string GetMessageTypeIcon(this MessageType messageType)
|
||||
public static string GetVisibilityIcon(this Visibility visibility)
|
||||
{
|
||||
switch (messageType)
|
||||
switch (visibility)
|
||||
{
|
||||
case MessageType.Public:
|
||||
case Visibility.Public:
|
||||
return "ion-md-globe";
|
||||
case MessageType.Unlisted:
|
||||
case Visibility.Unlisted:
|
||||
return "ion-md-unlock";
|
||||
case MessageType.FollowersOnly:
|
||||
case Visibility.FollowersOnly:
|
||||
return "ion-md-lock";
|
||||
case MessageType.Direct:
|
||||
case Visibility.Direct:
|
||||
return "ion-md-paper-plane";
|
||||
default:
|
||||
return default;
|
||||
|
||||
Reference in new issue
Block a user