summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/HttpRequestService.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-26 11:15:59 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-26 11:15:59 -0400
commitb506dd564b25066b921dccc294010cbd510c53a3 (patch)
treed84680a8742478e7bac5b853a14d5941ec740f48 /packages/backend/src/core/HttpRequestService.ts
parentmerge: Enforce HTTPS for all federation (!1042) (diff)
downloadsharkey-b506dd564b25066b921dccc294010cbd510c53a3.tar.gz
sharkey-b506dd564b25066b921dccc294010cbd510c53a3.tar.bz2
sharkey-b506dd564b25066b921dccc294010cbd510c53a3.zip
support fetching anonymous AP objects
Diffstat (limited to 'packages/backend/src/core/HttpRequestService.ts')
-rw-r--r--packages/backend/src/core/HttpRequestService.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/backend/src/core/HttpRequestService.ts b/packages/backend/src/core/HttpRequestService.ts
index 5c271b81e3..a0f2607ddc 100644
--- a/packages/backend/src/core/HttpRequestService.ts
+++ b/packages/backend/src/core/HttpRequestService.ts
@@ -235,7 +235,7 @@ export class HttpRequestService {
}
@bindThis
- public async getActivityJson(url: string, isLocalAddressAllowed = false): Promise<IObjectWithId> {
+ public async getActivityJson(url: string, isLocalAddressAllowed = false, allowAnonymous = false): Promise<IObjectWithId> {
this.apUtilityService.assertApUrl(url);
const res = await this.send(url, {
@@ -255,7 +255,11 @@ export class HttpRequestService {
// Make sure the object ID matches the final URL (which is where it actually exists).
// The caller (ApResolverService) will verify the ID against the original / entry URL, which ensures that all three match.
- this.apUtilityService.assertIdMatchesUrlAuthority(activity, res.url);
+ if (allowAnonymous && activity.id == null) {
+ activity.id = res.url;
+ } else {
+ this.apUtilityService.assertIdMatchesUrlAuthority(activity, res.url);
+ }
return activity as IObjectWithId;
}