From 2de48110bbc253ff4aa8457ea0cfed5a6fb5feb0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Nov 2018 00:44:56 +0900 Subject: ghostの設定をDBに保存するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/meta.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/models/meta.ts') diff --git a/src/models/meta.ts b/src/models/meta.ts index 3eb73681ac..5d03d94181 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -1,5 +1,7 @@ import db from '../db/mongodb'; import config from '../config'; +import User from './user'; +import { transform } from '../misc/cafy-id'; const Meta = db.get('meta'); export default Meta; @@ -74,6 +76,18 @@ if ((config as any).recaptcha) { } }); } +if ((config as any).ghost) { + Meta.findOne({}).then(async m => { + if (m != null && m.proxyAccount == null) { + const account = await User.findOne({ _id: transform((config as any).ghost) }); + Meta.update({}, { + $set: { + proxyAccount: account.username + } + }); + } + }); +} export type IMeta = { name?: string; @@ -92,6 +106,8 @@ export type IMeta = { cacheRemoteFiles?: boolean; + proxyAccount?: string; + enableRecaptcha?: boolean; recaptchaSiteKey?: string; recaptchaSecretKey?: string; -- cgit v1.2.3-freya