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
76 lines
3.3 KiB
C#
76 lines
3.3 KiB
C#
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
using decePubClient.Models.Types;
|
|
using decePubClient.Resources;
|
|
|
|
namespace decePubClient.Models;
|
|
|
|
/// <summary>
|
|
/// A new post or reply. It goes through the Mastodon API (plain text, a content warning, a visibility and media) unless
|
|
/// it is located (text only, kept within RangeKm of where it was written, never federated) or meant for a group; those
|
|
/// go through /clientapi/post/insert.
|
|
/// </summary>
|
|
public class ComposeForm
|
|
{
|
|
public const int MaxContentLength = 5_000;
|
|
|
|
/// <summary>The status a reply answers.</summary>
|
|
public string InReplyToId { get; set; }
|
|
/// <summary>The community or circle the post is for.</summary>
|
|
public string GroupId { get; set; }
|
|
|
|
[Required(ErrorMessageResourceName = ValidationNames.Required, ErrorMessageResourceType = typeof(ErrorMessages))]
|
|
public Visibility Visibility { get; set; } = Visibility.Public;
|
|
public bool HasContentWarning { get; set; }
|
|
// its media marked sensitive without a warning: the persona's default ("always mark media as sensitive"), or the post's own when edited
|
|
public bool Sensitive { get; set; }
|
|
[StringLength(500, ErrorMessageResourceName = ValidationNames.MaxLength, ErrorMessageResourceType = typeof(ErrorMessages))]
|
|
public string SpoilerText { get; set; }
|
|
[StringLength(MaxContentLength, ErrorMessageResourceName = ValidationNames.MaxLength, ErrorMessageResourceType = typeof(ErrorMessages))]
|
|
public string Content { get; set; }
|
|
public List<UploadMedia> Media { get; set; } = [];
|
|
|
|
/// <summary>A located post: shown only to readers within RangeKm of Latitude/Longitude.</summary>
|
|
public bool IsLocated { get; set; }
|
|
[Range(1, 50)]
|
|
public double RangeKm { get; set; } = 5;
|
|
public double? Latitude { get; set; }
|
|
public double? Longitude { get; set; }
|
|
|
|
/// <summary>A poll instead of media: two to four choices, open ExpiresIn seconds, one choice or several.</summary>
|
|
public bool HasPoll { get; set; }
|
|
public List<string> PollOptions { get; set; } = ["", ""];
|
|
public int PollExpiresIn { get; set; } = 86400;
|
|
public bool PollMultiple { get; set; }
|
|
|
|
/// <summary>The language the post is written in (ISO 639-1); null leaves it to PrivaPub.</summary>
|
|
public string Language { get; set; }
|
|
|
|
/// <summary>The post this one quotes.</summary>
|
|
public string QuotedStatusId { get; set; }
|
|
|
|
/// <summary>Whether the post waits for ScheduledAt (a datetime-local value, the reader's own time) instead of going now.</summary>
|
|
public bool IsScheduled { get; set; }
|
|
public string ScheduledAt { get; set; }
|
|
|
|
/// <summary>When the post is to be published, in UTC, or null when it goes now or ScheduledAt is not a time.</summary>
|
|
public DateTime? ScheduledAtUtc => IsScheduled && DateTime.TryParse(ScheduledAt, System.Globalization.CultureInfo.InvariantCulture,
|
|
System.Globalization.DateTimeStyles.AssumeLocal, out var local) ? local.ToUniversalTime() : null;
|
|
|
|
[JsonIgnore, Bindable(false)]
|
|
public MediaType MediaType { get; set; } = MediaType.Images;
|
|
[JsonIgnore, Bindable(false)]
|
|
public bool IsScopeOptionsOpen { get; set; }
|
|
|
|
/// <summary>The Mastodon visibility of Visibility.</summary>
|
|
public string MastodonVisibility => Visibility switch
|
|
{
|
|
Visibility.Direct => "direct",
|
|
Visibility.FollowersOnly => "private",
|
|
Visibility.Unlisted => "unlisted",
|
|
_ => "public"
|
|
};
|
|
}
|