From 432484eaaa8314b750f1f96712ebc6f561f5d22c Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 31 Dec 2022 01:29:55 -0500 Subject: [PATCH] testing deletion --- .../Models/Tombstone.cs | 9 ++++++ .../Controllers/DebugingController.cs | 31 +++++++++++++++++++ src/BirdsiteLive/Views/Debuging/Index.cshtml | 5 +++ 3 files changed, 45 insertions(+) create mode 100644 src/BirdsiteLive.ActivityPub/Models/Tombstone.cs diff --git a/src/BirdsiteLive.ActivityPub/Models/Tombstone.cs b/src/BirdsiteLive.ActivityPub/Models/Tombstone.cs new file mode 100644 index 0000000..49dcabe --- /dev/null +++ b/src/BirdsiteLive.ActivityPub/Models/Tombstone.cs @@ -0,0 +1,9 @@ +namespace BirdsiteLive.ActivityPub.Models +{ + public class Tombstone + { + public string id { get; set; } + public readonly string type = "Tombstone"; + public string atomUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/BirdsiteLive/Controllers/DebugingController.cs b/src/BirdsiteLive/Controllers/DebugingController.cs index 8f37f22..f3e7d4e 100644 --- a/src/BirdsiteLive/Controllers/DebugingController.cs +++ b/src/BirdsiteLive/Controllers/DebugingController.cs @@ -56,6 +56,35 @@ namespace BirdsiteLive.Controllers return View("Index"); } + private static string _noteId; + + [HttpPost] + public async Task DeleteNote() + { + var username = "twitter"; + var actor = $"https://{_instanceSettings.Domain}/users/{username}"; + var targetHost = "ioc.exchange"; + var target = $"https://{targetHost}/users/test"; + var inbox = $"/inbox"; + + var delete = new ActivityDelete + { + context = "https://www.w3.org/ns/activitystreams", + id = $"{_noteId}#delete", + type = "Delete", + actor = actor, + to = new[] { "https://www.w3.org/ns/activitystreams#Public" }, + apObject = new Tombstone + { + id = _noteId, + atomUrl = _noteId + } + }; + + await _activityPubService.PostDataAsync(delete, targetHost, actor, inbox); + return View("Index"); + } + [HttpPost] public async Task PostNote() { @@ -70,6 +99,8 @@ namespace BirdsiteLive.Controllers var noteId = $"https://{_instanceSettings.Domain}/users/{username}/statuses/{noteGuid}"; var noteUrl = $"https://{_instanceSettings.Domain}/@{username}/{noteGuid}"; + _noteId = noteId; + var to = $"{actor}/followers"; to = target; diff --git a/src/BirdsiteLive/Views/Debuging/Index.cshtml b/src/BirdsiteLive/Views/Debuging/Index.cshtml index e343cf2..886b88d 100644 --- a/src/BirdsiteLive/Views/Debuging/Index.cshtml +++ b/src/BirdsiteLive/Views/Debuging/Index.cshtml @@ -18,6 +18,11 @@ +
+ + + +