summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/admin/meta.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-09-18 03:27:08 +0900
committerGitHub <noreply@github.com>2022-09-18 03:27:08 +0900
commitb75184ec8e3436200bacdcd832e3324702553d20 (patch)
tree8b7e316f29e95df921db57289c8b8da476d18f07 /packages/backend/src/server/api/endpoints/admin/meta.ts
parentUpdate ROADMAP.md (diff)
downloadmisskey-b75184ec8e3436200bacdcd832e3324702553d20.tar.gz
misskey-b75184ec8e3436200bacdcd832e3324702553d20.tar.bz2
misskey-b75184ec8e3436200bacdcd832e3324702553d20.zip
なんかもうめっちゃ変えた
Diffstat (limited to 'packages/backend/src/server/api/endpoints/admin/meta.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/admin/meta.ts192
1 files changed, 102 insertions, 90 deletions
diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts
index 8746119687..615c0a0e70 100644
--- a/packages/backend/src/server/api/endpoints/admin/meta.ts
+++ b/packages/backend/src/server/api/endpoints/admin/meta.ts
@@ -1,7 +1,9 @@
-import config from '@/config/index.js';
-import { fetchMeta } from '@/misc/fetch-meta.js';
+import { Inject, Injectable } from '@nestjs/common';
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
-import define from '../../define.js';
+import { Endpoint } from '@/server/api/endpoint-base.js';
+import { MetaService } from '@/core/MetaService.js';
+import { Config } from '@/config.js';
+import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['meta'],
@@ -340,91 +342,101 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
-export default define(meta, paramDef, async (ps, me) => {
- const instance = await fetchMeta(true);
+@Injectable()
+export default class extends Endpoint<typeof meta, typeof paramDef> {
+ constructor(
+ @Inject(DI.config)
+ private config: Config,
- return {
- maintainerName: instance.maintainerName,
- maintainerEmail: instance.maintainerEmail,
- version: config.version,
- name: instance.name,
- uri: config.url,
- description: instance.description,
- langs: instance.langs,
- tosUrl: instance.ToSUrl,
- repositoryUrl: instance.repositoryUrl,
- feedbackUrl: instance.feedbackUrl,
- disableRegistration: instance.disableRegistration,
- disableLocalTimeline: instance.disableLocalTimeline,
- disableGlobalTimeline: instance.disableGlobalTimeline,
- driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
- driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
- emailRequiredForSignup: instance.emailRequiredForSignup,
- enableHcaptcha: instance.enableHcaptcha,
- hcaptchaSiteKey: instance.hcaptchaSiteKey,
- enableRecaptcha: instance.enableRecaptcha,
- recaptchaSiteKey: instance.recaptchaSiteKey,
- swPublickey: instance.swPublicKey,
- themeColor: instance.themeColor,
- mascotImageUrl: instance.mascotImageUrl,
- bannerUrl: instance.bannerUrl,
- errorImageUrl: instance.errorImageUrl,
- iconUrl: instance.iconUrl,
- backgroundImageUrl: instance.backgroundImageUrl,
- logoImageUrl: instance.logoImageUrl,
- maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため
- defaultLightTheme: instance.defaultLightTheme,
- defaultDarkTheme: instance.defaultDarkTheme,
- enableEmail: instance.enableEmail,
- enableTwitterIntegration: instance.enableTwitterIntegration,
- enableGithubIntegration: instance.enableGithubIntegration,
- enableDiscordIntegration: instance.enableDiscordIntegration,
- enableServiceWorker: instance.enableServiceWorker,
- translatorAvailable: instance.deeplAuthKey != null,
- pinnedPages: instance.pinnedPages,
- pinnedClipId: instance.pinnedClipId,
- cacheRemoteFiles: instance.cacheRemoteFiles,
- useStarForReactionFallback: instance.useStarForReactionFallback,
- pinnedUsers: instance.pinnedUsers,
- hiddenTags: instance.hiddenTags,
- blockedHosts: instance.blockedHosts,
- hcaptchaSecretKey: instance.hcaptchaSecretKey,
- recaptchaSecretKey: instance.recaptchaSecretKey,
- sensitiveMediaDetection: instance.sensitiveMediaDetection,
- sensitiveMediaDetectionSensitivity: instance.sensitiveMediaDetectionSensitivity,
- setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
- enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
- proxyAccountId: instance.proxyAccountId,
- twitterConsumerKey: instance.twitterConsumerKey,
- twitterConsumerSecret: instance.twitterConsumerSecret,
- githubClientId: instance.githubClientId,
- githubClientSecret: instance.githubClientSecret,
- discordClientId: instance.discordClientId,
- discordClientSecret: instance.discordClientSecret,
- summalyProxy: instance.summalyProxy,
- email: instance.email,
- smtpSecure: instance.smtpSecure,
- smtpHost: instance.smtpHost,
- smtpPort: instance.smtpPort,
- smtpUser: instance.smtpUser,
- smtpPass: instance.smtpPass,
- swPrivateKey: instance.swPrivateKey,
- useObjectStorage: instance.useObjectStorage,
- objectStorageBaseUrl: instance.objectStorageBaseUrl,
- objectStorageBucket: instance.objectStorageBucket,
- objectStoragePrefix: instance.objectStoragePrefix,
- objectStorageEndpoint: instance.objectStorageEndpoint,
- objectStorageRegion: instance.objectStorageRegion,
- objectStoragePort: instance.objectStoragePort,
- objectStorageAccessKey: instance.objectStorageAccessKey,
- objectStorageSecretKey: instance.objectStorageSecretKey,
- objectStorageUseSSL: instance.objectStorageUseSSL,
- objectStorageUseProxy: instance.objectStorageUseProxy,
- objectStorageSetPublicRead: instance.objectStorageSetPublicRead,
- objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle,
- deeplAuthKey: instance.deeplAuthKey,
- deeplIsPro: instance.deeplIsPro,
- enableIpLogging: instance.enableIpLogging,
- enableActiveEmailValidation: instance.enableActiveEmailValidation,
- };
-});
+ private metaService: MetaService,
+ ) {
+ super(meta, paramDef, async (ps, me) => {
+ const instance = await this.metaService.fetch(true);
+
+ return {
+ maintainerName: instance.maintainerName,
+ maintainerEmail: instance.maintainerEmail,
+ version: this.config.version,
+ name: instance.name,
+ uri: this.config.url,
+ description: instance.description,
+ langs: instance.langs,
+ tosUrl: instance.ToSUrl,
+ repositoryUrl: instance.repositoryUrl,
+ feedbackUrl: instance.feedbackUrl,
+ disableRegistration: instance.disableRegistration,
+ disableLocalTimeline: instance.disableLocalTimeline,
+ disableGlobalTimeline: instance.disableGlobalTimeline,
+ driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
+ driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
+ emailRequiredForSignup: instance.emailRequiredForSignup,
+ enableHcaptcha: instance.enableHcaptcha,
+ hcaptchaSiteKey: instance.hcaptchaSiteKey,
+ enableRecaptcha: instance.enableRecaptcha,
+ recaptchaSiteKey: instance.recaptchaSiteKey,
+ swPublickey: instance.swPublicKey,
+ themeColor: instance.themeColor,
+ mascotImageUrl: instance.mascotImageUrl,
+ bannerUrl: instance.bannerUrl,
+ errorImageUrl: instance.errorImageUrl,
+ iconUrl: instance.iconUrl,
+ backgroundImageUrl: instance.backgroundImageUrl,
+ logoImageUrl: instance.logoImageUrl,
+ maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため
+ defaultLightTheme: instance.defaultLightTheme,
+ defaultDarkTheme: instance.defaultDarkTheme,
+ enableEmail: instance.enableEmail,
+ enableTwitterIntegration: instance.enableTwitterIntegration,
+ enableGithubIntegration: instance.enableGithubIntegration,
+ enableDiscordIntegration: instance.enableDiscordIntegration,
+ enableServiceWorker: instance.enableServiceWorker,
+ translatorAvailable: instance.deeplAuthKey != null,
+ pinnedPages: instance.pinnedPages,
+ pinnedClipId: instance.pinnedClipId,
+ cacheRemoteFiles: instance.cacheRemoteFiles,
+ useStarForReactionFallback: instance.useStarForReactionFallback,
+ pinnedUsers: instance.pinnedUsers,
+ hiddenTags: instance.hiddenTags,
+ blockedHosts: instance.blockedHosts,
+ hcaptchaSecretKey: instance.hcaptchaSecretKey,
+ recaptchaSecretKey: instance.recaptchaSecretKey,
+ sensitiveMediaDetection: instance.sensitiveMediaDetection,
+ sensitiveMediaDetectionSensitivity: instance.sensitiveMediaDetectionSensitivity,
+ setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
+ enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
+ proxyAccountId: instance.proxyAccountId,
+ twitterConsumerKey: instance.twitterConsumerKey,
+ twitterConsumerSecret: instance.twitterConsumerSecret,
+ githubClientId: instance.githubClientId,
+ githubClientSecret: instance.githubClientSecret,
+ discordClientId: instance.discordClientId,
+ discordClientSecret: instance.discordClientSecret,
+ summalyProxy: instance.summalyProxy,
+ email: instance.email,
+ smtpSecure: instance.smtpSecure,
+ smtpHost: instance.smtpHost,
+ smtpPort: instance.smtpPort,
+ smtpUser: instance.smtpUser,
+ smtpPass: instance.smtpPass,
+ swPrivateKey: instance.swPrivateKey,
+ useObjectStorage: instance.useObjectStorage,
+ objectStorageBaseUrl: instance.objectStorageBaseUrl,
+ objectStorageBucket: instance.objectStorageBucket,
+ objectStoragePrefix: instance.objectStoragePrefix,
+ objectStorageEndpoint: instance.objectStorageEndpoint,
+ objectStorageRegion: instance.objectStorageRegion,
+ objectStoragePort: instance.objectStoragePort,
+ objectStorageAccessKey: instance.objectStorageAccessKey,
+ objectStorageSecretKey: instance.objectStorageSecretKey,
+ objectStorageUseSSL: instance.objectStorageUseSSL,
+ objectStorageUseProxy: instance.objectStorageUseProxy,
+ objectStorageSetPublicRead: instance.objectStorageSetPublicRead,
+ objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle,
+ deeplAuthKey: instance.deeplAuthKey,
+ deeplIsPro: instance.deeplIsPro,
+ enableIpLogging: instance.enableIpLogging,
+ enableActiveEmailValidation: instance.enableActiveEmailValidation,
+ };
+ });
+ }
+}