added shared inbox

This commit is contained in:
Nicolas Constant 2020-07-22 19:49:08 -04:00
parent 66630324d7
commit 1724d3a902
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688
4 changed files with 23 additions and 9 deletions

View file

@ -1,4 +1,5 @@
using BirdsiteLive.ActivityPub.Converters;
using System.Net;
using BirdsiteLive.ActivityPub.Converters;
using Newtonsoft.Json;
namespace BirdsiteLive.ActivityPub
@ -19,5 +20,6 @@ namespace BirdsiteLive.ActivityPub
public PublicKey publicKey { get; set; }
public Image icon { get; set; }
public Image image { get; set; }
public EndPoints endpoints { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace BirdsiteLive.ActivityPub
{
public class EndPoints
{
public string sharedInbox { get; set; }
}
}

View file

@ -27,18 +27,19 @@ namespace BirdsiteLive.Domain
private readonly IProcessFollowUser _processFollowUser;
private readonly IProcessUndoFollowUser _processUndoFollowUser;
private readonly InstanceSettings _instanceSettings;
private readonly ICryptoService _cryptoService;
private readonly IActivityPubService _activityPubService;
private readonly string _host;
#region Ctor
public UserService(InstanceSettings instanceSettings, ICryptoService cryptoService, IActivityPubService activityPubService, IProcessFollowUser processFollowUser, IProcessUndoFollowUser processUndoFollowUser)
{
_instanceSettings = instanceSettings;
_cryptoService = cryptoService;
_activityPubService = activityPubService;
_processFollowUser = processFollowUser;
_processUndoFollowUser = processUndoFollowUser;
_host = $"https://{instanceSettings.Domain.Replace("https://",string.Empty).Replace("http://", string.Empty).TrimEnd('/')}";
//_host = $"https://{instanceSettings.Domain.Replace("https://",string.Empty).Replace("http://", string.Empty).TrimEnd('/')}";
}
#endregion
@ -46,17 +47,17 @@ namespace BirdsiteLive.Domain
{
var user = new Actor
{
id = $"{_host}/users/{twitterUser.Acct}",
id = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}",
type = "Person",
preferredUsername = twitterUser.Acct,
name = twitterUser.Name,
inbox = $"{_host}/users/{twitterUser.Acct}/inbox",
inbox = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}/inbox",
summary = twitterUser.Description,
url = $"{_host}/@{twitterUser.Acct}",
url = $"https://{_instanceSettings.Domain}/@{twitterUser.Acct}",
publicKey = new PublicKey()
{
id = $"{_host}/users/{twitterUser.Acct}#main-key",
owner = $"{_host}/users/{twitterUser.Acct}",
id = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}#main-key",
owner = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}",
publicKeyPem = _cryptoService.GetUserPem(twitterUser.Acct)
},
icon = new Image
@ -68,6 +69,10 @@ namespace BirdsiteLive.Domain
{
mediaType = "image/jpeg",
url = twitterUser.ProfileBannerURL
},
endpoints = new EndPoints
{
sharedInbox = $"{_instanceSettings.Domain}/inbox"
}
};
return user;

View file

@ -19,7 +19,7 @@ namespace BirdsiteLive.Controllers
using (var reader = new StreamReader(Request.Body))
{
var body = await reader.ReadToEndAsync();
//System.IO.File.WriteAllText($@"C:\apdebug\inbox\{Guid.NewGuid()}.json", body);
}