diff --git a/.config/example.yml b/.config/example.yml index 3eb5bf0b1..1019f7b44 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -118,6 +118,3 @@ autoAdmin: true # Clustering #clusterLimit: 1 - -# Summaly proxy -#summalyProxy: "http://example.com" diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index 7252a4c7e..88738717a 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -42,6 +42,10 @@
{{ $t('disable-local-timeline') }}
+
+
summaly Proxy
+ URL +
{{ $t('user-recommendation-config') }}
{{ $t('enable-external-user-recommendation') }} @@ -138,6 +142,7 @@ export default Vue.extend({ enableExternalUserRecommendation: false, externalUserRecommendationEngine: null, externalUserRecommendationTimeout: null, + summalyProxy: null, faHeadset, faShieldAlt, faGhost, faUserPlus }; }, @@ -170,6 +175,7 @@ export default Vue.extend({ this.enableExternalUserRecommendation = meta.enableExternalUserRecommendation; this.externalUserRecommendationEngine = meta.externalUserRecommendationEngine; this.externalUserRecommendationTimeout = meta.externalUserRecommendationTimeout; + this.summalyProxy = meta.summalyProxy; }); }, @@ -214,7 +220,8 @@ export default Vue.extend({ discordClientSecret: this.discordClientSecret, enableExternalUserRecommendation: this.enableExternalUserRecommendation, externalUserRecommendationEngine: this.externalUserRecommendationEngine, - externalUserRecommendationTimeout: parseInt(this.externalUserRecommendationTimeout, 10) + externalUserRecommendationTimeout: parseInt(this.externalUserRecommendationTimeout, 10), + summalyProxy: this.summalyProxy }).then(() => { this.$root.alert({ type: 'success', diff --git a/src/config/types.ts b/src/config/types.ts index f9cb9d865..a08b90fec 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -37,8 +37,6 @@ export type Source = { proxy?: string; - summalyProxy?: string; - accesslog?: string; github_bot?: { diff --git a/src/models/meta.ts b/src/models/meta.ts index c91e66ce2..99d770366 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -197,6 +197,8 @@ export type IMeta = { */ maxNoteTextLength?: number; + summalyProxy?: string; + enableTwitterIntegration?: boolean; twitterConsumerKey?: string; twitterConsumerSecret?: string; diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index edbb51e3d..cff9ff8e5 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -139,6 +139,13 @@ export const meta = { } }, + summalyProxy: { + validator: $.str.optional.nullable, + desc: { + 'ja-JP': 'summalyプロキシURL' + } + }, + enableTwitterIntegration: { validator: $.bool.optional, desc: { @@ -300,6 +307,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { set.langs = ps.langs; } + if (ps.summalyProxy !== undefined) { + set.summalyProxy = ps.summalyProxy; + } + if (ps.enableTwitterIntegration !== undefined) { set.enableTwitterIntegration = ps.enableTwitterIntegration; } diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index faee9423d..49ce41c7d 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -107,6 +107,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => { response.githubClientSecret = instance.githubClientSecret; response.discordClientId = instance.discordClientId; response.discordClientSecret = instance.discordClientSecret; + response.summalyProxy = instance.summalyProxy; } res(response); diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts index eb835b05a..7be9a7576 100644 --- a/src/server/web/url-preview.ts +++ b/src/server/web/url-preview.ts @@ -2,11 +2,14 @@ import * as Koa from 'koa'; import * as request from 'request-promise-native'; import summaly from 'summaly'; import config from '../../config'; +import fetchMeta from '../../misc/fetch-meta'; module.exports = async (ctx: Koa.Context) => { + const meta = await fetchMeta(); + try { - const summary = config.summalyProxy ? await request.get({ - url: config.summalyProxy, + const summary = meta.summalyProxy ? await request.get({ + url: meta.summalyProxy, proxy: config.proxy, qs: { url: ctx.query.url