summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-07 13:14:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-07 13:14:52 +0900
commitcb6f390fb6964a032f15c6885d686d07c945ad38 (patch)
treee1e5d1de37ec20bc8b49c523fdaeff2227814944 /src/models
parentFix (diff)
downloadsharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.tar.gz
sharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.tar.bz2
sharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.zip
GitHub / Twitter連携の設定をDBに保存するように
Diffstat (limited to 'src/models')
-rw-r--r--src/models/meta.ts34
1 files changed, 34 insertions, 0 deletions
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;
};