Add factory reset functionality and update identity service
CI / Backend (build + test) (push) Successful in 1m18s
CI / Frontend (lint + typecheck + build) (push) Successful in 32s

- Introduced a new DELETE endpoint `/api/admin/maintenance/factory-reset` for a complete reset of the admin panel, removing all users except the current admin and clearing various data.
- Implemented the `FactoryReset` method in `AdminMaintenanceEndpoints` to handle the reset logic.
- Added a new method `ListAllUserIdsExceptAsync` in `IIdentityService` to retrieve user IDs excluding a specified user, aiding in the factory reset process.
- Updated the frontend to include a confirmation dialog for the factory reset action, enhancing user experience and safety.
- Enhanced localization support for the new factory reset feature in both Russian and English, ensuring clarity for all users.
This commit is contained in:
Leonid Pershin
2026-07-14 18:58:51 +03:00
parent 94ba514b8e
commit 701c3a1d51
16 changed files with 564 additions and 64 deletions
+46
View File
@@ -370,6 +370,29 @@ const resources = {
confirm: 'Удалить все отключённые приложения? Действие необратимо.',
deleted: 'Удалено приложений: {{count}}.',
},
factoryReset: {
dangerZone: 'Опасная зона',
title: 'Полный сброс панели',
description: 'Вернуть панель в состояние только что развёрнутой — удалить всех пользователей, конфиги, ноды и все данные. Ваш текущий аккаунт сохранится.',
action: 'Сбросить панель',
dialogTitle: 'Полный сброс панели',
warningIntro: 'Будет удалено безвозвратно:',
warningItems: [
'Все пользователи, кроме вашего текущего аккаунта',
'Все VPN-конфиги (сначала будут отозваны на нодах 3x-ui)',
'Все ноды и инбаунды — регистрация серверов 3x-ui и сохранённые креды',
'Все обращения в поддержку вместе с перепиской и вложениями',
'Все новости',
'Весь журнал аудита',
'Все роли, кроме системных admin/user',
'Каталог приложений (будет пересеян из стартового набора)',
],
irreversible: 'Действие необратимо и не может быть отменено.',
confirmPhrase: 'СБРОС',
confirmInputLabel: 'Введите «{{phrase}}» для подтверждения',
confirmButton: 'Сбросить панель безвозвратно',
done: 'Панель сброшена до начального состояния.',
},
},
stats: {
totalUsers: 'Всего пользователей',
@@ -752,6 +775,29 @@ const resources = {
confirm: 'Delete all disabled apps? This cannot be undone.',
deleted: 'Deleted apps: {{count}}.',
},
factoryReset: {
dangerZone: 'Danger zone',
title: 'Full panel reset',
description: 'Return the panel to a freshly-deployed state — deletes all users, configs, nodes and data. Your current account is kept.',
action: 'Reset panel',
dialogTitle: 'Full panel reset',
warningIntro: 'This will permanently delete:',
warningItems: [
'All users except your current account',
'All VPN configs (revoked on the 3x-ui nodes first)',
'All nodes and inbounds — 3x-ui server registrations and stored credentials',
'All support tickets with their comments and attachments',
'All news posts',
'The entire audit log',
'All roles except the system admin/user roles',
'The app catalog (will be re-seeded from the default set)',
],
irreversible: 'This cannot be undone.',
confirmPhrase: 'RESET',
confirmInputLabel: 'Type "{{phrase}}" to confirm',
confirmButton: 'Reset the panel permanently',
done: 'The panel has been reset to its initial state.',
},
},
stats: {
totalUsers: 'Total users',