diff options
Diffstat (limited to 'src/server/api/endpoints/meta.ts')
| -rw-r--r-- | src/server/api/endpoints/meta.ts | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index a297f47e0e..d18543f56a 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -1,10 +1,11 @@ import $ from 'cafy'; import * as os from 'os'; import config from '../../../config'; -import Emoji from '../../../models/emoji'; import define from '../define'; -import fetchMeta from '../../../misc/fetch-meta'; +import { fetchMeta } from '../../../misc/fetch-meta'; import * as pkg from '../../../../package.json'; +import { Emojis } from '../../../models'; +import { types, bool } from '../../../misc/schema'; export const meta = { stability: 'stable', @@ -26,32 +27,40 @@ export const meta = { }, res: { - type: 'object', + type: types.object, + optional: bool.false, nullable: bool.false, properties: { version: { - type: 'string', + type: types.string, + optional: bool.false, nullable: bool.false, description: 'The version of Misskey of this instance.', example: pkg.version }, name: { - type: 'string', + type: types.string, + optional: bool.false, nullable: bool.false, description: 'The name of this instance.', }, description: { - type: 'string', + type: types.string, + optional: bool.false, nullable: bool.false, description: 'The description of this instance.', }, announcements: { - type: 'array', + type: types.array, + optional: bool.false, nullable: bool.false, items: { - type: 'object', + type: types.object, + optional: bool.false, nullable: bool.false, properties: { title: { - type: 'string', + type: types.string, + optional: bool.false, nullable: bool.false, description: 'The title of the announcement.', }, text: { - type: 'string', + type: types.string, + optional: bool.false, nullable: bool.false, description: 'The text of the announcement. (can be HTML)', }, } @@ -59,19 +68,23 @@ export const meta = { description: 'The announcements of this instance.', }, disableRegistration: { - type: 'boolean', + type: types.boolean, + optional: bool.false, nullable: bool.false, description: 'Whether disabled open registration.', }, disableLocalTimeline: { - type: 'boolean', + type: types.boolean, + optional: bool.false, nullable: bool.false, description: 'Whether disabled LTL and STL.', }, disableGlobalTimeline: { - type: 'boolean', + type: types.boolean, + optional: bool.false, nullable: bool.false, description: 'Whether disabled GTL.', }, enableEmojiReaction: { - type: 'boolean', + type: types.boolean, + optional: bool.false, nullable: bool.false, description: 'Whether enabled emoji reaction.', }, } @@ -79,16 +92,13 @@ export const meta = { }; export default define(meta, async (ps, me) => { - const instance = await fetchMeta(); + const instance = await fetchMeta(true); - const emojis = await Emoji.find({ host: null }, { - fields: { - _id: false - } - }); + const emojis = await Emojis.find({ where: { host: null }, cache: 3600000 }); // 1 hour const response: any = { - maintainer: instance.maintainer, + maintainerName: instance.maintainerName, + maintainerEmail: instance.maintainerEmail, version: pkg.version, @@ -96,6 +106,9 @@ export default define(meta, async (ps, me) => { uri: config.url, description: instance.description, langs: instance.langs, + ToSUrl: instance.ToSUrl, + repositoryUrl: instance.repositoryUrl, + feedbackUrl: instance.feedbackUrl, secure: config.https != null, machine: os.hostname(), @@ -140,22 +153,19 @@ export default define(meta, async (ps, me) => { globalTimeLine: !instance.disableGlobalTimeline, elasticsearch: config.elasticsearch ? true : false, recaptcha: instance.enableRecaptcha, - objectStorage: config.drive && config.drive.storage === 'minio', + objectStorage: instance.useObjectStorage, twitter: instance.enableTwitterIntegration, github: instance.enableGithubIntegration, discord: instance.enableDiscordIntegration, serviceWorker: instance.enableServiceWorker, - userRecommendation: { - external: instance.enableExternalUserRecommendation, - engine: instance.externalUserRecommendationEngine, - timeout: instance.externalUserRecommendationTimeout - } }; } if (me && (me.isAdmin || me.isModerator)) { response.useStarForReactionFallback = instance.useStarForReactionFallback; - response.hidedTags = instance.hidedTags; + response.pinnedUsers = instance.pinnedUsers; + response.hiddenTags = instance.hiddenTags; + response.blockedHosts = instance.blockedHosts; response.recaptchaSecretKey = instance.recaptchaSecretKey; response.proxyAccount = instance.proxyAccount; response.twitterConsumerKey = instance.twitterConsumerKey; @@ -164,9 +174,6 @@ export default define(meta, async (ps, me) => { response.githubClientSecret = instance.githubClientSecret; response.discordClientId = instance.discordClientId; response.discordClientSecret = instance.discordClientSecret; - response.enableExternalUserRecommendation = instance.enableExternalUserRecommendation; - response.externalUserRecommendationEngine = instance.externalUserRecommendationEngine; - response.externalUserRecommendationTimeout = instance.externalUserRecommendationTimeout; response.summalyProxy = instance.summalyProxy; response.email = instance.email; response.smtpSecure = instance.smtpSecure; @@ -175,6 +182,16 @@ export default define(meta, async (ps, me) => { response.smtpUser = instance.smtpUser; response.smtpPass = instance.smtpPass; response.swPrivateKey = instance.swPrivateKey; + response.useObjectStorage = instance.useObjectStorage; + response.objectStorageBaseUrl = instance.objectStorageBaseUrl; + response.objectStorageBucket = instance.objectStorageBucket; + response.objectStoragePrefix = instance.objectStoragePrefix; + response.objectStorageEndpoint = instance.objectStorageEndpoint; + response.objectStorageRegion = instance.objectStorageRegion; + response.objectStoragePort = instance.objectStoragePort; + response.objectStorageAccessKey = instance.objectStorageAccessKey; + response.objectStorageSecretKey = instance.objectStorageSecretKey; + response.objectStorageUseSSL = instance.objectStorageUseSSL; } return response; |