1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 14:46:40 +09:00

feat(moderation): モデレーターがユーザーの名前を変更できるように&トークンを再生成できるように (MisskeyIO#747)

This commit is contained in:
あわわわとーにゅ 2024-10-18 08:53:33 +09:00 committed by GitHub
parent 227c85c2cf
commit 8706fa0747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 444 additions and 50 deletions

View File

@ -2003,8 +2003,8 @@ _permissions:
"read:admin:show-user": "Veure informació privada de l'usuari "
"read:admin:show-users": "Veure informació privada de l'usuari "
"write:admin:suspend-user": "Suspendre usuari"
"write:admin:unset-user-avatar": "Esborrar avatar d'usuari "
"write:admin:unset-user-banner": "Esborrar bàner de l'usuari "
"write:admin:user-avatar": "Esborrar avatar d'usuari "
"write:admin:user-banner": "Esborrar bàner de l'usuari "
"write:admin:unsuspend-user": "Treure la suspensió d'un usuari"
"write:admin:meta": "Gestionar les metadades de la instància"
"write:admin:user-note": "Gestionar les notes de moderació "

View File

@ -693,6 +693,7 @@ useGlobalSetting: "Use global settings"
useGlobalSettingDesc: "If turned on, your account's notification settings will be used. If turned off, individual configurations can be made."
other: "Other"
regenerateLoginToken: "Regenerate login token"
regenerateLoginTokenConfirm: "Are you sure you want to regenerate the login token? All devices will be logged out."
regenerateLoginTokenDescription: "Regenerates the token used internally during login. Normally this action is not necessary. If regenerated, all devices will be logged out."
theKeywordWhenSearchingForCustomEmoji: "This is the keyword when searching for custom emojis."
setMultipleBySeparatingWithSpace: "Separate multiple entries with spaces."
@ -1060,7 +1061,7 @@ likeOnlyForRemote: "All (Only likes for remote instances)"
nonSensitiveOnly: "Non-sensitive only"
nonSensitiveOnlyForLocalLikeOnlyForRemote: "Non-sensitive only (Only likes from remote)"
rolesAssignedToMe: "Roles assigned to me"
resetPasswordConfirm: "Really reset your password?"
resetPasswordConfirm: "Are you sure you want to reset password?"
sensitiveWords: "Sensitive words"
sensitiveWordsDescription: "The visibility of all notes containing any of the configured words will be set to \"Home\" automatically. You can list multiple by separating them via line breaks."
sensitiveWordsDescription2: "Using spaces will create AND expressions and surrounding keywords with slashes will turn them into a regular expression."
@ -1268,6 +1269,7 @@ inquiry: "Contact"
here: "here"
mutualLink: "Mutual Link"
saveThisFile: "Save this file to Drive"
changeUserName: "Change name"
_bubbleGame:
howToPlay: "How to play"
hold: "Hold"
@ -2111,6 +2113,7 @@ _permissions:
"read:admin:user-ips": "View user IP addresses"
"read:admin:meta": "View instance metadata"
"write:admin:reset-password": "Reset user password"
"write:admin:regenerate-user-token": "Regenerate user login token"
"write:admin:resolve-abuse-user-report": "Resolve user report"
"write:admin:send-email": "Send email"
"read:admin:server-info": "View server info"
@ -2118,11 +2121,12 @@ _permissions:
"read:admin:show-user": "View private user info"
"read:admin:show-users": "View private user info"
"write:admin:suspend-user": "Suspend user"
"write:admin:unset-user-avatar": "Remove user avatar"
"write:admin:unset-user-banner": "Remove user banner"
"write:admin:unset-user-mutual-link": "Remove user mutual link"
"write:admin:user-avatar": "Remove user avatar"
"write:admin:user-banner": "Remove user banner"
"write:admin:user-mutual-link": "Remove user mutual link"
"write:admin:unsuspend-user": "Unsuspend user"
"write:admin:meta": "Manage instance metadata"
"write:admin:user-name": "Change user name"
"write:admin:user-note": "Manage moderation note"
"write:admin:roles": "Manage roles"
"read:admin:roles": "View roles"

View File

@ -2031,8 +2031,8 @@ _permissions:
"read:admin:show-user": "Ver información privada de usuario"
"read:admin:show-users": "Ver información privada de usuario"
"write:admin:suspend-user": "Suspender cuentas de usuario"
"write:admin:unset-user-avatar": "Quitar avatares de usuario"
"write:admin:unset-user-banner": "Quitar banner de usuarios"
"write:admin:user-avatar": "Quitar avatares de usuario"
"write:admin:user-banner": "Quitar banner de usuarios"
"write:admin:unsuspend-user": "Quitar suspensión de cuentas de usuario"
"write:admin:meta": "Edición de metadatos de la instancia"
"write:admin:user-note": "Moderación de notas"

View File

@ -2034,8 +2034,8 @@ _permissions:
"read:admin:show-user": "Lihat informasi pengguna privat"
"read:admin:show-users": "Lihat informasi pengguna privat"
"write:admin:suspend-user": "Tangguhkan pengguna"
"write:admin:unset-user-avatar": "Hapus avatar pengguna"
"write:admin:unset-user-banner": "Hapus banner pengguna"
"write:admin:user-avatar": "Hapus avatar pengguna"
"write:admin:user-banner": "Hapus banner pengguna"
"write:admin:unsuspend-user": "Batalkan penangguhan pengguna"
"write:admin:meta": "Kelola metadata instansi"
"write:admin:user-note": "Kelola moderasi catatan"

24
locales/index.d.ts vendored
View File

@ -2796,6 +2796,10 @@ export interface Locale extends ILocale {
*
*/
"regenerateLoginToken": string;
/**
*
*/
"regenerateLoginTokenConfirm": string;
/**
* 使
*/
@ -4268,7 +4272,7 @@ export interface Locale extends ILocale {
*/
"rolesAssignedToMe": string;
/**
*
*
*/
"resetPasswordConfirm": string;
/**
@ -5130,6 +5134,10 @@ export interface Locale extends ILocale {
*
*/
"saveThisFile": string;
/**
*
*/
"changeUserName": string;
"_bubbleGame": {
/**
*
@ -8235,6 +8243,10 @@ export interface Locale extends ILocale {
*
*/
"write:admin:reset-password": string;
/**
*
*/
"write:admin:regenerate-user-token": string;
/**
*
*/
@ -8266,15 +8278,15 @@ export interface Locale extends ILocale {
/**
*
*/
"write:admin:unset-user-avatar": string;
"write:admin:user-avatar": string;
/**
*
*/
"write:admin:unset-user-banner": string;
"write:admin:user-banner": string;
/**
*
*/
"write:admin:unset-user-mutual-link": string;
"write:admin:user-mutual-link": string;
/**
*
*/
@ -8283,6 +8295,10 @@ export interface Locale extends ILocale {
*
*/
"write:admin:meta": string;
/**
*
*/
"write:admin:user-name": string;
/**
*
*/

View File

@ -2027,8 +2027,8 @@ _permissions:
"read:admin:show-user": "Vedere le informazioni private degli account utente"
"read:admin:show-users": "Vedere le informazioni private degli account utente"
"write:admin:suspend-user": "Sospendere i profili"
"write:admin:unset-user-avatar": "Rimuovere la foto profilo dai profili"
"write:admin:unset-user-banner": "Rimuovere l'immagine testata dai profili"
"write:admin:user-avatar": "Rimuovere la foto profilo dai profili"
"write:admin:user-banner": "Rimuovere l'immagine testata dai profili"
"write:admin:unsuspend-user": "Togliere la sospensione ai profili"
"write:admin:meta": "Modificare i metadati dell'istanza"
"write:admin:user-note": "Scrivere annotazioni di moderazione"

View File

@ -695,6 +695,7 @@ useGlobalSetting: "グローバル設定を使う"
useGlobalSettingDesc: "オンにすると、アカウントの通知設定が使用されます。オフにすると、個別に設定できるようになります。"
other: "その他"
regenerateLoginToken: "ログイントークンを再生成"
regenerateLoginTokenConfirm: "ログイントークンを再生成しますか?"
regenerateLoginTokenDescription: "ログインに使用される内部トークンを再生成します。通常この操作を行う必要はありません。再生成すると、全てのデバイスでログアウトされます。"
theKeywordWhenSearchingForCustomEmoji: "カスタム絵文字を検索する時のキーワードになります。"
setMultipleBySeparatingWithSpace: "スペースで区切って複数設定できます。"
@ -1062,7 +1063,7 @@ likeOnlyForRemote: "全て (リモートはいいねのみ)"
nonSensitiveOnly: "非センシティブのみ"
nonSensitiveOnlyForLocalLikeOnlyForRemote: "非センシティブのみ (リモートはいいねのみ)"
rolesAssignedToMe: "自分に割り当てられたロール"
resetPasswordConfirm: "パスワードリセットしますか?"
resetPasswordConfirm: "パスワードリセットしますか?"
sensitiveWords: "センシティブワード"
sensitiveWordsDescription: "設定したワードが含まれるノートの公開範囲をホームにします。改行で区切って複数設定できます。"
sensitiveWordsDescription2: "スペースで区切るとAND指定になり、キーワードをスラッシュで囲むと正規表現になります。"
@ -1277,6 +1278,7 @@ muteThisUser: "このユーザーをミュートする"
here: "こちら"
mutualLink: "相互リンク"
saveThisFile: "このファイルをドライブに保存する"
changeUserName: "名前を変更"
_bubbleGame:
howToPlay: "遊び方"
@ -2157,6 +2159,7 @@ _permissions:
"read:admin:user-ips": "ユーザーのIPアドレスを見る"
"read:admin:meta": "インスタンスのメタデータを見る"
"write:admin:reset-password": "ユーザーのパスワードをリセットする"
"write:admin:regenerate-user-token": "ユーザーのログイントークンを再生成する"
"write:admin:resolve-abuse-user-report": "ユーザーからの通報を解決する"
"write:admin:send-email": "メールを送る"
"read:admin:server-info": "サーバーの情報を見る"
@ -2164,11 +2167,12 @@ _permissions:
"read:admin:show-user": "ユーザーのプライベートな情報を見る"
"read:admin:show-users": "ユーザーのプライベートな情報を見る"
"write:admin:suspend-user": "ユーザーを凍結する"
"write:admin:unset-user-avatar": "ユーザーのアバターを削除する"
"write:admin:unset-user-banner": "ユーザーのバーナーを削除する"
"write:admin:unset-user-mutual-link": "ユーザーの相互リンクを削除する"
"write:admin:user-avatar": "ユーザーのアバターを削除する"
"write:admin:user-banner": "ユーザーのバーナーを削除する"
"write:admin:user-mutual-link": "ユーザーの相互リンクを削除する"
"write:admin:unsuspend-user": "ユーザーの凍結を解除する"
"write:admin:meta": "インスタンスのメタデータを操作する"
"write:admin:user-name": "ユーザーの名前を変更する"
"write:admin:user-note": "モデレーションノートを操作する"
"write:admin:roles": "ロールを操作する"
"read:admin:roles": "ロールを見る"

View File

@ -2034,8 +2034,8 @@ _permissions:
"read:admin:show-user": "ユーザーのプライベートな情報見る"
"read:admin:show-users": "ユーザーのプライベートな情報見る"
"write:admin:suspend-user": "ユーザーを凍結"
"write:admin:unset-user-avatar": "ユーザーのアバターを削除"
"write:admin:unset-user-banner": "ユーザーのバナーを削除"
"write:admin:user-avatar": "ユーザーのアバターを削除"
"write:admin:user-banner": "ユーザーのバナーを削除"
"write:admin:unsuspend-user": "ユーザーの凍結解除"
"write:admin:meta": "インスタンスのメタデータいじる"
"write:admin:user-note": "モデレーションノートいじる"

View File

@ -692,6 +692,7 @@ useGlobalSetting: "글로벌 설정을 사용하기"
useGlobalSettingDesc: "활성화하면 계정의 알림 설정이 적용됩니다. 비활성화하면 개별적으로 설정할 수 있게 됩니다."
other: "기타"
regenerateLoginToken: "로그인 토큰을 재생성"
regenerateLoginTokenConfirm: "정말 로그인 토큰을 재생성하시겠습니까? 이 작업을 실행하면 이 계정으로 로그인한 모든 기기에서 로그아웃됩니다."
regenerateLoginTokenDescription: "로그인할 때 사용되는 내부 토큰을 재생성합니다. 일반적으로 이 작업을 실행할 필요는 없습니다. 이 기능을 사용하면 이 계정으로 로그인한 모든 기기에서 로그아웃됩니다."
theKeywordWhenSearchingForCustomEmoji: "맞춤 이모티콘을 검색할 때 키워드가 됩니다."
setMultipleBySeparatingWithSpace: "공백으로 구분하여 여러 개 설정할 수 있습니다."
@ -1261,6 +1262,7 @@ useNativeUIForVideoAudioPlayer: "브라우저 UI에서 미디어 재생"
here: "여기"
mutualLink: "서로링크"
saveThisFile: "이 파일을 드라이브에 저장"
changeUserName: "이름 변경"
_bubbleGame:
howToPlay: "설명"
hold: "홀드"
@ -2102,9 +2104,9 @@ _permissions:
"read:admin:show-user": "사용자 개인정보 보기"
"read:admin:show-users": "사용자 개인정보 보기"
"write:admin:suspend-user": "사용자 정지하기"
"write:admin:unset-user-avatar": "사용자 아바타 삭제하기"
"write:admin:unset-user-banner": "사용자 배너 삭제하기"
"write:admin:unset-user-mutual-link": "사용자의 서로링크 삭제하기"
"write:admin:user-avatar": "사용자 아바타 삭제하기"
"write:admin:user-banner": "사용자 배너 삭제하기"
"write:admin:user-mutual-link": "사용자의 서로링크 삭제하기"
"write:admin:unsuspend-user": "사용자 정지 해제하기"
"write:admin:meta": "인스턴스 메타데이터 수정하기"
"write:admin:user-note": "조정 기록 수정하기"

View File

@ -2034,8 +2034,8 @@ _permissions:
"read:admin:show-user": "ดูข้อมูลส่วนตัวของผู้ใช้"
"read:admin:show-users": "ดูข้อมูลส่วนตัวของผู้ใช้"
"write:admin:suspend-user": "ระงับผู้ใช้"
"write:admin:unset-user-avatar": "ลบอวตารผู้ใช้"
"write:admin:unset-user-banner": "ลบแบนเนอร์ผู้ใช้"
"write:admin:user-avatar": "ลบอวตารผู้ใช้"
"write:admin:user-banner": "ลบแบนเนอร์ผู้ใช้"
"write:admin:unsuspend-user": "ยกเลิกการระงับผู้ใช้"
"write:admin:meta": "จัดการข้อมูลเมตาของอินสแตนซ์"
"write:admin:user-note": "จัดการโน้ตการกลั่นกรอง"

View File

@ -2052,8 +2052,8 @@ _permissions:
"read:admin:show-user": "查看用户的非公开信息"
"read:admin:show-users": "查看用户的非公开信息"
"write:admin:suspend-user": "冻结用户"
"write:admin:unset-user-avatar": "删除用户头像"
"write:admin:unset-user-banner": "删除用户横幅"
"write:admin:user-avatar": "删除用户头像"
"write:admin:user-banner": "删除用户横幅"
"write:admin:unsuspend-user": "解除用户冻结"
"write:admin:meta": "编辑实例元数据"
"write:admin:user-note": "编辑管理笔记"

View File

@ -2034,8 +2034,8 @@ _permissions:
"read:admin:show-user": "查看使用者的私密資訊"
"read:admin:show-users": "查看使用者的私密資訊"
"write:admin:suspend-user": "凍結使用者"
"write:admin:unset-user-avatar": "刪除使用者的頭像"
"write:admin:unset-user-banner": "刪除使用者的橫幅"
"write:admin:user-avatar": "刪除使用者的頭像"
"write:admin:user-banner": "刪除使用者的橫幅"
"write:admin:unsuspend-user": "解除凍結使用者"
"write:admin:meta": "編輯實例的詮釋資料"
"write:admin:user-note": "編輯審查筆記"

View File

@ -73,6 +73,7 @@ import * as ep___admin_relays_add from './endpoints/admin/relays/add.js';
import * as ep___admin_relays_list from './endpoints/admin/relays/list.js';
import * as ep___admin_relays_remove from './endpoints/admin/relays/remove.js';
import * as ep___admin_resetPassword from './endpoints/admin/reset-password.js';
import * as ep___admin_regenerateUserToken from './endpoints/admin/regenerate-user-token.js';
import * as ep___admin_resolveAbuseUserReport from './endpoints/admin/resolve-abuse-user-report.js';
import * as ep___admin_sendEmail from './endpoints/admin/send-email.js';
import * as ep___admin_serverInfo from './endpoints/admin/server-info.js';
@ -83,6 +84,7 @@ import * as ep___admin_showUsers from './endpoints/admin/show-users.js';
import * as ep___admin_suspendUser from './endpoints/admin/suspend-user.js';
import * as ep___admin_unsuspendUser from './endpoints/admin/unsuspend-user.js';
import * as ep___admin_updateMeta from './endpoints/admin/update-meta.js';
import * as ep___admin_updateUserName from './endpoints/admin/update-user-name.js';
import * as ep___admin_updateUserNote from './endpoints/admin/update-user-note.js';
import * as ep___admin_roles_create from './endpoints/admin/roles/create.js';
import * as ep___admin_roles_delete from './endpoints/admin/roles/delete.js';
@ -465,6 +467,7 @@ const $admin_relays_add: Provider = { provide: 'ep:admin/relays/add', useClass:
const $admin_relays_list: Provider = { provide: 'ep:admin/relays/list', useClass: ep___admin_relays_list.default };
const $admin_relays_remove: Provider = { provide: 'ep:admin/relays/remove', useClass: ep___admin_relays_remove.default };
const $admin_resetPassword: Provider = { provide: 'ep:admin/reset-password', useClass: ep___admin_resetPassword.default };
const $admin_regenerateUserToken: Provider = { provide: 'ep:admin/regenerate-user-token', useClass: ep___admin_regenerateUserToken.default };
const $admin_resolveAbuseUserReport: Provider = { provide: 'ep:admin/resolve-abuse-user-report', useClass: ep___admin_resolveAbuseUserReport.default };
const $admin_sendEmail: Provider = { provide: 'ep:admin/send-email', useClass: ep___admin_sendEmail.default };
const $admin_serverInfo: Provider = { provide: 'ep:admin/server-info', useClass: ep___admin_serverInfo.default };
@ -475,6 +478,7 @@ const $admin_showUsers: Provider = { provide: 'ep:admin/show-users', useClass: e
const $admin_suspendUser: Provider = { provide: 'ep:admin/suspend-user', useClass: ep___admin_suspendUser.default };
const $admin_unsuspendUser: Provider = { provide: 'ep:admin/unsuspend-user', useClass: ep___admin_unsuspendUser.default };
const $admin_updateMeta: Provider = { provide: 'ep:admin/update-meta', useClass: ep___admin_updateMeta.default };
const $admin_updateUserName: Provider = { provide: 'ep:admin/update-user-name', useClass: ep___admin_updateUserName.default };
const $admin_updateUserNote: Provider = { provide: 'ep:admin/update-user-note', useClass: ep___admin_updateUserNote.default };
const $admin_roles_create: Provider = { provide: 'ep:admin/roles/create', useClass: ep___admin_roles_create.default };
const $admin_roles_delete: Provider = { provide: 'ep:admin/roles/delete', useClass: ep___admin_roles_delete.default };
@ -861,6 +865,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$admin_relays_list,
$admin_relays_remove,
$admin_resetPassword,
$admin_regenerateUserToken,
$admin_resolveAbuseUserReport,
$admin_sendEmail,
$admin_serverInfo,
@ -871,6 +876,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$admin_suspendUser,
$admin_unsuspendUser,
$admin_updateMeta,
$admin_updateUserName,
$admin_updateUserNote,
$admin_roles_create,
$admin_roles_delete,
@ -1251,6 +1257,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$admin_relays_list,
$admin_relays_remove,
$admin_resetPassword,
$admin_regenerateUserToken,
$admin_resolveAbuseUserReport,
$admin_sendEmail,
$admin_serverInfo,
@ -1261,6 +1268,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__
$admin_suspendUser,
$admin_unsuspendUser,
$admin_updateMeta,
$admin_updateUserName,
$admin_updateUserNote,
$admin_roles_create,
$admin_roles_delete,

View File

@ -73,6 +73,7 @@ import * as ep___admin_relays_add from './endpoints/admin/relays/add.js';
import * as ep___admin_relays_list from './endpoints/admin/relays/list.js';
import * as ep___admin_relays_remove from './endpoints/admin/relays/remove.js';
import * as ep___admin_resetPassword from './endpoints/admin/reset-password.js';
import * as ep___admin_regenerateUserToken from './endpoints/admin/regenerate-user-token.js';
import * as ep___admin_resolveAbuseUserReport from './endpoints/admin/resolve-abuse-user-report.js';
import * as ep___admin_sendEmail from './endpoints/admin/send-email.js';
import * as ep___admin_serverInfo from './endpoints/admin/server-info.js';
@ -83,6 +84,7 @@ import * as ep___admin_showUsers from './endpoints/admin/show-users.js';
import * as ep___admin_suspendUser from './endpoints/admin/suspend-user.js';
import * as ep___admin_unsuspendUser from './endpoints/admin/unsuspend-user.js';
import * as ep___admin_updateMeta from './endpoints/admin/update-meta.js';
import * as ep___admin_updateUserName from './endpoints/admin/update-user-name.js';
import * as ep___admin_updateUserNote from './endpoints/admin/update-user-note.js';
import * as ep___admin_roles_create from './endpoints/admin/roles/create.js';
import * as ep___admin_roles_delete from './endpoints/admin/roles/delete.js';
@ -463,6 +465,7 @@ const eps = [
['admin/relays/list', ep___admin_relays_list],
['admin/relays/remove', ep___admin_relays_remove],
['admin/reset-password', ep___admin_resetPassword],
['admin/regenerate-user-token', ep___admin_regenerateUserToken],
['admin/resolve-abuse-user-report', ep___admin_resolveAbuseUserReport],
['admin/send-email', ep___admin_sendEmail],
['admin/server-info', ep___admin_serverInfo],
@ -473,6 +476,7 @@ const eps = [
['admin/suspend-user', ep___admin_suspendUser],
['admin/unsuspend-user', ep___admin_unsuspendUser],
['admin/update-meta', ep___admin_updateMeta],
['admin/update-user-name', ep___admin_updateUserName],
['admin/update-user-note', ep___admin_updateUserNote],
['admin/roles/create', ep___admin_roles_create],
['admin/roles/delete', ep___admin_roles_delete],

View File

@ -0,0 +1,61 @@
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { UsersRepository } from '@/models/_.js';
import generateUserToken from '@/misc/generate-native-user-token.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DI } from '@/di-symbols.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
export const meta = {
tags: ['admin'],
requireCredential: true,
requireModerator: true,
kind: 'write:admin:regenerate-user-token',
} as const;
export const paramDef = {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
},
required: ['userId'],
} as const;
// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
private globalEventService: GlobalEventService,
private moderationLogService: ModerationLogService,
) {
super(meta, paramDef, async (ps, me) => {
const user = await this.usersRepository.findOneBy({ id: ps.userId });
if (user == null) {
throw new Error('user not found');
}
const oldToken = user.token;
if (oldToken == null) return;
const newToken = generateUserToken();
await this.usersRepository.update(user.id, {
token: newToken,
});
// Publish event
this.globalEventService.publishInternalEvent('userTokenRegenerated', { id: user.id, oldToken, newToken });
this.globalEventService.publishMainStream(user.id, 'myTokenRegenerated');
this.moderationLogService.log(me, 'regenerateUserToken', {
userId: user.id,
userUsername: user.username,
userHost: user.host,
});
});
}
}

View File

@ -14,7 +14,7 @@ export const meta = {
requireCredential: true,
requireModerator: true,
kind: 'write:admin:unset-user-avatar',
kind: 'write:admin:user-avatar',
} as const;
export const paramDef = {

View File

@ -14,7 +14,7 @@ export const meta = {
requireCredential: true,
requireModerator: true,
kind: 'write:admin:unset-user-banner',
kind: 'write:admin:user-banner',
} as const;
export const paramDef = {

View File

@ -12,7 +12,7 @@ export const meta = {
requireCredential: true,
requireModerator: true,
kind: 'write:admin:unset-user-mutual-link',
kind: 'write:admin:user-mutual-link',
} as const;
export const paramDef = {

View File

@ -0,0 +1,53 @@
import { Inject, Injectable } from '@nestjs/common';
import type { UsersRepository } from '@/models/_.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { DI } from '@/di-symbols.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
export const meta = {
tags: ['admin'],
requireCredential: true,
requireModerator: true,
kind: 'write:admin:user-name',
} as const;
export const paramDef = {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
name: { type: 'string' },
},
required: ['userId'],
} as const;
// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
private moderationLogService: ModerationLogService,
) {
super(meta, paramDef, async (ps, me) => {
const user = await this.usersRepository.findOneBy({ id: ps.userId });
if (user == null) {
throw new Error('user not found');
}
await this.usersRepository.update(user.id, {
name: ps.name ?? null,
});
this.moderationLogService.log(me, 'updateUserName', {
userId: user.id,
userUsername: user.username,
userHost: user.host,
before: user.name,
after: ps.name ?? null,
});
});
}
}

View File

@ -55,6 +55,7 @@ export const moderationLogTypes = [
'updateServerSettings',
'suspend',
'unsuspend',
'updateUserName',
'updateUserNote',
'addCustomEmoji',
'updateCustomEmoji',
@ -75,6 +76,7 @@ export const moderationLogTypes = [
'deleteGlobalAnnouncement',
'deleteUserAnnouncement',
'resetPassword',
'regenerateUserToken',
'suspendRemoteInstance',
'unsuspendRemoteInstance',
'updateRemoteInstanceNote',
@ -114,6 +116,13 @@ export type ModerationLogPayloads = {
userUsername: string;
userHost: string | null;
};
updateUserName: {
userId: string;
userUsername: string;
userHost: string | null;
before: string | null;
after: string | null;
};
updateUserNote: {
userId: string;
userUsername: string;
@ -217,6 +226,11 @@ export type ModerationLogPayloads = {
userUsername: string;
userHost: string | null;
};
regenerateUserToken: {
userId: string;
userUsername: string;
userHost: string | null;
};
suspendRemoteInstance: {
id: string;
host: string;

View File

@ -63,7 +63,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.moderation }}</template>
<div class="_gaps">
<MkSwitch v-model="suspended" @update:modelValue="toggleSuspend">{{ i18n.ts.suspend }}</MkSwitch>
<MkButton v-if="user.host == null" @click="resetPassword"><i class="ti ti-key"></i> {{ i18n.ts.resetPassword }}</MkButton>
<div v-if="user.host == null" class="_buttons">
<MkButton @click="resetPassword"><i class="ti ti-key"></i> {{ i18n.ts.resetPassword }}</MkButton>
<MkButton danger @click="regenerateLoginToken"><i class="ti ti-refresh"></i> {{ i18n.ts.regenerateLoginToken }}</MkButton>
</div>
<MkButton inline danger @click="updateUserName"><i class="ti ti-user-edit"></i> {{ i18n.ts.changeUserName }}</MkButton>
<MkButton inline danger @click="unsetUserAvatar"><i class="ti ti-user-circle"></i> {{ i18n.ts.unsetUserAvatar }}</MkButton>
<MkButton inline danger @click="unsetUserBanner"><i class="ti ti-photo"></i> {{ i18n.ts.unsetUserBanner }}</MkButton>
<MkFolder v-if="user?.mutualLinkSections && user?.mutualLinkSections.reduce((acc, section) => acc + section.mutualLinks.length, 0) > 0">
@ -339,6 +343,18 @@ async function resetPassword() {
}
}
async function regenerateLoginToken() {
const confirm = await os.confirm({
type: 'warning',
text: i18n.ts.regenerateLoginTokenConfirm,
});
if (confirm.canceled) return;
await os.apiWithDialog('admin/regenerate-user-token', {
userId: user.value.id,
}).then(refreshUser);
}
async function toggleSuspend(v) {
const confirm = await os.confirm({
type: 'warning',
@ -353,6 +369,20 @@ async function toggleSuspend(v) {
}
}
async function updateUserName() {
const { canceled, result: name } = await os.inputText({
type: 'text',
title: i18n.ts.enterUsername,
default: '',
});
if (canceled) return;
await os.apiWithDialog('admin/update-user-name', {
userId: user.value.id,
name: name || undefined,
}).then(refreshUser);
}
async function unsetUserAvatar() {
const confirm = await os.confirm({
type: 'warning',

View File

@ -9,14 +9,19 @@ SPDX-License-Identifier: AGPL-3.0-only
<b
:class="{
[$style.logGreen]: ['createRole', 'addCustomEmoji', 'createGlobalAnnouncement', 'createUserAnnouncement', 'createAd', 'createInvitation', 'createAvatarDecoration'].includes(log.type),
[$style.logYellow]: ['markSensitiveDriveFile', 'resetPassword'].includes(log.type),
[$style.logYellow]: ['markSensitiveDriveFile', 'resetPassword', 'regenerateUserToken', 'updateUserName', 'unsetUserAvatar', 'unsetUserBanner', 'unsetUserMutualLink'].includes(log.type),
[$style.logRed]: ['suspend', 'deleteRole', 'suspendRemoteInstance', 'deleteGlobalAnnouncement', 'deleteUserAnnouncement', 'deleteCustomEmoji', 'deleteNote', 'deleteDriveFile', 'deleteAd', 'deleteAvatarDecoration'].includes(log.type)
}"
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
<span v-if="log.type === 'updateUserNote'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'updateUserName'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'unsetUserAvatar'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'unsetUserBanner'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'unsetUserMutualLink'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'suspend'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'unsuspend'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'resetPassword'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'regenerateUserToken'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
<span v-else-if="log.type === 'assignRole'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }} <i class="ti ti-arrow-right"></i> {{ log.info.roleName }}</span>
<span v-else-if="log.type === 'unassignRole'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }} <i class="ti ti-equal-not"></i> {{ log.info.roleName }}</span>
<span v-else-if="log.type === 'createRole'">: {{ log.info.role.name }}</span>
@ -59,6 +64,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<CodeDiff :context="5" :hideHeader="true" :oldString="JSON5.stringify(log.info.before, null, '\t')" :newString="JSON5.stringify(log.info.after, null, '\t')" language="javascript" maxHeight="300px"/>
</div>
</template>
<template v-else-if="log.type === 'updateUserName'">
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
<div :class="$style.diff">
<CodeDiff :context="5" :hideHeader="true" :oldString="log.info.before ?? ''" :newString="log.info.after ?? ''" maxHeight="300px"/>
</div>
</template>
<template v-else-if="log.type === 'updateUserNote'">
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
<div :class="$style.diff">

View File

@ -268,6 +268,9 @@ type AdminQueuePromoteRequest = operations['admin___queue___promote']['requestBo
// @public (undocumented)
type AdminQueueStatsResponse = operations['admin___queue___stats']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminRegenerateUserTokenRequest = operations['admin___regenerate-user-token']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminRelaysAddRequest = operations['admin___relays___add']['requestBody']['content']['application/json'];
@ -391,6 +394,9 @@ type AdminUnsuspendUserRequest = operations['admin___unsuspend-user']['requestBo
// @public (undocumented)
type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUpdateUserNameRequest = operations['admin___update-user-name']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json'];
@ -1293,6 +1299,7 @@ declare namespace entities {
AdminRelaysRemoveRequest,
AdminResetPasswordRequest,
AdminResetPasswordResponse,
AdminRegenerateUserTokenRequest,
AdminResolveAbuseUserReportRequest,
AdminSendEmailRequest,
AdminServerInfoResponse,
@ -1307,6 +1314,7 @@ declare namespace entities {
AdminSuspendUserRequest,
AdminUnsuspendUserRequest,
AdminUpdateMetaRequest,
AdminUpdateUserNameRequest,
AdminUpdateUserNoteRequest,
AdminRolesCreateRequest,
AdminRolesCreateResponse,
@ -2398,6 +2406,9 @@ type ModerationLog = {
} | {
type: 'unsuspend';
info: ModerationLogPayloads['unsuspend'];
} | {
type: 'updateUserName';
info: ModerationLogPayloads['updateUserName'];
} | {
type: 'updateUserNote';
info: ModerationLogPayloads['updateUserNote'];
@ -2458,6 +2469,9 @@ type ModerationLog = {
} | {
type: 'resetPassword';
info: ModerationLogPayloads['resetPassword'];
} | {
type: 'regenerateUserToken';
info: ModerationLogPayloads['regenerateUserToken'];
} | {
type: 'suspendRemoteInstance';
info: ModerationLogPayloads['suspendRemoteInstance'];
@ -2515,7 +2529,7 @@ type ModerationLog = {
});
// @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", "createInvitation", "createAd", "updateAd", "deleteAd", "createIndieAuthClient", "updateIndieAuthClient", "deleteIndieAuthClient", "createSSOServiceProvider", "updateSSOServiceProvider", "deleteSSOServiceProvider", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "unsetUserMutualBanner"];
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserName", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "regenerateUserToken", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createIndieAuthClient", "updateIndieAuthClient", "deleteIndieAuthClient", "createSSOServiceProvider", "updateSSOServiceProvider", "deleteSSOServiceProvider", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "unsetUserMutualBanner"];
// @public (undocumented)
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
@ -2767,7 +2781,7 @@ type PagesUpdateRequest = operations['pages___update']['requestBody']['content']
function parse(acct: string): Acct;
// @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", "read:admin:abuse-report-resolvers", "write:admin:abuse-report-resolvers", "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-account-move-log", "read:admin:show-user", "read:admin:show-users", "write:admin:suspend-user", "write:admin:unset-user-avatar", "write:admin:unset-user-banner", "write:admin:unset-user-mutual-link", "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:indie-auth", "read:admin:indie-auth", "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:sso", "read:admin:sso", "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", "read:admin:abuse-report-resolvers", "write:admin:abuse-report-resolvers", "read:admin:index-stats", "read:admin:table-stats", "read:admin:user-ips", "read:admin:meta", "write:admin:reset-password", "write:admin:regenerate-user-token", "write:admin:resolve-abuse-user-report", "write:admin:send-email", "read:admin:server-info", "read:admin:show-moderation-log", "read:admin:show-account-move-log", "read:admin:show-user", "read:admin:show-users", "write:admin:suspend-user", "write:admin:unsuspend-user", "write:admin:meta", "write:admin:user-name", "write:admin:user-note", "write:admin:user-avatar", "write:admin:user-banner", "write:admin:user-mutual-link", "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:indie-auth", "read:admin:indie-auth", "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:sso", "read:admin:sso", "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)
type PingResponse = operations['ping']['responses']['200']['content']['application/json'];

View File

@ -259,7 +259,7 @@ declare module '../api.js' {
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-avatar*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-avatar*
*/
request<E extends 'admin/unset-user-avatar', P extends Endpoints[E]['req']>(
endpoint: E,
@ -270,7 +270,7 @@ declare module '../api.js' {
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-banner*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-banner*
*/
request<E extends 'admin/unset-user-banner', P extends Endpoints[E]['req']>(
endpoint: E,
@ -281,7 +281,7 @@ declare module '../api.js' {
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-mutual-link*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-mutual-link*
*/
request<E extends 'admin/unset-user-mutual-link', P extends Endpoints[E]['req']>(
endpoint: E,
@ -741,6 +741,17 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:regenerate-user-token*
*/
request<E extends 'admin/regenerate-user-token', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
@ -851,6 +862,17 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-name*
*/
request<E extends 'admin/update-user-name', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*

View File

@ -89,6 +89,7 @@ import type {
AdminRelaysRemoveRequest,
AdminResetPasswordRequest,
AdminResetPasswordResponse,
AdminRegenerateUserTokenRequest,
AdminResolveAbuseUserReportRequest,
AdminSendEmailRequest,
AdminServerInfoResponse,
@ -103,6 +104,7 @@ import type {
AdminSuspendUserRequest,
AdminUnsuspendUserRequest,
AdminUpdateMetaRequest,
AdminUpdateUserNameRequest,
AdminUpdateUserNoteRequest,
AdminRolesCreateRequest,
AdminRolesCreateResponse,
@ -653,6 +655,7 @@ export type Endpoints = {
'admin/relays/list': { req: EmptyRequest; res: AdminRelaysListResponse };
'admin/relays/remove': { req: AdminRelaysRemoveRequest; res: EmptyResponse };
'admin/reset-password': { req: AdminResetPasswordRequest; res: AdminResetPasswordResponse };
'admin/regenerate-user-token': { req: AdminRegenerateUserTokenRequest; res: EmptyResponse };
'admin/resolve-abuse-user-report': { req: AdminResolveAbuseUserReportRequest; res: EmptyResponse };
'admin/send-email': { req: AdminSendEmailRequest; res: EmptyResponse };
'admin/server-info': { req: EmptyRequest; res: AdminServerInfoResponse };
@ -663,6 +666,7 @@ export type Endpoints = {
'admin/suspend-user': { req: AdminSuspendUserRequest; res: EmptyResponse };
'admin/unsuspend-user': { req: AdminUnsuspendUserRequest; res: EmptyResponse };
'admin/update-meta': { req: AdminUpdateMetaRequest; res: EmptyResponse };
'admin/update-user-name': { req: AdminUpdateUserNameRequest; res: EmptyResponse };
'admin/update-user-note': { req: AdminUpdateUserNoteRequest; res: EmptyResponse };
'admin/roles/create': { req: AdminRolesCreateRequest; res: AdminRolesCreateResponse };
'admin/roles/delete': { req: AdminRolesDeleteRequest; res: EmptyResponse };

View File

@ -92,6 +92,7 @@ export type AdminRelaysListResponse = operations['admin___relays___list']['respo
export type AdminRelaysRemoveRequest = operations['admin___relays___remove']['requestBody']['content']['application/json'];
export type AdminResetPasswordRequest = operations['admin___reset-password']['requestBody']['content']['application/json'];
export type AdminResetPasswordResponse = operations['admin___reset-password']['responses']['200']['content']['application/json'];
export type AdminRegenerateUserTokenRequest = operations['admin___regenerate-user-token']['requestBody']['content']['application/json'];
export type AdminResolveAbuseUserReportRequest = operations['admin___resolve-abuse-user-report']['requestBody']['content']['application/json'];
export type AdminSendEmailRequest = operations['admin___send-email']['requestBody']['content']['application/json'];
export type AdminServerInfoResponse = operations['admin___server-info']['responses']['200']['content']['application/json'];
@ -106,6 +107,7 @@ export type AdminShowUsersResponse = operations['admin___show-users']['responses
export type AdminSuspendUserRequest = operations['admin___suspend-user']['requestBody']['content']['application/json'];
export type AdminUnsuspendUserRequest = operations['admin___unsuspend-user']['requestBody']['content']['application/json'];
export type AdminUpdateMetaRequest = operations['admin___update-meta']['requestBody']['content']['application/json'];
export type AdminUpdateUserNameRequest = operations['admin___update-user-name']['requestBody']['content']['application/json'];
export type AdminUpdateUserNoteRequest = operations['admin___update-user-note']['requestBody']['content']['application/json'];
export type AdminRolesCreateRequest = operations['admin___roles___create']['requestBody']['content']['application/json'];
export type AdminRolesCreateResponse = operations['admin___roles___create']['responses']['200']['content']['application/json'];

View File

@ -224,7 +224,7 @@ export type paths = {
* admin/unset-user-avatar
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-avatar*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-avatar*
*/
post: operations['admin___unset-user-avatar'];
};
@ -233,7 +233,7 @@ export type paths = {
* admin/unset-user-banner
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-banner*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-banner*
*/
post: operations['admin___unset-user-banner'];
};
@ -242,7 +242,7 @@ export type paths = {
* admin/unset-user-mutual-link
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-mutual-link*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-mutual-link*
*/
post: operations['admin___unset-user-mutual-link'];
};
@ -616,6 +616,15 @@ export type paths = {
*/
post: operations['admin___reset-password'];
};
'/admin/regenerate-user-token': {
/**
* admin/regenerate-user-token
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:regenerate-user-token*
*/
post: operations['admin___regenerate-user-token'];
};
'/admin/resolve-abuse-user-report': {
/**
* admin/resolve-abuse-user-report
@ -706,6 +715,15 @@ export type paths = {
*/
post: operations['admin___update-meta'];
};
'/admin/update-user-name': {
/**
* admin/update-user-name
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-name*
*/
post: operations['admin___update-user-name'];
};
'/admin/update-user-note': {
/**
* admin/update-user-note
@ -6769,7 +6787,7 @@ export type operations = {
* admin/unset-user-avatar
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-avatar*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-avatar*
*/
'admin___unset-user-avatar': {
requestBody: {
@ -6821,7 +6839,7 @@ export type operations = {
* admin/unset-user-banner
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-banner*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-banner*
*/
'admin___unset-user-banner': {
requestBody: {
@ -6873,7 +6891,7 @@ export type operations = {
* admin/unset-user-mutual-link
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:unset-user-mutual-link*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-mutual-link*
*/
'admin___unset-user-mutual-link': {
requestBody: {
@ -9218,6 +9236,58 @@ export type operations = {
};
};
};
/**
* admin/regenerate-user-token
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:regenerate-user-token*
*/
'admin___regenerate-user-token': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
userId: string;
};
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
};
/** @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/resolve-abuse-user-report
* @description No description provided.
@ -10093,6 +10163,59 @@ export type operations = {
};
};
};
/**
* admin/update-user-name
* @description No description provided.
*
* **Credential required**: *Yes* / **Permission**: *write:admin:user-name*
*/
'admin___update-user-name': {
requestBody: {
content: {
'application/json': {
/** Format: misskey:id */
userId: string;
name?: string;
};
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
};
/** @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/update-user-note
* @description No description provided.

View File

@ -53,6 +53,7 @@ export const permissions = [
'read:admin:user-ips',
'read:admin:meta',
'write:admin:reset-password',
'write:admin:regenerate-user-token',
'write:admin:resolve-abuse-user-report',
'write:admin:send-email',
'read:admin:server-info',
@ -61,12 +62,13 @@ export const permissions = [
'read:admin:show-user',
'read:admin:show-users',
'write:admin:suspend-user',
'write:admin:unset-user-avatar',
'write:admin:unset-user-banner',
'write:admin:unset-user-mutual-link',
'write:admin:unsuspend-user',
'write:admin:meta',
'write:admin:user-name',
'write:admin:user-note',
'write:admin:user-avatar',
'write:admin:user-banner',
'write:admin:user-mutual-link',
'write:admin:roles',
'read:admin:roles',
'write:admin:relays',
@ -105,6 +107,7 @@ export const moderationLogTypes = [
'updateServerSettings',
'suspend',
'unsuspend',
'updateUserName',
'updateUserNote',
'addCustomEmoji',
'updateCustomEmoji',
@ -125,6 +128,7 @@ export const moderationLogTypes = [
'deleteGlobalAnnouncement',
'deleteUserAnnouncement',
'resetPassword',
'regenerateUserToken',
'suspendRemoteInstance',
'unsuspendRemoteInstance',
'updateRemoteInstanceNote',
@ -164,6 +168,13 @@ export type ModerationLogPayloads = {
userUsername: string;
userHost: string | null;
};
updateUserName: {
userId: string;
userUsername: string;
userHost: string | null;
before: string | null;
after: string | null;
}
updateUserNote: {
userId: string;
userUsername: string;
@ -267,6 +278,11 @@ export type ModerationLogPayloads = {
userUsername: string;
userHost: string | null;
};
regenerateUserToken: {
userId: string;
userUsername: string;
userHost: string | null;
};
suspendRemoteInstance: {
id: string;
host: string;

View File

@ -29,6 +29,9 @@ export type ModerationLog = {
} | {
type: 'unsuspend';
info: ModerationLogPayloads['unsuspend'];
} | {
type: 'updateUserName';
info: ModerationLogPayloads['updateUserName'];
} | {
type: 'updateUserNote';
info: ModerationLogPayloads['updateUserNote'];
@ -89,6 +92,9 @@ export type ModerationLog = {
} | {
type: 'resetPassword';
info: ModerationLogPayloads['resetPassword'];
} | {
type: 'regenerateUserToken';
info: ModerationLogPayloads['regenerateUserToken'];
} | {
type: 'suspendRemoteInstance';
info: ModerationLogPayloads['suspendRemoteInstance'];