From be11fd75085e8f8c000a42b40bd583894121a708 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Fri, 31 May 2024 10:12:23 +0900 Subject: [PATCH] =?UTF-8?q?enhance:=20=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=81=8A=E5=95=8F=E3=81=84=E5=90=88=E3=82=8F=E3=81=9B?= =?UTF-8?q?=E5=85=88URL=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + locales/index.d.ts | 8 ++++++++ locales/ja-JP.yml | 2 ++ .../migration/1717117195275-inquiryUrl.js | 20 +++++++++++++++++++ .../src/core/entities/MetaEntityService.ts | 1 + packages/backend/src/models/Meta.ts | 6 ++++++ .../backend/src/models/json-schema/meta.ts | 4 ++++ .../src/server/NodeinfoServerService.ts | 13 ++++++------ .../src/server/api/endpoints/admin/meta.ts | 5 +++++ .../server/api/endpoints/admin/update-meta.ts | 5 +++++ .../frontend/src/pages/admin/moderation.vue | 9 +++++++++ packages/frontend/src/pages/contact.vue | 18 ++++++++++++++++- packages/misskey-js/src/autogen/types.ts | 3 +++ 13 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 packages/backend/migration/1717117195275-inquiryUrl.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 865684aa20..efd07da891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Enhance: Goneを出さずに終了したサーバーへの配信停止を自動的に行うように - もしそのようなサーバーからから配信が届いた場合には自動的に配信を再開します - Enhance: 配信停止の理由を表示するように +- Enhance: サーバーのお問い合わせ先URLを設定できるようになりました - Fix: Play作成時に設定した公開範囲が機能していない問題を修正 - Fix: 正規化されていない状態のhashtagが連合されてきたhtmlに含まれているとhashtagが正しくhashtagに復元されない問題を修正 - Fix: みつけるのアンケート欄にてチャンネルのアンケートが含まれてしまう問題を修正 diff --git a/locales/index.d.ts b/locales/index.d.ts index d4ded0bb5b..91bbe4ccb6 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5471,6 +5471,14 @@ export interface Locale extends ILocale { * 有効にすると、タイムラインがキャッシュされていない場合にDBへ追加で問い合わせを行うフォールバック処理を行います。無効にすると、フォールバック処理を行わないことでさらにサーバーの負荷を軽減することができますが、タイムラインが取得できる範囲に制限が生じます。 */ "fanoutTimelineDbFallbackDescription": string; + /** + * 問い合わせ先URL + */ + "inquiryUrl": string; + /** + * サーバー運営者へのお問い合わせフォームのURLや、運営者の連絡先等が記載されたWebページのURLを指定します。 + */ + "inquiryUrlDescription": string; }; "_accountMigration": { /** diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d7ceb971af..b7083b4942 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1383,6 +1383,8 @@ _serverSettings: fanoutTimelineDescription: "有効にすると、各種タイムラインを取得する際のパフォーマンスが大幅に向上し、データベースへの負荷を軽減することが可能です。ただし、Redisのメモリ使用量は増加します。サーバーのメモリ容量が少ない場合、または動作が不安定な場合は無効にすることができます。" fanoutTimelineDbFallback: "データベースへのフォールバック" fanoutTimelineDbFallbackDescription: "有効にすると、タイムラインがキャッシュされていない場合にDBへ追加で問い合わせを行うフォールバック処理を行います。無効にすると、フォールバック処理を行わないことでさらにサーバーの負荷を軽減することができますが、タイムラインが取得できる範囲に制限が生じます。" + inquiryUrl: "問い合わせ先URL" + inquiryUrlDescription: "サーバー運営者へのお問い合わせフォームのURLや、運営者の連絡先等が記載されたWebページのURLを指定します。" _accountMigration: moveFrom: "別のアカウントからこのアカウントに移行" diff --git a/packages/backend/migration/1717117195275-inquiryUrl.js b/packages/backend/migration/1717117195275-inquiryUrl.js new file mode 100644 index 0000000000..3834df06d4 --- /dev/null +++ b/packages/backend/migration/1717117195275-inquiryUrl.js @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class InquiryUrl1717117195275 { + name = 'InquiryUrl1717117195275' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "trustedLinkUrlPatterns" TO "inquiryUrl"`); + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "inquiryUrl"`); + await queryRunner.query(`ALTER TABLE "meta" ADD "inquiryUrl" character varying(1024)`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "inquiryUrl"`); + await queryRunner.query(`ALTER TABLE "meta" ADD "inquiryUrl" character varying(3072) array NOT NULL DEFAULT '{}'`); + await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "inquiryUrl" TO "trustedLinkUrlPatterns"`); + } +} diff --git a/packages/backend/src/core/entities/MetaEntityService.ts b/packages/backend/src/core/entities/MetaEntityService.ts index 9d054ab6a1..5dfec589e1 100644 --- a/packages/backend/src/core/entities/MetaEntityService.ts +++ b/packages/backend/src/core/entities/MetaEntityService.ts @@ -67,6 +67,7 @@ export class MetaEntityService { feedbackUrl: instance.feedbackUrl, impressumUrl: instance.impressumUrl, privacyPolicyUrl: instance.privacyPolicyUrl, + inquiryUrl: instance.inquiryUrl, disableRegistration: instance.disableRegistration, emailRequiredForSignup: instance.emailRequiredForSignup, enableHcaptcha: instance.enableHcaptcha, diff --git a/packages/backend/src/models/Meta.ts b/packages/backend/src/models/Meta.ts index 04a34bbbb4..ad306fcad6 100644 --- a/packages/backend/src/models/Meta.ts +++ b/packages/backend/src/models/Meta.ts @@ -376,6 +376,12 @@ export class MiMeta { }) public privacyPolicyUrl: string | null; + @Column('varchar', { + length: 1024, + nullable: true, + }) + public inquiryUrl: string | null; + @Column('varchar', { length: 8192, nullable: true, diff --git a/packages/backend/src/models/json-schema/meta.ts b/packages/backend/src/models/json-schema/meta.ts index 473339a1ad..e7bc6356e5 100644 --- a/packages/backend/src/models/json-schema/meta.ts +++ b/packages/backend/src/models/json-schema/meta.ts @@ -227,6 +227,10 @@ export const packedMetaLiteSchema = { type: 'string', optional: false, nullable: true, }, + inquiryUrl: { + type: 'string', + optional: false, nullable: true, + }, serverRules: { type: 'array', optional: false, nullable: false, diff --git a/packages/backend/src/server/NodeinfoServerService.ts b/packages/backend/src/server/NodeinfoServerService.ts index c1e5af08c9..cc18997fdc 100644 --- a/packages/backend/src/server/NodeinfoServerService.ts +++ b/packages/backend/src/server/NodeinfoServerService.ts @@ -37,12 +37,12 @@ export class NodeinfoServerService { @bindThis public getLinks() { return [{ - rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1', - href: this.config.url + nodeinfo2_1path - }, { - rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', - href: this.config.url + nodeinfo2_0path, - }]; + rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1', + href: this.config.url + nodeinfo2_1path, + }, { + rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', + href: this.config.url + nodeinfo2_0path, + }]; } @bindThis @@ -108,6 +108,7 @@ export class NodeinfoServerService { langs: meta.langs, tosUrl: meta.termsOfServiceUrl, privacyPolicyUrl: meta.privacyPolicyUrl, + inquiryUrl: meta.inquiryUrl, impressumUrl: meta.impressumUrl, repositoryUrl: meta.repositoryUrl, feedbackUrl: meta.feedbackUrl, diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index f4ff573271..eee02a7123 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -427,6 +427,10 @@ export const meta = { type: 'string', optional: false, nullable: true, }, + inquiryUrl: { + type: 'string', + optional: false, nullable: true, + }, repositoryUrl: { type: 'string', optional: false, nullable: true, @@ -513,6 +517,7 @@ export default class extends Endpoint { // eslint- feedbackUrl: instance.feedbackUrl, impressumUrl: instance.impressumUrl, privacyPolicyUrl: instance.privacyPolicyUrl, + inquiryUrl: instance.inquiryUrl, disableRegistration: instance.disableRegistration, emailRequiredForSignup: instance.emailRequiredForSignup, enableHcaptcha: instance.enableHcaptcha, 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 2f62d30ada..4e28ee6877 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -107,6 +107,7 @@ export const paramDef = { feedbackUrl: { type: 'string', nullable: true }, impressumUrl: { type: 'string', nullable: true }, privacyPolicyUrl: { type: 'string', nullable: true }, + inquiryUrl: { type: 'string', nullable: true }, useObjectStorage: { type: 'boolean' }, objectStorageBaseUrl: { type: 'string', nullable: true }, objectStorageBucket: { type: 'string', nullable: true }, @@ -422,6 +423,10 @@ export default class extends Endpoint { // eslint- set.privacyPolicyUrl = ps.privacyPolicyUrl; } + if (ps.inquiryUrl !== undefined) { + set.inquiryUrl = ps.inquiryUrl; + } + if (ps.useObjectStorage !== undefined) { set.useObjectStorage = ps.useObjectStorage; } diff --git a/packages/frontend/src/pages/admin/moderation.vue b/packages/frontend/src/pages/admin/moderation.vue index 9efb34ac9a..a75799696d 100644 --- a/packages/frontend/src/pages/admin/moderation.vue +++ b/packages/frontend/src/pages/admin/moderation.vue @@ -30,6 +30,12 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + + + @@ -86,6 +92,7 @@ const hiddenTags = ref(''); const preservedUsernames = ref(''); const tosUrl = ref(null); const privacyPolicyUrl = ref(null); +const inquiryUrl = ref(null); async function init() { const meta = await misskeyApi('admin/meta'); @@ -97,6 +104,7 @@ async function init() { preservedUsernames.value = meta.preservedUsernames.join('\n'); tosUrl.value = meta.tosUrl; privacyPolicyUrl.value = meta.privacyPolicyUrl; + inquiryUrl.value = meta.inquiryUrl; } function save() { @@ -105,6 +113,7 @@ function save() { emailRequiredForSignup: emailRequiredForSignup.value, tosUrl: tosUrl.value, privacyPolicyUrl: privacyPolicyUrl.value, + inquiryUrl: inquiryUrl.value, sensitiveWords: sensitiveWords.value.split('\n'), prohibitedWords: prohibitedWords.value.split('\n'), hiddenTags: hiddenTags.value.split('\n'), diff --git a/packages/frontend/src/pages/contact.vue b/packages/frontend/src/pages/contact.vue index 3a694a7132..bcdcf43275 100644 --- a/packages/frontend/src/pages/contact.vue +++ b/packages/frontend/src/pages/contact.vue @@ -7,7 +7,21 @@ SPDX-License-Identifier: AGPL-3.0-only -
{{ instance.maintainerEmail }}
+
+ + + + + + + + + +
@@ -16,6 +30,8 @@ SPDX-License-Identifier: AGPL-3.0-only import { i18n } from '@/i18n.js'; import { definePageMetadata } from '@/scripts/page-metadata.js'; import { instance } from '@/instance.js'; +import MkKeyValue from '@/components/MkKeyValue.vue'; +import MkLink from '@/components/MkLink.vue'; definePageMetadata(() => ({ title: i18n.ts.inquiry, diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 11567677c9..9beb49fb64 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -4831,6 +4831,7 @@ export type components = { impressumUrl: string | null; logoImageUrl: string | null; privacyPolicyUrl: string | null; + inquiryUrl: string | null; serverRules: string[]; themeColor: string | null; policies: components['schemas']['RolePolicies']; @@ -4978,6 +4979,7 @@ export type operations = { shortName: string | null; objectStorageS3ForcePathStyle: boolean; privacyPolicyUrl: string | null; + inquiryUrl: string | null; repositoryUrl: string | null; /** * @deprecated @@ -8906,6 +8908,7 @@ export type operations = { feedbackUrl?: string | null; impressumUrl?: string | null; privacyPolicyUrl?: string | null; + inquiryUrl?: string | null; useObjectStorage?: boolean; objectStorageBaseUrl?: string | null; objectStorageBucket?: string | null;