mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 04:04:16 +00:00
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1119 Closes #756 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
@@ -791,6 +791,10 @@ export class ActivityPubServerService {
|
||||
reply.header('Access-Control-Allow-Origin', '*');
|
||||
reply.header('Access-Control-Expose-Headers', 'Vary');
|
||||
|
||||
// Tell crawlers not to index AP endpoints.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
|
||||
/* tell any caching proxy that they should not cache these
|
||||
responses: we wouldn't want the proxy to return a 403 to
|
||||
someone presenting a valid signature, or return a cached
|
||||
|
||||
@@ -70,6 +70,10 @@ export class FileServerService {
|
||||
fastify.addHook('onRequest', (request, reply, done) => {
|
||||
reply.header('Content-Security-Policy', 'default-src \'none\'; img-src \'self\'; media-src \'self\'; style-src \'unsafe-inline\'');
|
||||
reply.header('Access-Control-Allow-Origin', '*');
|
||||
|
||||
// Tell crawlers not to index files endpoints.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
@@ -148,6 +148,10 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||
request: FastifyRequest<{ Body: Record<string, unknown> | undefined, Querystring: Record<string, unknown> }>,
|
||||
reply: FastifyReply,
|
||||
): void {
|
||||
// Tell crawlers not to index API endpoints.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
|
||||
const body = request.method === 'GET'
|
||||
? request.query
|
||||
: request.body;
|
||||
|
||||
@@ -71,6 +71,13 @@ export class MastodonApiServerService {
|
||||
done();
|
||||
});
|
||||
|
||||
// Tell crawlers not to index API endpoints.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
fastify.addHook('onRequest', (request, reply, done) => {
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
done();
|
||||
});
|
||||
|
||||
// External endpoints
|
||||
this.apiAccountMastodon.register(fastify);
|
||||
this.apiAppsMastodon.register(fastify);
|
||||
|
||||
@@ -125,6 +125,10 @@ export class UrlPreviewService {
|
||||
reply: FastifyReply,
|
||||
): Promise<void> {
|
||||
if (!this.meta.urlPreviewEnabled) {
|
||||
// Tell crawlers not to index URL previews.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
|
||||
return reply.code(403).send({
|
||||
error: {
|
||||
message: 'URL preview is disabled',
|
||||
|
||||
Reference in New Issue
Block a user