a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend] Code cleanup

+26 -30
-1
Iceshrimp.Backend/Controllers/Mastodon/Schemas/Entities/BiteEntity.cs
··· 1 - using Iceshrimp.Shared.Helpers; 2 1 using J = System.Text.Json.Serialization.JsonPropertyNameAttribute; 3 2 4 3 namespace Iceshrimp.Backend.Controllers.Mastodon.Schemas.Entities;
+1 -1
Iceshrimp.Backend/Controllers/Mastodon/Schemas/InstanceInfoV2Response.cs
··· 95 95 [J("blurhash")] public string? Blurhash => blurhash; 96 96 } 97 97 98 - public class InstanceTimelinesAccessConfiguration() 98 + public class InstanceTimelinesAccessConfiguration 99 99 { 100 100 [J("live_feeds")] public InstanceTimelineAccessConfiguration LiveFeeds => new("authenticated"); 101 101 [J("hashtag_feeds")] public InstanceTimelineAccessConfiguration HashtagFeeds => new("authenticated");
+2 -2
Iceshrimp.Backend/Controllers/Shared/Attributes/LinkPaginationAttribute.cs
··· 18 18 19 19 public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) 20 20 { 21 - ArgumentNullException.ThrowIfNull(context, nameof(context)); 22 - ArgumentNullException.ThrowIfNull(next, nameof(next)); 21 + ArgumentNullException.ThrowIfNull(context); 22 + ArgumentNullException.ThrowIfNull(next); 23 23 OnActionExecuting(context); 24 24 if (context.Result != null) return; 25 25 var result = await next();
-1
Iceshrimp.Backend/Controllers/Web/FeedController.cs
··· 1 1 using System.Net; 2 2 using System.Net.Mime; 3 - using System.Text; 4 3 using System.Xml; 5 4 using System.Xml.Serialization; 6 5 using Iceshrimp.Backend.Controllers.Shared.Attributes;
+1 -1
Iceshrimp.Backend/Controllers/Web/MiscController.cs
··· 71 71 { 72 72 var user = HttpContext.GetUserOrFail(); 73 73 74 - var unreadAnnouncements = await db.Announcements.AnyAsync(p => !p.ReadBy.Any(p => p == user)); 74 + var unreadAnnouncements = await db.Announcements.AnyAsync(p => p.ReadBy.All(i => i != user)); 75 75 76 76 var unreadNotifications = await db.Notifications.AnyAsync(p => p.Notifiee == user && !p.IsRead); 77 77
+1 -1
Iceshrimp.Backend/Controllers/Web/Renderers/AnnouncementRenderer.cs
··· 103 103 .GroupBy(p => p.AnnouncementId) 104 104 .ToDictionaryAsync(p => p.Key, p => p.Count()); 105 105 106 - var zeros = ids.Where(p => !counts.Keys.Contains(p)).ToDictionary(p => p, p => 0); 106 + var zeros = ids.Where(p => !counts.ContainsKey(p)).ToDictionary(p => p, _ => 0); 107 107 108 108 return counts.Concat(zeros).ToDictionary(); 109 109 }
+1 -1
Iceshrimp.Backend/Core/Extensions/ServiceExtensions.cs
··· 441 441 [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(DataProtectionKey))] 442 442 public EntityFrameworkCoreXmlRepositoryAsync(IServiceProvider services, ILoggerFactory loggerFactory) 443 443 { 444 - ArgumentNullException.ThrowIfNull(loggerFactory, nameof(loggerFactory)); 444 + ArgumentNullException.ThrowIfNull(loggerFactory); 445 445 _services = services ?? throw new ArgumentNullException(nameof(services)); 446 446 } 447 447
+1
Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs
··· 562 562 await reportSvc.CreateReportAsync(resolvedActor, userMatch, noteMatches, [], flag.Content ?? ""); 563 563 } 564 564 565 + [SuppressMessage("ReSharper", "ParameterOnlyUsedForPreconditionCheck.Local")] 565 566 private async Task HandleQuoteRequestAsync(ASQuoteRequest quoteRequest, User quoter) 566 567 { 567 568 if (quoter.IsLocalUser)
+5 -4
Iceshrimp.Backend/Core/Federation/ActivityStreams/LdHelpers.cs
··· 15 15 16 16 public static class LdHelpers 17 17 { 18 - private static readonly ActivitySource _activitySource = new("Iceshrimp.NET/LdHelpers", VersionHelpers.VersionInfo.Value.Version); 18 + private static readonly ActivitySource ActivitySource = new("Iceshrimp.NET/LdHelpers", VersionHelpers.VersionInfo.Value.Version); 19 19 20 20 private static readonly Dictionary<string, RemoteDocument> PreloadedContexts = new() 21 21 { ··· 72 72 73 73 private static RemoteDocument CustomLoader(Uri uri, JsonLdLoaderOptions jsonLdLoaderOptions) 74 74 { 75 - using var activity = _activitySource.StartActivity("Load Context"); 75 + // ReSharper disable once ExplicitCallerInfoArgument 76 + using var activity = ActivitySource.StartActivity("Load Context"); 76 77 activity?.AddTag("uri", uri); 77 78 78 79 var key = uri.AbsolutePath == "/schemas/litepub-0.1.jsonld" ? "litepub-0.1" : uri.ToString(); ··· 140 141 141 142 public static JObject Compact(JToken? json) 142 143 { 143 - using var _ = _activitySource.StartActivity(); 144 + using var _ = ActivitySource.StartActivity(); 144 145 return JsonLdProcessor.Compact(json, FederationContext, Options); 145 146 } 146 147 147 148 public static JArray Expand(JToken? json) 148 149 { 149 - using var _ = _activitySource.StartActivity(); 150 + using var _ = ActivitySource.StartActivity(); 150 151 return JsonLdProcessor.Expand(json, Options); 151 152 } 152 153
-2
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASCollection.cs
··· 1 - using System.Diagnostics.CodeAnalysis; 2 1 using Iceshrimp.Backend.Core.Configuration; 3 2 using Newtonsoft.Json; 4 3 using Newtonsoft.Json.Linq; ··· 15 14 [JsonConstructor] 16 15 public ASCollection(bool withType = true) => Type = withType ? ObjectType : null; 17 16 18 - [SetsRequiredMembers] 19 17 public ASCollection(string id, bool withType = false) : this(withType) => Id = id; 20 18 21 19 [J($"{Constants.ActivityStreamsNs}#attributedTo")]
-2
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASCollectionPage.cs
··· 1 - using System.Diagnostics.CodeAnalysis; 2 1 using Iceshrimp.Backend.Core.Configuration; 3 2 using Newtonsoft.Json; 4 3 using J = Newtonsoft.Json.JsonPropertyAttribute; ··· 14 13 [JsonConstructor] 15 14 public ASCollectionPage(bool withType = true) => Type = withType ? ObjectType : null; 16 15 17 - [SetsRequiredMembers] 18 16 public ASCollectionPage(string id, bool withType = false) : this(withType) => Id = id; 19 17 20 18 [J($"{Constants.ActivityStreamsNs}#items")]
-2
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollection.cs
··· 1 - using System.Diagnostics.CodeAnalysis; 2 1 using Iceshrimp.Backend.Core.Configuration; 3 2 using Newtonsoft.Json; 4 3 using Newtonsoft.Json.Linq; ··· 14 13 [JsonConstructor] 15 14 public ASOrderedCollection(bool withType = true) => Type = withType ? ObjectType : null; 16 15 17 - [SetsRequiredMembers] 18 16 public ASOrderedCollection(string id, bool withType = false) : this(withType) => Id = id; 19 17 20 18 [J($"{Constants.ActivityStreamsNs}#items")]
-2
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASOrderedCollectionPage.cs
··· 1 - using System.Diagnostics.CodeAnalysis; 2 1 using Iceshrimp.Backend.Core.Configuration; 3 2 using Newtonsoft.Json; 4 3 using J = Newtonsoft.Json.JsonPropertyAttribute; ··· 13 12 [JsonConstructor] 14 13 public ASOrderedCollectionPage(bool withType = true) => Type = withType ? ObjectType : null; 15 14 16 - [SetsRequiredMembers] 17 15 public ASOrderedCollectionPage(string id, bool withType = false) : this(withType) => Id = id; 18 16 19 17 [J($"{Constants.ActivityStreamsNs}#items")]
+6 -4
Iceshrimp.Backend/Core/Federation/Cryptography/HttpSignature.cs
··· 12 12 13 13 public static class HttpSignature 14 14 { 15 - public static readonly TimeSpan MaxClockSkew = TimeSpan.FromMinutes(5); 16 - private static readonly ActivitySource _activitySource = new("Iceshrimp.NET/HttpSignature", VersionHelpers.VersionInfo.Value.Version); 15 + private static readonly TimeSpan MaxClockSkew = TimeSpan.FromMinutes(5); 16 + private static readonly ActivitySource ActivitySource = new("Iceshrimp.NET/HttpSignature", VersionHelpers.VersionInfo.Value.Version); 17 17 18 18 public static async Task<bool> VerifyAsync( 19 19 HttpRequest request, HttpSignatureHeader signature, ··· 24 24 throw new GracefulException(HttpStatusCode.Forbidden, "Request is missing required headers"); 25 25 26 26 // verify signature with "correct" query string behavior 27 - using var activity = _activitySource.StartActivity("HTTP Signature Verify"); 27 + // ReSharper disable once ExplicitCallerInfoArgument 28 + using var activity = ActivitySource.StartActivity("HTTP Signature Verify"); 28 29 activity?.AddTag("key", signature.KeyId); 29 30 30 31 var signingString = ··· 108 109 string key, string keyId 109 110 ) 110 111 { 111 - using var activity = _activitySource.StartActivity("HTTP Sign"); 112 + // ReSharper disable once ExplicitCallerInfoArgument 113 + using var activity = ActivitySource.StartActivity("HTTP Sign"); 112 114 activity?.AddTag("key", keyId); 113 115 114 116 ArgumentNullException.ThrowIfNull(request.RequestUri);
+5 -3
Iceshrimp.Backend/Core/Federation/Cryptography/LdSignature.cs
··· 18 18 19 19 public static class LdSignature 20 20 { 21 - private static readonly ActivitySource _activitySource = new("Iceshrimp.NET/LdSignature", VersionHelpers.VersionInfo.Value.Version); 21 + private static readonly ActivitySource ActivitySource = new("Iceshrimp.NET/LdSignature", VersionHelpers.VersionInfo.Value.Version); 22 22 23 23 public static Task<bool> VerifyAsync(JArray activity, JArray rawActivity, string key, string? keyId = null) 24 24 { ··· 31 31 32 32 public static async Task<bool> VerifyAsync(JObject activity, JObject rawActivity, string key, string? keyId = null) 33 33 { 34 - using var traceActivity = _activitySource.StartActivity("LD Signature Verify"); 34 + // ReSharper disable once ExplicitCallerInfoArgument 35 + using var traceActivity = ActivitySource.StartActivity("LD Signature Verify"); 35 36 traceActivity?.AddTag("key", keyId); 36 37 37 38 var options = activity[$"{Constants.W3IdSecurityNs}#signature"]; ··· 62 63 63 64 public static async Task<JObject> SignAsync(JObject activity, string key, string? creator) 64 65 { 65 - using var _ = _activitySource.StartActivity("LD Sign"); 66 + // ReSharper disable once ExplicitCallerInfoArgument 67 + using var _ = ActivitySource.StartActivity("LD Sign"); 66 68 67 69 var options = new SignatureOptions 68 70 {
+1 -1
Iceshrimp.Backend/Core/Services/QueueService.cs
··· 516 516 } 517 517 else 518 518 { 519 - _logger.LogTrace("Job in queue {queue} was delayed to {time} after {duration} ms, has been queued since {time}", 519 + _logger.LogTrace("Job in queue {queue} was delayed to {newTime} after {duration} ms, has been queued since {origTime}", 520 520 name, job.DelayedUntil.Value.ToLocalTime().ToStringIso8601Like(), job.Duration, 521 521 job.QueuedAt.ToLocalTime().ToStringIso8601Like()); 522 522 db.ChangeTracker.Clear();
+2 -2
Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs
··· 229 229 230 230 if (dryRun) 231 231 { 232 - logger.LogInformation("Finished validating {count} files, of which {count} would have been fixed up.", 232 + logger.LogInformation("Finished validating {fileCount} files, of which {fixupCount} would have been fixed up.", 233 233 progress, modified); 234 234 } 235 235 else 236 236 { 237 - logger.LogInformation("Finished validating {count} files, of which {count} have been fixed up.", 237 + logger.LogInformation("Finished validating {fileCount} files, of which {fixupCount} have been fixed up.", 238 238 progress, modified); 239 239 } 240 240 }