summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/admin
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-10 20:40:13 +0900
committerGitHub <noreply@github.com>2023-10-10 20:40:13 +0900
commitf964ef163b4c72d7eace319912ef139a41462344 (patch)
tree7315c9e4bf18d24124a393999ec3af194ec2bedb /packages/backend/src/server/api/endpoints/admin
parentMerge pull request #11926 from misskey-dev/develop (diff)
parentfix(backend): センシティブ設定されたチャンネルの投稿をuse... (diff)
downloadmisskey-f964ef163b4c72d7eace319912ef139a41462344.tar.gz
misskey-f964ef163b4c72d7eace319912ef139a41462344.tar.bz2
misskey-f964ef163b4c72d7eace319912ef139a41462344.zip
Merge pull request #11963 from misskey-dev/develop
Release: 2023.10.0
Diffstat (limited to 'packages/backend/src/server/api/endpoints/admin')
-rw-r--r--packages/backend/src/server/api/endpoints/admin/emoji/add.ts7
-rw-r--r--packages/backend/src/server/api/endpoints/admin/emoji/update.ts9
-rw-r--r--packages/backend/src/server/api/endpoints/admin/meta.ts110
-rw-r--r--packages/backend/src/server/api/endpoints/admin/roles/users.ts7
-rw-r--r--packages/backend/src/server/api/endpoints/admin/show-user.ts1
-rw-r--r--packages/backend/src/server/api/endpoints/admin/update-meta.ts35
6 files changed, 118 insertions, 51 deletions
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
index 24d3a8a943..faab8ee608 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts
@@ -23,6 +23,11 @@ export const meta = {
code: 'NO_SUCH_FILE',
id: 'fc46b5a4-6b92-4c33-ac66-b806659bb5cf',
},
+ duplicateName: {
+ message: 'Duplicate name.',
+ code: 'DUPLICATE_NAME',
+ id: 'f7a3462c-4e6e-4069-8421-b9bd4f4c3975',
+ },
},
} as const;
@@ -64,6 +69,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
+ const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
+ if (isDuplicate) throw new ApiError(meta.errors.duplicateName);
const emoji = await this.customEmojiService.add({
driveFile,
diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
index 2d69857408..04226d8953 100644
--- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
+++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts
@@ -74,6 +74,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
}
+ const emoji = await this.customEmojiService.getEmojiById(ps.id);
+ if (emoji != null) {
+ if (ps.name !== emoji.name) {
+ const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
+ if (isDuplicate) throw new ApiError(meta.errors.sameNameEmojiExists);
+ }
+ } else {
+ throw new ApiError(meta.errors.noSuchEmoji);
+ }
await this.customEmojiService.update(ps.id, {
driveFile,
diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts
index c3ba07cdd0..5a74456ab0 100644
--- a/packages/backend/src/server/api/endpoints/admin/meta.ts
+++ b/packages/backend/src/server/api/endpoints/admin/meta.ts
@@ -105,40 +105,32 @@ export const meta = {
type: 'boolean',
optional: false, nullable: false,
},
- userStarForReactionFallback: {
- type: 'boolean',
- optional: true, nullable: false,
- },
pinnedUsers: {
type: 'array',
- optional: true, nullable: false,
+ optional: false, nullable: false,
items: {
type: 'string',
- optional: false, nullable: false,
},
},
hiddenTags: {
type: 'array',
- optional: true, nullable: false,
+ optional: false, nullable: false,
items: {
type: 'string',
- optional: false, nullable: false,
},
},
blockedHosts: {
type: 'array',
- optional: true, nullable: false,
+ optional: false, nullable: false,
items: {
type: 'string',
- optional: false, nullable: false,
},
},
sensitiveWords: {
type: 'array',
- optional: true, nullable: false,
+ optional: false, nullable: false,
items: {
type: 'string',
- optional: false, nullable: false,
},
},
preservedUsernames: {
@@ -146,129 +138,124 @@ export const meta = {
optional: false, nullable: false,
items: {
type: 'string',
- optional: false, nullable: false,
},
},
hcaptchaSecretKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
recaptchaSecretKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
turnstileSecretKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
sensitiveMediaDetection: {
type: 'string',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
sensitiveMediaDetectionSensitivity: {
type: 'string',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
setSensitiveFlagAutomatically: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
enableSensitiveMediaDetectionForVideos: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
proxyAccountId: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
format: 'id',
},
- summaryProxy: {
- type: 'string',
- optional: true, nullable: true,
- },
email: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
smtpSecure: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
smtpHost: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
smtpPort: {
type: 'number',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
smtpUser: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
smtpPass: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
swPrivateKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
useObjectStorage: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
objectStorageBaseUrl: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageBucket: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStoragePrefix: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageEndpoint: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageRegion: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStoragePort: {
type: 'number',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageAccessKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageSecretKey: {
type: 'string',
- optional: true, nullable: true,
+ optional: false, nullable: true,
},
objectStorageUseSSL: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
objectStorageUseProxy: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
objectStorageSetPublicRead: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
enableIpLogging: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
enableActiveEmailValidation: {
type: 'boolean',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
enableChartsForRemoteUser: {
type: 'boolean',
@@ -288,12 +275,32 @@ export const meta = {
},
manifestJsonOverride: {
type: 'string',
- optional: true, nullable: false,
+ optional: false, nullable: false,
},
policies: {
type: 'object',
optional: false, nullable: false,
},
+ perLocalUserUserTimelineCacheMax: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
+ perRemoteUserUserTimelineCacheMax: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
+ perUserHomeTimelineCacheMax: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
+ perUserListTimelineCacheMax: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
+ notesPerOneAd: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
},
},
} as const;
@@ -313,7 +320,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private metaService: MetaService,
) {
- super(meta, paramDef, async (ps, me) => {
+ super(meta, paramDef, async () => {
const instance = await this.metaService.fetch(true);
return {
@@ -328,6 +335,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
+ impressumUrl: instance.impressumUrl,
+ privacyPolicyUrl: instance.privacyPolicyUrl,
disableRegistration: instance.disableRegistration,
emailRequiredForSignup: instance.emailRequiredForSignup,
enableHcaptcha: instance.enableHcaptcha,
@@ -399,6 +408,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
enableIdenticonGeneration: instance.enableIdenticonGeneration,
policies: { ...DEFAULT_POLICIES, ...instance.policies },
manifestJsonOverride: instance.manifestJsonOverride,
+ perLocalUserUserTimelineCacheMax: instance.perLocalUserUserTimelineCacheMax,
+ perRemoteUserUserTimelineCacheMax: instance.perRemoteUserUserTimelineCacheMax,
+ perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
+ perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
+ notesPerOneAd: instance.notesPerOneAd,
};
});
}
diff --git a/packages/backend/src/server/api/endpoints/admin/roles/users.ts b/packages/backend/src/server/api/endpoints/admin/roles/users.ts
index b1772be777..ef5627bc9a 100644
--- a/packages/backend/src/server/api/endpoints/admin/roles/users.ts
+++ b/packages/backend/src/server/api/endpoints/admin/roles/users.ts
@@ -61,9 +61,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
.andWhere('assign.roleId = :roleId', { roleId: role.id })
- .andWhere(new Brackets(qb => { qb
- .where('assign.expiresAt IS NULL')
- .orWhere('assign.expiresAt > :now', { now: new Date() });
+ .andWhere(new Brackets(qb => {
+ qb
+ .where('assign.expiresAt IS NULL')
+ .orWhere('assign.expiresAt > :now', { now: new Date() });
}))
.innerJoinAndSelect('assign.user', 'user');
diff --git a/packages/backend/src/server/api/endpoints/admin/show-user.ts b/packages/backend/src/server/api/endpoints/admin/show-user.ts
index 3454597532..0731413d05 100644
--- a/packages/backend/src/server/api/endpoints/admin/show-user.ts
+++ b/packages/backend/src/server/api/endpoints/admin/show-user.ts
@@ -85,6 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
isModerator: isModerator,
isSilenced: isSilenced,
isSuspended: user.isSuspended,
+ isHibernated: user.isHibernated,
lastActiveDate: user.lastActiveDate,
moderationNote: profile.moderationNote ?? '',
signins,
diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts
index ea6ebdd1fe..7db25e659f 100644
--- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts
+++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts
@@ -86,6 +86,8 @@ export const paramDef = {
tosUrl: { type: 'string', nullable: true },
repositoryUrl: { type: 'string' },
feedbackUrl: { type: 'string' },
+ impressumUrl: { type: 'string' },
+ privacyPolicyUrl: { type: 'string' },
useObjectStorage: { type: 'boolean' },
objectStorageBaseUrl: { type: 'string', nullable: true },
objectStorageBucket: { type: 'string', nullable: true },
@@ -108,6 +110,11 @@ export const paramDef = {
serverRules: { type: 'array', items: { type: 'string' } },
preservedUsernames: { type: 'array', items: { type: 'string' } },
manifestJsonOverride: { type: 'string' },
+ perLocalUserUserTimelineCacheMax: { type: 'integer' },
+ perRemoteUserUserTimelineCacheMax: { type: 'integer' },
+ perUserHomeTimelineCacheMax: { type: 'integer' },
+ perUserListTimelineCacheMax: { type: 'integer' },
+ notesPerOneAd: { type: 'integer' },
},
required: [],
} as const;
@@ -341,6 +348,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.feedbackUrl = ps.feedbackUrl;
}
+ if (ps.impressumUrl !== undefined) {
+ set.impressumUrl = ps.impressumUrl;
+ }
+
+ if (ps.privacyPolicyUrl !== undefined) {
+ set.privacyPolicyUrl = ps.privacyPolicyUrl;
+ }
+
if (ps.useObjectStorage !== undefined) {
set.useObjectStorage = ps.useObjectStorage;
}
@@ -441,6 +456,26 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.manifestJsonOverride = ps.manifestJsonOverride;
}
+ 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;
+ }
+
+ if (ps.notesPerOneAd !== undefined) {
+ set.notesPerOneAd = ps.notesPerOneAd;
+ }
+
const before = await this.metaService.fetch(true);
await this.metaService.update(set);