added shared inbox
This commit is contained in:
parent
66630324d7
commit
1724d3a902
4 changed files with 23 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
using BirdsiteLive.ActivityPub.Converters;
|
using System.Net;
|
||||||
|
using BirdsiteLive.ActivityPub.Converters;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BirdsiteLive.ActivityPub
|
namespace BirdsiteLive.ActivityPub
|
||||||
|
@ -19,5 +20,6 @@ namespace BirdsiteLive.ActivityPub
|
||||||
public PublicKey publicKey { get; set; }
|
public PublicKey publicKey { get; set; }
|
||||||
public Image icon { get; set; }
|
public Image icon { get; set; }
|
||||||
public Image image { get; set; }
|
public Image image { get; set; }
|
||||||
|
public EndPoints endpoints { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
src/BirdsiteLive.ActivityPub/Models/EndPoints.cs
Normal file
7
src/BirdsiteLive.ActivityPub/Models/EndPoints.cs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
namespace BirdsiteLive.ActivityPub
|
||||||
|
{
|
||||||
|
public class EndPoints
|
||||||
|
{
|
||||||
|
public string sharedInbox { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,18 +27,19 @@ namespace BirdsiteLive.Domain
|
||||||
private readonly IProcessFollowUser _processFollowUser;
|
private readonly IProcessFollowUser _processFollowUser;
|
||||||
private readonly IProcessUndoFollowUser _processUndoFollowUser;
|
private readonly IProcessUndoFollowUser _processUndoFollowUser;
|
||||||
|
|
||||||
|
private readonly InstanceSettings _instanceSettings;
|
||||||
private readonly ICryptoService _cryptoService;
|
private readonly ICryptoService _cryptoService;
|
||||||
private readonly IActivityPubService _activityPubService;
|
private readonly IActivityPubService _activityPubService;
|
||||||
private readonly string _host;
|
|
||||||
|
|
||||||
#region Ctor
|
#region Ctor
|
||||||
public UserService(InstanceSettings instanceSettings, ICryptoService cryptoService, IActivityPubService activityPubService, IProcessFollowUser processFollowUser, IProcessUndoFollowUser processUndoFollowUser)
|
public UserService(InstanceSettings instanceSettings, ICryptoService cryptoService, IActivityPubService activityPubService, IProcessFollowUser processFollowUser, IProcessUndoFollowUser processUndoFollowUser)
|
||||||
{
|
{
|
||||||
|
_instanceSettings = instanceSettings;
|
||||||
_cryptoService = cryptoService;
|
_cryptoService = cryptoService;
|
||||||
_activityPubService = activityPubService;
|
_activityPubService = activityPubService;
|
||||||
_processFollowUser = processFollowUser;
|
_processFollowUser = processFollowUser;
|
||||||
_processUndoFollowUser = processUndoFollowUser;
|
_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
|
#endregion
|
||||||
|
|
||||||
|
@ -46,17 +47,17 @@ namespace BirdsiteLive.Domain
|
||||||
{
|
{
|
||||||
var user = new Actor
|
var user = new Actor
|
||||||
{
|
{
|
||||||
id = $"{_host}/users/{twitterUser.Acct}",
|
id = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}",
|
||||||
type = "Person",
|
type = "Person",
|
||||||
preferredUsername = twitterUser.Acct,
|
preferredUsername = twitterUser.Acct,
|
||||||
name = twitterUser.Name,
|
name = twitterUser.Name,
|
||||||
inbox = $"{_host}/users/{twitterUser.Acct}/inbox",
|
inbox = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}/inbox",
|
||||||
summary = twitterUser.Description,
|
summary = twitterUser.Description,
|
||||||
url = $"{_host}/@{twitterUser.Acct}",
|
url = $"https://{_instanceSettings.Domain}/@{twitterUser.Acct}",
|
||||||
publicKey = new PublicKey()
|
publicKey = new PublicKey()
|
||||||
{
|
{
|
||||||
id = $"{_host}/users/{twitterUser.Acct}#main-key",
|
id = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}#main-key",
|
||||||
owner = $"{_host}/users/{twitterUser.Acct}",
|
owner = $"https://{_instanceSettings.Domain}/users/{twitterUser.Acct}",
|
||||||
publicKeyPem = _cryptoService.GetUserPem(twitterUser.Acct)
|
publicKeyPem = _cryptoService.GetUserPem(twitterUser.Acct)
|
||||||
},
|
},
|
||||||
icon = new Image
|
icon = new Image
|
||||||
|
@ -68,6 +69,10 @@ namespace BirdsiteLive.Domain
|
||||||
{
|
{
|
||||||
mediaType = "image/jpeg",
|
mediaType = "image/jpeg",
|
||||||
url = twitterUser.ProfileBannerURL
|
url = twitterUser.ProfileBannerURL
|
||||||
|
},
|
||||||
|
endpoints = new EndPoints
|
||||||
|
{
|
||||||
|
sharedInbox = $"{_instanceSettings.Domain}/inbox"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return user;
|
return user;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace BirdsiteLive.Controllers
|
||||||
using (var reader = new StreamReader(Request.Body))
|
using (var reader = new StreamReader(Request.Body))
|
||||||
{
|
{
|
||||||
var body = await reader.ReadToEndAsync();
|
var body = await reader.ReadToEndAsync();
|
||||||
|
//System.IO.File.WriteAllText($@"C:\apdebug\inbox\{Guid.NewGuid()}.json", body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue