Merge be219d27bc into bb51574762
				
					
				
			This commit is contained in:
		
						commit
						6c7f64a884
					
				|  | @ -9902,6 +9902,10 @@ export interface Locale extends ILocale { | ||||||
|          * サーバー設定更新 |          * サーバー設定更新 | ||||||
|          */ |          */ | ||||||
|         "updateServerSettings": string; |         "updateServerSettings": string; | ||||||
|  | 				/** | ||||||
|  | 				 * ユーザーを更新 | ||||||
|  | 				 */ | ||||||
|  | 				"updateUser": string; | ||||||
|         /** |         /** | ||||||
|          * ユーザーのモデレーションノート更新 |          * ユーザーのモデレーションノート更新 | ||||||
|          */ |          */ | ||||||
|  |  | ||||||
|  | @ -2625,6 +2625,7 @@ _moderationLogTypes: | ||||||
|   updateCustomEmoji: "カスタム絵文字更新" |   updateCustomEmoji: "カスタム絵文字更新" | ||||||
|   deleteCustomEmoji: "カスタム絵文字削除" |   deleteCustomEmoji: "カスタム絵文字削除" | ||||||
|   updateServerSettings: "サーバー設定更新" |   updateServerSettings: "サーバー設定更新" | ||||||
|  |   updateUser: "ユーザーを更新" | ||||||
|   updateUserNote: "ユーザーのモデレーションノート更新" |   updateUserNote: "ユーザーのモデレーションノート更新" | ||||||
|   deleteDriveFile: "ファイルを削除" |   deleteDriveFile: "ファイルを削除" | ||||||
|   deleteNote: "ノートを削除" |   deleteNote: "ノートを削除" | ||||||
|  |  | ||||||
|  | @ -4,25 +4,55 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import { Inject, Injectable } from '@nestjs/common'; | import { Inject, Injectable } from '@nestjs/common'; | ||||||
|  | import { IsNull } from 'typeorm'; | ||||||
| import type { MiMeta, UsersRepository } from '@/models/_.js'; | import type { MiMeta, UsersRepository } from '@/models/_.js'; | ||||||
| import type { MiLocalUser } from '@/models/User.js'; | import type { MiLocalUser } from '@/models/User.js'; | ||||||
| import { DI } from '@/di-symbols.js'; | import { DI } from '@/di-symbols.js'; | ||||||
| import { bindThis } from '@/decorators.js'; | import { bindThis } from '@/decorators.js'; | ||||||
|  | import { CreateSystemUserService } from '@/core/CreateSystemUserService.js'; | ||||||
|  | import { MemorySingleCache } from '@/misc/cache.js'; | ||||||
|  | import { MetaService } from '@/core/MetaService.js'; | ||||||
|  | 
 | ||||||
|  | const ACTOR_USERNAME = 'proxy.actor' as const; | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
| export class ProxyAccountService { | export class ProxyAccountService { | ||||||
|  | 	private cache: MemorySingleCache<MiLocalUser>; | ||||||
|  | 
 | ||||||
| 	constructor( | 	constructor( | ||||||
| 		@Inject(DI.meta) | 		@Inject(DI.meta) | ||||||
| 		private meta: MiMeta, | 		private meta: MiMeta, | ||||||
| 
 | 
 | ||||||
| 		@Inject(DI.usersRepository) | 		@Inject(DI.usersRepository) | ||||||
| 		private usersRepository: UsersRepository, | 		private usersRepository: UsersRepository, | ||||||
|  | 
 | ||||||
|  | 		private createSystemUserService: CreateSystemUserService, | ||||||
|  | 		private metaService: MetaService, | ||||||
| 	) { | 	) { | ||||||
|  | 		this.cache = new MemorySingleCache<MiLocalUser>(Infinity); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@bindThis | 	@bindThis | ||||||
| 	public async fetch(): Promise<MiLocalUser | null> { | 	public async fetch(): Promise<MiLocalUser | null> { | ||||||
| 		if (this.meta.proxyAccountId == null) return null; | 		if (this.meta.proxyAccountId == null) return null; | ||||||
| 		return await this.usersRepository.findOneByOrFail({ id: this.meta.proxyAccountId }) as MiLocalUser; | 		const cached = this.cache.get(); | ||||||
|  | 		if (cached) return cached; | ||||||
|  | 
 | ||||||
|  | 		const user = await this.usersRepository.findOneBy({ | ||||||
|  | 			host: IsNull(), | ||||||
|  | 			username: ACTOR_USERNAME, | ||||||
|  | 		}) as MiLocalUser | undefined; | ||||||
|  | 
 | ||||||
|  | 		if (user) { | ||||||
|  | 			this.cache.set(user); | ||||||
|  | 			return user; | ||||||
|  | 		} else { | ||||||
|  | 			const created = await this.createSystemUserService.createSystemUser(ACTOR_USERNAME) as MiLocalUser; | ||||||
|  | 			this.cache.set(created); | ||||||
|  | 			const set = {} as Partial<MiMeta>; | ||||||
|  | 			set.proxyAccountId = created.id; | ||||||
|  | 			await this.metaService.update(set); | ||||||
|  | 			return created; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -31,6 +31,7 @@ import * as ep___admin_avatarDecorations_update from './endpoints/admin/avatar-d | ||||||
| import * as ep___admin_captcha_current from './endpoints/admin/captcha/current.js'; | import * as ep___admin_captcha_current from './endpoints/admin/captcha/current.js'; | ||||||
| import * as ep___admin_captcha_save from './endpoints/admin/captcha/save.js'; | import * as ep___admin_captcha_save from './endpoints/admin/captcha/save.js'; | ||||||
| import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; | import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; | ||||||
|  | import * as ep___admin_updateProxyAccount from './endpoints/admin/update-proxy-account.js'; | ||||||
| import * as ep___admin_unsetUserAvatar from './endpoints/admin/unset-user-avatar.js'; | import * as ep___admin_unsetUserAvatar from './endpoints/admin/unset-user-avatar.js'; | ||||||
| import * as ep___admin_unsetUserBanner from './endpoints/admin/unset-user-banner.js'; | import * as ep___admin_unsetUserBanner from './endpoints/admin/unset-user-banner.js'; | ||||||
| import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; | import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; | ||||||
|  | @ -421,6 +422,7 @@ const $admin_avatarDecorations_update: Provider = { provide: 'ep:admin/avatar-de | ||||||
| const $admin_captcha_current: Provider = { provide: 'ep:admin/captcha/current', useClass: ep___admin_captcha_current.default }; | const $admin_captcha_current: Provider = { provide: 'ep:admin/captcha/current', useClass: ep___admin_captcha_current.default }; | ||||||
| const $admin_captcha_save: Provider = { provide: 'ep:admin/captcha/save', useClass: ep___admin_captcha_save.default }; | const $admin_captcha_save: Provider = { provide: 'ep:admin/captcha/save', useClass: ep___admin_captcha_save.default }; | ||||||
| const $admin_deleteAllFilesOfAUser: Provider = { provide: 'ep:admin/delete-all-files-of-a-user', useClass: ep___admin_deleteAllFilesOfAUser.default }; | const $admin_deleteAllFilesOfAUser: Provider = { provide: 'ep:admin/delete-all-files-of-a-user', useClass: ep___admin_deleteAllFilesOfAUser.default }; | ||||||
|  | const $admin_updateProxyAccount: Provider = { provide: 'ep:admin/update-proxy-account', useClass: ep___admin_updateProxyAccount.default }; | ||||||
| const $admin_unsetUserAvatar: Provider = { provide: 'ep:admin/unset-user-avatar', useClass: ep___admin_unsetUserAvatar.default }; | const $admin_unsetUserAvatar: Provider = { provide: 'ep:admin/unset-user-avatar', useClass: ep___admin_unsetUserAvatar.default }; | ||||||
| const $admin_unsetUserBanner: Provider = { provide: 'ep:admin/unset-user-banner', useClass: ep___admin_unsetUserBanner.default }; | const $admin_unsetUserBanner: Provider = { provide: 'ep:admin/unset-user-banner', useClass: ep___admin_unsetUserBanner.default }; | ||||||
| const $admin_drive_cleanRemoteFiles: Provider = { provide: 'ep:admin/drive/clean-remote-files', useClass: ep___admin_drive_cleanRemoteFiles.default }; | const $admin_drive_cleanRemoteFiles: Provider = { provide: 'ep:admin/drive/clean-remote-files', useClass: ep___admin_drive_cleanRemoteFiles.default }; | ||||||
|  | @ -815,6 +817,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__ | ||||||
| 		$admin_captcha_current, | 		$admin_captcha_current, | ||||||
| 		$admin_captcha_save, | 		$admin_captcha_save, | ||||||
| 		$admin_deleteAllFilesOfAUser, | 		$admin_deleteAllFilesOfAUser, | ||||||
|  | 		$admin_updateProxyAccount, | ||||||
| 		$admin_unsetUserAvatar, | 		$admin_unsetUserAvatar, | ||||||
| 		$admin_unsetUserBanner, | 		$admin_unsetUserBanner, | ||||||
| 		$admin_drive_cleanRemoteFiles, | 		$admin_drive_cleanRemoteFiles, | ||||||
|  | @ -1203,6 +1206,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__ | ||||||
| 		$admin_captcha_current, | 		$admin_captcha_current, | ||||||
| 		$admin_captcha_save, | 		$admin_captcha_save, | ||||||
| 		$admin_deleteAllFilesOfAUser, | 		$admin_deleteAllFilesOfAUser, | ||||||
|  | 		$admin_updateProxyAccount, | ||||||
| 		$admin_unsetUserAvatar, | 		$admin_unsetUserAvatar, | ||||||
| 		$admin_unsetUserBanner, | 		$admin_unsetUserBanner, | ||||||
| 		$admin_drive_cleanRemoteFiles, | 		$admin_drive_cleanRemoteFiles, | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ import * as ep___admin_avatarDecorations_update from './endpoints/admin/avatar-d | ||||||
| import * as ep___admin_captcha_current from './endpoints/admin/captcha/current.js'; | import * as ep___admin_captcha_current from './endpoints/admin/captcha/current.js'; | ||||||
| import * as ep___admin_captcha_save from './endpoints/admin/captcha/save.js'; | import * as ep___admin_captcha_save from './endpoints/admin/captcha/save.js'; | ||||||
| import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; | import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; | ||||||
|  | import * as ep___admin_updateProxyAccount from './endpoints/admin/update-proxy-account.js'; | ||||||
| import * as ep___admin_unsetUserAvatar from './endpoints/admin/unset-user-avatar.js'; | import * as ep___admin_unsetUserAvatar from './endpoints/admin/unset-user-avatar.js'; | ||||||
| import * as ep___admin_unsetUserBanner from './endpoints/admin/unset-user-banner.js'; | import * as ep___admin_unsetUserBanner from './endpoints/admin/unset-user-banner.js'; | ||||||
| import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; | import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; | ||||||
|  | @ -425,6 +426,7 @@ const eps = [ | ||||||
| 	['admin/captcha/current', ep___admin_captcha_current], | 	['admin/captcha/current', ep___admin_captcha_current], | ||||||
| 	['admin/captcha/save', ep___admin_captcha_save], | 	['admin/captcha/save', ep___admin_captcha_save], | ||||||
| 	['admin/delete-all-files-of-a-user', ep___admin_deleteAllFilesOfAUser], | 	['admin/delete-all-files-of-a-user', ep___admin_deleteAllFilesOfAUser], | ||||||
|  | 	['admin/update-proxy-account', ep___admin_updateProxyAccount], | ||||||
| 	['admin/unset-user-avatar', ep___admin_unsetUserAvatar], | 	['admin/unset-user-avatar', ep___admin_unsetUserAvatar], | ||||||
| 	['admin/unset-user-banner', ep___admin_unsetUserBanner], | 	['admin/unset-user-banner', ep___admin_unsetUserBanner], | ||||||
| 	['admin/drive/clean-remote-files', ep___admin_drive_cleanRemoteFiles], | 	['admin/drive/clean-remote-files', ep___admin_drive_cleanRemoteFiles], | ||||||
|  |  | ||||||
|  | @ -0,0 +1,353 @@ | ||||||
|  | /* | ||||||
|  |  * SPDX-FileCopyrightText: syuilo and misskey-project | ||||||
|  |  * SPDX-License-Identifier: AGPL-3.0-only | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | import { Inject, Injectable } from '@nestjs/common'; | ||||||
|  | import * as mfm from 'mfm-js'; | ||||||
|  | import { JSDOM } from 'jsdom'; | ||||||
|  | import type { Config } from '@/config.js'; | ||||||
|  | import { normalizeForSearch } from '@/misc/normalize-for-search.js'; | ||||||
|  | import { extractHashtags } from '@/misc/extract-hashtags.js'; | ||||||
|  | import type { | ||||||
|  | 	UsersRepository, | ||||||
|  | 	UserProfilesRepository, | ||||||
|  | 	MiUser, | ||||||
|  | 	MiUserProfile, | ||||||
|  | 	DriveFilesRepository, | ||||||
|  | 	PagesRepository, | ||||||
|  | 	MiMeta, | ||||||
|  | } from '@/models/_.js'; | ||||||
|  | import { Endpoint } from '@/server/api/endpoint-base.js'; | ||||||
|  | import { DI } from '@/di-symbols.js'; | ||||||
|  | import { RoleService } from '@/core/RoleService.js'; | ||||||
|  | import { | ||||||
|  | 	descriptionSchema, | ||||||
|  | 	MiLocalUser, | ||||||
|  | 	nameSchema, | ||||||
|  | } from '@/models/User.js'; | ||||||
|  | import { ApiError } from '@/server/api/error.js'; | ||||||
|  | import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; | ||||||
|  | import { UserEntityService } from '@/core/entities/UserEntityService.js'; | ||||||
|  | import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; | ||||||
|  | import { GlobalEventService } from '@/core/GlobalEventService.js'; | ||||||
|  | import { AccountUpdateService } from '@/core/AccountUpdateService.js'; | ||||||
|  | import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js'; | ||||||
|  | import { ApiLoggerService } from '@/server/api/ApiLoggerService.js'; | ||||||
|  | import { HashtagService } from '@/core/HashtagService.js'; | ||||||
|  | import { CacheService } from '@/core/CacheService.js'; | ||||||
|  | import { HttpRequestService } from '@/core/HttpRequestService.js'; | ||||||
|  | import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; | ||||||
|  | import { UtilityService } from '@/core/UtilityService.js'; | ||||||
|  | import { ModerationLogService } from '@/core/ModerationLogService.js'; | ||||||
|  | import { safeForSql } from '@/misc/safe-for-sql.js'; | ||||||
|  | import { ProxyAccountService } from '@/core/ProxyAccountService.js'; | ||||||
|  | 
 | ||||||
|  | export const meta = { | ||||||
|  | 	tags: ['admin'], | ||||||
|  | 
 | ||||||
|  | 	requireCredential: true, | ||||||
|  | 	requireModerator: true, | ||||||
|  | 	kind: 'write:admin:update-proxy-account', | ||||||
|  | 	secure: true, | ||||||
|  | 
 | ||||||
|  | 	errors: { | ||||||
|  | 		noSuchAvatar: { | ||||||
|  | 			message: 'No such avatar file.', | ||||||
|  | 			code: 'NO_SUCH_AVATAR', | ||||||
|  | 			id: '539f3a45-f215-4f81-a9a8-31293640207f', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		noSuchBanner: { | ||||||
|  | 			message: 'No such banner file.', | ||||||
|  | 			code: 'NO_SUCH_BANNER', | ||||||
|  | 			id: '0d8f5629-f210-41c2-9433-735831a58595', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		avatarNotAnImage: { | ||||||
|  | 			message: 'The file specified as an avatar is not an image.', | ||||||
|  | 			code: 'AVATAR_NOT_AN_IMAGE', | ||||||
|  | 			id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		bannerNotAnImage: { | ||||||
|  | 			message: 'The file specified as a banner is not an image.', | ||||||
|  | 			code: 'BANNER_NOT_AN_IMAGE', | ||||||
|  | 			id: '75aedb19-2afd-4e6d-87fc-67941256fa60', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		noSuchPage: { | ||||||
|  | 			message: 'No such page.', | ||||||
|  | 			code: 'NO_SUCH_PAGE', | ||||||
|  | 			id: '8e01b590-7eb9-431b-a239-860e086c408e', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		invalidRegexp: { | ||||||
|  | 			message: 'Invalid Regular Expression.', | ||||||
|  | 			code: 'INVALID_REGEXP', | ||||||
|  | 			id: '0d786918-10df-41cd-8f33-8dec7d9a89a5', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		tooManyMutedWords: { | ||||||
|  | 			message: 'Too many muted words.', | ||||||
|  | 			code: 'TOO_MANY_MUTED_WORDS', | ||||||
|  | 			id: '010665b1-a211-42d2-bc64-8f6609d79785', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		noSuchUser: { | ||||||
|  | 			message: 'No such user.', | ||||||
|  | 			code: 'NO_SUCH_USER', | ||||||
|  | 			id: 'fcd2eef9-a9b2-4c4f-8624-038099e90aa5', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		uriNull: { | ||||||
|  | 			message: 'User ActivityPup URI is null.', | ||||||
|  | 			code: 'URI_NULL', | ||||||
|  | 			id: 'bf326f31-d430-4f97-9933-5d61e4d48a23', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		forbiddenToSetYourself: { | ||||||
|  | 			message: 'You can\'t set yourself as your own alias.', | ||||||
|  | 			code: 'FORBIDDEN_TO_SET_YOURSELF', | ||||||
|  | 			id: '25c90186-4ab0-49c8-9bba-a1fa6c202ba4', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		restrictedByRole: { | ||||||
|  | 			message: 'This feature is restricted by your role.', | ||||||
|  | 			code: 'RESTRICTED_BY_ROLE', | ||||||
|  | 			id: '8feff0ba-5ab5-585b-31f4-4df816663fad', | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		nameContainsProhibitedWords: { | ||||||
|  | 			message: 'Your new name contains prohibited words.', | ||||||
|  | 			code: 'YOUR_NAME_CONTAINS_PROHIBITED_WORDS', | ||||||
|  | 			id: '0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191', | ||||||
|  | 			httpStatusCode: 422, | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		accessDenied: { | ||||||
|  | 			message: 'Only administrators can edit members of the role.', | ||||||
|  | 			code: 'ACCESS_DENIED', | ||||||
|  | 			id: '25b5bc31-dc79-4ebd-9bd2-c84978fd052c', | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	res: { | ||||||
|  | 		type: 'object', | ||||||
|  | 		nullable: false, optional: false, | ||||||
|  | 		ref: 'UserDetailed', | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	required: [], | ||||||
|  | } as const; | ||||||
|  | 
 | ||||||
|  | export const paramDef = { | ||||||
|  | 	type: 'object', | ||||||
|  | 	properties: { | ||||||
|  | 		name: { ...nameSchema, nullable: true }, | ||||||
|  | 		description: { ...descriptionSchema, nullable: true }, | ||||||
|  | 		avatarId: { type: 'string', format: 'misskey:id', nullable: true }, | ||||||
|  | 		bannerId: { type: 'string', format: 'misskey:id', nullable: true }, | ||||||
|  | 	}, | ||||||
|  | } as const; | ||||||
|  | 
 | ||||||
|  | @Injectable() | ||||||
|  | export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
 | ||||||
|  | 	constructor( | ||||||
|  | 		@Inject(DI.config) | ||||||
|  | 		private config: Config, | ||||||
|  | 
 | ||||||
|  | 		@Inject(DI.meta) | ||||||
|  | 		private instanceMeta: MiMeta, | ||||||
|  | 
 | ||||||
|  | 		@Inject(DI.usersRepository) | ||||||
|  | 		private usersRepository: UsersRepository, | ||||||
|  | 
 | ||||||
|  | 		@Inject(DI.userProfilesRepository) | ||||||
|  | 		private userProfilesRepository: UserProfilesRepository, | ||||||
|  | 
 | ||||||
|  | 		@Inject(DI.driveFilesRepository) | ||||||
|  | 		private driveFilesRepository: DriveFilesRepository, | ||||||
|  | 
 | ||||||
|  | 		@Inject(DI.pagesRepository) | ||||||
|  | 		private pagesRepository: PagesRepository, | ||||||
|  | 
 | ||||||
|  | 		private roleService: RoleService, | ||||||
|  | 		private userEntityService: UserEntityService, | ||||||
|  | 		private driveFileEntityService: DriveFileEntityService, | ||||||
|  | 		private globalEventService: GlobalEventService, | ||||||
|  | 		private accountUpdateService: AccountUpdateService, | ||||||
|  | 		private remoteUserResolveService: RemoteUserResolveService, | ||||||
|  | 		private apiLoggerService: ApiLoggerService, | ||||||
|  | 		private hashtagService: HashtagService, | ||||||
|  | 		private cacheService: CacheService, | ||||||
|  | 		private httpRequestService: HttpRequestService, | ||||||
|  | 		private avatarDecorationService: AvatarDecorationService, | ||||||
|  | 		private utilityService: UtilityService, | ||||||
|  | 		private moderationLogService: ModerationLogService, | ||||||
|  | 		private proxyAccountService: ProxyAccountService, | ||||||
|  | 	) { | ||||||
|  | 		super(meta, paramDef, async (ps, me) => { | ||||||
|  | 			const _me = await this.usersRepository.findOneByOrFail({ id: me.id }); | ||||||
|  | 			if (!await this.roleService.isModerator(_me)) { | ||||||
|  | 				throw new ApiError(meta.errors.accessDenied); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			const proxy = await this.proxyAccountService.fetch(); | ||||||
|  | 			if (!proxy) throw new ApiError(meta.errors.noSuchUser); | ||||||
|  | 
 | ||||||
|  | 			const profile = await this.userProfilesRepository.findOneByOrFail({ userId: proxy.id }); | ||||||
|  | 
 | ||||||
|  | 			const updates = {} as Partial<MiUser>; | ||||||
|  | 			const profileUpdates = {} as Partial<MiUserProfile>; | ||||||
|  | 
 | ||||||
|  | 			if (ps.name !== undefined) { | ||||||
|  | 				if (ps.name === null) { | ||||||
|  | 					updates.name = null; | ||||||
|  | 				} else { | ||||||
|  | 					const trimmedName = ps.name.trim(); | ||||||
|  | 					updates.name = trimmedName === '' ? null : trimmedName; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			if (ps.description !== undefined) profileUpdates.description = ps.description; | ||||||
|  | 
 | ||||||
|  | 			if (ps.avatarId) { | ||||||
|  | 				const avatar = await this.driveFilesRepository.findOneBy({ id: ps.avatarId }); | ||||||
|  | 
 | ||||||
|  | 				if (avatar == null) throw new ApiError(meta.errors.noSuchAvatar); | ||||||
|  | 				if (!avatar.type.startsWith('image/')) throw new ApiError(meta.errors.avatarNotAnImage); | ||||||
|  | 
 | ||||||
|  | 				updates.avatarId = avatar.id; | ||||||
|  | 				updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar'); | ||||||
|  | 				updates.avatarBlurhash = avatar.blurhash; | ||||||
|  | 			} else if (ps.avatarId === null) { | ||||||
|  | 				updates.avatarId = null; | ||||||
|  | 				updates.avatarUrl = null; | ||||||
|  | 				updates.avatarBlurhash = null; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (ps.bannerId) { | ||||||
|  | 				const banner = await this.driveFilesRepository.findOneBy({ id: ps.bannerId }); | ||||||
|  | 
 | ||||||
|  | 				if (banner == null) throw new ApiError(meta.errors.noSuchBanner); | ||||||
|  | 				if (!banner.type.startsWith('image/')) throw new ApiError(meta.errors.bannerNotAnImage); | ||||||
|  | 
 | ||||||
|  | 				updates.bannerId = banner.id; | ||||||
|  | 				updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner); | ||||||
|  | 				updates.bannerBlurhash = banner.blurhash; | ||||||
|  | 			} else if (ps.bannerId === null) { | ||||||
|  | 				updates.bannerId = null; | ||||||
|  | 				updates.bannerUrl = null; | ||||||
|  | 				updates.bannerBlurhash = null; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			//#region emojis/tags
 | ||||||
|  | 			let emojis = [] as string[]; | ||||||
|  | 			let tags = [] as string[]; | ||||||
|  | 
 | ||||||
|  | 			const newName = updates.name === undefined ? proxy.name : updates.name; | ||||||
|  | 			const newDescription = profileUpdates.description === undefined ? profile.description : profileUpdates.description; | ||||||
|  | 
 | ||||||
|  | 			if (newName != null) { | ||||||
|  | 				let hasProhibitedWords = false; | ||||||
|  | 				if (!await this.roleService.isModerator(proxy)) { | ||||||
|  | 					hasProhibitedWords = this.utilityService.isKeyWordIncluded(newName, this.instanceMeta.prohibitedWordsForNameOfUser); | ||||||
|  | 				} | ||||||
|  | 				if (hasProhibitedWords) { | ||||||
|  | 					throw new ApiError(meta.errors.nameContainsProhibitedWords); | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				const tokens = mfm.parseSimple(newName); | ||||||
|  | 				emojis = emojis.concat(extractCustomEmojisFromMfm(tokens)); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (newDescription != null) { | ||||||
|  | 				const tokens = mfm.parse(newDescription); | ||||||
|  | 				emojis = emojis.concat(extractCustomEmojisFromMfm(tokens)); | ||||||
|  | 				tags = extractHashtags(tokens).map(tag => normalizeForSearch(tag)).splice(0, 32); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			for (const field of profile.fields) { | ||||||
|  | 				const nameTokens = mfm.parseSimple(field.name); | ||||||
|  | 				const valueTokens = mfm.parseSimple(field.value); | ||||||
|  | 				emojis = emojis.concat([ | ||||||
|  | 					...extractCustomEmojisFromMfm(nameTokens), | ||||||
|  | 					...extractCustomEmojisFromMfm(valueTokens), | ||||||
|  | 				]); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (profile.followedMessage != null) { | ||||||
|  | 				const tokens = mfm.parse(profile.followedMessage); | ||||||
|  | 				emojis = emojis.concat(extractCustomEmojisFromMfm(tokens)); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			updates.emojis = emojis; | ||||||
|  | 			updates.tags = tags; | ||||||
|  | 
 | ||||||
|  | 			// ハッシュタグ更新
 | ||||||
|  | 			this.hashtagService.updateUsertags(proxy, tags); | ||||||
|  | 			//#endregion
 | ||||||
|  | 
 | ||||||
|  | 			if (Object.keys(updates).length > 0) { | ||||||
|  | 				await this.usersRepository.update(proxy.id, updates); | ||||||
|  | 				this.globalEventService.publishInternalEvent('localUserUpdated', { id: proxy.id }); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			await this.userProfilesRepository.update(proxy.id, { | ||||||
|  | 				...profileUpdates, | ||||||
|  | 				verifiedLinks: [], | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			const updated = await this.userEntityService.pack(proxy.id, proxy, { | ||||||
|  | 				schema: 'MeDetailed', | ||||||
|  | 			}); | ||||||
|  | 			const updatedProfile = await this.userProfilesRepository.findOneByOrFail({ userId: proxy.id }); | ||||||
|  | 
 | ||||||
|  | 			this.cacheService.userProfileCache.set(proxy.id, updatedProfile); | ||||||
|  | 
 | ||||||
|  | 			this.moderationLogService.log(me, 'updateUser', { | ||||||
|  | 				userId: proxy.id, | ||||||
|  | 				userUsername: proxy.username, | ||||||
|  | 				userHost: proxy.host, | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 			const urls = updatedProfile.fields.filter(x => x.value.startsWith('https://')); | ||||||
|  | 			for (const url of urls) { | ||||||
|  | 				this.verifyLink(url.value, proxy); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			return updated; | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | 	private async verifyLink(url: string, user: MiLocalUser) { | ||||||
|  | 		if (!safeForSql(url)) return; | ||||||
|  | 
 | ||||||
|  | 		try { | ||||||
|  | 			const html = await this.httpRequestService.getHtml(url); | ||||||
|  | 
 | ||||||
|  | 			const { window } = new JSDOM(html); | ||||||
|  | 			const doc = window.document; | ||||||
|  | 
 | ||||||
|  | 			const myLink = `${this.config.url}/@${user.username}`; | ||||||
|  | 
 | ||||||
|  | 			const aEls = Array.from(doc.getElementsByTagName('a')); | ||||||
|  | 			const linkEls = Array.from(doc.getElementsByTagName('link')); | ||||||
|  | 
 | ||||||
|  | 			const includesMyLink = aEls.some(a => a.href === myLink); | ||||||
|  | 			const includesRelMeLinks = [...aEls, ...linkEls].some(link => link.rel === 'me' && link.href === myLink); | ||||||
|  | 
 | ||||||
|  | 			if (includesMyLink || includesRelMeLinks) { | ||||||
|  | 				await this.userProfilesRepository.createQueryBuilder('profile').update() | ||||||
|  | 					.where('userId = :userId', { userId: user.id }) | ||||||
|  | 					.set({ | ||||||
|  | 						verifiedLinks: () => `array_append("verifiedLinks", '${url}')`, // ここでSQLインジェクションされそうなのでとりあえず safeForSql で弾いている
 | ||||||
|  | 					}) | ||||||
|  | 					.execute(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			window.close(); | ||||||
|  | 		} catch (err) { | ||||||
|  | 			// なにもしない
 | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | @ -73,6 +73,7 @@ export const moderationLogTypes = [ | ||||||
| 	'updateServerSettings', | 	'updateServerSettings', | ||||||
| 	'suspend', | 	'suspend', | ||||||
| 	'unsuspend', | 	'unsuspend', | ||||||
|  | 	'updateUser', | ||||||
| 	'updateUserNote', | 	'updateUserNote', | ||||||
| 	'addCustomEmoji', | 	'addCustomEmoji', | ||||||
| 	'updateCustomEmoji', | 	'updateCustomEmoji', | ||||||
|  | @ -311,6 +312,11 @@ export type ModerationLogPayloads = { | ||||||
| 		avatarDecorationId: string; | 		avatarDecorationId: string; | ||||||
| 		avatarDecoration: any; | 		avatarDecoration: any; | ||||||
| 	}; | 	}; | ||||||
|  | 	updateUser: { | ||||||
|  | 		userId: string; | ||||||
|  | 		userUsername: string; | ||||||
|  | 		userHost: string | null; | ||||||
|  | 	}; | ||||||
| 	unsetUserAvatar: { | 	unsetUserAvatar: { | ||||||
| 		userId: string; | 		userId: string; | ||||||
| 		userUsername: string; | 		userUsername: string; | ||||||
|  |  | ||||||
|  | @ -238,15 +238,33 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 				<MkFolder> | 				<MkFolder> | ||||||
| 					<template #icon><i class="ti ti-ghost"></i></template> | 					<template #icon><i class="ti ti-ghost"></i></template> | ||||||
| 					<template #label>{{ i18n.ts.proxyAccount }}</template> | 					<template #label>{{ i18n.ts.proxyAccount }}</template> | ||||||
|  | 					<template v-if="proxyAccountForm.modified.value" #footer> | ||||||
|  | 						<MkFormFooter :form="proxyAccountForm"/> | ||||||
|  | 					</template> | ||||||
| 
 | 
 | ||||||
| 					<div class="_gaps"> | 					<div class="_gaps"> | ||||||
| 						<MkInfo>{{ i18n.ts.proxyAccountDescription }}</MkInfo> | 						<MkInfo>{{ i18n.ts.proxyAccountDescription }}</MkInfo> | ||||||
| 						<MkKeyValue> |  | ||||||
| 							<template #key>{{ i18n.ts.proxyAccount }}</template> |  | ||||||
| 							<template #value>{{ proxyAccount ? `@${proxyAccount.username}` : i18n.ts.none }}</template> |  | ||||||
| 						</MkKeyValue> |  | ||||||
| 
 | 
 | ||||||
| 						<MkButton primary @click="chooseProxyAccount">{{ i18n.ts.selectAccount }}</MkButton> | 						<div class="_panel"> | ||||||
|  | 							<div :class="$style.banner" :style="{ backgroundImage: proxyAccount.bannerUrl ? `url(${ proxyAccount.bannerUrl })` : null }"> | ||||||
|  | 								<MkButton primary rounded :class="$style.bannerEdit" @click="changeProxyAccountBanner">{{ i18n.ts._profile.changeBanner }}</MkButton> | ||||||
|  | 							</div> | ||||||
|  | 							<div :class="$style.avatarContainer"> | ||||||
|  | 								<MkAvatar :class="$style.avatar" :user="proxyAccount" forceShowDecoration @click="changeProxyAccountAvatar"/> | ||||||
|  | 								<div class="_buttonsCenter"> | ||||||
|  | 									<MkButton primary rounded @click="changeProxyAccountAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton> | ||||||
|  | 								</div> | ||||||
|  | 							</div> | ||||||
|  | 						</div> | ||||||
|  | 
 | ||||||
|  | 						<MkInput v-model="proxyAccountForm.state.name" :max="30" :mfmAutocomplete="['emoji']"> | ||||||
|  | 							<template #label>{{ i18n.ts._profile.name }}</template> | ||||||
|  | 						</MkInput> | ||||||
|  | 
 | ||||||
|  | 						<MkTextarea v-model="proxyAccountForm.state.description" :max="500" tall mfmAutocomplete :mfmPreview="true"> | ||||||
|  | 							<template #label>{{ i18n.ts._profile.description }}</template> | ||||||
|  | 							<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template> | ||||||
|  | 						</MkTextarea> | ||||||
| 					</div> | 					</div> | ||||||
| 				</MkFolder> | 				</MkFolder> | ||||||
| 			</div> | 			</div> | ||||||
|  | @ -256,7 +274,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| import { ref, computed } from 'vue'; | import { ref, computed, reactive } from 'vue'; | ||||||
| import XHeader from './_header_.vue'; | import XHeader from './_header_.vue'; | ||||||
| import MkSwitch from '@/components/MkSwitch.vue'; | import MkSwitch from '@/components/MkSwitch.vue'; | ||||||
| import MkInput from '@/components/MkInput.vue'; | import MkInput from '@/components/MkInput.vue'; | ||||||
|  | @ -274,10 +292,17 @@ import MkKeyValue from '@/components/MkKeyValue.vue'; | ||||||
| import { useForm } from '@/scripts/use-form.js'; | import { useForm } from '@/scripts/use-form.js'; | ||||||
| import MkFormFooter from '@/components/MkFormFooter.vue'; | import MkFormFooter from '@/components/MkFormFooter.vue'; | ||||||
| import MkRadios from '@/components/MkRadios.vue'; | import MkRadios from '@/components/MkRadios.vue'; | ||||||
|  | import { selectFile } from '@/scripts/select-file.js'; | ||||||
|  | import { globalEvents } from '@/events.js'; | ||||||
|  | import { claimAchievement } from '@/scripts/achievements.js'; | ||||||
| 
 | 
 | ||||||
| const meta = await misskeyApi('admin/meta'); | const meta = await misskeyApi('admin/meta'); | ||||||
| 
 | 
 | ||||||
| const proxyAccount = ref(meta.proxyAccountId ? await misskeyApi('users/show', { userId: meta.proxyAccountId }) : null); | const proxyAccount = ref(meta.proxyAccountId ? await misskeyApi('users/show', { userId: meta.proxyAccountId }) : null); | ||||||
|  | const proxyAccountProfile = reactive({ | ||||||
|  | 	name: proxyAccount.value.name, | ||||||
|  | 	description: proxyAccount.value.description, | ||||||
|  | }); | ||||||
| 
 | 
 | ||||||
| const infoForm = useForm({ | const infoForm = useForm({ | ||||||
| 	name: meta.name ?? '', | 	name: meta.name ?? '', | ||||||
|  | @ -378,6 +403,69 @@ const federationForm = useForm({ | ||||||
| 	fetchInstance(true); | 	fetchInstance(true); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | const proxyAccountForm = useForm({ | ||||||
|  | 	name: proxyAccountProfile.name, | ||||||
|  | 	description: proxyAccountProfile.description, | ||||||
|  | }, async (state) => { | ||||||
|  | 	await os.apiWithDialog('admin/update-proxy-account', { | ||||||
|  | 		name: state.name, | ||||||
|  | 		description: state.description, | ||||||
|  | 	}); | ||||||
|  | 	fetchInstance(true); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | function changeProxyAccountAvatar(ev) { | ||||||
|  | 	selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar).then(async (file) => { | ||||||
|  | 		let originalOrCropped = file; | ||||||
|  | 
 | ||||||
|  | 		const { canceled } = await os.confirm({ | ||||||
|  | 			type: 'question', | ||||||
|  | 			text: i18n.ts.cropImageAsk, | ||||||
|  | 			okText: i18n.ts.cropYes, | ||||||
|  | 			cancelText: i18n.ts.cropNo, | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		if (!canceled) { | ||||||
|  | 			originalOrCropped = await os.cropImage(file, { | ||||||
|  | 				aspectRatio: 1, | ||||||
|  | 			}); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		const proxy = await os.apiWithDialog('admin/update-proxy-account', { | ||||||
|  | 			avatarId: originalOrCropped.id, | ||||||
|  | 		}); | ||||||
|  | 		proxyAccount.value.avatarId = proxy.avatarId; | ||||||
|  | 		proxyAccount.value.avatarUrl = proxy.avatarUrl; | ||||||
|  | 		globalEvents.emit('requestClearPageCache'); | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function changeProxyAccountBanner(ev) { | ||||||
|  | 	selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner).then(async (file) => { | ||||||
|  | 		let originalOrCropped = file; | ||||||
|  | 
 | ||||||
|  | 		const { canceled } = await os.confirm({ | ||||||
|  | 			type: 'question', | ||||||
|  | 			text: i18n.ts.cropImageAsk, | ||||||
|  | 			okText: i18n.ts.cropYes, | ||||||
|  | 			cancelText: i18n.ts.cropNo, | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		if (!canceled) { | ||||||
|  | 			originalOrCropped = await os.cropImage(file, { | ||||||
|  | 				aspectRatio: 2, | ||||||
|  | 			}); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		const proxy = await os.apiWithDialog('admin/update-proxy-account', { | ||||||
|  | 			bannerId: originalOrCropped.id, | ||||||
|  | 		}); | ||||||
|  | 		proxyAccount.value.bannerId = proxy.bannerId; | ||||||
|  | 		proxyAccount.value.bannerUrl = proxy.bannerUrl; | ||||||
|  | 		globalEvents.emit('requestClearPageCache'); | ||||||
|  | 	}); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function chooseProxyAccount() { | function chooseProxyAccount() { | ||||||
| 	os.selectUser({ localOnly: true }).then(user => { | 	os.selectUser({ localOnly: true }).then(user => { | ||||||
| 		proxyAccount.value = user; | 		proxyAccount.value = user; | ||||||
|  | @ -402,4 +490,32 @@ definePageMetadata(() => ({ | ||||||
| 	font-size: 0.85em; | 	font-size: 0.85em; | ||||||
| 	color: var(--MI_THEME-fgTransparentWeak); | 	color: var(--MI_THEME-fgTransparentWeak); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .banner { | ||||||
|  | 	position: relative; | ||||||
|  | 	height: 130px; | ||||||
|  | 	background-size: cover; | ||||||
|  | 	background-position: center; | ||||||
|  | 	border-bottom: solid 1px var(--MI_THEME-divider); | ||||||
|  | 	overflow: clip; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .avatarContainer { | ||||||
|  | 	margin-top: -50px; | ||||||
|  | 	padding-bottom: 16px; | ||||||
|  | 	text-align: center; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .avatar { | ||||||
|  | 	display: inline-block; | ||||||
|  | 	width: 72px; | ||||||
|  | 	height: 72px; | ||||||
|  | 	margin: 0 auto 16px auto; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .bannerEdit { | ||||||
|  | 	position: absolute; | ||||||
|  | 	top: 16px; | ||||||
|  | 	right: 16px; | ||||||
|  | } | ||||||
| </style> | </style> | ||||||
|  |  | ||||||
|  | @ -61,6 +61,9 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||||
| 							</MkA> | 							</MkA> | ||||||
| 						</span> | 						</span> | ||||||
| 					</div> | 					</div> | ||||||
|  | 					<div v-if="['instance.actor', 'relay.actor', 'proxy.actor'].includes(user.username)" class="isSystemAccount"> | ||||||
|  | 						<MkInfo>{{ i18n.ts.isSystemAccount }}</MkInfo> | ||||||
|  | 					</div> | ||||||
| 					<div v-if="iAmModerator" class="moderationNote"> | 					<div v-if="iAmModerator" class="moderationNote"> | ||||||
| 						<MkTextarea v-if="editModerationNote || (moderationNote != null && moderationNote !== '')" v-model="moderationNote" manualSave> | 						<MkTextarea v-if="editModerationNote || (moderationNote != null && moderationNote !== '')" v-model="moderationNote" manualSave> | ||||||
| 							<template #label>{{ i18n.ts.moderationNote }}</template> | 							<template #label>{{ i18n.ts.moderationNote }}</template> | ||||||
|  | @ -489,6 +492,10 @@ onUnmounted(() => { | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  | 				> .isSystemAccount { | ||||||
|  | 					padding: 24px 24px 0 154px; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
| 				> .roles { | 				> .roles { | ||||||
| 					padding: 24px 24px 0 154px; | 					padding: 24px 24px 0 154px; | ||||||
| 					font-size: 0.95em; | 					font-size: 0.95em; | ||||||
|  |  | ||||||
|  | @ -398,6 +398,12 @@ type AdminUpdateAbuseUserReportRequest = operations['admin___update-abuse-user-r | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json']; | type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json']; | ||||||
| 
 | 
 | ||||||
|  | // @public (undocumented) | ||||||
|  | type AdminUpdateProxyAccountRequest = operations['admin___update-proxy-account']['requestBody']['content']['application/json']; | ||||||
|  | 
 | ||||||
|  | // @public (undocumented) | ||||||
|  | type AdminUpdateProxyAccountResponse = operations['admin___update-proxy-account']['responses']['200']['content']['application/json']; | ||||||
|  | 
 | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json']; | type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json']; | ||||||
| 
 | 
 | ||||||
|  | @ -1271,6 +1277,8 @@ declare namespace entities { | ||||||
|         AdminCaptchaCurrentResponse, |         AdminCaptchaCurrentResponse, | ||||||
|         AdminCaptchaSaveRequest, |         AdminCaptchaSaveRequest, | ||||||
|         AdminDeleteAllFilesOfAUserRequest, |         AdminDeleteAllFilesOfAUserRequest, | ||||||
|  |         AdminUpdateProxyAccountRequest, | ||||||
|  |         AdminUpdateProxyAccountResponse, | ||||||
|         AdminUnsetUserAvatarRequest, |         AdminUnsetUserAvatarRequest, | ||||||
|         AdminUnsetUserBannerRequest, |         AdminUnsetUserBannerRequest, | ||||||
|         AdminDriveFilesRequest, |         AdminDriveFilesRequest, | ||||||
|  | @ -2477,6 +2485,9 @@ type ModerationLog = { | ||||||
| } | { | } | { | ||||||
|     type: 'unsuspend'; |     type: 'unsuspend'; | ||||||
|     info: ModerationLogPayloads['unsuspend']; |     info: ModerationLogPayloads['unsuspend']; | ||||||
|  | } | { | ||||||
|  |     type: 'updateUser'; | ||||||
|  |     info: ModerationLogPayloads['updateUser']; | ||||||
| } | { | } | { | ||||||
|     type: 'updateUserNote'; |     type: 'updateUserNote'; | ||||||
|     info: ModerationLogPayloads['updateUserNote']; |     info: ModerationLogPayloads['updateUserNote']; | ||||||
|  | @ -2621,7 +2632,7 @@ type ModerationLog = { | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "forwardAbuseReport", "updateAbuseReportNote", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"]; | export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUser", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "forwardAbuseReport", "updateAbuseReportNote", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"]; | ||||||
| 
 | 
 | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json']; | type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json']; | ||||||
|  | @ -2889,7 +2900,7 @@ type PartialRolePolicyOverride = Partial<{ | ||||||
| }>; | }>; | ||||||
| 
 | 
 | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "write:admin:suspend-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse"]; | export const permissions: readonly ["read:account", "write:account", "read:blocks", "write:blocks", "read:drive", "write:drive", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes", "read:pages", "write:pages", "write:page-likes", "read:page-likes", "read:user-groups", "write:user-groups", "read:channels", "write:channels", "read:gallery", "write:gallery", "read:gallery-likes", "write:gallery-likes", "read:flash", "write:flash", "read:flash-likes", "write:flash-likes", "read:admin:abuse-user-reports", "write:admin:delete-account", "write:admin:delete-all-files-of-a-user", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:update-proxy-account", "write:admin:reset-password", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-user", "write:admin:suspend-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-note", "write:admin:roles", "read:admin:roles", "write:admin:relays", "read:admin:relays", "write:admin:invite-codes", "read:admin:invite-codes", "write:admin:announcements", "read:admin:announcements", "write:admin:avatar-decorations", "read:admin:avatar-decorations", "write:admin:federation", "write:admin:account", "read:admin:account", "write:admin:emoji", "read:admin:emoji", "write:admin:queue", "read:admin:queue", "write:admin:promo", "write:admin:drive", "read:admin:drive", "write:admin:ad", "read:admin:ad", "write:invite-codes", "read:invite-codes", "write:clip-favorite", "read:clip-favorite", "read:federation", "write:report-abuse"]; | ||||||
| 
 | 
 | ||||||
| // @public (undocumented) | // @public (undocumented) | ||||||
| type PingResponse = operations['ping']['responses']['200']['content']['application/json']; | type PingResponse = operations['ping']['responses']['200']['content']['application/json']; | ||||||
|  |  | ||||||
|  | @ -283,6 +283,18 @@ declare module '../api.js' { | ||||||
|       credential?: string | null, |       credential?: string | null, | ||||||
|     ): Promise<SwitchCaseResponseType<E, P>>; |     ): Promise<SwitchCaseResponseType<E, P>>; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * No description provided. | ||||||
|  |      *  | ||||||
|  |      * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. | ||||||
|  |      * **Credential required**: *Yes* / **Permission**: *write:admin:update-proxy-account* | ||||||
|  |      */ | ||||||
|  |     request<E extends 'admin/update-proxy-account', P extends Endpoints[E]['req']>( | ||||||
|  |       endpoint: E, | ||||||
|  |       params: P, | ||||||
|  |       credential?: string | null, | ||||||
|  |     ): Promise<SwitchCaseResponseType<E, P>>; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * No description provided. |      * No description provided. | ||||||
|      *  |      *  | ||||||
|  |  | ||||||
|  | @ -39,6 +39,8 @@ import type { | ||||||
| 	AdminCaptchaCurrentResponse, | 	AdminCaptchaCurrentResponse, | ||||||
| 	AdminCaptchaSaveRequest, | 	AdminCaptchaSaveRequest, | ||||||
| 	AdminDeleteAllFilesOfAUserRequest, | 	AdminDeleteAllFilesOfAUserRequest, | ||||||
|  | 	AdminUpdateProxyAccountRequest, | ||||||
|  | 	AdminUpdateProxyAccountResponse, | ||||||
| 	AdminUnsetUserAvatarRequest, | 	AdminUnsetUserAvatarRequest, | ||||||
| 	AdminUnsetUserBannerRequest, | 	AdminUnsetUserBannerRequest, | ||||||
| 	AdminDriveFilesRequest, | 	AdminDriveFilesRequest, | ||||||
|  | @ -609,6 +611,7 @@ export type Endpoints = { | ||||||
| 	'admin/captcha/current': { req: EmptyRequest; res: AdminCaptchaCurrentResponse }; | 	'admin/captcha/current': { req: EmptyRequest; res: AdminCaptchaCurrentResponse }; | ||||||
| 	'admin/captcha/save': { req: AdminCaptchaSaveRequest; res: EmptyResponse }; | 	'admin/captcha/save': { req: AdminCaptchaSaveRequest; res: EmptyResponse }; | ||||||
| 	'admin/delete-all-files-of-a-user': { req: AdminDeleteAllFilesOfAUserRequest; res: EmptyResponse }; | 	'admin/delete-all-files-of-a-user': { req: AdminDeleteAllFilesOfAUserRequest; res: EmptyResponse }; | ||||||
|  | 	'admin/update-proxy-account': { req: AdminUpdateProxyAccountRequest; res: AdminUpdateProxyAccountResponse }; | ||||||
| 	'admin/unset-user-avatar': { req: AdminUnsetUserAvatarRequest; res: EmptyResponse }; | 	'admin/unset-user-avatar': { req: AdminUnsetUserAvatarRequest; res: EmptyResponse }; | ||||||
| 	'admin/unset-user-banner': { req: AdminUnsetUserBannerRequest; res: EmptyResponse }; | 	'admin/unset-user-banner': { req: AdminUnsetUserBannerRequest; res: EmptyResponse }; | ||||||
| 	'admin/drive/clean-remote-files': { req: EmptyRequest; res: EmptyResponse }; | 	'admin/drive/clean-remote-files': { req: EmptyRequest; res: EmptyResponse }; | ||||||
|  |  | ||||||
|  | @ -42,6 +42,8 @@ export type AdminAvatarDecorationsUpdateRequest = operations['admin___avatar-dec | ||||||
| export type AdminCaptchaCurrentResponse = operations['admin___captcha___current']['responses']['200']['content']['application/json']; | export type AdminCaptchaCurrentResponse = operations['admin___captcha___current']['responses']['200']['content']['application/json']; | ||||||
| export type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody']['content']['application/json']; | export type AdminCaptchaSaveRequest = operations['admin___captcha___save']['requestBody']['content']['application/json']; | ||||||
| export type AdminDeleteAllFilesOfAUserRequest = operations['admin___delete-all-files-of-a-user']['requestBody']['content']['application/json']; | export type AdminDeleteAllFilesOfAUserRequest = operations['admin___delete-all-files-of-a-user']['requestBody']['content']['application/json']; | ||||||
|  | export type AdminUpdateProxyAccountRequest = operations['admin___update-proxy-account']['requestBody']['content']['application/json']; | ||||||
|  | export type AdminUpdateProxyAccountResponse = operations['admin___update-proxy-account']['responses']['200']['content']['application/json']; | ||||||
| export type AdminUnsetUserAvatarRequest = operations['admin___unset-user-avatar']['requestBody']['content']['application/json']; | export type AdminUnsetUserAvatarRequest = operations['admin___unset-user-avatar']['requestBody']['content']['application/json']; | ||||||
| export type AdminUnsetUserBannerRequest = operations['admin___unset-user-banner']['requestBody']['content']['application/json']; | export type AdminUnsetUserBannerRequest = operations['admin___unset-user-banner']['requestBody']['content']['application/json']; | ||||||
| export type AdminDriveFilesRequest = operations['admin___drive___files']['requestBody']['content']['application/json']; | export type AdminDriveFilesRequest = operations['admin___drive___files']['requestBody']['content']['application/json']; | ||||||
|  |  | ||||||
|  | @ -242,6 +242,16 @@ export type paths = { | ||||||
|      */ |      */ | ||||||
|     post: operations['admin___delete-all-files-of-a-user']; |     post: operations['admin___delete-all-files-of-a-user']; | ||||||
|   }; |   }; | ||||||
|  |   '/admin/update-proxy-account': { | ||||||
|  |     /** | ||||||
|  |      * admin/update-proxy-account | ||||||
|  |      * @description No description provided. | ||||||
|  |      * | ||||||
|  |      * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. | ||||||
|  |      * **Credential required**: *Yes* / **Permission**: *write:admin:update-proxy-account* | ||||||
|  |      */ | ||||||
|  |     post: operations['admin___update-proxy-account']; | ||||||
|  |   }; | ||||||
|   '/admin/unset-user-avatar': { |   '/admin/unset-user-avatar': { | ||||||
|     /** |     /** | ||||||
|      * admin/unset-user-avatar |      * admin/unset-user-avatar | ||||||
|  | @ -6758,6 +6768,65 @@ export type operations = { | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  |   /** | ||||||
|  |    * admin/update-proxy-account | ||||||
|  |    * @description No description provided. | ||||||
|  |    * | ||||||
|  |    * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. | ||||||
|  |    * **Credential required**: *Yes* / **Permission**: *write:admin:update-proxy-account* | ||||||
|  |    */ | ||||||
|  |   'admin___update-proxy-account': { | ||||||
|  |     requestBody: { | ||||||
|  |       content: { | ||||||
|  |         'application/json': { | ||||||
|  |           name?: string | null; | ||||||
|  |           description?: string | null; | ||||||
|  |           /** Format: misskey:id */ | ||||||
|  |           avatarId?: string | null; | ||||||
|  |           /** Format: misskey:id */ | ||||||
|  |           bannerId?: string | null; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |     responses: { | ||||||
|  |       /** @description OK (with results) */ | ||||||
|  |       200: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['UserDetailed']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       /** @description Client error */ | ||||||
|  |       400: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['Error']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       /** @description Authentication error */ | ||||||
|  |       401: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['Error']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       /** @description Forbidden error */ | ||||||
|  |       403: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['Error']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       /** @description I'm Ai */ | ||||||
|  |       418: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['Error']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       /** @description Internal server error */ | ||||||
|  |       500: { | ||||||
|  |         content: { | ||||||
|  |           'application/json': components['schemas']['Error']; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|   /** |   /** | ||||||
|    * admin/unset-user-avatar |    * admin/unset-user-avatar | ||||||
|    * @description No description provided. |    * @description No description provided. | ||||||
|  |  | ||||||
|  | @ -70,6 +70,7 @@ export const permissions = [ | ||||||
| 	'read:admin:table-stats', | 	'read:admin:table-stats', | ||||||
| 	'read:admin:user-ips', | 	'read:admin:user-ips', | ||||||
| 	'read:admin:meta', | 	'read:admin:meta', | ||||||
|  | 	'write:admin:update-proxy-account', | ||||||
| 	'write:admin:reset-password', | 	'write:admin:reset-password', | ||||||
| 	'write:admin:resolve-abuse-user-report', | 	'write:admin:resolve-abuse-user-report', | ||||||
| 	'write:admin:send-email', | 	'write:admin:send-email', | ||||||
|  | @ -116,6 +117,7 @@ export const moderationLogTypes = [ | ||||||
| 	'updateServerSettings', | 	'updateServerSettings', | ||||||
| 	'suspend', | 	'suspend', | ||||||
| 	'unsuspend', | 	'unsuspend', | ||||||
|  | 	'updateUser', | ||||||
| 	'updateUserNote', | 	'updateUserNote', | ||||||
| 	'addCustomEmoji', | 	'addCustomEmoji', | ||||||
| 	'updateCustomEmoji', | 	'updateCustomEmoji', | ||||||
|  | @ -200,6 +202,13 @@ export type ModerationLogPayloads = { | ||||||
| 		userUsername: string; | 		userUsername: string; | ||||||
| 		userHost: string | null; | 		userHost: string | null; | ||||||
| 	}; | 	}; | ||||||
|  | 	updateUser: { | ||||||
|  | 		userId: string; | ||||||
|  | 		userUsername: string; | ||||||
|  | 		userHost: string | null; | ||||||
|  | 		before: MetaDetailed | null; | ||||||
|  | 		after: MetaDetailed | null; | ||||||
|  | 	}; | ||||||
| 	updateUserNote: { | 	updateUserNote: { | ||||||
| 		userId: string; | 		userId: string; | ||||||
| 		userUsername: string; | 		userUsername: string; | ||||||
|  |  | ||||||
|  | @ -54,6 +54,9 @@ export type ModerationLog = { | ||||||
| } | { | } | { | ||||||
| 	type: 'unsuspend'; | 	type: 'unsuspend'; | ||||||
| 	info: ModerationLogPayloads['unsuspend']; | 	info: ModerationLogPayloads['unsuspend']; | ||||||
|  | } | { | ||||||
|  | 	type: 'updateUser'; | ||||||
|  | 	info: ModerationLogPayloads['updateUser']; | ||||||
| } | { | } | { | ||||||
| 	type: 'updateUserNote'; | 	type: 'updateUserNote'; | ||||||
| 	info: ModerationLogPayloads['updateUserNote']; | 	info: ModerationLogPayloads['updateUserNote']; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue