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/federation] Advertise quote permissions to Mastodon

Kopper 32a3c5b8 fdfcb806

+64 -3
+1
Iceshrimp.Backend/Core/Configuration/Constants.cs
··· 24 24 public const string MastodonNs = "http://joinmastodon.org/ns"; 25 25 public const string MisskeyNs = "https://misskey-hub.net/ns"; 26 26 public const string FedibirdNs = "http://fedibird.com/ns"; 27 + public const string GoToSocialNs = "https://gotosocial.org/ns"; 27 28 public static readonly string[] SystemUsers = ["instance.actor", "relay.actor"]; 28 29 29 30 public const string APMime = "application/activity+json";
+13 -2
Iceshrimp.Backend/Core/Federation/ActivityPub/NoteRenderer.cs
··· 143 143 MediaType = Constants.ASMime 144 144 }); 145 145 } 146 + 147 + var interactionPolicy = note.VisibilityIsPublicOrHome ? 148 + new ASInteractionPolicy 149 + { 150 + CanQuote = new ASInteractionSubPolicy 151 + { 152 + AutomaticApproval = [new ASObjectBase($"{Constants.ActivityStreamsNs}#Public")] 153 + } 154 + } : null; 146 155 147 156 if (note.HasPoll) 148 157 { ··· 190 199 MkQuote = quoteUri, 191 200 QuoteUri = quoteUri, 192 201 QuoteUrl = quoteUri, 202 + InteractionPolicy = interactionPolicy, 193 203 EndTime = endTime, 194 204 Closed = closed, 195 205 AnyOf = anyOf, 196 206 OneOf = oneOf, 197 207 VotersCount = poll.VotersCount, 198 - HtmlMfm = true 208 + HtmlMfm = true, 199 209 }; 200 210 } 201 211 } ··· 223 233 MkQuote = quoteUri, 224 234 QuoteUri = quoteUri, 225 235 QuoteUrl = quoteUri, 226 - HtmlMfm = true 236 + HtmlMfm = true, 237 + InteractionPolicy = interactionPolicy 227 238 }; 228 239 } 229 240 }
+14 -1
Iceshrimp.Backend/Core/Federation/ActivityStreams/Contexts/iceshrimp.json
··· 6 6 "toot": "http://joinmastodon.org/ns#", 7 7 "misskey": "https://misskey-hub.net/ns#", 8 8 "vcard": "http://www.w3.org/2006/vcard/ns#", 9 + "gts": "https://gotosocial.org/ns#", 9 10 10 11 "movedTo": { 11 12 "@id": "as:movedTo", ··· 49 50 "@id": "https://ns.pancakes.gay/as#pronouns", 50 51 "@container": "@language" 51 52 }, 52 - "htmlMfm": "https://w3id.org/fep/c16b#htmlMfm" 53 + "htmlMfm": "https://w3id.org/fep/c16b#htmlMfm", 54 + "interactionPolicy": { 55 + "@id": "gts:interactionPolicy", 56 + "@type": "@id" 57 + }, 58 + "canQuote": { 59 + "@id": "gts:canQuote", 60 + "@type": "@id" 61 + }, 62 + "automaticApproval": { 63 + "@id": "gts:automaticApproval", 64 + "@type": "@id" 65 + } 53 66 } 54 67 ] 55 68 }
+32
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASInteractionPolicy.cs
··· 1 + using Iceshrimp.Backend.Core.Configuration; 2 + using J = Newtonsoft.Json.JsonPropertyAttribute; 3 + using JC = Newtonsoft.Json.JsonConverterAttribute; 4 + 5 + namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 6 + 7 + public class ASInteractionPolicy 8 + { 9 + [J($"{Constants.GoToSocialNs}#canQuote")] 10 + [JC(typeof(ASInteractionSubPolicyConverter))] 11 + public ASInteractionSubPolicy? CanQuote { get; set; } 12 + 13 + public ASInteractionPolicy ShallowClone() 14 + { 15 + return (ASInteractionPolicy) MemberwiseClone(); 16 + } 17 + } 18 + 19 + public class ASInteractionPolicyConverter : ASSerializer.ListSingleObjectConverter<ASInteractionPolicy>; 20 + 21 + public class ASInteractionSubPolicy 22 + { 23 + [J($"{Constants.GoToSocialNs}#automaticApproval")] 24 + public List<ASObjectBase>? AutomaticApproval { get; set; } 25 + 26 + public ASInteractionSubPolicy ShallowClone() 27 + { 28 + return (ASInteractionSubPolicy) MemberwiseClone(); 29 + } 30 + } 31 + 32 + public class ASInteractionSubPolicyConverter : ASSerializer.ListSingleObjectConverter<ASInteractionSubPolicy>;
+4
Iceshrimp.Backend/Core/Federation/ActivityStreams/Types/ASNote.cs
··· 98 98 [J($"{Constants.ActivityStreamsNs}#context")] 99 99 [JC(typeof(ASCollectionConverter))] 100 100 public ASCollection? Context { get; set; } 101 + 102 + [J($"{Constants.GoToSocialNs}#interactionPolicy")] 103 + [JC(typeof(ASInteractionPolicyConverter))] 104 + public ASInteractionPolicy? InteractionPolicy { get; set; } 101 105 102 106 public Note.NoteVisibility GetVisibility(User actor) 103 107 {