ghostの設定をDBに保存するように

This commit is contained in:
syuilo
2018-11-07 00:44:56 +09:00
parent 87d4452d19
commit 2de48110bb
9 changed files with 55 additions and 21 deletions

View File

@@ -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<IMeta>('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;