diff --git a/.config/example.yml b/.config/example.yml
index 3eb5bf0b11..1019f7b44b 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 7252a4c7ea..88738717a4 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') }}
+
{{ $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 f9cb9d8659..a08b90fec3 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 c91e66ce2d..99d770366d 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 edbb51e3dc..cff9ff8e52 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 faee9423d8..49ce41c7da 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 eb835b05ac..7be9a75765 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