From 001bb7bbcd688510223b4f355057cf73d264a7c4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Nov 2018 12:28:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=81=AE=E5=AF=BE=E8=B1=A1=E8=A8=80=E8=AA=9E=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 ++ src/client/app/admin/views/instance.vue | 6 +++++- src/misc/fetch-meta.ts | 1 + src/models/meta.ts | 2 ++ src/server/api/endpoints/admin/update-meta.ts | 11 +++++++++++ src/server/api/endpoints/meta.ts | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index b94fea1da..c3a9848b7 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1079,6 +1079,8 @@ admin/views/instance.vue: instance-name: "インスタンス名" instance-description: "インスタンスの紹介" banner-url: "バナー画像URL" + languages: "インスタンスの対象言語" + languages-desc: "スペースで区切って複数設定できます。" maintainer-config: "管理者情報" maintainer-name: "管理者名" maintainer-email: "管理者の連絡先" diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index 9d0204cfb..815cea631 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -6,6 +6,7 @@ %i18n:@instance-name% %i18n:@instance-description% %i18n:@banner-url% + %i18n:@languages%%i18n:@languages-desc%
%i18n:@maintainer-config%
@@ -31,7 +32,7 @@
%i18n:@proxy-account-config%
%i18n:@proxy-account-info% - @%i18n:@proxy-account-username%%i18n:@proxy-account-username-desc% + @%i18n:@proxy-account-username%%i18n:@proxy-account-username-desc% %i18n:@proxy-account-warn%
@@ -68,6 +69,7 @@ export default Vue.extend({ bannerUrl: null, name: null, description: null, + languages: null, cacheRemoteFiles: false, localDriveCapacityMb: null, remoteDriveCapacityMb: null, @@ -87,6 +89,7 @@ export default Vue.extend({ this.bannerUrl = meta.bannerUrl; this.name = meta.name; this.description = meta.description; + this.languages = meta.langs.join(' '); this.cacheRemoteFiles = meta.cacheRemoteFiles; this.localDriveCapacityMb = meta.driveCapacityPerLocalUserMb; this.remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb; @@ -119,6 +122,7 @@ export default Vue.extend({ bannerUrl: this.bannerUrl, name: this.name, description: this.description, + langs: this.languages.split(' '), cacheRemoteFiles: this.cacheRemoteFiles, localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10), remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10), diff --git a/src/misc/fetch-meta.ts b/src/misc/fetch-meta.ts index fde244d1c..e8ff1aca7 100644 --- a/src/misc/fetch-meta.ts +++ b/src/misc/fetch-meta.ts @@ -2,6 +2,7 @@ import Meta, { IMeta } from '../models/meta'; const defaultMeta: any = { name: 'Misskey', + langs: [], cacheRemoteFiles: true, localDriveCapacityMb: 256, remoteDriveCapacityMb: 8, diff --git a/src/models/meta.ts b/src/models/meta.ts index 8d3a917df..f62117a0b 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -119,6 +119,8 @@ export type IMeta = { email?: string; }; + langs?: string[]; + broadcasts?: any[]; stats?: { diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index bcfa420ed..d45a8759f 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -130,6 +130,13 @@ export const meta = { desc: { 'ja-JP': 'インスタンス管理者の連絡先メールアドレス' } + }, + + langs: { + validator: $.arr($.str).optional, + desc: { + 'ja-JP': 'インスタンスの対象言語' + } } } }; @@ -205,6 +212,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { set['maintainer.email'] = ps.maintainerEmail; } + if (ps.langs !== undefined) { + set.langs = ps.langs; + } + await Meta.update({}, { $set: set }, { upsert: true }); diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 311e3d669..625a9519d 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -43,6 +43,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => { name: instance.name, description: instance.description, + langs: instance.langs, secure: config.https != null, machine: os.hostname(),