2023-07-27 05:31:52 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-08-05 01:33:00 +00:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2023-09-20 02:33:36 +00:00
|
|
|
import type { MiMeta } from '@/models/Meta.js';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
2022-09-20 17:52:19 +00:00
|
|
|
import { MetaService } from '@/core/MetaService.js';
|
2018-08-22 18:19:57 +00:00
|
|
|
|
|
|
|
export const meta = {
|
2019-02-23 02:20:58 +00:00
|
|
|
tags: ['admin'],
|
|
|
|
|
2022-01-18 13:27:10 +00:00
|
|
|
requireCredential: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
requireAdmin: true,
|
2023-12-27 06:08:59 +00:00
|
|
|
kind: 'write:admin:meta',
|
2022-02-19 05:05:32 +00:00
|
|
|
} as const;
|
2018-08-22 18:19:57 +00:00
|
|
|
|
2022-02-20 04:15:40 +00:00
|
|
|
export const paramDef = {
|
2022-02-19 05:05:32 +00:00
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
disableRegistration: { type: 'boolean', nullable: true },
|
2023-10-16 11:11:27 +00:00
|
|
|
pinnedUsers: {
|
|
|
|
type: 'array', nullable: true, items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hiddenTags: {
|
|
|
|
type: 'array', nullable: true, items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
blockedHosts: {
|
|
|
|
type: 'array', nullable: true, items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sensitiveWords: {
|
|
|
|
type: 'array', nullable: true, items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
2022-05-19 07:54:45 +00:00
|
|
|
themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' },
|
2022-02-19 05:05:32 +00:00
|
|
|
mascotImageUrl: { type: 'string', nullable: true },
|
|
|
|
bannerUrl: { type: 'string', nullable: true },
|
2023-06-09 05:00:53 +00:00
|
|
|
serverErrorImageUrl: { type: 'string', nullable: true },
|
|
|
|
infoImageUrl: { type: 'string', nullable: true },
|
|
|
|
notFoundImageUrl: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
iconUrl: { type: 'string', nullable: true },
|
2023-09-16 08:05:17 +00:00
|
|
|
app192IconUrl: { type: 'string', nullable: true },
|
|
|
|
app512IconUrl: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
backgroundImageUrl: { type: 'string', nullable: true },
|
|
|
|
logoImageUrl: { type: 'string', nullable: true },
|
|
|
|
name: { type: 'string', nullable: true },
|
2023-09-23 03:38:20 +00:00
|
|
|
shortName: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
description: { type: 'string', nullable: true },
|
2022-03-01 14:58:01 +00:00
|
|
|
defaultLightTheme: { type: 'string', nullable: true },
|
|
|
|
defaultDarkTheme: { type: 'string', nullable: true },
|
2023-11-12 21:16:47 +00:00
|
|
|
defaultLike: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
cacheRemoteFiles: { type: 'boolean' },
|
2023-07-15 11:12:20 +00:00
|
|
|
cacheRemoteSensitiveFiles: { type: 'boolean' },
|
2022-02-19 05:05:32 +00:00
|
|
|
emailRequiredForSignup: { type: 'boolean' },
|
2023-10-18 00:41:36 +00:00
|
|
|
approvalRequiredForSignup: { type: 'boolean' },
|
2022-02-19 05:05:32 +00:00
|
|
|
enableHcaptcha: { type: 'boolean' },
|
|
|
|
hcaptchaSiteKey: { type: 'string', nullable: true },
|
|
|
|
hcaptchaSecretKey: { type: 'string', nullable: true },
|
2024-01-06 11:14:33 +00:00
|
|
|
enableMcaptcha: { type: 'boolean' },
|
|
|
|
mcaptchaSiteKey: { type: 'string', nullable: true },
|
|
|
|
mcaptchaInstanceUrl: { type: 'string', nullable: true },
|
|
|
|
mcaptchaSecretKey: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
enableRecaptcha: { type: 'boolean' },
|
|
|
|
recaptchaSiteKey: { type: 'string', nullable: true },
|
|
|
|
recaptchaSecretKey: { type: 'string', nullable: true },
|
2022-10-13 00:19:57 +00:00
|
|
|
enableTurnstile: { type: 'boolean' },
|
|
|
|
turnstileSiteKey: { type: 'string', nullable: true },
|
|
|
|
turnstileSecretKey: { type: 'string', nullable: true },
|
2022-07-07 12:06:37 +00:00
|
|
|
sensitiveMediaDetection: { type: 'string', enum: ['none', 'all', 'local', 'remote'] },
|
|
|
|
sensitiveMediaDetectionSensitivity: { type: 'string', enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'] },
|
|
|
|
setSensitiveFlagAutomatically: { type: 'boolean' },
|
|
|
|
enableSensitiveMediaDetectionForVideos: { type: 'boolean' },
|
2023-10-18 05:29:16 +00:00
|
|
|
enableBotTrending: { type: 'boolean' },
|
2022-02-19 05:05:32 +00:00
|
|
|
proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true },
|
|
|
|
maintainerName: { type: 'string', nullable: true },
|
|
|
|
maintainerEmail: { type: 'string', nullable: true },
|
2023-10-16 11:11:27 +00:00
|
|
|
langs: {
|
|
|
|
type: 'array', items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
2022-02-19 05:05:32 +00:00
|
|
|
summalyProxy: { type: 'string', nullable: true },
|
|
|
|
deeplAuthKey: { type: 'string', nullable: true },
|
|
|
|
deeplIsPro: { type: 'boolean' },
|
|
|
|
enableEmail: { type: 'boolean' },
|
|
|
|
email: { type: 'string', nullable: true },
|
|
|
|
smtpSecure: { type: 'boolean' },
|
|
|
|
smtpHost: { type: 'string', nullable: true },
|
|
|
|
smtpPort: { type: 'integer', nullable: true },
|
|
|
|
smtpUser: { type: 'string', nullable: true },
|
|
|
|
smtpPass: { type: 'string', nullable: true },
|
|
|
|
enableServiceWorker: { type: 'boolean' },
|
|
|
|
swPublicKey: { type: 'string', nullable: true },
|
|
|
|
swPrivateKey: { type: 'string', nullable: true },
|
|
|
|
tosUrl: { type: 'string', nullable: true },
|
|
|
|
repositoryUrl: { type: 'string' },
|
|
|
|
feedbackUrl: { type: 'string' },
|
2023-10-17 17:39:48 +00:00
|
|
|
impressumUrl: { type: 'string', nullable: true },
|
2024-01-09 20:32:47 +00:00
|
|
|
donationUrl: { type: 'string', nullable: true },
|
2023-10-17 17:39:48 +00:00
|
|
|
privacyPolicyUrl: { type: 'string', nullable: true },
|
2022-02-19 05:05:32 +00:00
|
|
|
useObjectStorage: { type: 'boolean' },
|
|
|
|
objectStorageBaseUrl: { type: 'string', nullable: true },
|
|
|
|
objectStorageBucket: { type: 'string', nullable: true },
|
|
|
|
objectStoragePrefix: { type: 'string', nullable: true },
|
|
|
|
objectStorageEndpoint: { type: 'string', nullable: true },
|
|
|
|
objectStorageRegion: { type: 'string', nullable: true },
|
|
|
|
objectStoragePort: { type: 'integer', nullable: true },
|
|
|
|
objectStorageAccessKey: { type: 'string', nullable: true },
|
|
|
|
objectStorageSecretKey: { type: 'string', nullable: true },
|
|
|
|
objectStorageUseSSL: { type: 'boolean' },
|
|
|
|
objectStorageUseProxy: { type: 'boolean' },
|
|
|
|
objectStorageSetPublicRead: { type: 'boolean' },
|
|
|
|
objectStorageS3ForcePathStyle: { type: 'boolean' },
|
2022-07-02 06:12:11 +00:00
|
|
|
enableIpLogging: { type: 'boolean' },
|
2022-07-09 06:05:55 +00:00
|
|
|
enableActiveEmailValidation: { type: 'boolean' },
|
2023-11-18 11:39:48 +00:00
|
|
|
enableVerifymailApi: { type: 'boolean' },
|
|
|
|
verifymailAuthKey: { type: 'string', nullable: true },
|
2023-12-29 09:23:29 +00:00
|
|
|
enableTruemailApi: { type: 'boolean' },
|
|
|
|
truemailInstance: { type: 'string', nullable: true },
|
|
|
|
truemailAuthKey: { type: 'string', nullable: true },
|
2023-03-24 06:43:36 +00:00
|
|
|
enableChartsForRemoteUser: { type: 'boolean' },
|
2023-03-24 10:08:08 +00:00
|
|
|
enableChartsForFederatedInstances: { type: 'boolean' },
|
2023-07-02 07:02:32 +00:00
|
|
|
enableServerMachineStats: { type: 'boolean' },
|
2023-09-28 22:57:38 +00:00
|
|
|
enableAchievements: { type: 'boolean' },
|
2023-07-02 07:02:32 +00:00
|
|
|
enableIdenticonGeneration: { type: 'boolean' },
|
2023-04-19 12:24:31 +00:00
|
|
|
serverRules: { type: 'array', items: { type: 'string' } },
|
2023-12-23 03:06:22 +00:00
|
|
|
bannedEmailDomains: { type: 'array', items: { type: 'string' } },
|
2023-04-29 08:03:14 +00:00
|
|
|
preservedUsernames: { type: 'array', items: { type: 'string' } },
|
2023-12-04 01:10:51 +00:00
|
|
|
bubbleInstances: { type: 'array', items: { type: 'string' } },
|
2023-09-16 08:05:17 +00:00
|
|
|
manifestJsonOverride: { type: 'string' },
|
2023-10-23 06:17:25 +00:00
|
|
|
enableFanoutTimeline: { type: 'boolean' },
|
2023-11-16 01:20:57 +00:00
|
|
|
enableFanoutTimelineDbFallback: { type: 'boolean' },
|
2023-10-03 23:46:27 +00:00
|
|
|
perLocalUserUserTimelineCacheMax: { type: 'integer' },
|
|
|
|
perRemoteUserUserTimelineCacheMax: { type: 'integer' },
|
|
|
|
perUserHomeTimelineCacheMax: { type: 'integer' },
|
|
|
|
perUserListTimelineCacheMax: { type: 'integer' },
|
2023-10-08 08:56:44 +00:00
|
|
|
notesPerOneAd: { type: 'integer' },
|
2023-10-16 11:11:27 +00:00
|
|
|
silencedHosts: {
|
|
|
|
type: 'array',
|
|
|
|
nullable: true,
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
2021-12-09 14:58:30 +00:00
|
|
|
},
|
2022-02-19 05:05:32 +00:00
|
|
|
required: [],
|
2022-01-18 13:27:10 +00:00
|
|
|
} as const;
|
2018-08-22 18:19:57 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
@Injectable()
|
2023-08-17 12:20:58 +00:00
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
2022-09-17 18:27:08 +00:00
|
|
|
constructor(
|
2022-09-20 17:52:19 +00:00
|
|
|
private metaService: MetaService,
|
2022-09-17 18:27:08 +00:00
|
|
|
private moderationLogService: ModerationLogService,
|
|
|
|
) {
|
|
|
|
super(meta, paramDef, async (ps, me) => {
|
2023-08-16 08:51:28 +00:00
|
|
|
const set = {} as Partial<MiMeta>;
|
2018-08-22 18:19:57 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (typeof ps.disableRegistration === 'boolean') {
|
|
|
|
set.disableRegistration = ps.disableRegistration;
|
|
|
|
}
|
2019-03-17 16:03:35 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (Array.isArray(ps.pinnedUsers)) {
|
|
|
|
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
|
|
|
}
|
2022-07-07 12:06:37 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (Array.isArray(ps.hiddenTags)) {
|
|
|
|
set.hiddenTags = ps.hiddenTags.filter(Boolean);
|
|
|
|
}
|
2022-07-07 12:06:37 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (Array.isArray(ps.blockedHosts)) {
|
2023-01-13 09:21:07 +00:00
|
|
|
set.blockedHosts = ps.blockedHosts.filter(Boolean).map(x => x.toLowerCase());
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
2022-07-07 12:06:37 +00:00
|
|
|
|
2023-03-13 08:37:22 +00:00
|
|
|
if (Array.isArray(ps.sensitiveWords)) {
|
|
|
|
set.sensitiveWords = ps.sensitiveWords.filter(Boolean);
|
|
|
|
}
|
2023-10-16 11:11:27 +00:00
|
|
|
if (Array.isArray(ps.silencedHosts)) {
|
|
|
|
let lastValue = '';
|
|
|
|
set.silencedHosts = ps.silencedHosts.sort().filter((h) => {
|
|
|
|
const lv = lastValue;
|
|
|
|
lastValue = h;
|
|
|
|
return h !== '' && h !== lv && !set.blockedHosts?.includes(h);
|
|
|
|
});
|
|
|
|
}
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.themeColor !== undefined) {
|
|
|
|
set.themeColor = ps.themeColor;
|
|
|
|
}
|
2018-11-06 15:44:56 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.mascotImageUrl !== undefined) {
|
|
|
|
set.mascotImageUrl = ps.mascotImageUrl;
|
|
|
|
}
|
2018-11-06 16:12:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.bannerUrl !== undefined) {
|
|
|
|
set.bannerUrl = ps.bannerUrl;
|
|
|
|
}
|
2018-11-06 16:12:26 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.iconUrl !== undefined) {
|
|
|
|
set.iconUrl = ps.iconUrl;
|
|
|
|
}
|
2018-11-07 03:28:53 +00:00
|
|
|
|
2023-09-16 08:05:17 +00:00
|
|
|
if (ps.app192IconUrl !== undefined) {
|
|
|
|
set.app192IconUrl = ps.app192IconUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.app512IconUrl !== undefined) {
|
|
|
|
set.app512IconUrl = ps.app512IconUrl;
|
|
|
|
}
|
|
|
|
|
2023-06-09 05:00:53 +00:00
|
|
|
if (ps.serverErrorImageUrl !== undefined) {
|
|
|
|
set.serverErrorImageUrl = ps.serverErrorImageUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.infoImageUrl !== undefined) {
|
|
|
|
set.infoImageUrl = ps.infoImageUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.notFoundImageUrl !== undefined) {
|
|
|
|
set.notFoundImageUrl = ps.notFoundImageUrl;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.backgroundImageUrl !== undefined) {
|
|
|
|
set.backgroundImageUrl = ps.backgroundImageUrl;
|
|
|
|
}
|
2020-11-17 05:59:15 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.logoImageUrl !== undefined) {
|
|
|
|
set.logoImageUrl = ps.logoImageUrl;
|
|
|
|
}
|
2020-12-05 07:05:40 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.name !== undefined) {
|
|
|
|
set.name = ps.name;
|
|
|
|
}
|
2018-11-22 23:13:17 +00:00
|
|
|
|
2023-09-23 03:38:20 +00:00
|
|
|
if (ps.shortName !== undefined) {
|
|
|
|
set.shortName = ps.shortName;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.description !== undefined) {
|
|
|
|
set.description = ps.description;
|
|
|
|
}
|
2018-11-07 04:14:52 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.defaultLightTheme !== undefined) {
|
|
|
|
set.defaultLightTheme = ps.defaultLightTheme;
|
|
|
|
}
|
2018-11-07 04:14:52 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.defaultDarkTheme !== undefined) {
|
|
|
|
set.defaultDarkTheme = ps.defaultDarkTheme;
|
|
|
|
}
|
2018-11-07 04:14:52 +00:00
|
|
|
|
2023-11-12 21:16:47 +00:00
|
|
|
if (ps.defaultLike !== undefined) {
|
|
|
|
set.defaultLike = ps.defaultLike;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.cacheRemoteFiles !== undefined) {
|
|
|
|
set.cacheRemoteFiles = ps.cacheRemoteFiles;
|
|
|
|
}
|
2018-11-07 04:14:52 +00:00
|
|
|
|
2023-07-15 11:12:20 +00:00
|
|
|
if (ps.cacheRemoteSensitiveFiles !== undefined) {
|
|
|
|
set.cacheRemoteSensitiveFiles = ps.cacheRemoteSensitiveFiles;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.emailRequiredForSignup !== undefined) {
|
|
|
|
set.emailRequiredForSignup = ps.emailRequiredForSignup;
|
|
|
|
}
|
2018-11-15 10:15:04 +00:00
|
|
|
|
2023-10-18 00:41:36 +00:00
|
|
|
if (ps.approvalRequiredForSignup !== undefined) {
|
|
|
|
set.approvalRequiredForSignup = ps.approvalRequiredForSignup;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.enableHcaptcha !== undefined) {
|
|
|
|
set.enableHcaptcha = ps.enableHcaptcha;
|
|
|
|
}
|
2018-11-15 10:15:04 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.hcaptchaSiteKey !== undefined) {
|
|
|
|
set.hcaptchaSiteKey = ps.hcaptchaSiteKey;
|
|
|
|
}
|
2018-11-15 10:15:04 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.hcaptchaSecretKey !== undefined) {
|
|
|
|
set.hcaptchaSecretKey = ps.hcaptchaSecretKey;
|
|
|
|
}
|
2018-11-29 07:23:45 +00:00
|
|
|
|
2024-01-06 11:14:33 +00:00
|
|
|
if (ps.enableMcaptcha !== undefined) {
|
|
|
|
set.enableMcaptcha = ps.enableMcaptcha;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.mcaptchaSiteKey !== undefined) {
|
|
|
|
set.mcaptchaSitekey = ps.mcaptchaSiteKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.mcaptchaInstanceUrl !== undefined) {
|
|
|
|
set.mcaptchaInstanceUrl = ps.mcaptchaInstanceUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.mcaptchaSecretKey !== undefined) {
|
|
|
|
set.mcaptchaSecretKey = ps.mcaptchaSecretKey;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.enableRecaptcha !== undefined) {
|
|
|
|
set.enableRecaptcha = ps.enableRecaptcha;
|
|
|
|
}
|
2018-11-29 07:23:45 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.recaptchaSiteKey !== undefined) {
|
|
|
|
set.recaptchaSiteKey = ps.recaptchaSiteKey;
|
|
|
|
}
|
2018-11-29 07:23:45 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.recaptchaSecretKey !== undefined) {
|
|
|
|
set.recaptchaSecretKey = ps.recaptchaSecretKey;
|
|
|
|
}
|
2018-11-29 07:23:45 +00:00
|
|
|
|
2022-10-13 00:19:57 +00:00
|
|
|
if (ps.enableTurnstile !== undefined) {
|
|
|
|
set.enableTurnstile = ps.enableTurnstile;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.turnstileSiteKey !== undefined) {
|
|
|
|
set.turnstileSiteKey = ps.turnstileSiteKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.turnstileSecretKey !== undefined) {
|
|
|
|
set.turnstileSecretKey = ps.turnstileSecretKey;
|
|
|
|
}
|
|
|
|
|
2023-10-18 05:29:16 +00:00
|
|
|
if (ps.enableBotTrending !== undefined) {
|
|
|
|
set.enableBotTrending = ps.enableBotTrending;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.proxyAccountId !== undefined) {
|
|
|
|
set.proxyAccountId = ps.proxyAccountId;
|
|
|
|
}
|
2018-12-19 19:08:13 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.maintainerName !== undefined) {
|
|
|
|
set.maintainerName = ps.maintainerName;
|
|
|
|
}
|
2018-12-19 19:08:13 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.maintainerEmail !== undefined) {
|
|
|
|
set.maintainerEmail = ps.maintainerEmail;
|
|
|
|
}
|
2018-12-19 19:08:13 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (Array.isArray(ps.langs)) {
|
|
|
|
set.langs = ps.langs.filter(Boolean);
|
|
|
|
}
|
2019-05-13 17:57:04 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.summalyProxy !== undefined) {
|
|
|
|
set.summalyProxy = ps.summalyProxy;
|
|
|
|
}
|
2019-05-15 16:07:32 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.enableEmail !== undefined) {
|
|
|
|
set.enableEmail = ps.enableEmail;
|
|
|
|
}
|
2020-04-12 11:32:34 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.email !== undefined) {
|
|
|
|
set.email = ps.email;
|
|
|
|
}
|
2020-08-13 11:05:01 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.smtpSecure !== undefined) {
|
|
|
|
set.smtpSecure = ps.smtpSecure;
|
|
|
|
}
|
2021-02-06 02:48:57 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.smtpHost !== undefined) {
|
|
|
|
set.smtpHost = ps.smtpHost;
|
|
|
|
}
|
2021-08-15 11:26:44 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.smtpPort !== undefined) {
|
|
|
|
set.smtpPort = ps.smtpPort;
|
|
|
|
}
|
2021-08-24 04:19:21 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.smtpUser !== undefined) {
|
|
|
|
set.smtpUser = ps.smtpUser;
|
|
|
|
}
|
2022-07-02 06:12:11 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.smtpPass !== undefined) {
|
|
|
|
set.smtpPass = ps.smtpPass;
|
|
|
|
}
|
2022-07-09 06:05:55 +00:00
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.enableServiceWorker !== undefined) {
|
|
|
|
set.enableServiceWorker = ps.enableServiceWorker;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.swPublicKey !== undefined) {
|
|
|
|
set.swPublicKey = ps.swPublicKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.swPrivateKey !== undefined) {
|
|
|
|
set.swPrivateKey = ps.swPrivateKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.tosUrl !== undefined) {
|
2023-03-10 05:53:56 +00:00
|
|
|
set.termsOfServiceUrl = ps.tosUrl;
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.repositoryUrl !== undefined) {
|
|
|
|
set.repositoryUrl = ps.repositoryUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.feedbackUrl !== undefined) {
|
|
|
|
set.feedbackUrl = ps.feedbackUrl;
|
|
|
|
}
|
|
|
|
|
2023-10-07 04:13:13 +00:00
|
|
|
if (ps.impressumUrl !== undefined) {
|
|
|
|
set.impressumUrl = ps.impressumUrl;
|
|
|
|
}
|
|
|
|
|
2024-01-09 20:32:47 +00:00
|
|
|
if (ps.donationUrl !== undefined) {
|
|
|
|
set.donationUrl = ps.donationUrl;
|
|
|
|
}
|
|
|
|
|
2023-10-07 04:13:13 +00:00
|
|
|
if (ps.privacyPolicyUrl !== undefined) {
|
|
|
|
set.privacyPolicyUrl = ps.privacyPolicyUrl;
|
|
|
|
}
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
if (ps.useObjectStorage !== undefined) {
|
|
|
|
set.useObjectStorage = ps.useObjectStorage;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageBaseUrl !== undefined) {
|
|
|
|
set.objectStorageBaseUrl = ps.objectStorageBaseUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageBucket !== undefined) {
|
|
|
|
set.objectStorageBucket = ps.objectStorageBucket;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStoragePrefix !== undefined) {
|
|
|
|
set.objectStoragePrefix = ps.objectStoragePrefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageEndpoint !== undefined) {
|
|
|
|
set.objectStorageEndpoint = ps.objectStorageEndpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageRegion !== undefined) {
|
|
|
|
set.objectStorageRegion = ps.objectStorageRegion;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStoragePort !== undefined) {
|
|
|
|
set.objectStoragePort = ps.objectStoragePort;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageAccessKey !== undefined) {
|
|
|
|
set.objectStorageAccessKey = ps.objectStorageAccessKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageSecretKey !== undefined) {
|
|
|
|
set.objectStorageSecretKey = ps.objectStorageSecretKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageUseSSL !== undefined) {
|
|
|
|
set.objectStorageUseSSL = ps.objectStorageUseSSL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageUseProxy !== undefined) {
|
|
|
|
set.objectStorageUseProxy = ps.objectStorageUseProxy;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageSetPublicRead !== undefined) {
|
|
|
|
set.objectStorageSetPublicRead = ps.objectStorageSetPublicRead;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.objectStorageS3ForcePathStyle !== undefined) {
|
|
|
|
set.objectStorageS3ForcePathStyle = ps.objectStorageS3ForcePathStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.deeplAuthKey !== undefined) {
|
|
|
|
if (ps.deeplAuthKey === '') {
|
|
|
|
set.deeplAuthKey = null;
|
|
|
|
} else {
|
|
|
|
set.deeplAuthKey = ps.deeplAuthKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.deeplIsPro !== undefined) {
|
|
|
|
set.deeplIsPro = ps.deeplIsPro;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.enableIpLogging !== undefined) {
|
|
|
|
set.enableIpLogging = ps.enableIpLogging;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.enableActiveEmailValidation !== undefined) {
|
|
|
|
set.enableActiveEmailValidation = ps.enableActiveEmailValidation;
|
|
|
|
}
|
|
|
|
|
2023-11-18 11:39:48 +00:00
|
|
|
if (ps.enableVerifymailApi !== undefined) {
|
|
|
|
set.enableVerifymailApi = ps.enableVerifymailApi;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.verifymailAuthKey !== undefined) {
|
|
|
|
if (ps.verifymailAuthKey === '') {
|
|
|
|
set.verifymailAuthKey = null;
|
|
|
|
} else {
|
|
|
|
set.verifymailAuthKey = ps.verifymailAuthKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-29 09:23:29 +00:00
|
|
|
if (ps.enableTruemailApi !== undefined) {
|
|
|
|
set.enableTruemailApi = ps.enableTruemailApi;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.truemailInstance !== undefined) {
|
|
|
|
if (ps.truemailInstance === '') {
|
|
|
|
set.truemailInstance = null;
|
|
|
|
} else {
|
|
|
|
set.truemailInstance = ps.truemailInstance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.truemailAuthKey !== undefined) {
|
|
|
|
if (ps.truemailAuthKey === '') {
|
|
|
|
set.truemailAuthKey = null;
|
|
|
|
} else {
|
|
|
|
set.truemailAuthKey = ps.truemailAuthKey;
|
|
|
|
}
|
|
|
|
}
|
2023-11-18 11:39:48 +00:00
|
|
|
|
2023-03-24 06:43:36 +00:00
|
|
|
if (ps.enableChartsForRemoteUser !== undefined) {
|
|
|
|
set.enableChartsForRemoteUser = ps.enableChartsForRemoteUser;
|
|
|
|
}
|
|
|
|
|
2023-03-24 10:08:08 +00:00
|
|
|
if (ps.enableChartsForFederatedInstances !== undefined) {
|
|
|
|
set.enableChartsForFederatedInstances = ps.enableChartsForFederatedInstances;
|
|
|
|
}
|
|
|
|
|
2023-07-02 07:02:32 +00:00
|
|
|
if (ps.enableServerMachineStats !== undefined) {
|
|
|
|
set.enableServerMachineStats = ps.enableServerMachineStats;
|
|
|
|
}
|
|
|
|
|
2023-09-28 22:57:38 +00:00
|
|
|
if (ps.enableAchievements !== undefined) {
|
|
|
|
set.enableAchievements = ps.enableAchievements;
|
|
|
|
}
|
|
|
|
|
2023-07-02 07:02:32 +00:00
|
|
|
if (ps.enableIdenticonGeneration !== undefined) {
|
|
|
|
set.enableIdenticonGeneration = ps.enableIdenticonGeneration;
|
|
|
|
}
|
|
|
|
|
2023-04-19 12:24:31 +00:00
|
|
|
if (ps.serverRules !== undefined) {
|
|
|
|
set.serverRules = ps.serverRules;
|
|
|
|
}
|
|
|
|
|
2023-04-29 08:03:14 +00:00
|
|
|
if (ps.preservedUsernames !== undefined) {
|
|
|
|
set.preservedUsernames = ps.preservedUsernames;
|
|
|
|
}
|
|
|
|
|
2023-12-04 01:10:51 +00:00
|
|
|
if (ps.bubbleInstances !== undefined) {
|
|
|
|
set.bubbleInstances = ps.bubbleInstances;
|
|
|
|
}
|
|
|
|
|
2023-09-16 08:05:17 +00:00
|
|
|
if (ps.manifestJsonOverride !== undefined) {
|
|
|
|
set.manifestJsonOverride = ps.manifestJsonOverride;
|
|
|
|
}
|
|
|
|
|
2023-10-23 06:17:25 +00:00
|
|
|
if (ps.enableFanoutTimeline !== undefined) {
|
|
|
|
set.enableFanoutTimeline = ps.enableFanoutTimeline;
|
|
|
|
}
|
|
|
|
|
2023-11-16 01:20:57 +00:00
|
|
|
if (ps.enableFanoutTimelineDbFallback !== undefined) {
|
|
|
|
set.enableFanoutTimelineDbFallback = ps.enableFanoutTimelineDbFallback;
|
|
|
|
}
|
|
|
|
|
2023-10-03 23:46:27 +00:00
|
|
|
if (ps.perLocalUserUserTimelineCacheMax !== undefined) {
|
|
|
|
set.perLocalUserUserTimelineCacheMax = ps.perLocalUserUserTimelineCacheMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.perRemoteUserUserTimelineCacheMax !== undefined) {
|
|
|
|
set.perRemoteUserUserTimelineCacheMax = ps.perRemoteUserUserTimelineCacheMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.perUserHomeTimelineCacheMax !== undefined) {
|
|
|
|
set.perUserHomeTimelineCacheMax = ps.perUserHomeTimelineCacheMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.perUserListTimelineCacheMax !== undefined) {
|
|
|
|
set.perUserListTimelineCacheMax = ps.perUserListTimelineCacheMax;
|
|
|
|
}
|
|
|
|
|
2023-10-08 08:56:44 +00:00
|
|
|
if (ps.notesPerOneAd !== undefined) {
|
|
|
|
set.notesPerOneAd = ps.notesPerOneAd;
|
|
|
|
}
|
|
|
|
|
2023-12-23 03:06:22 +00:00
|
|
|
if (ps.bannedEmailDomains !== undefined) {
|
|
|
|
set.bannedEmailDomains = ps.bannedEmailDomains;
|
|
|
|
}
|
|
|
|
|
2023-09-23 09:28:16 +00:00
|
|
|
const before = await this.metaService.fetch(true);
|
|
|
|
|
2022-09-20 17:52:19 +00:00
|
|
|
await this.metaService.update(set);
|
2023-09-23 09:28:16 +00:00
|
|
|
|
|
|
|
const after = await this.metaService.fetch(true);
|
|
|
|
|
|
|
|
this.moderationLogService.log(me, 'updateServerSettings', {
|
|
|
|
before,
|
|
|
|
after,
|
|
|
|
});
|
2019-04-16 15:45:33 +00:00
|
|
|
});
|
2022-09-17 18:27:08 +00:00
|
|
|
}
|
|
|
|
}
|