Browse Source

Adjust @context, always specify the Activity.DefaultContext, update README

master
Pasture Pastureson 7 months ago
parent
commit
f774cade0e
5 changed files with 25 additions and 6 deletions
  1. +1
    -1
      README.md
  2. +20
    -2
      src/BirdsiteLive.ActivityPub/Models/Activity.cs
  3. +1
    -1
      src/BirdsiteLive.ActivityPub/Models/Actor.cs
  4. +1
    -1
      src/BirdsiteLive.ActivityPub/Models/Followers.cs
  5. +2
    -1
      src/BirdsiteLive.ActivityPub/Models/Note.cs

+ 1
- 1
README.md View File

@ -1,4 +1,4 @@
This project is a *fork* of [the original BirdsiteLIVE from NicolasConstant](https://github.com/NicolasConstant/BirdsiteLive). Changes made in this fork include:
This project is a *fork* of [the original BirdsiteLIVE from NicolasConstant](https://github.com/NicolasConstant/BirdsiteLive). This fork runs in production on [a large BirdsiteLIVE instance](https://twtr.plus). Changes made in this fork include:
* Rework About page entirely - also disclose unlisted accounts and federation restrictions
* Cache Tweets so that, for example, Announces do not hit rate limits


+ 20
- 2
src/BirdsiteLive.ActivityPub/Models/Activity.cs View File

@ -1,12 +1,30 @@
using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace BirdsiteLive.ActivityPub
{
public class Activity
{
[Newtonsoft.Json.JsonIgnore]
public static readonly object[] DefaultContext = new object[] {
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
new Dictionary<string, string>
{
{ "Emoji", "toot:Emoji" },
{ "Hashtag", "as:Hashtag" },
{ "PropertyValue", "schema:PropertyValue" },
{ "value", "schema:value" },
{ "sensitive", "as:sensitive" },
{ "schema", "http://schema.org#" },
{ "toot", "https://joinmastodon.org/ns#" }
}
};
[JsonProperty("@context")]
public object context { get; set; }
public object context { get; set; } = DefaultContext;
public string id { get; set; }
public string type { get; set; }
public string actor { get; set; }


+ 1
- 1
src/BirdsiteLive.ActivityPub/Models/Actor.cs View File

@ -12,7 +12,7 @@ namespace BirdsiteLive.ActivityPub
//[JsonPropertyName("@context")]
[JsonProperty("@context")]
[JsonConverter(typeof(ContextArrayConverter))]
public string[] context { get; set; } = new[] { "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1" };
public object[] context { get; set; } = Activity.DefaultContext;
public string id { get; set; }
public string type { get; set; }
public string followers { get; set; }


+ 1
- 1
src/BirdsiteLive.ActivityPub/Models/Followers.cs View File

@ -7,7 +7,7 @@ namespace BirdsiteLive.ActivityPub.Models
{
[JsonProperty("@context")]
[JsonConverter(typeof(ContextArrayConverter))]
public string context { get; set; } = "https://www.w3.org/ns/activitystreams";
public object[] context { get; set; } = Activity.DefaultContext;
public string id { get; set; }
public string type { get; set; } = "OrderedCollection";


+ 2
- 1
src/BirdsiteLive.ActivityPub/Models/Note.cs View File

@ -1,5 +1,6 @@
using BirdsiteLive.ActivityPub.Converters;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace BirdsiteLive.ActivityPub.Models
{
@ -7,7 +8,7 @@ namespace BirdsiteLive.ActivityPub.Models
{
[JsonProperty("@context")]
[JsonConverter(typeof(ContextArrayConverter))]
public string[] context { get; set; } = new[] { "https://www.w3.org/ns/activitystreams" };
public object[] context { get; set; } = Activity.DefaultContext;
public string id { get; set; }
public string type { get; } = "Note";


Loading…
Cancel
Save