diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue
index 4c234ec260..84a6e49db7 100644
--- a/src/client/app/admin/views/instance.vue
+++ b/src/client/app/admin/views/instance.vue
@@ -45,6 +45,12 @@
+
+ {{ $t('user-recommendation-config') }}
+ {{ $t('enable-external-user-recommendation') }}
+ {{ $t('external-user-recommendation-engine') }}
+ {{ $t('external-user-recommendation-timeout') }}ns{{ $t('ns') }}
+
@@ -95,7 +101,7 @@ import Vue from 'vue';
import i18n from '../../i18n';
import { host } from '../../config';
import { toUnicode } from 'punycode';
-import { faHeadset, faShieldAlt, faGhost } from '@fortawesome/free-solid-svg-icons';
+import { faHeadset, faShieldAlt, faGhost, faUserPlus } from '@fortawesome/free-solid-svg-icons';
export default Vue.extend({
i18n: i18n('admin/views/instance.vue'),
@@ -129,7 +135,10 @@ export default Vue.extend({
discordClientSecret: null,
proxyAccount: null,
inviteCode: null,
- faHeadset, faShieldAlt, faGhost
+ enableExternalUserRecommendation: false,
+ externalUserRecommendationEngine: null,
+ externalUserRecommendationTimeout: null,
+ faHeadset, faShieldAlt, faGhost, faUserPlus
};
},
@@ -158,6 +167,9 @@ export default Vue.extend({
this.enableDiscordIntegration = meta.enableDiscordIntegration;
this.discordClientId = meta.discordClientId;
this.discordClientSecret = meta.discordClientSecret;
+ this.enableExternalUserRecommendation = meta.ebableExternalUserRecommendation;
+ this.externalUserRecommendationEngine = meta.externalUserRecommendationEngine;
+ this.externalUserRecommendationTimeout = meta.externalUserRecommendationTimeout;
});
},
@@ -199,7 +211,10 @@ export default Vue.extend({
githubClientSecret: this.githubClientSecret,
enableDiscordIntegration: this.enableDiscordIntegration,
discordClientId: this.discordClientId,
- discordClientSecret: this.discordClientSecret
+ discordClientSecret: this.discordClientSecret,
+ enableExternalUserRecommendation: this.enableExternalUserRecommendation,
+ externalUserRecommendationEngine: this.externalUserRecommendationEngine,
+ externalUserRecommenadtionTimeout: this.externalUserRecommendationTimeout
}).then(() => {
this.$root.alert({
type: 'success',
diff --git a/src/misc/fetch-meta.ts b/src/misc/fetch-meta.ts
index e855097c42..87af2647d6 100644
--- a/src/misc/fetch-meta.ts
+++ b/src/misc/fetch-meta.ts
@@ -15,7 +15,10 @@ const defaultMeta: any = {
maxNoteTextLength: 1000,
enableTwitterIntegration: false,
enableGithubIntegration: false,
- enableDiscordIntegration: false
+ enableDiscordIntegration: false,
+ enableExternalUserRecommendation: false;
+ externalUserRecommendationEngine: "http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-misskey-api.cgi?{{host}}+{{user}}+{{limit}}+{{offset}}";
+ externalUserRecommendationTimeout: 300000;
};
export default async function(): Promise {
diff --git a/src/models/meta.ts b/src/models/meta.ts
index 34117afd25..a8e3c85cff 100644
--- a/src/models/meta.ts
+++ b/src/models/meta.ts
@@ -125,6 +125,19 @@ if ((config as any).github) {
}
});
}
+if ((config as any).user_recommendation) {
+ Meta.findOne({}).then(m => {
+ if (m != null && m.enableExternalUserRecommendation == null) {
+ Meta.update({}, {
+ $set: {
+ enableExternalUserRecommendation: true,
+ externalUserRecommendationEngine: (config as any).user_recommendation.engine,
+ externalUserRecommendationTimeout: (config as any).user_recommendation.timeout
+ }
+ });
+ }
+ });
+}
export type IMeta = {
name?: string;
@@ -195,4 +208,8 @@ export type IMeta = {
enableDiscordIntegration?: boolean;
discordClientId?: string;
discordClientSecret?: string;
+
+ enableExternalUserRecommendation? boolean;
+ externalUserRecommendationEngine? string;
+ externalUserRecommendationTimeout? number;
};
diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts
index bbae212bd7..956581b94c 100644
--- a/src/server/api/endpoints/admin/update-meta.ts
+++ b/src/server/api/endpoints/admin/update-meta.ts
@@ -200,6 +200,27 @@ export const meta = {
desc: {
'ja-JP': 'DiscordアプリのClient Secret'
}
+ },
+
+ enableExternalUserRecommendation: {
+ validator: $.bool.optional,
+ desc: {
+ 'ja-JP': '外部ユーザーレコメンデーションを有効にする'
+ }
+ },
+
+ externalUserRecommendationEngine: {
+ validator: $.str.optional.nullable,
+ desc: {
+ 'ja-JP': '外部ユーザーレコメンデーションのサードパーティエンジン'
+ }
+ },
+
+ externalUserRecommendationTimeout: {
+ validator: $.num.optional.min(0),
+ desc: {
+ 'ja-JP': '外部ユーザーレコメンデーションのタイムアウト (ミリ秒)'
+ }
}
}
};
@@ -315,6 +336,18 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.discordClientSecret = ps.discordClientSecret;
}
+ if (ps.enableExternalUserRecommendation !== undefined) {
+ set.enableExternalUserRecommendation = ps.enableExternalUserRecommendation;
+ }
+
+ if (ps.externalUserRecommendationEngine !== undefined) {
+ set.externalUserRecommendationEngine = ps.externalUserRecommendationEngine;
+ }
+
+ if (ps.externalUserRecommendationTimeout !== undefined) {
+ set.externalUserRecommendationTimeout = ps.externalUserRecommendationTimeout;
+ }
+
await Meta.update({}, {
$set: set
}, { upsert: true });
diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts
index 9846e95959..e5e2f3365b 100644
--- a/src/server/api/endpoints/meta.ts
+++ b/src/server/api/endpoints/meta.ts
@@ -85,7 +85,11 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
github: instance.enableGithubIntegration,
discord: instance.enableDiscordIntegration,
serviceWorker: config.sw ? true : false,
- userRecommendation: config.user_recommendation ? config.user_recommendation : {}
+ userRecommendation: {
+ external: instance.enableExternalUserRecommendation,
+ engine: instance.externalUserRecommendationEngine,
+ timeout: instance.externalUserRecommendationTimeout
+ }
};
}