This commit is contained in:
syuilo 2018-11-23 08:13:17 +09:00
parent 7e803ff9a9
commit 0d272b1fb0
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
7 changed files with 27 additions and 8 deletions

View File

@ -118,6 +118,3 @@ autoAdmin: true
# Clustering
#clusterLimit: 1
# Summaly proxy
#summalyProxy: "http://example.com"

View File

@ -42,6 +42,10 @@
<section>
<ui-switch v-model="disableLocalTimeline">{{ $t('disable-local-timeline') }}</ui-switch>
</section>
<section>
<header>summaly Proxy</header>
<ui-input v-model="summalyProxy">URL</ui-input>
</section>
<section>
<header><fa :icon="faUserPlus"/> {{ $t('user-recommendation-config') }}</header>
<ui-switch v-model="enableExternalUserRecommendation">{{ $t('enable-external-user-recommendation') }}</ui-switch>
@ -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',

View File

@ -37,8 +37,6 @@ export type Source = {
proxy?: string;
summalyProxy?: string;
accesslog?: string;
github_bot?: {

View File

@ -197,6 +197,8 @@ export type IMeta = {
*/
maxNoteTextLength?: number;
summalyProxy?: string;
enableTwitterIntegration?: boolean;
twitterConsumerKey?: string;
twitterConsumerSecret?: string;

View File

@ -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;
}

View File

@ -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);

View File

@ -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