From cb6f390fb6964a032f15c6885d686d07c945ad38 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Nov 2018 13:14:52 +0900 Subject: GitHub / Twitter連携の設定をDBに保存するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/meta.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/models') diff --git a/src/models/meta.ts b/src/models/meta.ts index f62117a0ba..a12747ea3c 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -99,6 +99,32 @@ if ((config as any).maintainer) { } }); } +if ((config as any).twitter) { + Meta.findOne({}).then(m => { + if (m != null && m.enableTwitterIntegration == null) { + Meta.update({}, { + $set: { + enableTwitterIntegration: true, + twitterConsumerKey: (config as any).twitter.consumer_key, + twitterConsumerSecret: (config as any).twitter.consumer_secret + } + }); + } + }); +} +if ((config as any).github) { + Meta.findOne({}).then(m => { + if (m != null && m.enableGithubIntegration == null) { + Meta.update({}, { + $set: { + enableGithubIntegration: true, + githubClientId: (config as any).github.client_id, + githubClientSecret: (config as any).github.client_secret + } + }); + } + }); +} export type IMeta = { name?: string; @@ -157,4 +183,12 @@ export type IMeta = { * Max allowed note text length in charactors */ maxNoteTextLength?: number; + + enableTwitterIntegration?: boolean; + twitterConsumerKey?: string; + twitterConsumerSecret?: string; + + enableGithubIntegration?: boolean; + githubClientId?: string; + githubClientSecret?: string; }; -- cgit v1.2.3-freya