From 5e0feab2b3dcf72e5cbdb8e8b6b44414f1c246a9 Mon Sep 17 00:00:00 2001 From: uwaa Date: Wed, 18 Dec 2024 13:08:27 +0000 Subject: [PATCH] pleroma: add webfinger address and instance --- Pleroma/Models/Account.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Pleroma/Models/Account.cs b/Pleroma/Models/Account.cs index 22bc4f7..dd23e3b 100644 --- a/Pleroma/Models/Account.cs +++ b/Pleroma/Models/Account.cs @@ -41,7 +41,25 @@ public class Account [JsonPropertyName("username")] public string Username { get; set; } = null!; - public override string ToString() => $"@{Username}"; + [JsonPropertyName("acct")] + public string Webfinger { get; set; } = null!; + + public string? Instance + { + get + { + if (Webfinger == null) + return null; + + int spl = Webfinger.IndexOf('@'); + if (spl == -1) + return null; + + return Webfinger[(spl + 1)..]; + } + } + + public override string ToString() => $"@{Webfinger}"; } [JsonConverter(typeof(AccountIDConverter))]