mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 15:15:12 +00:00
Resolve #3376
This commit is contained in:
parent
7e803ff9a9
commit
0d272b1fb0
7 changed files with 27 additions and 8 deletions
|
@ -118,6 +118,3 @@ autoAdmin: true
|
|||
|
||||
# Clustering
|
||||
#clusterLimit: 1
|
||||
|
||||
# Summaly proxy
|
||||
#summalyProxy: "http://example.com"
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -37,8 +37,6 @@ export type Source = {
|
|||
|
||||
proxy?: string;
|
||||
|
||||
summalyProxy?: string;
|
||||
|
||||
accesslog?: string;
|
||||
|
||||
github_bot?: {
|
||||
|
|
|
@ -197,6 +197,8 @@ export type IMeta = {
|
|||
*/
|
||||
maxNoteTextLength?: number;
|
||||
|
||||
summalyProxy?: string;
|
||||
|
||||
enableTwitterIntegration?: boolean;
|
||||
twitterConsumerKey?: string;
|
||||
twitterConsumerSecret?: string;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue