conversion to System.Text.Json
This commit is contained in:
parent
6dc006bc66
commit
8b5d03e0f1
23 changed files with 77 additions and 107 deletions
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using BirdsiteLive.Common.Settings;
|
using BirdsiteLive.Common.Settings;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BSLManager.Tools
|
namespace BSLManager.Tools
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ namespace BSLManager.Tools
|
||||||
if (!File.Exists(LocalFileName)) return null;
|
if (!File.Exists(LocalFileName)) return null;
|
||||||
|
|
||||||
var jsonContent = File.ReadAllText(LocalFileName);
|
var jsonContent = File.ReadAllText(LocalFileName);
|
||||||
var content = JsonConvert.DeserializeObject<LocalSettingsData>(jsonContent);
|
var content = JsonSerializer.Deserialize<LocalSettingsData>(jsonContent);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
@ -105,7 +105,7 @@ namespace BSLManager.Tools
|
||||||
|
|
||||||
private void SaveLocalSettings(LocalSettingsData data)
|
private void SaveLocalSettings(LocalSettingsData data)
|
||||||
{
|
{
|
||||||
var jsonContent = JsonConvert.SerializeObject(data);
|
var jsonContent = JsonSerializer.Serialize(data);
|
||||||
File.WriteAllText(LocalFileName, jsonContent);
|
File.WriteAllText(LocalFileName, jsonContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using BirdsiteLive.ActivityPub.Models;
|
using BirdsiteLive.ActivityPub.Models;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
|
@ -10,22 +11,21 @@ namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var activity = JsonConvert.DeserializeObject<Activity>(json);
|
var activity = JsonSerializer.Deserialize<Activity>(json);
|
||||||
switch (activity.type)
|
switch (activity.type)
|
||||||
{
|
{
|
||||||
case "Follow":
|
case "Follow":
|
||||||
return JsonConvert.DeserializeObject<ActivityFollow>(json);
|
return JsonSerializer.Deserialize<ActivityFollow>(json);
|
||||||
case "Undo":
|
case "Undo":
|
||||||
var a = JsonConvert.DeserializeObject<ActivityUndo>(json);
|
var a = JsonSerializer.Deserialize<ActivityUndo>(json);
|
||||||
if(a.apObject.type == "Follow")
|
if(a.apObject.type == "Follow")
|
||||||
return JsonConvert.DeserializeObject<ActivityUndoFollow>(json);
|
return JsonSerializer.Deserialize<ActivityUndoFollow>(json);
|
||||||
break;
|
break;
|
||||||
case "Delete":
|
case "Delete":
|
||||||
return JsonConvert.DeserializeObject<ActivityDelete>(json);
|
return JsonSerializer.Deserialize<ActivityDelete>(json);
|
||||||
case "Accept":
|
case "Accept":
|
||||||
var accept = JsonConvert.DeserializeObject<ActivityAccept>(json);
|
var accept = JsonSerializer.Deserialize<ActivityAccept>(json);
|
||||||
//var acceptType = JsonConvert.DeserializeObject<Activity>(accept.apObject);
|
switch (accept.apObject.type)
|
||||||
switch ((accept.apObject as dynamic).type.ToString())
|
|
||||||
{
|
{
|
||||||
case "Follow":
|
case "Follow":
|
||||||
var acceptFollow = new ActivityAcceptFollow()
|
var acceptFollow = new ActivityAcceptFollow()
|
||||||
|
@ -34,13 +34,13 @@ namespace BirdsiteLive.ActivityPub
|
||||||
id = accept.id,
|
id = accept.id,
|
||||||
actor = accept.actor,
|
actor = accept.actor,
|
||||||
context = accept.context,
|
context = accept.context,
|
||||||
apObject = new ActivityFollow()
|
apObject = new NestedActivity()
|
||||||
{
|
{
|
||||||
id = (accept.apObject as dynamic).id?.ToString(),
|
id = accept.apObject.id,
|
||||||
type = (accept.apObject as dynamic).type?.ToString(),
|
type = accept.apObject.type,
|
||||||
actor = (accept.apObject as dynamic).actor?.ToString(),
|
actor = accept.apObject.actor,
|
||||||
context = (accept.apObject as dynamic).context?.ToString(),
|
context = accept.apObject.context,
|
||||||
apObject = (accept.apObject as dynamic).@object?.ToString()
|
apObject = accept.apObject.apObject,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return acceptFollow;
|
return acceptFollow;
|
||||||
|
@ -58,7 +58,7 @@ namespace BirdsiteLive.ActivityPub
|
||||||
|
|
||||||
private class Ac : Activity
|
private class Ac : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public Activity apObject { get; set; }
|
public Activity apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub.Converters
|
|
||||||
{
|
|
||||||
public class ContextArrayConverter : JsonConverter
|
|
||||||
{
|
|
||||||
public override bool CanWrite { get { return false; } }
|
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
|
||||||
{
|
|
||||||
var result = new List<string>();
|
|
||||||
|
|
||||||
var list = serializer.Deserialize<List<object>>(reader);
|
|
||||||
foreach (var l in list)
|
|
||||||
{
|
|
||||||
if (l is string s)
|
|
||||||
result.Add(s);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var str = JsonConvert.SerializeObject(l);
|
|
||||||
result.Add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanConvert(Type objectType)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +1,16 @@
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class Activity
|
public class Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("@context")]
|
[JsonPropertyName("@context")]
|
||||||
public object context { get; set; }
|
public object context { get; set; }
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
public string actor { get; set; }
|
public string actor { get; set; }
|
||||||
|
|
||||||
//[JsonProperty("object")]
|
//[JsonPropertyName("object")]
|
||||||
//public string apObject { get; set; }
|
//public string apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityAccept : Activity
|
public class ActivityAccept : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public object apObject { get; set; }
|
public NestedActivity apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityAcceptFollow : Activity
|
public class ActivityAcceptFollow : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public ActivityFollow apObject { get; set; }
|
public NestedActivity apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityAcceptUndoFollow : Activity
|
public class ActivityAcceptUndoFollow : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public ActivityUndoFollow apObject { get; set; }
|
public ActivityUndoFollow apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using BirdsiteLive.ActivityPub.Models;
|
||||||
using BirdsiteLive.ActivityPub.Models;
|
using System.Text.Json.Serialization;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
|
@ -10,7 +9,7 @@ namespace BirdsiteLive.ActivityPub
|
||||||
public string[] to { get; set; }
|
public string[] to { get; set; }
|
||||||
public string[] cc { get; set; }
|
public string[] cc { get; set; }
|
||||||
|
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public Note apObject { get; set; }
|
public Note apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub.Models
|
namespace BirdsiteLive.ActivityPub.Models
|
||||||
{
|
{
|
||||||
public class ActivityDelete : Activity
|
public class ActivityDelete : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public object apObject { get; set; }
|
public string apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityFollow : Activity
|
public class ActivityFollow : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public string apObject { get; set; }
|
public string apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityRejectFollow : Activity
|
public class ActivityRejectFollow : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public ActivityFollow apObject { get; set; }
|
public ActivityFollow apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityUndo : Activity
|
public class ActivityUndo : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public Activity apObject { get; set; }
|
public Activity apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class ActivityUndoFollow : Activity
|
public class ActivityUndoFollow : Activity
|
||||||
{
|
{
|
||||||
[JsonProperty("object")]
|
[JsonPropertyName("object")]
|
||||||
public ActivityFollow apObject { get; set; }
|
public ActivityFollow apObject { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,12 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using BirdsiteLive.ActivityPub.Converters;
|
using BirdsiteLive.ActivityPub.Converters;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
{
|
{
|
||||||
public class Actor
|
public class Actor
|
||||||
{
|
{
|
||||||
//[JsonPropertyName("@context")]
|
[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 string[] context { get; set; } = new[] { "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1" };
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
using BirdsiteLive.ActivityPub.Converters;
|
using BirdsiteLive.ActivityPub.Converters;
|
||||||
using Newtonsoft.Json;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub.Models
|
namespace BirdsiteLive.ActivityPub.Models
|
||||||
{
|
{
|
||||||
public class Followers
|
public class Followers
|
||||||
{
|
{
|
||||||
[JsonProperty("@context")]
|
[JsonPropertyName("@context")]
|
||||||
[JsonConverter(typeof(ContextArrayConverter))]
|
|
||||||
public string context { get; set; } = "https://www.w3.org/ns/activitystreams";
|
public string context { get; set; } = "https://www.w3.org/ns/activitystreams";
|
||||||
|
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
16
src/BirdsiteLive.ActivityPub/Models/NestedActivity.cs
Normal file
16
src/BirdsiteLive.ActivityPub/Models/NestedActivity.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace BirdsiteLive.ActivityPub
|
||||||
|
{
|
||||||
|
public class NestedActivity
|
||||||
|
{
|
||||||
|
[JsonPropertyName("@context")]
|
||||||
|
public object context { get; set; }
|
||||||
|
public string id { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public string actor { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("object")]
|
||||||
|
public string apObject { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,10 @@
|
||||||
using BirdsiteLive.ActivityPub.Converters;
|
using System.Text.Json.Serialization;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub.Models
|
namespace BirdsiteLive.ActivityPub.Models
|
||||||
{
|
{
|
||||||
public class Note
|
public class Note
|
||||||
{
|
{
|
||||||
[JsonProperty("@context")]
|
[JsonPropertyName("@context")]
|
||||||
[JsonConverter(typeof(ContextArrayConverter))]
|
|
||||||
public string[] context { get; set; } = new[] { "https://www.w3.org/ns/activitystreams" };
|
public string[] context { get; set; } = new[] { "https://www.w3.org/ns/activitystreams" };
|
||||||
|
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
|
@ -4,13 +4,14 @@ using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BirdsiteLive.ActivityPub;
|
using BirdsiteLive.ActivityPub;
|
||||||
using BirdsiteLive.ActivityPub.Converters;
|
using BirdsiteLive.ActivityPub.Converters;
|
||||||
using BirdsiteLive.ActivityPub.Models;
|
using BirdsiteLive.ActivityPub.Models;
|
||||||
using BirdsiteLive.Common.Settings;
|
using BirdsiteLive.Common.Settings;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.Domain
|
namespace BirdsiteLive.Domain
|
||||||
{
|
{
|
||||||
|
@ -52,7 +53,7 @@ namespace BirdsiteLive.Domain
|
||||||
|
|
||||||
var content = await result.Content.ReadAsStringAsync();
|
var content = await result.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var actor = JsonConvert.DeserializeObject<Actor>(content);
|
var actor = JsonSerializer.Deserialize<Actor>(content);
|
||||||
if (string.IsNullOrWhiteSpace(actor.url)) actor.url = objectId;
|
if (string.IsNullOrWhiteSpace(actor.url)) actor.url = objectId;
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ namespace BirdsiteLive.Domain
|
||||||
if (!string.IsNullOrWhiteSpace(inbox))
|
if (!string.IsNullOrWhiteSpace(inbox))
|
||||||
usedInbox = inbox;
|
usedInbox = inbox;
|
||||||
|
|
||||||
var json = JsonConvert.SerializeObject(data, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
var json = JsonSerializer.Serialize(data, new JsonSerializerOptions() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull });
|
||||||
|
|
||||||
var date = DateTime.UtcNow.ToUniversalTime();
|
var date = DateTime.UtcNow.ToUniversalTime();
|
||||||
var httpDate = date.ToString("r");
|
var httpDate = date.ToString("r");
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace BirdsiteLive.Domain
|
||||||
id = $"{activity.apObject}#accepts/follows/{Guid.NewGuid()}",
|
id = $"{activity.apObject}#accepts/follows/{Guid.NewGuid()}",
|
||||||
type = "Accept",
|
type = "Accept",
|
||||||
actor = activity.apObject,
|
actor = activity.apObject,
|
||||||
apObject = new ActivityFollow()
|
apObject = new NestedActivity()
|
||||||
{
|
{
|
||||||
id = activity.id,
|
id = activity.id,
|
||||||
type = activity.type,
|
type = activity.type,
|
||||||
|
|
|
@ -10,7 +10,6 @@ using BirdsiteLive.Common.Settings;
|
||||||
using BirdsiteLive.Domain;
|
using BirdsiteLive.Domain;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.Controllers
|
namespace BirdsiteLive.Controllers
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -19,7 +20,6 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BirdsiteLive.Controllers
|
namespace BirdsiteLive.Controllers
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ namespace BirdsiteLive.Controllers
|
||||||
if (isSaturated) return new ObjectResult("Too Many Requests") { StatusCode = 429 };
|
if (isSaturated) return new ObjectResult("Too Many Requests") { StatusCode = 429 };
|
||||||
if (notFound) return NotFound();
|
if (notFound) return NotFound();
|
||||||
var apUser = _userService.GetUser(user);
|
var apUser = _userService.GetUser(user);
|
||||||
var jsonApUser = JsonConvert.SerializeObject(apUser);
|
var jsonApUser = System.Text.Json.JsonSerializer.Serialize(apUser);
|
||||||
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ namespace BirdsiteLive.Controllers
|
||||||
|
|
||||||
if (r.Contains("application/activity+json"))
|
if (r.Contains("application/activity+json"))
|
||||||
{
|
{
|
||||||
var jsonApUser = JsonConvert.SerializeObject(status);
|
var jsonApUser = JsonSerializer.Serialize(status);
|
||||||
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ namespace BirdsiteLive.Controllers
|
||||||
|
|
||||||
var status = _statusService.GetActivity(id, tweet);
|
var status = _statusService.GetActivity(id, tweet);
|
||||||
|
|
||||||
var jsonApUser = JsonConvert.SerializeObject(status);
|
var jsonApUser = JsonSerializer.Serialize(status);
|
||||||
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ namespace BirdsiteLive.Controllers
|
||||||
{
|
{
|
||||||
id = $"https://{_instanceSettings.Domain}/users/{id}/followers"
|
id = $"https://{_instanceSettings.Domain}/users/{id}/followers"
|
||||||
};
|
};
|
||||||
var jsonApUser = JsonConvert.SerializeObject(followers);
|
var jsonApUser = JsonSerializer.Serialize(followers);
|
||||||
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"Instance__ParallelTwitterRequests": "0"
|
||||||
},
|
},
|
||||||
"applicationUrl": "http://localhost:5000"
|
"applicationUrl": "http://localhost:5000"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue