This commit is contained in:
syuilo 2018-11-23 08:13:17 +09:00
parent 38a9438ef5
commit 536ea5d280
7 changed files with 27 additions and 8 deletions

View file

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

View file

@ -42,6 +42,10 @@
<section> <section>
<ui-switch v-model="disableLocalTimeline">{{ $t('disable-local-timeline') }}</ui-switch> <ui-switch v-model="disableLocalTimeline">{{ $t('disable-local-timeline') }}</ui-switch>
</section> </section>
<section>
<header>summaly Proxy</header>
<ui-input v-model="summalyProxy">URL</ui-input>
</section>
<section> <section>
<header><fa :icon="faUserPlus"/> {{ $t('user-recommendation-config') }}</header> <header><fa :icon="faUserPlus"/> {{ $t('user-recommendation-config') }}</header>
<ui-switch v-model="enableExternalUserRecommendation">{{ $t('enable-external-user-recommendation') }}</ui-switch> <ui-switch v-model="enableExternalUserRecommendation">{{ $t('enable-external-user-recommendation') }}</ui-switch>
@ -138,6 +142,7 @@ export default Vue.extend({
enableExternalUserRecommendation: false, enableExternalUserRecommendation: false,
externalUserRecommendationEngine: null, externalUserRecommendationEngine: null,
externalUserRecommendationTimeout: null, externalUserRecommendationTimeout: null,
summalyProxy: null,
faHeadset, faShieldAlt, faGhost, faUserPlus faHeadset, faShieldAlt, faGhost, faUserPlus
}; };
}, },
@ -170,6 +175,7 @@ export default Vue.extend({
this.enableExternalUserRecommendation = meta.enableExternalUserRecommendation; this.enableExternalUserRecommendation = meta.enableExternalUserRecommendation;
this.externalUserRecommendationEngine = meta.externalUserRecommendationEngine; this.externalUserRecommendationEngine = meta.externalUserRecommendationEngine;
this.externalUserRecommendationTimeout = meta.externalUserRecommendationTimeout; this.externalUserRecommendationTimeout = meta.externalUserRecommendationTimeout;
this.summalyProxy = meta.summalyProxy;
}); });
}, },
@ -214,7 +220,8 @@ export default Vue.extend({
discordClientSecret: this.discordClientSecret, discordClientSecret: this.discordClientSecret,
enableExternalUserRecommendation: this.enableExternalUserRecommendation, enableExternalUserRecommendation: this.enableExternalUserRecommendation,
externalUserRecommendationEngine: this.externalUserRecommendationEngine, externalUserRecommendationEngine: this.externalUserRecommendationEngine,
externalUserRecommendationTimeout: parseInt(this.externalUserRecommendationTimeout, 10) externalUserRecommendationTimeout: parseInt(this.externalUserRecommendationTimeout, 10),
summalyProxy: this.summalyProxy
}).then(() => { }).then(() => {
this.$root.alert({ this.$root.alert({
type: 'success', type: 'success',

View file

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

View file

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

View file

@ -139,6 +139,13 @@ export const meta = {
} }
}, },
summalyProxy: {
validator: $.str.optional.nullable,
desc: {
'ja-JP': 'summalyプロキシURL'
}
},
enableTwitterIntegration: { enableTwitterIntegration: {
validator: $.bool.optional, validator: $.bool.optional,
desc: { desc: {
@ -300,6 +307,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.langs = ps.langs; set.langs = ps.langs;
} }
if (ps.summalyProxy !== undefined) {
set.summalyProxy = ps.summalyProxy;
}
if (ps.enableTwitterIntegration !== undefined) { if (ps.enableTwitterIntegration !== undefined) {
set.enableTwitterIntegration = ps.enableTwitterIntegration; 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.githubClientSecret = instance.githubClientSecret;
response.discordClientId = instance.discordClientId; response.discordClientId = instance.discordClientId;
response.discordClientSecret = instance.discordClientSecret; response.discordClientSecret = instance.discordClientSecret;
response.summalyProxy = instance.summalyProxy;
} }
res(response); res(response);

View file

@ -2,11 +2,14 @@ import * as Koa from 'koa';
import * as request from 'request-promise-native'; import * as request from 'request-promise-native';
import summaly from 'summaly'; import summaly from 'summaly';
import config from '../../config'; import config from '../../config';
import fetchMeta from '../../misc/fetch-meta';
module.exports = async (ctx: Koa.Context) => { module.exports = async (ctx: Koa.Context) => {
const meta = await fetchMeta();
try { try {
const summary = config.summalyProxy ? await request.get({ const summary = meta.summalyProxy ? await request.get({
url: config.summalyProxy, url: meta.summalyProxy,
proxy: config.proxy, proxy: config.proxy,
qs: { qs: {
url: ctx.query.url url: ctx.query.url