testing deletion

This commit is contained in:
Nicolas Constant 2022-12-31 01:29:55 -05:00
parent f8ab522505
commit 432484eaaa
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 45 additions and 0 deletions

View File

@ -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; }
}
}

View File

@ -56,6 +56,35 @@ namespace BirdsiteLive.Controllers
return View("Index");
}
private static string _noteId;
[HttpPost]
public async Task<IActionResult> 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<IActionResult> 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;

View File

@ -18,6 +18,11 @@
<button type="submit" value="Submit">Post Note</button>
</form>
<form asp-controller="Debuging" asp-action="DeleteNote" method="post">
<!-- Input and Submit elements -->
<button type="submit" value="Submit">Delete Note</button>
</form>
<form asp-controller="Debuging" asp-action="PostRejectFollow" method="post">
<!-- Input and Submit elements -->