This commit is contained in:
dakkar 2023-12-31 16:17:45 +00:00
parent 6d5d3d9ea1
commit 61c193c08f

View file

@ -329,13 +329,11 @@ export class ActivityPubServerService {
if (profile.followersVisibility === 'private') { if (profile.followersVisibility === 'private') {
reply.code(403); reply.code(403);
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=30');
reply.header('Cache-Control', 'public, max-age=30');
return; return;
} else if (profile.followersVisibility === 'followers') { } else if (profile.followersVisibility === 'followers') {
reply.code(403); reply.code(403);
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=30');
reply.header('Cache-Control', 'public, max-age=30');
return; return;
} }
//#endregion //#endregion
@ -387,8 +385,7 @@ export class ActivityPubServerService {
user.followersCount, user.followersCount,
`${partOf}?page=true`, `${partOf}?page=true`,
); );
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(rendered)); return (this.apRendererService.addContext(rendered));
} }
@ -426,13 +423,11 @@ export class ActivityPubServerService {
if (profile.followingVisibility === 'private') { if (profile.followingVisibility === 'private') {
reply.code(403); reply.code(403);
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=30');
reply.header('Cache-Control', 'public, max-age=30');
return; return;
} else if (profile.followingVisibility === 'followers') { } else if (profile.followingVisibility === 'followers') {
reply.code(403); reply.code(403);
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=30');
reply.header('Cache-Control', 'public, max-age=30');
return; return;
} }
//#endregion //#endregion
@ -484,8 +479,7 @@ export class ActivityPubServerService {
user.followingCount, user.followingCount,
`${partOf}?page=true`, `${partOf}?page=true`,
); );
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(rendered)); return (this.apRendererService.addContext(rendered));
} }
@ -526,8 +520,7 @@ export class ActivityPubServerService {
renderedNotes, renderedNotes,
); );
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(rendered)); return (this.apRendererService.addContext(rendered));
} }
@ -618,8 +611,7 @@ export class ActivityPubServerService {
`${partOf}?page=true`, `${partOf}?page=true`,
`${partOf}?page=true&since_id=000000000000000000000000`, `${partOf}?page=true&since_id=000000000000000000000000`,
); );
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(rendered)); return (this.apRendererService.addContext(rendered));
} }
@ -632,8 +624,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(await this.apRendererService.renderPerson(user as MiLocalUser))); return (this.apRendererService.addContext(await this.apRendererService.renderPerson(user as MiLocalUser)));
} }
@ -723,8 +714,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return this.apRendererService.addContext(await this.apRendererService.renderNote(note, false)); return this.apRendererService.addContext(await this.apRendererService.renderNote(note, false));
}); });
@ -747,8 +737,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(await this.packActivity(note))); return (this.apRendererService.addContext(await this.packActivity(note)));
}); });
@ -793,8 +782,7 @@ export class ActivityPubServerService {
const keypair = await this.userKeypairService.getUserKeypair(user.id); const keypair = await this.userKeypairService.getUserKeypair(user.id);
if (this.userEntityService.isLocalUser(user)) { if (this.userEntityService.isLocalUser(user)) {
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(this.apRendererService.renderKey(user, keypair))); return (this.apRendererService.addContext(this.apRendererService.renderKey(user, keypair)));
} else { } else {
@ -844,8 +832,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(await this.apRendererService.renderEmoji(emoji))); return (this.apRendererService.addContext(await this.apRendererService.renderEmoji(emoji)));
}); });
@ -868,8 +855,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(await this.apRendererService.renderLike(reaction, note))); return (this.apRendererService.addContext(await this.apRendererService.renderLike(reaction, note)));
}); });
@ -897,8 +883,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee))); return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee)));
}); });
@ -935,8 +920,7 @@ export class ActivityPubServerService {
return; return;
} }
if (!this.config.checkActivityPubGetSignature) if (!this.config.checkActivityPubGetSignature) reply.header('Cache-Control', 'public, max-age=180');
reply.header('Cache-Control', 'public, max-age=180');
this.setResponseType(request, reply); this.setResponseType(request, reply);
return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee))); return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee)));
}); });