From a0940c49a218e64dd421dbfbd4a9c1ba6fe7abae Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 18 Jul 2022 14:31:34 +0200 Subject: [PATCH] refactor: remove repositoryUrl & feedbackUrl from meta These two URLs are static so there is no reason to keep them in the database. They are also not even used anywhere by the API, so they can also be removed from there. Where they are used is in the nodeinfo, where they are now hardcoded. While editing the nodeinfo, also uncommented nodeinfo version 2.1. --- .../migration/1658146000392-remove-repo-url.js | 13 +++++++++++++ packages/backend/src/models/entities/meta.ts | 14 -------------- .../backend/src/server/api/endpoints/admin/meta.ts | 2 -- .../src/server/api/endpoints/admin/update-meta.ts | 10 ---------- packages/backend/src/server/api/endpoints/meta.ts | 12 ------------ packages/backend/src/server/nodeinfo.ts | 10 +++++----- 6 files changed, 18 insertions(+), 43 deletions(-) create mode 100644 packages/backend/migration/1658146000392-remove-repo-url.js diff --git a/packages/backend/migration/1658146000392-remove-repo-url.js b/packages/backend/migration/1658146000392-remove-repo-url.js new file mode 100644 index 000000000..71309650b --- /dev/null +++ b/packages/backend/migration/1658146000392-remove-repo-url.js @@ -0,0 +1,13 @@ +export class removeRepoUrl1658146000392 { + name = 'removeRepoUrl1658146000392'; + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "repositoryUrl"`); + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "feedbackUrl"`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) not null default 'https://github.com/misskey-dev/misskey'`); + await queryRunner.query(`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) default 'https://github.com/misskey-dev/misskey/issues/new'`); + } +} diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 0de01e507..c6a4c9f41 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -316,20 +316,6 @@ export class Meta { }) public ToSUrl: string | null; - @Column('varchar', { - length: 512, - default: 'https://github.com/misskey-dev/misskey', - nullable: false, - }) - public repositoryUrl: string; - - @Column('varchar', { - length: 512, - default: 'https://github.com/misskey-dev/misskey/issues/new', - nullable: true, - }) - public feedbackUrl: string | null; - @Column('varchar', { length: 8192, nullable: true, diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 5068da32b..5d7973669 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -294,8 +294,6 @@ export default define(meta, paramDef, async (ps, me) => { description: instance.description, langs: instance.langs, tosUrl: instance.ToSUrl, - repositoryUrl: instance.repositoryUrl, - feedbackUrl: instance.feedbackUrl, disableRegistration: instance.disableRegistration, disableLocalTimeline: instance.disableLocalTimeline, disableGlobalTimeline: instance.disableGlobalTimeline, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index a82af38f1..bd75e0f93 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -78,8 +78,6 @@ export const paramDef = { swPublicKey: { type: 'string', nullable: true }, swPrivateKey: { type: 'string', nullable: true }, tosUrl: { type: 'string', nullable: true }, - repositoryUrl: { type: 'string' }, - feedbackUrl: { type: 'string' }, useObjectStorage: { type: 'boolean' }, objectStorageBaseUrl: { type: 'string', nullable: true }, objectStorageBucket: { type: 'string', nullable: true }, @@ -313,14 +311,6 @@ export default define(meta, paramDef, async (ps, me) => { set.ToSUrl = ps.tosUrl; } - if (ps.repositoryUrl !== undefined) { - set.repositoryUrl = ps.repositoryUrl; - } - - if (ps.feedbackUrl !== undefined) { - set.feedbackUrl = ps.feedbackUrl; - } - if (ps.useObjectStorage !== undefined) { set.useObjectStorage = ps.useObjectStorage; } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 99a4187c2..2b6de3756 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -53,16 +53,6 @@ export const meta = { type: 'string', optional: false, nullable: true, }, - repositoryUrl: { - type: 'string', - optional: false, nullable: false, - default: 'https://github.com/misskey-dev/misskey', - }, - feedbackUrl: { - type: 'string', - optional: false, nullable: false, - default: 'https://github.com/misskey-dev/misskey/issues/new', - }, defaultDarkTheme: { type: 'string', optional: false, nullable: true, @@ -297,8 +287,6 @@ export default define(meta, paramDef, async (ps, me) => { description: instance.description, langs: instance.langs, tosUrl: instance.ToSUrl, - repositoryUrl: instance.repositoryUrl, - feedbackUrl: instance.feedbackUrl, disableRegistration: instance.disableRegistration, disableLocalTimeline: instance.disableLocalTimeline, disableGlobalTimeline: instance.disableGlobalTimeline, diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index f139d203d..764718f30 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -11,10 +11,10 @@ const router = new Router(); const nodeinfo2_1path = '/nodeinfo/2.1'; const nodeinfo2_0path = '/nodeinfo/2.0'; -export const links = [/* (awaiting release) { +export const links = [{ rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1', href: config.url + nodeinfo2_1path -}, */{ +}, { rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', href: config.url + nodeinfo2_0path, }]; @@ -39,9 +39,9 @@ const nodeinfo2 = async () => { return { software: { - name: 'misskey', + name: 'foundkey', version: config.version, - repository: meta.repositoryUrl, + repository: 'https://akkoma.dev/FoundKeyGang/FoundKey', }, protocols: ['activitypub'], services: { @@ -64,7 +64,7 @@ const nodeinfo2 = async () => { langs: meta.langs, tosUrl: meta.ToSUrl, repositoryUrl: meta.repositoryUrl, - feedbackUrl: meta.feedbackUrl, + feedbackUrl: 'ircs://irc.akkoma.dev/foundkey', disableRegistration: meta.disableRegistration, disableLocalTimeline: meta.disableLocalTimeline, disableGlobalTimeline: meta.disableGlobalTimeline,