2022-09-17 20:27:08 +02:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
2022-03-24 17:50:28 +01:00
|
|
|
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
|
|
import { MetaService } from '@/core/MetaService.js';
|
2022-09-20 22:33:11 +02:00
|
|
|
import type { Config } from '@/config.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { DI } from '@/di-symbols.js';
|
2023-01-15 12:52:53 +01:00
|
|
|
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
2022-03-24 17:50:28 +01:00
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['meta'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireAdmin: true,
|
|
|
|
|
|
|
|
res: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
properties: {
|
|
|
|
cacheRemoteFiles: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
emailRequiredForSignup: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
enableHcaptcha: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
hcaptchaSiteKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
enableRecaptcha: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
recaptchaSiteKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
2022-10-13 02:19:57 +02:00
|
|
|
enableTurnstile: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
turnstileSiteKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
2022-03-24 17:50:28 +01:00
|
|
|
swPublickey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
mascotImageUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
default: '/assets/ai.png',
|
|
|
|
},
|
|
|
|
bannerUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
errorImageUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
default: 'https://xn--931a.moe/aiart/yubitun.png',
|
|
|
|
},
|
|
|
|
iconUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
maxNoteTextLength: {
|
|
|
|
type: 'number',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
emojis: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
properties: {
|
|
|
|
id: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'id',
|
|
|
|
},
|
|
|
|
aliases: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
category: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
host: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'url',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ads: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
properties: {
|
|
|
|
place: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'url',
|
|
|
|
},
|
|
|
|
imageUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'url',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
enableEmail: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
enableServiceWorker: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
translatorAvailable: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
proxyAccountName: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
userStarForReactionFallback: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
pinnedUsers: {
|
|
|
|
type: 'array',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hiddenTags: {
|
|
|
|
type: 'array',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
blockedHosts: {
|
|
|
|
type: 'array',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hcaptchaSecretKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
recaptchaSecretKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
2022-10-13 02:19:57 +02:00
|
|
|
turnstileSecretKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
2022-12-02 15:12:09 +01:00
|
|
|
},
|
2022-07-07 14:06:37 +02:00
|
|
|
sensitiveMediaDetection: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
sensitiveMediaDetectionSensitivity: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
setSensitiveFlagAutomatically: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
enableSensitiveMediaDetectionForVideos: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
2022-03-24 17:50:28 +01:00
|
|
|
proxyAccountId: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
format: 'id',
|
|
|
|
},
|
|
|
|
summaryProxy: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
email: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
smtpSecure: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
smtpHost: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
smtpPort: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
smtpUser: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
smtpPass: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
swPrivateKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
useObjectStorage: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
objectStorageBaseUrl: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageBucket: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStoragePrefix: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageEndpoint: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageRegion: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStoragePort: {
|
|
|
|
type: 'number',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageAccessKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageSecretKey: {
|
|
|
|
type: 'string',
|
|
|
|
optional: true, nullable: true,
|
|
|
|
},
|
|
|
|
objectStorageUseSSL: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
objectStorageUseProxy: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
|
|
|
objectStorageSetPublicRead: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
2022-07-02 08:12:11 +02:00
|
|
|
enableIpLogging: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
2022-07-09 08:05:55 +02:00
|
|
|
enableActiveEmailValidation: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
2022-03-24 17:50:28 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export const paramDef = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
},
|
|
|
|
required: [],
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-09-17 20:27:08 +02:00
|
|
|
@Injectable()
|
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|
|
|
constructor(
|
|
|
|
@Inject(DI.config)
|
|
|
|
private config: Config,
|
2022-03-24 17:50:28 +01:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
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,
|
|
|
|
emailRequiredForSignup: instance.emailRequiredForSignup,
|
|
|
|
enableHcaptcha: instance.enableHcaptcha,
|
|
|
|
hcaptchaSiteKey: instance.hcaptchaSiteKey,
|
|
|
|
enableRecaptcha: instance.enableRecaptcha,
|
|
|
|
recaptchaSiteKey: instance.recaptchaSiteKey,
|
2022-10-13 02:19:57 +02:00
|
|
|
enableTurnstile: instance.enableTurnstile,
|
|
|
|
turnstileSiteKey: instance.turnstileSiteKey,
|
2022-09-17 20:27:08 +02:00
|
|
|
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,
|
|
|
|
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,
|
2022-10-13 02:19:57 +02:00
|
|
|
turnstileSecretKey: instance.turnstileSecretKey,
|
2022-09-17 20:27:08 +02:00
|
|
|
sensitiveMediaDetection: instance.sensitiveMediaDetection,
|
|
|
|
sensitiveMediaDetectionSensitivity: instance.sensitiveMediaDetectionSensitivity,
|
|
|
|
setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
|
|
|
|
enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
|
|
|
|
proxyAccountId: instance.proxyAccountId,
|
|
|
|
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,
|
2023-01-15 12:52:53 +01:00
|
|
|
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
2022-09-17 20:27:08 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|