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/server/api/endpoints/admin/update-meta.ts | 68 ++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) (limited to 'src/server/api/endpoints/admin') 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 }); -- cgit v1.2.3-freya