From 55b0fbd1722bc9b804a9e9c900e26ac4b498efff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Wed, 15 Apr 2026 09:56:07 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20robots.txt=E3=81=A7=E8=BF=94?= =?UTF-8?q?=E5=8D=B4=E3=81=99=E3=82=8B=E5=86=85=E5=AE=B9=E3=81=AE=E8=AA=BF?= =?UTF-8?q?=E6=95=B4=20(#17165)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(backend): robots.txtで返却する内容の調整 * Update Changelog * fix: add paths * Update Changleog --- CHANGELOG.md | 1 + packages/backend/assets/robots.txt | 4 --- .../src/server/web/ClientServerService.ts | 29 ++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) delete mode 100644 packages/backend/assets/robots.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e62b28d8ba..211f6f5319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Fix: support `alsoKnownAs` from remote actors as either array or unwrapped singleton - Fix: ローカルに存在しないリモートアカウントに対するアカウント削除リクエストを受信した際に、そのユーザーを新規作成して削除する挙動を修正 - Fix: ID生成アルゴリズムにULIDを使用している場合にMisskeyが正しく動作しない問題を修正 +- Fix: robots.txtの内容を調整 ## 2026.3.2 diff --git a/packages/backend/assets/robots.txt b/packages/backend/assets/robots.txt deleted file mode 100644 index dc17e04e3f..0000000000 --- a/packages/backend/assets/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -user-agent: * -allow: / - -# todo: sitemap diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index 24bc619e79..49a802632f 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -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