feat: add warning prompt before resetting application

This commit is contained in:
ezequielnick 2025-04-25 22:33:16 +08:00
parent 0218f72c5f
commit 08f15c7e01
8 changed files with 81 additions and 2 deletions

View File

@ -1,3 +1,23 @@
## 1.7.3
**注意:如安装后为英文,请在设置中反复选择几次不同语言以写入配置文件**
### 新功能 (Feat)
- Mihomo 内核升级 v1.19.5
- MacOS 下添加 Dock 图标动态展现方式 (#594)
- 更改默认 UA 并添加版本
- 添加固定间隔的配置文件更新按钮 (#670)
- 使用 pkexec 替换基于密码的 sudo提高安全性
- 重置软件增加警告提示
### 修复 (Fix)
- 修复代理节点页面因为重复刷新导致的溢出问题
- 修复由于 Mihomo 核心错误导致启动时窗口丢失 (#601)
- 修复 sub-store 临时目录
- sub-store 迁移到用户 work 目录下
- 更新多语言中的密码提示,从 'root' 改为 'administrator'
- 修复 defaultBypass 几乎总是 Windows 默认绕过设置 (#602)
- 修复重置防火墙时发生的错误,因为没有指定防火墙规则 (#650)
## 1.7.2
**注意:如安装后为英文,请在设置中反复选择几次不同语言以写入配置文件**

View File

@ -1,6 +1,6 @@
{
"name": "mihomo-party",
"version": "1.7.2",
"version": "1.7.3",
"description": "Mihomo Party",
"main": "./out/main/index.js",
"author": "mihomo-party-org",

View File

@ -0,0 +1,37 @@
import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button } from '@heroui/react'
import React from 'react'
import { useTranslation } from 'react-i18next'
interface Props {
title: string
content: string
onCancel: () => void
onConfirm: () => void
isOpen: boolean
}
const BaseConfirmModal: React.FC<Props> = (props) => {
const { t } = useTranslation()
const { title, content, onCancel, onConfirm, isOpen } = props
return (
<Modal backdrop="blur" classNames={{ backdrop: 'top-[48px]' }} hideCloseButton isOpen={isOpen}>
<ModalContent>
<ModalHeader className="flex app-drag">{title}</ModalHeader>
<ModalBody>
<p>{content}</p>
</ModalBody>
<ModalFooter>
<Button size="sm" variant="light" onPress={onCancel}>
{t('common.cancel')}
</Button>
<Button size="sm" color="danger" onPress={onConfirm}>
{t('common.confirm')}
</Button>
</ModalFooter>
</ModalContent>
</Modal>
)
}
export default BaseConfirmModal

View File

@ -14,6 +14,7 @@ import { version } from '@renderer/utils/init'
import { IoIosHelpCircle } from 'react-icons/io'
import { getDriver } from '@renderer/App'
import { useTranslation } from 'react-i18next'
import BaseConfirmModal from '../base/base-confirm-modal'
const Actions: React.FC = () => {
const { t } = useTranslation()
@ -21,6 +22,7 @@ const Actions: React.FC = () => {
const [changelog, setChangelog] = useState('')
const [openUpdate, setOpenUpdate] = useState(false)
const [checkingUpdate, setCheckingUpdate] = useState(false)
const [showResetConfirm, setShowResetConfirm] = useState(false)
return (
<>
@ -31,6 +33,18 @@ const Actions: React.FC = () => {
changelog={changelog}
/>
)}
{showResetConfirm && (
<BaseConfirmModal
isOpen={showResetConfirm}
title={t('actions.reset.confirm.title')}
content={t('actions.reset.confirm.content')}
onCancel={() => setShowResetConfirm(false)}
onConfirm={() => {
resetAppConfig()
setShowResetConfirm(false)
}}
/>
)}
<SettingCard>
<SettingItem title={t('actions.guide.title')} divider>
<Button size="sm" onPress={() => getDriver()?.drive()}>
@ -75,7 +89,7 @@ const Actions: React.FC = () => {
}
divider
>
<Button size="sm" onPress={resetAppConfig}>
<Button size="sm" onPress={() => setShowResetConfirm(true)}>
{t('actions.reset.button')}
</Button>
</SettingItem>

View File

@ -226,6 +226,8 @@
"actions.reset.title": "Reset App",
"actions.reset.button": "Reset App",
"actions.reset.tooltip": "Delete all configurations and restore the app to its initial state",
"actions.reset.confirm.title": "Confirm Reset",
"actions.reset.confirm.content": "Are you sure you want to reset the app and delete all configurations? Only reset the app when it is not working properly. Your all subscriptions, overrides, and scripts will be lost!",
"actions.heapSnapshot.title": "Create Heap Snapshot",
"actions.heapSnapshot.button": "Create Heap Snapshot",
"actions.heapSnapshot.tooltip": "Create a heap snapshot of the main process for memory issue debugging",

View File

@ -226,6 +226,8 @@
"actions.reset.title": "بازنشانی برنامه",
"actions.reset.button": "بازنشانی برنامه",
"actions.reset.tooltip": "حذف تمام پیکربندی‌ها و بازگرداندن برنامه به حالت اولیه",
"actions.reset.confirm.title": "تایید بازنشانی",
"actions.reset.confirm.content": "آیا از بازنشانی برنامه و حذف تمام پیکربندی‌ها مطمئن هستید؟ فقط بازنشانی برنامه زمانی که برنامه نادرست کار می‌کند، مورد استفاده قرار می‌گیرد. تمام اشتراک ها و جایگزینی‌ها و اسکریپت‌ها حذف خواهند شد!",
"actions.heapSnapshot.title": "ایجاد نمای لحظه‌ای حافظه",
"actions.heapSnapshot.button": "ایجاد نمای لحظه‌ای حافظه",
"actions.heapSnapshot.tooltip": "ایجاد نمای لحظه‌ای از فرآیند اصلی برای اشکال‌زدایی مشکلات حافظه",

View File

@ -226,6 +226,8 @@
"actions.reset.title": "Сбросить приложение",
"actions.reset.button": "Сбросить приложение",
"actions.reset.tooltip": "Удалить все настройки и вернуть приложение к исходному состоянию",
"actions.reset.confirm.title": "Подтвердить сброс",
"actions.reset.confirm.content": "Вы уверены, что хотите сбросить приложение и удалить все настройки? Сброс приложения следует выполнять только в том случае, если оно не работает должным образом. Ваши все подписки, переопределения и скрипты будут потеряны!",
"actions.heapSnapshot.title": "Создать снимок кучи",
"actions.heapSnapshot.button": "Создать снимок кучи",
"actions.heapSnapshot.tooltip": "Создать снимок кучи основного процесса для отладки проблем с памятью",

View File

@ -226,6 +226,8 @@
"actions.reset.title": "重置软件",
"actions.reset.button": "重置软件",
"actions.reset.tooltip": "删除所有配置,将软件恢复初始状态",
"actions.reset.confirm.title": "确认重置",
"actions.reset.confirm.content": "您确定要重置删除所有配置,将软件恢复初始状态吗?只有软件运行不正常的时候才需重置,您的所有订阅、覆写、脚本将全部丢失!",
"actions.heapSnapshot.title": "创建堆快照",
"actions.heapSnapshot.button": "创建堆快照",
"actions.heapSnapshot.tooltip": "创建主进程堆快照,用于排查内存问题",