1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 23:25:41 +02:00

fix(backend): robots.txtで返却する内容の調整 (#17165)

* fix(backend): robots.txtで返却する内容の調整

* Update Changelog

* fix: add paths

* Update Changleog
This commit is contained in:
かっこかり
2026-04-15 09:56:07 +09:00
committed by GitHub
parent 6532cb85e7
commit 55b0fbd172
3 changed files with 29 additions and 5 deletions

View File

@@ -1,4 +0,0 @@
user-agent: *
allow: /
# todo: sitemap

View File

@@ -396,7 +396,34 @@ export class ClientServerService {
});
fastify.get('/robots.txt', async (request, reply) => {
return await reply.sendFile('/robots.txt', staticAssets);
const disallowedPaths = [
'/settings',
'/admin',
'/custom-emojis-manager',
'/avatar-decorations',
'/share',
'/my',
'/api',
'/inbox',
'/oauth',
'/proxy',
'/url',
];
if (this.meta.ugcVisibilityForVisitor === 'none') {
disallowedPaths.push(
'/@',
'/notes',
);
}
let content = `User-agent: *\n`;
content += disallowedPaths.map((path) => `Disallow: ${path}`).join('\n') + '\n';
content += 'Allow: /\n';
content += '\n# todo: sitemap\n';
reply.header('Content-Type', 'text/plain; charset=utf-8');
return await reply.send(content);
});
// OpenSearch XML