This commit is contained in:
parent
374271d5a2
commit
b0a19fe668
9 changed files with 77 additions and 2 deletions
|
@ -51,6 +51,25 @@ public class UserRenderer(
|
||||||
var avatarAlt = data?.AvatarAlt.GetValueOrDefault(user.Id);
|
var avatarAlt = data?.AvatarAlt.GetValueOrDefault(user.Id);
|
||||||
var bannerAlt = data?.BannerAlt.GetValueOrDefault(user.Id);
|
var bannerAlt = data?.BannerAlt.GetValueOrDefault(user.Id);
|
||||||
|
|
||||||
|
string? favicon;
|
||||||
|
string? softwareName;
|
||||||
|
string? softwareVersion;
|
||||||
|
if (user.IsRemoteUser)
|
||||||
|
{
|
||||||
|
var instInfo = await db.Instances
|
||||||
|
.Where(p => p.Host == user.Host)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
favicon = instInfo?.FaviconUrl;
|
||||||
|
softwareName = instInfo?.SoftwareName;
|
||||||
|
softwareVersion = instInfo?.SoftwareVersion;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
favicon = "http://localhost:3000/_content/Iceshrimp.Assets.Branding/favicon.wy3b9djz5j.png";
|
||||||
|
softwareName = "iceshrimp";
|
||||||
|
softwareVersion = config.Value.Version;
|
||||||
|
}
|
||||||
|
|
||||||
var res = new AccountEntity
|
var res = new AccountEntity
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
|
@ -82,7 +101,24 @@ public class UserRenderer(
|
||||||
? new PleromaUserExtensions
|
? new PleromaUserExtensions
|
||||||
{
|
{
|
||||||
IsAdmin = user.IsAdmin,
|
IsAdmin = user.IsAdmin,
|
||||||
IsModerator = user.IsModerator
|
IsModerator = user.IsModerator,
|
||||||
|
Favicon = favicon!
|
||||||
|
} : null,
|
||||||
|
Akkoma = flags?.IsPleroma.Value == true
|
||||||
|
? new AkkomaUserExtensions
|
||||||
|
{
|
||||||
|
Instance = new AkkomaInstanceEntity
|
||||||
|
{
|
||||||
|
Name = user.Host ?? config.Value.AccountDomain,
|
||||||
|
NodeInfo = new AkkomaNodeInfoEntity
|
||||||
|
{
|
||||||
|
Software = new AkkomaNodeInfoSoftwareEntity
|
||||||
|
{
|
||||||
|
Name = softwareName,
|
||||||
|
Version = softwareVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} : null
|
} : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class AccountEntity : IIdentifiable
|
||||||
[J("id")] public required string Id { get; set; }
|
[J("id")] public required string Id { get; set; }
|
||||||
[J("last_status_at")] public string? LastStatusAt { get; set; }
|
[J("last_status_at")] public string? LastStatusAt { get; set; }
|
||||||
[J("pleroma")] public required PleromaUserExtensions? Pleroma { get; set; }
|
[J("pleroma")] public required PleromaUserExtensions? Pleroma { get; set; }
|
||||||
|
[J("akkoma")] public required AkkomaUserExtensions? Akkoma { get; set; }
|
||||||
|
|
||||||
[J("avatar_description")] public required string AvatarDescription { get; set; }
|
[J("avatar_description")] public required string AvatarDescription { get; set; }
|
||||||
[J("header_description")] public required string HeaderDescription { get; set; }
|
[J("header_description")] public required string HeaderDescription { get; set; }
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
|
||||||
|
|
||||||
|
public class AkkomaInstanceEntity
|
||||||
|
{
|
||||||
|
[J("name")] public required string Name { get; set; }
|
||||||
|
[J("nodeinfo")] public required AkkomaNodeInfoEntity NodeInfo { get; set; }
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
|
||||||
|
|
||||||
|
public class AkkomaNodeInfoEntity
|
||||||
|
{
|
||||||
|
[J("software")] public required AkkomaNodeInfoSoftwareEntity Software { get; set; }
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
|
||||||
|
|
||||||
|
public class AkkomaNodeInfoSoftwareEntity
|
||||||
|
{
|
||||||
|
[J("name")] public required string? Name { get; set; }
|
||||||
|
[J("version")] public required string? Version { get; set; }
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
|
||||||
|
|
||||||
|
[Keyless]
|
||||||
|
public class AkkomaUserExtensions
|
||||||
|
{
|
||||||
|
[J("instance")] public required AkkomaInstanceEntity Instance { get; set; }
|
||||||
|
}
|
|
@ -8,4 +8,5 @@ public class PleromaUserExtensions
|
||||||
{
|
{
|
||||||
[J("is_admin")] public required bool IsAdmin { get; set; }
|
[J("is_admin")] public required bool IsAdmin { get; set; }
|
||||||
[J("is_moderator")] public required bool IsModerator { get; set; }
|
[J("is_moderator")] public required bool IsModerator { get; set; }
|
||||||
|
[J("favicon")] public required string Favicon { get; set; }
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": false,
|
"launchBrowser": false,
|
||||||
"externalUrlConfiguration": true,
|
"externalUrlConfiguration": true,
|
||||||
|
"commandLineArgs": "--migrate-and-start",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ ProxyRemoteMedia = true
|
||||||
|
|
||||||
[Storage:Local]
|
[Storage:Local]
|
||||||
;; Path where media is stored at. Must be writable for the service user.
|
;; Path where media is stored at. Must be writable for the service user.
|
||||||
Path = /path/to/media/location
|
Path = /home/luke/Documents/shrimp
|
||||||
|
|
||||||
[Storage:ObjectStorage]
|
[Storage:ObjectStorage]
|
||||||
;;Endpoint = endpoint.example.org
|
;;Endpoint = endpoint.example.org
|
||||||
|
|
Loading…
Add table
Reference in a new issue