diff --git a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs index 74f04989..89955d9d 100644 --- a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs +++ b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs @@ -88,8 +88,8 @@ public class ActivityPubController( throw GracefulException.NotFound("Note not found"); var replies = await db.Notes.Where(p => p.ReplyId == id) - .OrderByDescending(p => p.Id) - .ToListAsync(); + .OrderByDescending(p => p.Id) + .ToListAsync(); var rendered = replies.Select(noteRenderer.RenderLite).ToList(); var res = new ASOrderedCollection diff --git a/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs b/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs index e11c4b92..9c45e63e 100644 --- a/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs +++ b/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs @@ -16,7 +16,11 @@ namespace Iceshrimp.Backend.Controllers.Federation; [Route("/nodeinfo")] [EnableCors("well-known")] [Produces(MediaTypeNames.Application.Json)] -public class NodeInfoController(IOptions instanceConfig, IOptions storageConfig, DatabaseContext db) : ControllerBase +public class NodeInfoController( + IOptions instanceConfig, + IOptions storageConfig, + DatabaseContext db +) : ControllerBase { [HttpGet("2.1")] [HttpGet("2.0")] @@ -36,7 +40,7 @@ public class NodeInfoController(IOptions instanceConfig, await db.Users.LongCountAsync(p => p.IsLocalUser && !Constants.SystemUsers.Contains(p.UsernameLower) && p.LastActiveDate > cutoffHalfYear); - var localPosts = await db.Notes.LongCountAsync(p => p.UserHost == null); + var localPosts = await db.Notes.LongCountAsync(p => p.UserHost == null); var maxUploadSize = storageConfig.Value.MaxUploadSizeBytes; return new NodeInfoResponse @@ -92,30 +96,30 @@ public class NodeInfoController(IOptions instanceConfig, EnableGithubIntegration = false, EnableDiscordIntegration = false, EnableEmail = false, - PublicTimelineVisibility = new() { + PublicTimelineVisibility = new NodeInfoResponse.PleromaPublicTimelineVisibility + { Bubble = false, Federated = false, - Local = false, + Local = false }, - UploadLimits = new() { + // @formatter:off + UploadLimits = new NodeInfoResponse.PleromaUploadLimits + { General = maxUploadSize, Avatar = maxUploadSize, Background = maxUploadSize, - Banner = maxUploadSize, + Banner = maxUploadSize }, - Suggestions = new() { - Enabled = false - }, - Federation = new() { - Enabled = true - } + // @formatter:on + Suggestions = new NodeInfoResponse.PleromaSuggestions { Enabled = false }, + Federation = new NodeInfoResponse.PleromaFederation { Enabled = true } }, OpenRegistrations = false }; } [HttpGet("2.0.json")] - public IActionResult GetNodeInfoAkkoFE() + public IActionResult GetNodeInfoAkkoma() { return Redirect("/nodeinfo/2.0"); } diff --git a/Iceshrimp.Backend/Controllers/Mastodon/ConversationsController.cs b/Iceshrimp.Backend/Controllers/Mastodon/ConversationsController.cs index a44e0b39..cab8e366 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/ConversationsController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/ConversationsController.cs @@ -96,7 +96,7 @@ public class ConversationsController( var user = HttpContext.GetUserOrFail(); var conversation = await db.Conversations(user) .IncludeCommonProperties() - .Where(p => (p.ThreadIdOrId) == id) + .Where(p => p.ThreadIdOrId == id) .Select(p => new Conversation { Id = p.ThreadIdOrId, diff --git a/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs b/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs index 05adeedc..0bd375c2 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs @@ -3,6 +3,7 @@ using System.Net.Mime; using Iceshrimp.Backend.Controllers.Mastodon.Attributes; using Iceshrimp.Backend.Controllers.Mastodon.Schemas; using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; +using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; using Iceshrimp.Backend.Controllers.Shared.Attributes; using Iceshrimp.Backend.Core.Configuration; using Iceshrimp.Backend.Core.Database; @@ -33,15 +34,14 @@ public class InstanceController(DatabaseContext db, MetaService meta) : Controll var (instanceName, instanceDescription, adminContact) = await meta.GetMany(MetaEntity.InstanceName, MetaEntity.InstanceDescription, MetaEntity.AdminContactEmail); - var vapidKey = await meta.Get(MetaEntity.VapidPublicKey); // can't merge with above call since they're all nullable and this is not. + + // can't merge with above call since they're all nullable and this is not. + var vapidKey = await meta.Get(MetaEntity.VapidPublicKey); return new InstanceInfoV1Response(config.Value, instanceName, instanceDescription, adminContact) { Stats = new InstanceStats(userCount, noteCount, instanceCount), - Pleroma = new() { - VapidPublicKey = vapidKey, - Metadata = new(), - } + Pleroma = new PleromaInstanceExtensions { VapidPublicKey = vapidKey, Metadata = new InstanceMetadata() } }; } diff --git a/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs b/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs index 1a3ea8de..ad2c6ee1 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs @@ -33,7 +33,7 @@ public class NotificationController(DatabaseContext db, NotificationRenderer not MastodonPaginationQuery query, NotificationSchemas.GetNotificationsRequest request ) { - var user = HttpContext.GetUserOrFail(); + var user = HttpContext.GetUserOrFail(); var isPleroma = HttpContext.GetOauthToken()!.IsPleroma; return await db.Notifications @@ -65,7 +65,7 @@ public class NotificationController(DatabaseContext db, NotificationRenderer not [ProducesErrors(HttpStatusCode.NotFound)] public async Task GetNotification(long id) { - var user = HttpContext.GetUserOrFail(); + var user = HttpContext.GetUserOrFail(); var isPleroma = HttpContext.GetOauthToken()!.IsPleroma; var notification = await db.Notifications @@ -76,7 +76,7 @@ public class NotificationController(DatabaseContext db, NotificationRenderer not .FirstOrDefaultAsync() ?? throw GracefulException.RecordNotFound(); - var res = await notificationRenderer.RenderAsync(notification.EnforceRenoteReplyVisibility(p => p.Note), user, isPleroma); - return res; + return await notificationRenderer.RenderAsync(notification.EnforceRenoteReplyVisibility(p => p.Note), + user, isPleroma); } } \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NoteRenderer.cs b/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NoteRenderer.cs index 384ea604..5fe72d67 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NoteRenderer.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NoteRenderer.cs @@ -1,4 +1,5 @@ using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; +using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; using Iceshrimp.Backend.Core.Configuration; using Iceshrimp.Backend.Core.Database; using Iceshrimp.Backend.Core.Database.Tables; @@ -162,10 +163,7 @@ public class NoteRenderer( Poll = poll, Reactions = reactions, Filtered = filterResult, - Pleroma = new() { - Reactions = reactions, - ConversationId = note.ThreadIdOrId - } + Pleroma = new PleromaStatusExtensions { Reactions = reactions, ConversationId = note.ThreadIdOrId } }; return res; @@ -321,7 +319,11 @@ public class NoteRenderer( db.NoteReactions.Any(i => i.NoteId == p.First().NoteId && i.Reaction == p.First().Reaction && i.User == user), - AccountIds = db.NoteReactions.Where(i => i.NoteId == p.First().NoteId && p.Select(r => r.Id).Contains(i.Id)).Select(i => i.UserId).ToList() + AccountIds = db.NoteReactions + .Where(i => i.NoteId == p.First().NoteId && + p.Select(r => r.Id).Contains(i.Id)) + .Select(i => i.UserId) + .ToList() }) .ToListAsync(); diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NotificationRenderer.cs b/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NotificationRenderer.cs index 914e155d..b54737ff 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NotificationRenderer.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Renderers/NotificationRenderer.cs @@ -1,4 +1,5 @@ using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; +using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; using Iceshrimp.Backend.Core.Database; using Iceshrimp.Backend.Core.Database.Tables; using Iceshrimp.Backend.Core.Extensions; @@ -29,7 +30,8 @@ public class NotificationRenderer(DatabaseContext db, NoteRenderer noteRenderer, await userRenderer.RenderAsync(dbNotifier); string? emojiUrl = null; - if (notification.Reaction != null) { + if (notification.Reaction != null) + { // explicitly check to skip another database call if url is actually null if (emojiUrls != null) { @@ -38,7 +40,10 @@ public class NotificationRenderer(DatabaseContext db, NoteRenderer noteRenderer, else if (EmojiService.IsCustomEmoji(notification.Reaction)) { var parts = notification.Reaction.Trim(':').Split('@'); - emojiUrl = await db.Emojis.Where(e => e.Name == parts[0] && e.Host == (parts.Length > 1 ? parts[1] : null)).Select(e => e.PublicUrl).FirstOrDefaultAsync(); + emojiUrl = await db.Emojis + .Where(e => e.Name == parts[0] && e.Host == (parts.Length > 1 ? parts[1] : null)) + .Select(e => e.PublicUrl) + .FirstOrDefaultAsync(); } } @@ -51,9 +56,7 @@ public class NotificationRenderer(DatabaseContext db, NoteRenderer noteRenderer, CreatedAt = notification.CreatedAt.ToStringIso8601Like(), Emoji = notification.Reaction, EmojiUrl = emojiUrl, - Pleroma = new() { - IsSeen = notification.IsRead - } + Pleroma = new PleromaNotificationExtensions { IsSeen = notification.IsRead } }; return res; @@ -85,20 +88,28 @@ public class NotificationRenderer(DatabaseContext db, NoteRenderer noteRenderer, .DistinctBy(p => p.Id), user, Filter.FilterContext.Notifications, accounts); - var parts = notifications.Where(p => p.Reaction != null && EmojiService.IsCustomEmoji(p.Reaction)).Select(p => { - var parts = p.Reaction!.Trim(':').Split('@'); - return new { Name = parts[0], Host = parts.Length > 1 ? parts[1] : null }; - }); + var parts = notificationList.Where(p => p.Reaction != null && EmojiService.IsCustomEmoji(p.Reaction)) + .Select(p => + { + var parts = p.Reaction!.Trim(':').Split('@'); + return new { Name = parts[0], Host = parts.Length > 1 ? parts[1] : null }; + }); // https://github.com/dotnet/efcore/issues/31492 + //TODO: is there a better way of expressing this using LINQ? IQueryable urlQ = db.Emojis; foreach (var part in parts) urlQ = urlQ.Concat(db.Emojis.Where(e => e.Name == part.Name && e.Host == part.Host)); - var emojiUrls = (await urlQ - .Select(e => new { Name = $":{e.Name}{(e.Host != null ? "@" + e.Host : "")}:", Url = e.PublicUrl }) - .ToArrayAsync()) - .DistinctBy(e => e.Name) - .ToDictionary(e => e.Name, e => e.Url); + + //TODO: can we somehow optimize this to do the dedupe database side? + var emojiUrls = await urlQ.Select(e => new + { + Name = $":{e.Name}{(e.Host != null ? "@" + e.Host : "")}:", + Url = e.PublicUrl + }) + .ToArrayAsync() + .ContinueWithResult(res => res.DistinctBy(e => e.Name) + .ToDictionary(e => e.Name, e => e.Url)); return await notificationList .Select(p => RenderAsync(p, user, isPleroma, accounts, notes, emojiUrls)) diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/Entities/NotificationEntity.cs b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/Entities/NotificationEntity.cs index 72ee6beb..0f1f386d 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/Entities/NotificationEntity.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/Entities/NotificationEntity.cs @@ -1,8 +1,8 @@ +using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; using Iceshrimp.Backend.Core.Database; using Iceshrimp.Backend.Core.Middleware; using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; using static Iceshrimp.Backend.Core.Database.Tables.Notification; -using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; namespace Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; @@ -14,8 +14,8 @@ public class NotificationEntity : IEntity [J("status")] public required StatusEntity? Note { get; set; } [J("id")] public required string Id { get; set; } [J("pleroma")] public required PleromaNotificationExtensions Pleroma { get; set; } - [J("emoji")] public string? Emoji { get; set; } - [J("emoji_url")] public string? EmojiUrl { get; set; } + [J("emoji")] public string? Emoji { get; set; } + [J("emoji_url")] public string? EmojiUrl { get; set; } public static string EncodeType(NotificationType type, bool isPleroma) { diff --git a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/StatusSchemas.cs b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/StatusSchemas.cs index d802e4df..680f5971 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/Schemas/StatusSchemas.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/Schemas/StatusSchemas.cs @@ -45,9 +45,7 @@ public abstract class StatusSchemas [B(Name = "poll")] [J("poll")] public PollData? Poll { get; set; } - [B(Name = "preview")] - [J("preview")] - public bool Preview { get; set; } = false; + [B(Name = "preview")] [J("preview")] public bool Preview { get; set; } = false; public class PollData { diff --git a/Iceshrimp.Backend/Controllers/Pleroma/EmojiController.cs b/Iceshrimp.Backend/Controllers/Pleroma/EmojiController.cs index 6f711e57..e59d6a39 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/EmojiController.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/EmojiController.cs @@ -21,14 +21,16 @@ public class EmojiController(DatabaseContext db) : ControllerBase [ProducesResults(HttpStatusCode.OK)] public async Task> GetCustomEmojis() { - var emoji = await db.Emojis.Where(p => p.Host == null) - .Select(p => KeyValuePair.Create(p.Name, new PleromaEmojiEntity - { - ImageUrl = p.PublicUrl, - Tags = new string[] { p.Category == null ? "" : p.Category } - })) - .ToArrayAsync(); + var emoji = await db.Emojis + .Where(p => p.Host == null) + .Select(p => KeyValuePair.Create(p.Name, + new PleromaEmojiEntity + { + ImageUrl = p.PublicUrl, + Tags = new[] { p.Category ?? "" } + })) + .ToArrayAsync(); return new Dictionary(emoji); } -} +} \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/FrontendController.cs b/Iceshrimp.Backend/Controllers/Pleroma/FrontendController.cs index bf983e8f..6c3b1fdd 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/FrontendController.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/FrontendController.cs @@ -21,4 +21,4 @@ public class FrontendController : ControllerBase { return new FrontendConfigurationsResponse(); } -} +} \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/NotificationController.cs b/Iceshrimp.Backend/Controllers/Pleroma/NotificationController.cs index f64aefae..fbabcfb2 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/NotificationController.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/NotificationController.cs @@ -4,10 +4,8 @@ using Iceshrimp.Backend.Controllers.Mastodon.Attributes; using Iceshrimp.Backend.Controllers.Mastodon.Renderers; using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; using Iceshrimp.Backend.Controllers.Pleroma.Schemas; -using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; using Iceshrimp.Backend.Controllers.Shared.Attributes; using Iceshrimp.Backend.Core.Database; -using Iceshrimp.Backend.Core.Database.Tables; using Iceshrimp.Backend.Core.Extensions; using Iceshrimp.Backend.Core.Middleware; using Microsoft.AspNetCore.Cors; @@ -27,23 +25,23 @@ public class NotificationController(DatabaseContext db, NotificationRenderer not [HttpPost("/api/v1/pleroma/notifications/read")] [Authorize("read:notifications")] [ProducesResults(HttpStatusCode.OK)] - public async Task> MarkNotificationsAsRead([FromHybrid] PleromaNotificationSchemas.ReadNotificationsRequest request) + public async Task> MarkNotificationsAsRead( + [FromHybrid] PleromaNotificationSchemas.ReadNotificationsRequest request + ) { var user = HttpContext.GetUserOrFail(); - if (request.Id != null && request.MaxId != null) + if (request is { Id: not null, MaxId: not null }) throw GracefulException.BadRequest("id and max_id are mutually exclusive."); var q = db.Notifications - .IncludeCommonProperties() - .Include(p => p.Notifier) - .Include(p => p.Note) - .Where(p => p.Notifiee == user) - .Where(p => p.Notifier != null) - .Where(p => !p.IsRead) - .EnsureNoteVisibilityFor(p => p.Note, user) - .OrderByDescending(n => n.MastoId) - .Take(80); + .IncludeCommonProperties() + .Where(p => p.Notifiee == user) + .Where(p => p.Notifier != null) + .Where(p => !p.IsRead) + .EnsureNoteVisibilityFor(p => p.Note, user) + .OrderByDescending(n => n.MastoId) + .Take(80); if (request.Id != null) q = q.Where(n => n.MastoId == request.Id); @@ -59,4 +57,4 @@ public class NotificationController(DatabaseContext db, NotificationRenderer not await db.SaveChangesAsync(); return (await notificationRenderer.RenderManyAsync(notifications, user, isPleroma: true)).ToList(); } -} +} \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaInstanceExtensions.cs b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaInstanceExtensions.cs index 79b5d1f5..7a58d64f 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaInstanceExtensions.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaInstanceExtensions.cs @@ -2,7 +2,7 @@ using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; -public class PleromaInstanceExtensions +public class PleromaInstanceExtensions { [J("vapid_public_key")] public required string VapidPublicKey { get; set; } [J("metadata")] public required InstanceMetadata Metadata { get; set; } @@ -10,8 +10,23 @@ public class PleromaInstanceExtensions public class InstanceMetadata { - [J("post_formats")] public string[] PostFormats => ["text/plain", "text/x.misskeymarkdown"]; - [J("features")] public string[] Features => ["pleroma_api", "akkoma_api", "mastodon_api", "mastodon_api_streaming", "polls", "quote_posting", "editing", "pleroma_emoji_reactions", "exposable_reactions", "custom_emoji_reactions"]; + [J("post_formats")] public string[] PostFormats => ["text/plain", "text/x.misskeymarkdown"]; + + [J("features")] + public string[] Features => + [ + "pleroma_api", + "akkoma_api", + "mastodon_api", + "mastodon_api_streaming", + "polls", + "quote_posting", + "editing", + "pleroma_emoji_reactions", + "exposable_reactions", + "custom_emoji_reactions" + ]; + [J("fields_limits")] public FieldsLimits FieldsLimits => new(); } diff --git a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaNotificationExtensions.cs b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaNotificationExtensions.cs index b96fe0eb..d7089edb 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaNotificationExtensions.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaNotificationExtensions.cs @@ -2,7 +2,7 @@ using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; -public class PleromaNotificationExtensions +public class PleromaNotificationExtensions { [J("is_seen")] public required bool IsSeen { get; set; } } \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaStatusExtensions.cs b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaStatusExtensions.cs index 1b6ec9a5..d84fea4e 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaStatusExtensions.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/Entities/PleromaStatusExtensions.cs @@ -3,7 +3,7 @@ using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities; -public class PleromaStatusExtensions +public class PleromaStatusExtensions { [J("emoji_reactions")] public required List Reactions { get; set; } [J("conversation_id")] public required string ConversationId { get; set; } diff --git a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/FrontendConfigurationsResponse.cs b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/FrontendConfigurationsResponse.cs index e85bec1f..f58aaaf0 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/FrontendConfigurationsResponse.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/FrontendConfigurationsResponse.cs @@ -2,14 +2,13 @@ using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas; -public class FrontendConfigurationsResponse() +public class FrontendConfigurationsResponse { - [J("pleroma_fe")] public PleromaFeConfiguration PleromaFe => new(); + [J("pleroma_fe")] public PleromaFeConfiguration PleromaFe => new(); } - -public class PleromaFeConfiguration() +public class PleromaFeConfiguration { - [J("loginMethod")] public string LoginMethod => "token"; - [J("useStreamingApi")] public bool UseStreamingApi => true; -} + [J("loginMethod")] public string LoginMethod => "token"; + [J("useStreamingApi")] public bool UseStreamingApi => true; +} \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/NotificationSchemas.cs b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/NotificationSchemas.cs index 75182774..6b3689ca 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/Schemas/NotificationSchemas.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/Schemas/NotificationSchemas.cs @@ -7,7 +7,7 @@ public abstract class PleromaNotificationSchemas { public class ReadNotificationsRequest { - [B(Name = "id")] [J("id")] public long? Id { get; set; } + [B(Name = "id")] [J("id")] public long? Id { get; set; } [B(Name = "max_id")] [J("max_id")] public long? MaxId { get; set; } } } \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Pleroma/StatusController.cs b/Iceshrimp.Backend/Controllers/Pleroma/StatusController.cs index 4929e3ab..8093ecaf 100644 --- a/Iceshrimp.Backend/Controllers/Pleroma/StatusController.cs +++ b/Iceshrimp.Backend/Controllers/Pleroma/StatusController.cs @@ -2,12 +2,10 @@ using System.Net; using System.Net.Mime; using Iceshrimp.Backend.Controllers.Mastodon.Attributes; using Iceshrimp.Backend.Controllers.Mastodon.Renderers; -using Iceshrimp.Backend.Controllers.Mastodon.Schemas; using Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities; using Iceshrimp.Backend.Controllers.Shared.Attributes; using Iceshrimp.Backend.Core.Configuration; using Iceshrimp.Backend.Core.Database; -using Iceshrimp.Backend.Core.Database.Tables; using Iceshrimp.Backend.Core.Extensions; using Iceshrimp.Backend.Core.Middleware; using Iceshrimp.Backend.Core.Services; @@ -121,4 +119,4 @@ public class StatusController( return await GetNote(id); } -} +} \ No newline at end of file diff --git a/Iceshrimp.Backend/Controllers/Web/IdenticonController.cs b/Iceshrimp.Backend/Controllers/Web/IdenticonController.cs index f677edf9..76d167d5 100644 --- a/Iceshrimp.Backend/Controllers/Web/IdenticonController.cs +++ b/Iceshrimp.Backend/Controllers/Web/IdenticonController.cs @@ -31,7 +31,6 @@ public class IdenticonController : ControllerBase var gradient = new LinearGradientBrush(new Point(0, 0), new Point(Size, Size), GradientRepetitionMode.None, new ColorStop(0, color.start), new ColorStop(1, color.end)); - image.Mutate(p => p.Fill(gradient)); var paint = new SolidBrush(Color.White); diff --git a/Iceshrimp.Backend/Controllers/Web/Renderers/FilterRenderer.cs b/Iceshrimp.Backend/Controllers/Web/Renderers/FilterRenderer.cs index 283918a9..f8d1ea76 100644 --- a/Iceshrimp.Backend/Controllers/Web/Renderers/FilterRenderer.cs +++ b/Iceshrimp.Backend/Controllers/Web/Renderers/FilterRenderer.cs @@ -12,7 +12,7 @@ public static class FilterRenderer Expiry = filter.Expiry, Keywords = filter.Keywords, Action = (FilterResponse.FilterAction)filter.Action, - Contexts = filter.Contexts.Cast().ToList(), + Contexts = filter.Contexts.Cast().ToList() }; public static IEnumerable RenderMany(IEnumerable filters) => filters.Select(RenderOne); diff --git a/Iceshrimp.Backend/Controllers/Web/SettingsController.cs b/Iceshrimp.Backend/Controllers/Web/SettingsController.cs index 5ba70c37..867da6a6 100644 --- a/Iceshrimp.Backend/Controllers/Web/SettingsController.cs +++ b/Iceshrimp.Backend/Controllers/Web/SettingsController.cs @@ -30,7 +30,7 @@ public class SettingsController(DatabaseContext db) : ControllerBase AlwaysMarkSensitive = settings.AlwaysMarkSensitive, AutoAcceptFollowed = settings.AutoAcceptFollowed, DefaultNoteVisibility = (NoteVisibility)settings.DefaultNoteVisibility, - DefaultRenoteVisibility = (NoteVisibility)settings.DefaultNoteVisibility, + DefaultRenoteVisibility = (NoteVisibility)settings.DefaultNoteVisibility }; } diff --git a/Iceshrimp.Backend/Core/Database/Tables/OauthApp.cs b/Iceshrimp.Backend/Core/Database/Tables/OauthApp.cs index 4852380f..2333b539 100644 --- a/Iceshrimp.Backend/Core/Database/Tables/OauthApp.cs +++ b/Iceshrimp.Backend/Core/Database/Tables/OauthApp.cs @@ -63,7 +63,7 @@ public class OauthApp public virtual ICollection OauthTokens { get; set; } = new List(); /// - /// The app token, returned by /oauth/token when grant_type client_credentials is requested + /// The app token, returned by /oauth/token when grant_type client_credentials is requested /// [Column("appToken")] [StringLength(64)] public string? Token; diff --git a/Iceshrimp.Backend/Core/Database/Tables/UserProfile.cs b/Iceshrimp.Backend/Core/Database/Tables/UserProfile.cs index 8a12a579..ff1c66c5 100644 --- a/Iceshrimp.Backend/Core/Database/Tables/UserProfile.cs +++ b/Iceshrimp.Backend/Core/Database/Tables/UserProfile.cs @@ -84,7 +84,7 @@ public class UserProfile [J("value")] public required string Value { get; set; } [J("verified")] public bool? IsVerified { get; set; } } - + [PgName("user_profile_ffvisibility_enum")] public enum UserProfileFFVisibility { diff --git a/Iceshrimp.Backend/Core/Extensions/MvcBuilderExtensions.cs b/Iceshrimp.Backend/Core/Extensions/MvcBuilderExtensions.cs index 1ab78521..806e1e28 100644 --- a/Iceshrimp.Backend/Core/Extensions/MvcBuilderExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/MvcBuilderExtensions.cs @@ -104,7 +104,7 @@ public static class MvcBuilderExtensions } /// -/// Overrides the default OutputFormatterSelector, to make sure we return a body when content negotiation errors occur. +/// Overrides the default OutputFormatterSelector, to make sure we return a body when content negotiation errors occur. /// public class AcceptHeaderOutputFormatterSelector( IOptions options, diff --git a/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs b/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs index 60ea060a..4caa3774 100644 --- a/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs @@ -537,7 +537,7 @@ public static class QueryableExtensions ) { if (request.ExcludeReplies) - query = query.Where(p => p.Reply == null && p.ReplyUri == null || p.ReplyUserId == p.UserId); + query = query.Where(p => (p.Reply == null && p.ReplyUri == null) || p.ReplyUserId == p.UserId); if (request.ExcludeRenotes) query = query.Where(p => p.Renote == null && p.RenoteUri == null); if (request.Tagged != null) diff --git a/Iceshrimp.Backend/Core/Extensions/StringExtensions.cs b/Iceshrimp.Backend/Core/Extensions/StringExtensions.cs index 84d98074..ce01f0db 100644 --- a/Iceshrimp.Backend/Core/Extensions/StringExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/StringExtensions.cs @@ -57,7 +57,7 @@ public static class StringBuilderExtensions private const char NewLineLf = '\n'; /// - /// Equivalent to .AppendLine, but always uses \n instead of Environment.NewLine + /// Equivalent to .AppendLine, but always uses \n instead of Environment.NewLine /// public static StringBuilder AppendLineLf(this StringBuilder sb, string? value) { diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs index d183c1b5..adb91bb8 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs @@ -82,7 +82,7 @@ public class ActivityFetcherService( } /// - /// This abstracts FetchActivityInternal to keep stack traces short in case of HTTP timeouts. + /// This abstracts FetchActivityInternal to keep stack traces short in case of HTTP timeouts. /// /// private async Task<(ASObject? obj, Uri finalUri)> FetchActivityInternalWrapper( diff --git a/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASActivity.cs b/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASActivity.cs index 136f46fc..71c51d97 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASActivity.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASActivity.cs @@ -129,7 +129,7 @@ public class ASLike : ASActivity [J($"{Constants.MisskeyNs}#_misskey_reaction")] [JC(typeof(VC))] public string? MisskeyReaction { get; set; } - + [J($"{Constants.ActivityStreamsNs}#content")] [JC(typeof(VC))] public string? Content { get; set; } diff --git a/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollection.cs b/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollection.cs index 98ca89b5..0f1b24b9 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollection.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollection.cs @@ -43,7 +43,7 @@ internal sealed class ASOrderedCollectionItemsConverter : ASCollectionItemsConve serializer.Serialize(writer, value); writer.WriteEndObject(); } - + public override object? ReadJson( JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer diff --git a/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs b/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs index cc883b2e..d013498d 100644 --- a/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs +++ b/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs @@ -111,11 +111,27 @@ public class NodeInfoResponse [J("enableDiscordIntegration")] public bool? EnableDiscordIntegration { get; set; } [J("enableEmail")] public bool? EnableEmail { get; set; } - [J("post_formats")] public string[] PostFormats => ["text/plain", "text/x.misskeymarkdown"]; - [J("features")] public string[] Features => ["pleroma_api", "akkoma_api", "mastodon_api", "mastodon_api_streaming", "polls", "quote_posting", "editing", "pleroma_emoji_reactions", "exposable_reactions", "custom_emoji_reactions"]; - [J("localBubbleInstances")] public string[] LocalBubbleInstances { get; set; } = []; + [J("post_formats")] public string[] PostFormats => ["text/plain", "text/x.misskeymarkdown"]; + + [J("features")] + public string[] Features => + [ + "pleroma_api", + "akkoma_api", + "mastodon_api", + "mastodon_api_streaming", + "polls", + "quote_posting", + "editing", + "pleroma_emoji_reactions", + "exposable_reactions", + "custom_emoji_reactions" + ]; + + [J("localBubbleInstances")] public string[] LocalBubbleInstances { get; set; } = []; + // TODO: list of ap object ids i believe? - [J("staffAccounts")] public string[] StaffAccounts { get; set; } = []; + [J("staffAccounts")] public string[] StaffAccounts { get; set; } = []; [J("publicTimelineVisibility")] public PleromaPublicTimelineVisibility? PublicTimelineVisibility { get; set; } [J("uploadLimits")] public PleromaUploadLimits? UploadLimits { get; set; } diff --git a/Iceshrimp.Backend/Core/Helpers/BlurhashHelper.cs b/Iceshrimp.Backend/Core/Helpers/BlurhashHelper.cs index a06d90ab..49e67734 100644 --- a/Iceshrimp.Backend/Core/Helpers/BlurhashHelper.cs +++ b/Iceshrimp.Backend/Core/Helpers/BlurhashHelper.cs @@ -10,7 +10,7 @@ public static class BlurhashHelper private static readonly ImmutableArray PrecomputedLut = [..Enumerable.Range(0, 256).Select(SRgbToLinear)]; /// - /// Encodes a Span2D of raw pixel data into a Blurhash string + /// Encodes a Span2D of raw pixel data into a Blurhash string /// /// The Span2D of raw pixel data to encode /// The number of components used on the X-Axis for the DCT @@ -64,7 +64,7 @@ public static class BlurhashHelper var dc = factors[0]; var acCount = componentsX * componentsY - 1; - var sizeFlag = (componentsX - 1) + (componentsY - 1) * 9; + var sizeFlag = componentsX - 1 + (componentsY - 1) * 9; sizeFlag.EncodeBase83(resultBuffer[..1]); float maximumValue; diff --git a/Iceshrimp.Backend/Core/Middleware/ErrorHandlerMiddleware.cs b/Iceshrimp.Backend/Core/Middleware/ErrorHandlerMiddleware.cs index f100f7c6..08eb6f44 100644 --- a/Iceshrimp.Backend/Core/Middleware/ErrorHandlerMiddleware.cs +++ b/Iceshrimp.Backend/Core/Middleware/ErrorHandlerMiddleware.cs @@ -231,7 +231,7 @@ public class GracefulException( public static GracefulException Conflict(string message, string? details = null) => new(HttpStatusCode.Conflict, message, details); - + public static GracefulException RequestEntityTooLarge(string message, string? details = null) => new(HttpStatusCode.RequestEntityTooLarge, message, details); diff --git a/Iceshrimp.Backend/Core/Services/EmojiImportService.cs b/Iceshrimp.Backend/Core/Services/EmojiImportService.cs index 2483b2f7..07ae51c1 100644 --- a/Iceshrimp.Backend/Core/Services/EmojiImportService.cs +++ b/Iceshrimp.Backend/Core/Services/EmojiImportService.cs @@ -1,106 +1,109 @@ using System.IO.Compression; +using System.Net; using System.Text.Json; using Iceshrimp.Backend.Core.Middleware; -using Microsoft.AspNetCore.StaticFiles; +using Microsoft.AspNetCore.StaticFiles; namespace Iceshrimp.Backend.Core.Services; public class EmojiZipEmoji { - public string? Name { get; set; } - public string? Category { get; set; } - public List Aliases { get; set; } = []; + public string? Name { get; set; } + public string? Category { get; set; } + public List Aliases { get; set; } = []; } public class EmojiZipEntry { - public required string FileName { get; set; } - public required EmojiZipEmoji Emoji { get; set; } + public required string FileName { get; set; } + public required EmojiZipEmoji Emoji { get; set; } } public class EmojiZipMeta { - public required ushort MetaVersion { get; set; } - public required EmojiZipEntry[] Emojis { get; set; } + public required ushort MetaVersion { get; set; } + public required EmojiZipEntry[] Emojis { get; set; } } public record EmojiZip(EmojiZipMeta Metadata, ZipArchive Archive); public class EmojiImportService( - EmojiService emojiSvc, - ILogger logger + EmojiService emojiSvc, + ILogger logger ) { - public static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web); + public static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web); - public async Task Parse(Stream zipStream) - { - var archive = new ZipArchive(zipStream, ZipArchiveMode.Read); + public async Task Parse(Stream zipStream) + { + var archive = new ZipArchive(zipStream, ZipArchiveMode.Read); - try - { - var meta = archive.GetEntry("meta.json") - ?? throw GracefulException.BadRequest("Invalid emoji zip. Only Misskey-style emoji zips are supported."); + try + { + var meta = archive.GetEntry("meta.json") ?? + throw GracefulException + .BadRequest("Invalid emoji zip. Only Misskey-style emoji zips are supported."); - var metaJson = await JsonSerializer.DeserializeAsync(meta.Open(), SerializerOptions) - ?? throw GracefulException.BadRequest("Invalid emoji zip metadata"); + var metaJson = await JsonSerializer.DeserializeAsync(meta.Open(), SerializerOptions) ?? + throw GracefulException.BadRequest("Invalid emoji zip metadata"); - if (metaJson.MetaVersion < 1 || metaJson.MetaVersion > 2) - throw GracefulException.BadRequest("Unrecognized metaVersion {version}, expected 1 or 2", metaJson.MetaVersion.ToString()); + if (metaJson.MetaVersion < 1 || metaJson.MetaVersion > 2) + throw GracefulException.BadRequest("Unrecognized metaVersion {version}, expected 1 or 2", + metaJson.MetaVersion.ToString()); - return new(metaJson, archive); - } - catch - { - // We don't want to dispose of archive on success, as Import will do it when it's done. - archive.Dispose(); - throw; - } - } + return new EmojiZip(metaJson, archive); + } + catch + { + // We don't want to dispose of archive on success, as Import will do it when it's done. + archive.Dispose(); + throw; + } + } - public async Task Import(EmojiZip zip) - { - using var archive = zip.Archive; - var contentTypeProvider = new FileExtensionContentTypeProvider(); + public async Task Import(EmojiZip zip) + { + using var archive = zip.Archive; + var contentTypeProvider = new FileExtensionContentTypeProvider(); - foreach (var emoji in zip.Metadata.Emojis) - { - var file = archive.GetEntry(emoji.FileName); - if (file == null) - { - logger.LogWarning("Skipping {file} as no such file was found in the zip.", emoji.FileName); - continue; - } + foreach (var emoji in zip.Metadata.Emojis) + { + var file = archive.GetEntry(emoji.FileName); + if (file == null) + { + logger.LogWarning("Skipping {file} as no such file was found in the zip.", emoji.FileName); + continue; + } - if (!contentTypeProvider.TryGetContentType(emoji.FileName, out var mimeType)) - { - logger.LogWarning("Skipping {file} as the mime type could not be detemrined.", emoji.FileName); - continue; - } + if (!contentTypeProvider.TryGetContentType(emoji.FileName, out var mimeType)) + { + logger.LogWarning("Skipping {file} as the mime type could not be detemrined.", emoji.FileName); + continue; + } - // DriveService requires a seekable and .Length-able stream, which the DeflateStream from file.Open does not support. - using var buffer = new MemoryStream((int)file.Length); - await file.Open().CopyToAsync(buffer); - buffer.Seek(0, SeekOrigin.Begin); + // DriveService requires a seekable and .Length-able stream, which the DeflateStream from file.Open does not support. + using var buffer = new MemoryStream((int)file.Length); + await file.Open().CopyToAsync(buffer); + buffer.Seek(0, SeekOrigin.Begin); - var name = emoji.Emoji.Name ?? emoji.FileName; + var name = emoji.Emoji.Name ?? emoji.FileName; - try - { - await emojiSvc.CreateEmojiFromStream( - buffer, - name, - mimeType, - emoji.Emoji.Aliases, - emoji.Emoji.Category - ); + try + { + await emojiSvc.CreateEmojiFromStream( + buffer, + name, + mimeType, + emoji.Emoji.Aliases, + emoji.Emoji.Category + ); - logger.LogDebug("Imported emoji {emoji}", name); - } - catch (GracefulException e) when (e.StatusCode == System.Net.HttpStatusCode.Conflict) - { - logger.LogDebug("Skipping {emoji} as it already exists.", name); - } - } - } + logger.LogDebug("Imported emoji {emoji}", name); + } + catch (GracefulException e) when (e.StatusCode == HttpStatusCode.Conflict) + { + logger.LogDebug("Skipping {emoji} as it already exists.", name); + } + } + } } \ No newline at end of file diff --git a/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageProcessor.cs b/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageProcessor.cs index 7fd69310..6b351f0b 100644 --- a/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageProcessor.cs +++ b/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageProcessor.cs @@ -81,6 +81,7 @@ public class ImageProcessor _logger.LogWarning("No image processor supports the format {format}, skipping", p.Format.MimeType); return null; } + return async () => { if (_concurrency is 0) diff --git a/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageSharpProcessor.cs b/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageSharpProcessor.cs index 0e3d85d7..582d60de 100644 --- a/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageSharpProcessor.cs +++ b/Iceshrimp.Backend/Core/Services/ImageProcessing/ImageSharpProcessor.cs @@ -111,7 +111,7 @@ public class ImageSharpProcessor : ImageProcessorBase, IImageProcessor { var width = Math.Min(ident.Width, targetWidth); var height = Math.Min(ident.Height, targetHeight ?? targetWidth); - var size = new Size(width, height); + var size = new Size(width, height); var options = new DecoderOptions { MaxFrames = 1, diff --git a/Iceshrimp.Backend/Core/Services/PluginStore.cs b/Iceshrimp.Backend/Core/Services/PluginStore.cs index fb02465f..4f3c9c19 100644 --- a/Iceshrimp.Backend/Core/Services/PluginStore.cs +++ b/Iceshrimp.Backend/Core/Services/PluginStore.cs @@ -11,7 +11,8 @@ using Microsoft.EntityFrameworkCore; namespace Iceshrimp.Backend.Core.Services; /// -/// This is needed because static fields in generic classes aren't shared between instances with different generic type arguments +/// This is needed because static fields in generic classes aren't shared between instances with different generic type +/// arguments /// file static class PluginStoreHelpers { diff --git a/Iceshrimp.Backend/Core/Services/PushService.cs b/Iceshrimp.Backend/Core/Services/PushService.cs index 1831c6c8..ff95cfb2 100644 --- a/Iceshrimp.Backend/Core/Services/PushService.cs +++ b/Iceshrimp.Backend/Core/Services/PushService.cs @@ -90,7 +90,7 @@ public class PushService( "reaction" when rendered.Emoji is null => $"{name} reacted to your post", "reaction" when rendered.Emoji is not null => $"{name} reacted with {rendered.Emoji} to your post", - _ => $"New notification from {name}" + _ => $"New notification from {name}" }; var body = ""; diff --git a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs index 21029678..8bfba129 100644 --- a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs +++ b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs @@ -17,11 +17,11 @@ public class AuthorizeModel(DatabaseContext db) : PageModel public List Scopes = []; public OauthToken? Token; public List AuthenticatedUsers = []; - [FromQuery(Name = "response_type")] public string ResponseType { get; set; } = null!; - [FromQuery(Name = "client_id")] public string ClientId { get; set; } = null!; - [FromQuery(Name = "redirect_uri")] public string RedirectUri { get; set; } = null!; - [FromQuery(Name = "force_login")] public bool ForceLogin { get; set; } = false; - [FromQuery(Name = "lang")] public string? Language { get; set; } + [FromQuery(Name = "response_type")] public string ResponseType { get; set; } = null!; + [FromQuery(Name = "client_id")] public string ClientId { get; set; } = null!; + [FromQuery(Name = "redirect_uri")] public string RedirectUri { get; set; } = null!; + [FromQuery(Name = "force_login")] public bool ForceLogin { get; set; } = false; + [FromQuery(Name = "lang")] public string? Language { get; set; } [FromQuery(Name = "scope")] public string Scope @@ -91,7 +91,7 @@ public class AuthorizeModel(DatabaseContext db) : PageModel RedirectUri = RedirectUri, AutoDetectQuotes = autoDetectQuotes, SupportsHtmlFormatting = supportsHtmlFormatting, - IsPleroma = isPleroma, + IsPleroma = isPleroma }; await db.AddAsync(token); diff --git a/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs b/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs index 62b7b439..d664ccee 100644 --- a/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs +++ b/Iceshrimp.Backend/Pages/QueueJob.cshtml.cs @@ -13,7 +13,7 @@ public class QueueJobModel(DatabaseContext db) : PageModel { ["inbox"] = "body", ["deliver"] = "payload", - ["pre-deliver"] = "serializedActivity", + ["pre-deliver"] = "serializedActivity" }; public Job Job = null!; diff --git a/Iceshrimp.Frontend/App.razor b/Iceshrimp.Frontend/App.razor index faee4d90..12bfe1a1 100644 --- a/Iceshrimp.Frontend/App.razor +++ b/Iceshrimp.Frontend/App.razor @@ -1,6 +1,6 @@ @using Iceshrimp.Frontend.Components @using Microsoft.AspNetCore.Components.Authorization - + diff --git a/Iceshrimp.Frontend/Components/AttachmentComponent.razor b/Iceshrimp.Frontend/Components/AttachmentComponent.razor index dd343ef4..5b0aa510 100644 --- a/Iceshrimp.Frontend/Components/AttachmentComponent.razor +++ b/Iceshrimp.Frontend/Components/AttachmentComponent.razor @@ -1,6 +1,5 @@ @using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Shared.Schemas.Web - @if (Attachment.ContentType.StartsWith("image")) {
@@ -16,7 +15,7 @@ else if (Attachment.ContentType.StartsWith("audio"))
-} +} else if (Attachment.ContentType.StartsWith("video")) {
diff --git a/Iceshrimp.Frontend/Components/ClosingBackdrop.razor b/Iceshrimp.Frontend/Components/ClosingBackdrop.razor index 5e42ad2b..367e4c36 100644 --- a/Iceshrimp.Frontend/Components/ClosingBackdrop.razor +++ b/Iceshrimp.Frontend/Components/ClosingBackdrop.razor @@ -1,8 +1,8 @@
@code { - [Parameter][EditorRequired] public required EventCallback OnClose { get; set; } - [Parameter] public bool Darken { get; set; } + [Parameter] [EditorRequired] public required EventCallback OnClose { get; set; } + [Parameter] public bool Darken { get; set; } private void Close() { diff --git a/Iceshrimp.Frontend/Components/Compose.razor b/Iceshrimp.Frontend/Components/Compose.razor index cf7c915e..e7acf32a 100644 --- a/Iceshrimp.Frontend/Components/Compose.razor +++ b/Iceshrimp.Frontend/Components/Compose.razor @@ -20,20 +20,20 @@ - - - @Loc["ComposePost"] - - - - - - - - - @Loc["Retry"] - - + + + @Loc["ComposePost"] + + + + + + + + + @Loc["Retry"] + +
@if (ReplyOrQuote != null) { @@ -84,7 +84,12 @@ Cw = null }; - private Dictionary AvailablePlaceholders { get; set; } = new() { { "default", "What's on your mind?" }, { "reply", "Reply goes here!" }, { "quote", "Quote this post!" } }; + private Dictionary AvailablePlaceholders { get; set; } = new() + { + { "default", "What's on your mind?" }, + { "reply", "Reply goes here!" }, + { "quote", "Quote this post!" } + }; RenderFragment DropdownIcon(NoteVisibility vis) { @@ -117,7 +122,9 @@ new DropdownElement { #pragma warning disable BL0005 // Setting this outside the component is fine until this is reworked - Icon = DropdownIcon(vis), Content = DropdownContent(vis), Selection = vis + Icon = DropdownIcon(vis), + Content = DropdownContent(vis), + Selection = vis #pragma warning restore BL0005 }) .ToList(); @@ -210,9 +217,14 @@ private void ResetState() { - ReplyOrQuote = null; - Attachments = new List(); - NoteDraft = new NoteCreateRequest { Text = "", Visibility = NoteVisibility.Followers, Cw = null }; + ReplyOrQuote = null; + Attachments = new List(); + NoteDraft = new NoteCreateRequest + { + Text = "", + Visibility = NoteVisibility.Followers, + Cw = null + }; TextPlaceholder = AvailablePlaceholders["default"]; } diff --git a/Iceshrimp.Frontend/Components/EmojiPicker.razor b/Iceshrimp.Frontend/Components/EmojiPicker.razor index ec9d172a..69d86cd3 100644 --- a/Iceshrimp.Frontend/Components/EmojiPicker.razor +++ b/Iceshrimp.Frontend/Components/EmojiPicker.razor @@ -18,8 +18,8 @@ @code { - private EventCallback OnEmojiSelect { get; set; } - private List EmojiList { get; set; } = []; + private EventCallback OnEmojiSelect { get; set; } + private List EmojiList { get; set; } = []; private ElementReference EmojiPickerRef { get; set; } private float _top; private float _left; diff --git a/Iceshrimp.Frontend/Components/ErrorUi.razor b/Iceshrimp.Frontend/Components/ErrorUi.razor index 115a3fc0..1afa1cff 100644 --- a/Iceshrimp.Frontend/Components/ErrorUi.razor +++ b/Iceshrimp.Frontend/Components/ErrorUi.razor @@ -7,7 +7,7 @@ @inject NavigationManager Navigation; @inject VersionService Version; @inject InMemoryLogService LogService; -@inject IJSRuntime Js; +@inject IJSRuntime Js;

@Loc["Unhandled Exception has occured"]

@@ -40,8 +40,7 @@ }
@Loc["Logs"] - @Loc["These logs may contain sensitive information, please do not post them publicly.\n" + - "Providing them to developers upon request may help with debugging."] + @Loc["These logs may contain sensitive information, please do not post them publicly.\n" + "Providing them to developers upon request may help with debugging."]

                 @foreach (var line in _rawLog)
@@ -60,7 +59,7 @@
     [Parameter] [EditorRequired] public required Exception                   Exception { get; set; }
     private                                      IEnumerable         _logs   = [];
     private                                      IJSInProcessObjectReference _module = null!;
-    private                                      List _rawLog = null!;
+    private                                      List                _rawLog = null!;
 
     private void Reload()
     {
@@ -68,16 +67,14 @@
     }
 
     protected override async Task OnInitializedAsync()
-    { 
+    {
         _rawLog = LogService.GetLogs();
-        _module = (IJSInProcessObjectReference) await Js.InvokeAsync("import", "./Components/ErrorUi.razor.js");
-     }
-    
+        _module = (IJSInProcessObjectReference)await Js.InvokeAsync("import", "./Components/ErrorUi.razor.js");
+    }
 
     private void DownloadLogs()
     {
         var logBytes = LogService.GetLogs().SelectMany(p => Encoding.UTF8.GetBytes(p)).ToArray();
         _module.InvokeVoid("DownloadFile", "log.txt", "text/plain", logBytes);
     }
-    
 }
\ No newline at end of file
diff --git a/Iceshrimp.Frontend/Components/FollowButton.razor b/Iceshrimp.Frontend/Components/FollowButton.razor
index 0bec4037..19688f37 100644
--- a/Iceshrimp.Frontend/Components/FollowButton.razor
+++ b/Iceshrimp.Frontend/Components/FollowButton.razor
@@ -1,8 +1,8 @@
+@using Iceshrimp.Assets.PhosphorIcons
+@using Iceshrimp.Frontend.Core.Services
 @using Iceshrimp.Frontend.Localization
 @using Iceshrimp.Shared.Schemas.Web
 @using Microsoft.Extensions.Localization
-@using Iceshrimp.Assets.PhosphorIcons
-@using Iceshrimp.Frontend.Core.Services
 @inject IStringLocalizer Loc;
 @inject ApiService                     Api;