From 6aef12e8258de195cc13800a1c2b1e5bf28c5c04 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 9 Jan 2021 22:52:52 -0500 Subject: [PATCH] clean up --- src/BirdsiteLive.Domain/ActivityPubService.cs | 3 --- src/BirdsiteLive.Domain/StatusService.cs | 10 ++-------- src/BirdsiteLive/Controllers/WellKnownController.cs | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/BirdsiteLive.Domain/ActivityPubService.cs b/src/BirdsiteLive.Domain/ActivityPubService.cs index 16d9610..3fc17e6 100644 --- a/src/BirdsiteLive.Domain/ActivityPubService.cs +++ b/src/BirdsiteLive.Domain/ActivityPubService.cs @@ -48,10 +48,7 @@ namespace BirdsiteLive.Domain public async Task PostNewNoteActivity(Note note, string username, string noteId, string targetHost, string targetInbox) { - //var actor = $"https://{_instanceSettings.Domain}/users/{username}"; var actor = UrlFactory.GetActorUrl(_instanceSettings.Domain, username); - - //var noteUri = $"https://{_instanceSettings.Domain}/users/{username}/statuses/{noteId}"; var noteUri = UrlFactory.GetNoteUrl(_instanceSettings.Domain, username, noteId); var now = DateTime.UtcNow; diff --git a/src/BirdsiteLive.Domain/StatusService.cs b/src/BirdsiteLive.Domain/StatusService.cs index d86512a..ab48e92 100644 --- a/src/BirdsiteLive.Domain/StatusService.cs +++ b/src/BirdsiteLive.Domain/StatusService.cs @@ -34,12 +34,8 @@ namespace BirdsiteLive.Domain public Note GetStatus(string username, ExtractedTweet tweet) { - //var actorUrl = $"https://{_instanceSettings.Domain}/users/{username}"; var actorUrl = UrlFactory.GetActorUrl(_instanceSettings.Domain, username); - //var noteId = $"https://{_instanceSettings.Domain}/users/{username}/statuses/{tweet.Id}"; - var noteId = UrlFactory.GetNoteUrl(_instanceSettings.Domain, username, tweet.Id.ToString()); - //var noteUrl = $"https://{_instanceSettings.Domain}/@{username}/{tweet.Id}"; - var noteUrl = noteId; + var noteUrl = UrlFactory.GetNoteUrl(_instanceSettings.Domain, username, tweet.Id.ToString()); var to = $"{actorUrl}/followers"; var apPublic = "https://www.w3.org/ns/activitystreams#Public"; @@ -52,8 +48,7 @@ namespace BirdsiteLive.Domain var note = new Note { - //id = $"{noteId}/activity", - id = $"{noteId}", + id = noteUrl, published = tweet.CreatedAt.ToString("s") + "Z", url = noteUrl, @@ -72,7 +67,6 @@ namespace BirdsiteLive.Domain attachment = Convert(tweet.Media), tag = extractedTags.tags }; - return note; } diff --git a/src/BirdsiteLive/Controllers/WellKnownController.cs b/src/BirdsiteLive/Controllers/WellKnownController.cs index 543eb06..255981d 100644 --- a/src/BirdsiteLive/Controllers/WellKnownController.cs +++ b/src/BirdsiteLive/Controllers/WellKnownController.cs @@ -157,6 +157,7 @@ namespace BirdsiteLive.Controllers return BadRequest(); } + // Ensure lowercase name = name.ToLowerInvariant(); if (!string.IsNullOrWhiteSpace(domain) && domain != _settings.Domain) @@ -173,8 +174,6 @@ namespace BirdsiteLive.Controllers subject = $"acct:{name}@{_settings.Domain}", aliases = new[] { - //$"https://{_settings.Domain}/@{name}", - //$"https://{_settings.Domain}/users/{name}" actorUrl }, links = new List @@ -183,14 +182,12 @@ namespace BirdsiteLive.Controllers { rel = "http://webfinger.net/rel/profile-page", type = "text/html", - //href = $"https://{_settings.Domain}/@{name}" href = actorUrl }, new WebFingerLink() { rel = "self", type = "application/activity+json", - //href = $"https://{_settings.Domain}/users/{name}" href = actorUrl } }