From 4d91baaa13a8c4e8b9df221ce710d7005102c5a3 Mon Sep 17 00:00:00 2001 From: Kinetix Date: Fri, 31 Jan 2025 10:22:13 -0800 Subject: Adjust as per suggestions in !877 --- packages/backend/migration/1738098171990-robotsTxt.js | 16 ---------------- packages/backend/migration/1738346484187-robotsTxt.js | 16 ++++++++++++++++ packages/backend/src/server/web/ClientServerService.ts | 4 +--- 3 files changed, 17 insertions(+), 19 deletions(-) delete mode 100644 packages/backend/migration/1738098171990-robotsTxt.js create mode 100644 packages/backend/migration/1738346484187-robotsTxt.js (limited to 'packages') diff --git a/packages/backend/migration/1738098171990-robotsTxt.js b/packages/backend/migration/1738098171990-robotsTxt.js deleted file mode 100644 index 947f21cc46..0000000000 --- a/packages/backend/migration/1738098171990-robotsTxt.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * SPDX-FileCopyrightText: marie and other Sharkey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export class RobotsTxt1738098171990 { - name = 'RobotsTxt1738098171990' - - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" ADD "robotsTxt" character varying(2048)`); - } - - async down(queryRunner) { - await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "robotsTxt"`); - } -} diff --git a/packages/backend/migration/1738346484187-robotsTxt.js b/packages/backend/migration/1738346484187-robotsTxt.js new file mode 100644 index 0000000000..00ea1fb030 --- /dev/null +++ b/packages/backend/migration/1738346484187-robotsTxt.js @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: marie and other Sharkey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class RobotsTxt1738346484187 { + name = 'RobotsTxt1738346484187' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "robotsTxt" text`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "robotsTxt"`); + } +} diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index e93900b358..ae923ada1f 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -489,10 +489,8 @@ export class ClientServerService { fastify.get('/robots.txt', async (request, reply) => { if (this.meta.robotsTxt) { - let content = ''; - content += this.meta.robotsTxt; reply.header('Content-Type', 'text/plain'); - return await reply.send(content); + return await reply.send(this.meta.robotsTxt); } else { return await reply.sendFile('/robots.txt', staticAssets); } -- cgit v1.2.3-freya