switch external user recommendation to admin ui config
This commit is contained in:
parent
664c3c7322
commit
7bddc02958
|
@ -6,6 +6,8 @@ import Mute from '../../../../models/mute';
|
||||||
import * as request from 'request';
|
import * as request from 'request';
|
||||||
import config from '../../../../config';
|
import config from '../../../../config';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
|
import fetchMeta from '../../../../misc/fetch-meta';
|
||||||
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -30,13 +32,15 @@ export const meta = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||||
if (config.user_recommendation && config.user_recommendation.external) {
|
const instance = await fetchMeta();
|
||||||
|
|
||||||
|
if (instance.enableExternalUserRecommendation) {
|
||||||
const userName = me.username;
|
const userName = me.username;
|
||||||
const hostName = config.hostname;
|
const hostName = config.hostname;
|
||||||
const limit = ps.limit;
|
const limit = ps.limit;
|
||||||
const offset = ps.offset;
|
const offset = ps.offset;
|
||||||
const timeout = config.user_recommendation.timeout;
|
const timeout = instance.externalUserRecommendationTimeout;
|
||||||
const engine = config.user_recommendation.engine;
|
const engine = instance.externalUserRecommendationEngine;
|
||||||
const url = engine
|
const url = engine
|
||||||
.replace('{{host}}', hostName)
|
.replace('{{host}}', hostName)
|
||||||
.replace('{{user}}', userName)
|
.replace('{{user}}', userName)
|
||||||
|
|
Loading…
Reference in New Issue