From a6f8327aa263022ed5d079f8e413bb17480feb7b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Nov 2018 00:08:21 +0900 Subject: reCAPTCHAの設定をDBに保存するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/meta.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/models') diff --git a/src/models/meta.ts b/src/models/meta.ts index 073be7de82..3eb73681ac 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -61,6 +61,19 @@ if ((config as any).preventCacheRemoteFiles) { } }); } +if ((config as any).recaptcha) { + Meta.findOne({}).then(m => { + if (m != null && m.enableRecaptcha == null) { + Meta.update({}, { + $set: { + enableRecaptcha: (config as any).recaptcha != null, + recaptchaSiteKey: (config as any).recaptcha.site_key, + recaptchaSecretKey: (config as any).recaptcha.secret_key, + } + }); + } + }); +} export type IMeta = { name?: string; @@ -79,6 +92,10 @@ export type IMeta = { cacheRemoteFiles?: boolean; + enableRecaptcha?: boolean; + recaptchaSiteKey?: string; + recaptchaSecretKey?: string; + /** * Drive capacity of a local user (MB) */ -- cgit v1.2.3-freya