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

This commit is contained in:
Miss Pasture 2022-01-25 18:53:51 -05:00
parent 7a915f51e4
commit f774cade0e
5 changed files with 25 additions and 6 deletions

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

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; }

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; }

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";

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";