summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/admin
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/server/api/endpoints/admin
parentFix (diff)
downloadsharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.tar.gz
sharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.tar.bz2
sharkey-cb6f390fb6964a032f15c6885d686d07c945ad38.zip
GitHub / Twitter連携の設定をDBに保存するように
Diffstat (limited to 'src/server/api/endpoints/admin')
-rw-r--r--src/server/api/endpoints/admin/update-meta.ts68
1 files changed, 67 insertions, 1 deletions
diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts
index d45a8759f2..39d7ef86b9 100644
--- a/src/server/api/endpoints/admin/update-meta.ts
+++ b/src/server/api/endpoints/admin/update-meta.ts
@@ -137,7 +137,49 @@ export const meta = {
desc: {
'ja-JP': 'インスタンスの対象言語'
}
- }
+ },
+
+ enableTwitterIntegration: {
+ validator: $.bool.optional,
+ desc: {
+ 'ja-JP': 'Twitter連携機能を有効にするか否か'
+ }
+ },
+
+ twitterConsumerKey: {
+ validator: $.str.optional.nullable,
+ desc: {
+ 'ja-JP': 'TwitterアプリのConsumer key'
+ }
+ },
+
+ twitterConsumerSecret: {
+ validator: $.str.optional.nullable,
+ desc: {
+ 'ja-JP': 'TwitterアプリのConsumer secret'
+ }
+ },
+
+ enableGithubIntegration: {
+ validator: $.bool.optional,
+ desc: {
+ 'ja-JP': 'GitHub連携機能を有効にするか否か'
+ }
+ },
+
+ githubClientId: {
+ validator: $.str.optional.nullable,
+ desc: {
+ 'ja-JP': 'GitHubアプリのClient ID'
+ }
+ },
+
+ githubClientSecret: {
+ validator: $.str.optional.nullable,
+ desc: {
+ 'ja-JP': 'GitHubアプリのClient secret'
+ }
+ },
}
};
@@ -216,6 +258,30 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.langs = ps.langs;
}
+ if (ps.enableTwitterIntegration !== undefined) {
+ set.enableTwitterIntegration = ps.enableTwitterIntegration;
+ }
+
+ if (ps.twitterConsumerKey !== undefined) {
+ set.twitterConsumerKey = ps.twitterConsumerKey;
+ }
+
+ if (ps.twitterConsumerSecret !== undefined) {
+ set.twitterConsumerSecret = ps.twitterConsumerSecret;
+ }
+
+ if (ps.enableGithubIntegration !== undefined) {
+ set.enableGithubIntegration = ps.enableGithubIntegration;
+ }
+
+ if (ps.githubClientId !== undefined) {
+ set.githubClientId = ps.githubClientId;
+ }
+
+ if (ps.githubClientSecret !== undefined) {
+ set.githubClientSecret = ps.githubClientSecret;
+ }
+
await Meta.update({}, {
$set: set
}, { upsert: true });