[backend/federation] Add Guid to end of follow activity URIs
This stops mastodon from caching the undo, preventing re-follows & debugging of federation issues
This commit is contained in:
parent
16fdc48800
commit
b705c95714
3 changed files with 7 additions and 2 deletions
|
@ -184,7 +184,10 @@ public class ActivityHandlerService(
|
||||||
throw GracefulException.UnprocessableEntity($"Object id '{obj.Id}' not a valid follow request id");
|
throw GracefulException.UnprocessableEntity($"Object id '{obj.Id}' not a valid follow request id");
|
||||||
|
|
||||||
var ids = obj.Id[prefix.Length..].TrimEnd('/').Split("/");
|
var ids = obj.Id[prefix.Length..].TrimEnd('/').Split("/");
|
||||||
if (ids.Length != 2 || ids[1] != actor.Id)
|
if (ids.Length < 2)
|
||||||
|
throw GracefulException
|
||||||
|
.UnprocessableEntity("Failed to parse ASAccept activity: ASFollow id doesn't have enough components");
|
||||||
|
if (ids[1] != actor.Id)
|
||||||
throw GracefulException
|
throw GracefulException
|
||||||
.UnprocessableEntity($"Actor id '{actor.Id}' doesn't match followee id '{ids[1]}'");
|
.UnprocessableEntity($"Actor id '{actor.Id}' doesn't match followee id '{ids[1]}'");
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class ActivityRenderer(
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "SuggestBaseTypeForParameter", Justification = "This only makes sense for users")]
|
[SuppressMessage("ReSharper", "SuggestBaseTypeForParameter", Justification = "This only makes sense for users")]
|
||||||
private string RenderFollowId(User follower, User followee) =>
|
private string RenderFollowId(User follower, User followee) =>
|
||||||
$"https://{config.Value.WebDomain}/follows/{follower.Id}/{followee.Id}";
|
$"https://{config.Value.WebDomain}/follows/{follower.Id}/{followee.Id}/{Guid.NewGuid().ToStringLower()}";
|
||||||
|
|
||||||
public static ASAnnounce RenderAnnounce(
|
public static ASAnnounce RenderAnnounce(
|
||||||
ASNote note, ASActor actor, List<ASObjectBase> to, List<ASObjectBase> cc, string uri
|
ASNote note, ASActor actor, List<ASObjectBase> to, List<ASObjectBase> cc, string uri
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class ObjectResolver(
|
||||||
return new ASNote { Id = baseObj.Id, VerifiedFetch = true };
|
return new ASNote { Id = baseObj.Id, VerifiedFetch = true };
|
||||||
if (baseObj.Id.StartsWith($"https://{config.Value.WebDomain}/users/"))
|
if (baseObj.Id.StartsWith($"https://{config.Value.WebDomain}/users/"))
|
||||||
return new ASActor { Id = baseObj.Id };
|
return new ASActor { Id = baseObj.Id };
|
||||||
|
if (baseObj.Id.StartsWith($"https://{config.Value.WebDomain}/follows/"))
|
||||||
|
return new ASFollow { Id = baseObj.Id };
|
||||||
|
|
||||||
if (await federationCtrl.ShouldBlockAsync(baseObj.Id))
|
if (await federationCtrl.ShouldBlockAsync(baseObj.Id))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue