2018-08-22 13:19:57 -05:00
|
|
|
import $ from 'cafy';
|
2021-08-19 07:55:45 -05:00
|
|
|
import define from '../../define';
|
2019-04-16 10:45:33 -05:00
|
|
|
import { getConnection } from 'typeorm';
|
2021-08-19 07:55:45 -05:00
|
|
|
import { Meta } from '@/models/entities/meta';
|
|
|
|
import { insertModerationLog } from '@/services/insert-moderation-log';
|
|
|
|
import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits';
|
|
|
|
import { ID } from '@/misc/cafy-id';
|
2018-08-22 13:19:57 -05:00
|
|
|
|
|
|
|
export const meta = {
|
2019-02-22 20:20:58 -06:00
|
|
|
tags: ['admin'],
|
|
|
|
|
2022-01-18 07:27:10 -06:00
|
|
|
requireCredential: true,
|
2020-01-29 13:37:25 -06:00
|
|
|
requireAdmin: true,
|
2018-08-22 13:19:57 -05:00
|
|
|
|
|
|
|
params: {
|
2018-11-01 13:32:24 -05:00
|
|
|
disableRegistration: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.bool,
|
2018-11-01 13:32:24 -05:00
|
|
|
},
|
2018-09-07 05:20:50 -05:00
|
|
|
|
2018-11-01 13:32:24 -05:00
|
|
|
disableLocalTimeline: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.bool,
|
2018-11-01 13:32:24 -05:00
|
|
|
},
|
2018-09-11 12:48:19 -05:00
|
|
|
|
2019-01-15 23:54:14 -06:00
|
|
|
disableGlobalTimeline: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.bool,
|
2019-01-15 23:54:14 -06:00
|
|
|
},
|
|
|
|
|
2019-03-17 11:03:35 -05:00
|
|
|
useStarForReactionFallback: {
|
|
|
|
validator: $.optional.nullable.bool,
|
|
|
|
},
|
|
|
|
|
2019-05-10 03:30:28 -05:00
|
|
|
pinnedUsers: {
|
|
|
|
validator: $.optional.nullable.arr($.str),
|
|
|
|
},
|
|
|
|
|
2019-04-07 07:50:36 -05:00
|
|
|
hiddenTags: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.arr($.str),
|
2018-11-01 13:32:24 -05:00
|
|
|
},
|
2018-09-20 03:21:16 -05:00
|
|
|
|
2019-05-14 06:49:09 -05:00
|
|
|
blockedHosts: {
|
|
|
|
validator: $.optional.nullable.arr($.str),
|
|
|
|
},
|
|
|
|
|
2022-02-09 06:25:48 -06:00
|
|
|
themeColor: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
2019-01-03 12:52:50 -06:00
|
|
|
mascotImageUrl: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-01-03 12:02:40 -06:00
|
|
|
},
|
|
|
|
|
2018-11-01 13:32:24 -05:00
|
|
|
bannerUrl: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-01 13:32:24 -05:00
|
|
|
},
|
2018-11-04 08:00:43 -06:00
|
|
|
|
2018-12-11 05:19:13 -06:00
|
|
|
errorImageUrl: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-12-11 05:19:13 -06:00
|
|
|
},
|
|
|
|
|
2019-03-14 02:30:51 -05:00
|
|
|
iconUrl: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
2020-11-25 06:31:34 -06:00
|
|
|
backgroundImageUrl: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
|
|
|
logoImageUrl: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
2018-11-04 08:00:43 -06:00
|
|
|
name: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-04 08:00:43 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
description: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-04 08:00:43 -06:00
|
|
|
},
|
2018-11-04 20:09:05 -06:00
|
|
|
|
|
|
|
maxNoteTextLength: {
|
2019-09-30 11:46:31 -05:00
|
|
|
validator: $.optional.num.min(0).max(DB_MAX_NOTE_TEXT_LENGTH),
|
2018-11-05 16:14:43 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
localDriveCapacityMb: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.num.min(0),
|
2018-11-05 16:14:43 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
remoteDriveCapacityMb: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.num.min(0),
|
2018-11-05 16:14:43 -06:00
|
|
|
},
|
2018-11-05 16:52:13 -06:00
|
|
|
|
|
|
|
cacheRemoteFiles: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-06 09:08:21 -06:00
|
|
|
},
|
|
|
|
|
2019-12-31 02:23:47 -06:00
|
|
|
proxyRemoteFiles: {
|
|
|
|
validator: $.optional.bool,
|
|
|
|
},
|
|
|
|
|
2021-10-07 23:37:02 -05:00
|
|
|
emailRequiredForSignup: {
|
|
|
|
validator: $.optional.bool,
|
|
|
|
},
|
|
|
|
|
2020-04-28 00:29:33 -05:00
|
|
|
enableHcaptcha: {
|
|
|
|
validator: $.optional.bool,
|
|
|
|
},
|
|
|
|
|
|
|
|
hcaptchaSiteKey: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
|
|
|
hcaptchaSecretKey: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
2018-11-06 09:08:21 -06:00
|
|
|
enableRecaptcha: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-06 09:08:21 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
recaptchaSiteKey: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 09:08:21 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
recaptchaSecretKey: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 09:44:56 -06:00
|
|
|
},
|
|
|
|
|
2020-02-04 19:15:09 -06:00
|
|
|
proxyAccountId: {
|
|
|
|
validator: $.optional.nullable.type(ID),
|
2018-11-06 10:12:26 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
maintainerName: {
|
2019-04-23 08:48:53 -05:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 10:12:26 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
maintainerEmail: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 21:28:53 -06:00
|
|
|
},
|
|
|
|
|
2020-11-16 23:59:15 -06:00
|
|
|
pinnedPages: {
|
|
|
|
validator: $.optional.arr($.str),
|
|
|
|
},
|
|
|
|
|
2020-12-05 01:05:40 -06:00
|
|
|
pinnedClipId: {
|
|
|
|
validator: $.optional.nullable.type(ID),
|
|
|
|
},
|
|
|
|
|
2018-11-06 21:28:53 -06:00
|
|
|
langs: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.arr($.str),
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
2018-11-22 17:13:17 -06:00
|
|
|
summalyProxy: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-22 17:13:17 -06:00
|
|
|
},
|
|
|
|
|
2021-08-15 06:26:44 -05:00
|
|
|
deeplAuthKey: {
|
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
2021-08-23 23:19:21 -05:00
|
|
|
deeplIsPro: {
|
|
|
|
validator: $.optional.bool,
|
|
|
|
},
|
|
|
|
|
2018-11-06 22:14:52 -06:00
|
|
|
enableTwitterIntegration: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
twitterConsumerKey: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
twitterConsumerSecret: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
enableGithubIntegration: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
githubClientId: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
githubClientSecret: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-06 22:14:52 -06:00
|
|
|
},
|
2018-11-15 04:15:04 -06:00
|
|
|
|
|
|
|
enableDiscordIntegration: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-15 04:15:04 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
discordClientId: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-15 04:15:04 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
discordClientSecret: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-21 08:44:59 -06:00
|
|
|
},
|
|
|
|
|
2018-11-29 01:23:45 -06:00
|
|
|
enableEmail: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
email: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
smtpSecure: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
smtpHost: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
smtpPort: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.num,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
smtpUser: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
smtpPass: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-11-29 01:23:45 -06:00
|
|
|
},
|
2018-12-19 13:08:13 -06:00
|
|
|
|
|
|
|
enableServiceWorker: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.bool,
|
2018-12-19 13:08:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
swPublicKey: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-12-19 13:08:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
swPrivateKey: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2018-12-19 13:08:13 -06:00
|
|
|
},
|
2019-05-13 12:57:04 -05:00
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
tosUrl: {
|
2019-05-13 12:57:04 -05:00
|
|
|
validator: $.optional.nullable.str,
|
|
|
|
},
|
|
|
|
|
|
|
|
repositoryUrl: {
|
|
|
|
validator: $.optional.str,
|
|
|
|
},
|
|
|
|
|
|
|
|
feedbackUrl: {
|
|
|
|
validator: $.optional.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
useObjectStorage: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.bool,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageBaseUrl: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageBucket: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStoragePrefix: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageEndpoint: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageRegion: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStoragePort: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.num,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageAccessKey: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageSecretKey: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.nullable.str,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageUseSSL: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.bool,
|
2019-05-15 11:07:32 -05:00
|
|
|
},
|
2020-04-12 06:32:34 -05:00
|
|
|
|
|
|
|
objectStorageUseProxy: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.bool,
|
2020-08-13 06:05:01 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageSetPublicRead: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.bool,
|
2021-02-05 20:48:57 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
objectStorageS3ForcePathStyle: {
|
2021-12-09 08:58:30 -06:00
|
|
|
validator: $.optional.bool,
|
2021-02-05 20:48:57 -06:00
|
|
|
},
|
2021-12-09 08:58:30 -06:00
|
|
|
},
|
2022-01-18 07:27:10 -06:00
|
|
|
} as const;
|
2018-08-22 13:19:57 -05:00
|
|
|
|
2022-01-02 11:12:50 -06:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2019-07-13 13:18:45 -05:00
|
|
|
export default define(meta, async (ps, me) => {
|
2019-04-07 07:50:36 -05:00
|
|
|
const set = {} as Partial<Meta>;
|
2018-08-22 13:19:57 -05:00
|
|
|
|
2018-09-01 09:29:22 -05:00
|
|
|
if (typeof ps.disableRegistration === 'boolean') {
|
2018-08-22 13:19:57 -05:00
|
|
|
set.disableRegistration = ps.disableRegistration;
|
|
|
|
}
|
|
|
|
|
2018-09-11 12:48:19 -05:00
|
|
|
if (typeof ps.disableLocalTimeline === 'boolean') {
|
|
|
|
set.disableLocalTimeline = ps.disableLocalTimeline;
|
|
|
|
}
|
|
|
|
|
2019-01-15 23:54:14 -06:00
|
|
|
if (typeof ps.disableGlobalTimeline === 'boolean') {
|
|
|
|
set.disableGlobalTimeline = ps.disableGlobalTimeline;
|
|
|
|
}
|
|
|
|
|
2019-03-17 11:03:35 -05:00
|
|
|
if (typeof ps.useStarForReactionFallback === 'boolean') {
|
|
|
|
set.useStarForReactionFallback = ps.useStarForReactionFallback;
|
|
|
|
}
|
|
|
|
|
2019-05-10 03:30:28 -05:00
|
|
|
if (Array.isArray(ps.pinnedUsers)) {
|
2019-09-12 07:27:44 -05:00
|
|
|
set.pinnedUsers = ps.pinnedUsers.filter(Boolean);
|
2019-05-10 03:30:28 -05:00
|
|
|
}
|
|
|
|
|
2019-04-07 07:50:36 -05:00
|
|
|
if (Array.isArray(ps.hiddenTags)) {
|
2019-09-12 07:27:44 -05:00
|
|
|
set.hiddenTags = ps.hiddenTags.filter(Boolean);
|
2018-09-07 05:20:50 -05:00
|
|
|
}
|
|
|
|
|
2019-05-14 06:49:09 -05:00
|
|
|
if (Array.isArray(ps.blockedHosts)) {
|
2019-09-12 07:27:44 -05:00
|
|
|
set.blockedHosts = ps.blockedHosts.filter(Boolean);
|
2019-05-14 06:49:09 -05:00
|
|
|
}
|
|
|
|
|
2022-02-09 06:25:48 -06:00
|
|
|
if (ps.themeColor !== undefined) {
|
|
|
|
set.themeColor = ps.themeColor;
|
|
|
|
}
|
|
|
|
|
2019-01-03 12:52:50 -06:00
|
|
|
if (ps.mascotImageUrl !== undefined) {
|
|
|
|
set.mascotImageUrl = ps.mascotImageUrl;
|
2019-01-03 12:02:40 -06:00
|
|
|
}
|
|
|
|
|
2018-09-20 03:21:16 -05:00
|
|
|
if (ps.bannerUrl !== undefined) {
|
|
|
|
set.bannerUrl = ps.bannerUrl;
|
|
|
|
}
|
|
|
|
|
2019-03-14 02:30:51 -05:00
|
|
|
if (ps.iconUrl !== undefined) {
|
|
|
|
set.iconUrl = ps.iconUrl;
|
|
|
|
}
|
|
|
|
|
2020-11-25 06:31:34 -06:00
|
|
|
if (ps.backgroundImageUrl !== undefined) {
|
|
|
|
set.backgroundImageUrl = ps.backgroundImageUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.logoImageUrl !== undefined) {
|
|
|
|
set.logoImageUrl = ps.logoImageUrl;
|
|
|
|
}
|
|
|
|
|
2018-11-04 08:00:43 -06:00
|
|
|
if (ps.name !== undefined) {
|
|
|
|
set.name = ps.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.description !== undefined) {
|
|
|
|
set.description = ps.description;
|
|
|
|
}
|
|
|
|
|
2018-11-04 20:09:05 -06:00
|
|
|
if (ps.maxNoteTextLength) {
|
|
|
|
set.maxNoteTextLength = ps.maxNoteTextLength;
|
|
|
|
}
|
|
|
|
|
2018-11-05 16:14:43 -06:00
|
|
|
if (ps.localDriveCapacityMb !== undefined) {
|
|
|
|
set.localDriveCapacityMb = ps.localDriveCapacityMb;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.remoteDriveCapacityMb !== undefined) {
|
|
|
|
set.remoteDriveCapacityMb = ps.remoteDriveCapacityMb;
|
|
|
|
}
|
|
|
|
|
2018-11-05 16:52:13 -06:00
|
|
|
if (ps.cacheRemoteFiles !== undefined) {
|
|
|
|
set.cacheRemoteFiles = ps.cacheRemoteFiles;
|
|
|
|
}
|
|
|
|
|
2019-12-31 02:23:47 -06:00
|
|
|
if (ps.proxyRemoteFiles !== undefined) {
|
|
|
|
set.proxyRemoteFiles = ps.proxyRemoteFiles;
|
|
|
|
}
|
|
|
|
|
2021-10-07 23:37:02 -05:00
|
|
|
if (ps.emailRequiredForSignup !== undefined) {
|
|
|
|
set.emailRequiredForSignup = ps.emailRequiredForSignup;
|
|
|
|
}
|
|
|
|
|
2020-04-28 00:29:33 -05:00
|
|
|
if (ps.enableHcaptcha !== undefined) {
|
|
|
|
set.enableHcaptcha = ps.enableHcaptcha;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.hcaptchaSiteKey !== undefined) {
|
|
|
|
set.hcaptchaSiteKey = ps.hcaptchaSiteKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.hcaptchaSecretKey !== undefined) {
|
|
|
|
set.hcaptchaSecretKey = ps.hcaptchaSecretKey;
|
|
|
|
}
|
|
|
|
|
2018-11-06 09:08:21 -06:00
|
|
|
if (ps.enableRecaptcha !== undefined) {
|
|
|
|
set.enableRecaptcha = ps.enableRecaptcha;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.recaptchaSiteKey !== undefined) {
|
|
|
|
set.recaptchaSiteKey = ps.recaptchaSiteKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.recaptchaSecretKey !== undefined) {
|
|
|
|
set.recaptchaSecretKey = ps.recaptchaSecretKey;
|
|
|
|
}
|
|
|
|
|
2020-02-04 19:15:09 -06:00
|
|
|
if (ps.proxyAccountId !== undefined) {
|
|
|
|
set.proxyAccountId = ps.proxyAccountId;
|
2018-11-06 09:44:56 -06:00
|
|
|
}
|
|
|
|
|
2018-11-06 10:12:26 -06:00
|
|
|
if (ps.maintainerName !== undefined) {
|
2019-04-07 07:50:36 -05:00
|
|
|
set.maintainerName = ps.maintainerName;
|
2018-11-06 10:12:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.maintainerEmail !== undefined) {
|
2019-04-07 07:50:36 -05:00
|
|
|
set.maintainerEmail = ps.maintainerEmail;
|
2018-11-06 10:12:26 -06:00
|
|
|
}
|
|
|
|
|
2019-09-12 07:27:44 -05:00
|
|
|
if (Array.isArray(ps.langs)) {
|
|
|
|
set.langs = ps.langs.filter(Boolean);
|
2018-11-06 21:28:53 -06:00
|
|
|
}
|
|
|
|
|
2020-11-16 23:59:15 -06:00
|
|
|
if (Array.isArray(ps.pinnedPages)) {
|
|
|
|
set.pinnedPages = ps.pinnedPages.filter(Boolean);
|
|
|
|
}
|
|
|
|
|
2020-12-05 01:05:40 -06:00
|
|
|
if (ps.pinnedClipId !== undefined) {
|
|
|
|
set.pinnedClipId = ps.pinnedClipId;
|
|
|
|
}
|
|
|
|
|
2018-11-22 17:13:17 -06:00
|
|
|
if (ps.summalyProxy !== undefined) {
|
|
|
|
set.summalyProxy = ps.summalyProxy;
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:14:52 -06:00
|
|
|
if (ps.enableTwitterIntegration !== undefined) {
|
|
|
|
set.enableTwitterIntegration = ps.enableTwitterIntegration;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.twitterConsumerKey !== undefined) {
|
|
|
|
set.twitterConsumerKey = ps.twitterConsumerKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.twitterConsumerSecret !== undefined) {
|
|
|
|
set.twitterConsumerSecret = ps.twitterConsumerSecret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.enableGithubIntegration !== undefined) {
|
|
|
|
set.enableGithubIntegration = ps.enableGithubIntegration;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.githubClientId !== undefined) {
|
|
|
|
set.githubClientId = ps.githubClientId;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.githubClientSecret !== undefined) {
|
|
|
|
set.githubClientSecret = ps.githubClientSecret;
|
|
|
|
}
|
|
|
|
|
2018-11-15 04:15:04 -06:00
|
|
|
if (ps.enableDiscordIntegration !== undefined) {
|
|
|
|
set.enableDiscordIntegration = ps.enableDiscordIntegration;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.discordClientId !== undefined) {
|
|
|
|
set.discordClientId = ps.discordClientId;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.discordClientSecret !== undefined) {
|
|
|
|
set.discordClientSecret = ps.discordClientSecret;
|
|
|
|
}
|
|
|
|
|
2018-11-29 01:23:45 -06:00
|
|
|
if (ps.enableEmail !== undefined) {
|
|
|
|
set.enableEmail = ps.enableEmail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.email !== undefined) {
|
|
|
|
set.email = ps.email;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.smtpSecure !== undefined) {
|
|
|
|
set.smtpSecure = ps.smtpSecure;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.smtpHost !== undefined) {
|
|
|
|
set.smtpHost = ps.smtpHost;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.smtpPort !== undefined) {
|
|
|
|
set.smtpPort = ps.smtpPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.smtpUser !== undefined) {
|
|
|
|
set.smtpUser = ps.smtpUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.smtpPass !== undefined) {
|
|
|
|
set.smtpPass = ps.smtpPass;
|
|
|
|
}
|
|
|
|
|
2018-12-11 06:17:57 -06:00
|
|
|
if (ps.errorImageUrl !== undefined) {
|
|
|
|
set.errorImageUrl = ps.errorImageUrl;
|
|
|
|
}
|
|
|
|
|
2018-12-19 13:08:13 -06: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;
|
|
|
|
}
|
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
if (ps.tosUrl !== undefined) {
|
|
|
|
set.ToSUrl = ps.tosUrl;
|
2019-05-13 12:57:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.repositoryUrl !== undefined) {
|
|
|
|
set.repositoryUrl = ps.repositoryUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps.feedbackUrl !== undefined) {
|
|
|
|
set.feedbackUrl = ps.feedbackUrl;
|
|
|
|
}
|
|
|
|
|
2019-05-15 11:07:32 -05: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;
|
|
|
|
}
|
|
|
|
|
2020-04-12 06:32:34 -05:00
|
|
|
if (ps.objectStorageUseProxy !== undefined) {
|
|
|
|
set.objectStorageUseProxy = ps.objectStorageUseProxy;
|
|
|
|
}
|
|
|
|
|
2020-08-13 06:05:01 -05:00
|
|
|
if (ps.objectStorageSetPublicRead !== undefined) {
|
|
|
|
set.objectStorageSetPublicRead = ps.objectStorageSetPublicRead;
|
|
|
|
}
|
|
|
|
|
2021-02-05 20:48:57 -06:00
|
|
|
if (ps.objectStorageS3ForcePathStyle !== undefined) {
|
|
|
|
set.objectStorageS3ForcePathStyle = ps.objectStorageS3ForcePathStyle;
|
|
|
|
}
|
|
|
|
|
2021-08-15 06:26:44 -05:00
|
|
|
if (ps.deeplAuthKey !== undefined) {
|
|
|
|
if (ps.deeplAuthKey === '') {
|
|
|
|
set.deeplAuthKey = null;
|
|
|
|
} else {
|
|
|
|
set.deeplAuthKey = ps.deeplAuthKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-23 23:19:21 -05:00
|
|
|
if (ps.deeplIsPro !== undefined) {
|
|
|
|
set.deeplIsPro = ps.deeplIsPro;
|
|
|
|
}
|
|
|
|
|
2019-04-16 10:45:33 -05:00
|
|
|
await getConnection().transaction(async transactionalEntityManager => {
|
|
|
|
const meta = await transactionalEntityManager.findOne(Meta, {
|
|
|
|
order: {
|
2021-12-09 08:58:30 -06:00
|
|
|
id: 'DESC',
|
|
|
|
},
|
2019-04-16 10:45:33 -05:00
|
|
|
});
|
2018-08-22 13:19:57 -05:00
|
|
|
|
2019-04-16 10:45:33 -05:00
|
|
|
if (meta) {
|
|
|
|
await transactionalEntityManager.update(Meta, meta.id, set);
|
|
|
|
} else {
|
|
|
|
await transactionalEntityManager.save(Meta, set);
|
|
|
|
}
|
|
|
|
});
|
2019-07-13 13:18:45 -05:00
|
|
|
|
|
|
|
insertModerationLog(me, 'updateMeta');
|
2019-02-21 20:46:58 -06:00
|
|
|
});
|