feat(security): 添加重置管理密钥功能

This commit is contained in:
DLmaster361
2025-07-12 01:27:27 +08:00
parent 70b936012f
commit 6d3fda50d3
7 changed files with 173 additions and 78 deletions

View File

@@ -469,7 +469,7 @@ class AUTO_MAA(MSFluentWindow):
logger.warning("启动主任务失败:未找到有效的主任务配置文件")
MainInfoBar.push_info_bar(
"warning", "启动主任务失败", "调度队列_1”与“脚本_1均不存在", -1
"warning", "启动主任务失败", "调度队列_1」与「脚本_1均不存在", -1
)
def __currentChanged(self, index: int) -> None:

View File

@@ -804,7 +804,7 @@ class MemberManager(QWidget):
self.card_TaskTransitionMethod = ComboBoxSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="任务切换方式",
content="相邻两个任务间的切换方式,使用详细配置的用户固定为重启模拟器",
content="相邻两个任务间的切换方式,使用详细配置的用户固定为重启模拟器",
texts=["直接切换账号", "重启明日方舟", "重启模拟器"],
qconfig=self.config,
configItem=self.config.RunSet_TaskTransitionMethod,
@@ -813,7 +813,7 @@ class MemberManager(QWidget):
self.card_ProxyTimesLimit = SpinBoxSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="用户单日代理次数上限",
content="当用户本日代理成功次数达到该阈值时跳过代理,阈值为“0”时视为无代理次数上限",
content="当用户本日代理成功次数达到该阈值时跳过代理,阈值为「0」时视为无代理次数上限",
range=(0, 1024),
qconfig=self.config,
configItem=self.config.RunSet_ProxyTimesLimit,
@@ -2187,7 +2187,7 @@ class MemberManager(QWidget):
self.card_ServerChanChannel = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="用户ServerChanChannel代码",
content="留空则默认,多个请使用“|”隔开",
content="留空则默认,多个请使用「|」隔开",
text="请输入Channel代码仅SCT生效",
qconfig=self.config,
configItem=self.config.Notify_ServerChanChannel,
@@ -2196,7 +2196,7 @@ class MemberManager(QWidget):
self.card_ServerChanTag = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="用户Tag内容",
content="留空则默认,多个请使用“|”隔开",
content="留空则默认,多个请使用「|」隔开",
text="请输入加入推送的Tag仅SC3生效",
qconfig=self.config,
configItem=self.config.Notify_ServerChanTag,
@@ -2404,7 +2404,7 @@ class MemberManager(QWidget):
self.card_SuccessLog = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="脚本成功日志",
content="任务成功完成时出现的日志,多条请使用“|”隔开",
content="任务成功完成时出现的日志,多条请使用「|」隔开",
text="请输入脚本成功日志内容",
qconfig=self.config,
configItem=self.config.Script_SuccessLog,
@@ -2413,7 +2413,7 @@ class MemberManager(QWidget):
self.card_ErrorLog = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="脚本异常日志 - [必填]",
content="脚本运行异常时的日志内容,多条请使用“|”隔开",
content="脚本运行异常时的日志内容,多条请使用「|」隔开",
text="请输入脚本异常日志内容",
qconfig=self.config,
configItem=self.config.Script_ErrorLog,
@@ -2580,7 +2580,7 @@ class MemberManager(QWidget):
self.card_ProxyTimesLimit = SpinBoxSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="子配置单日代理次数上限",
content="当子配置本日代理成功次数达到该阈值时跳过代理,阈值为“0”时视为无代理次数上限",
content="当子配置本日代理成功次数达到该阈值时跳过代理,阈值为「0」时视为无代理次数上限",
range=(0, 1024),
qconfig=self.config,
configItem=self.config.Run_ProxyTimesLimit,
@@ -3339,7 +3339,7 @@ class MemberManager(QWidget):
self.card_ServerChanChannel = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="用户ServerChanChannel代码",
content="留空则默认,多个请使用“|”隔开",
content="留空则默认,多个请使用「|」隔开",
text="请输入Channel代码仅SCT生效",
qconfig=self.config,
configItem=self.config.Notify_ServerChanChannel,
@@ -3348,7 +3348,7 @@ class MemberManager(QWidget):
self.card_ServerChanTag = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="用户Tag内容",
content="留空则默认,多个请使用“|”隔开",
content="留空则默认,多个请使用「|」隔开",
text="请输入加入推送的Tag仅SC3生效",
qconfig=self.config,
configItem=self.config.Notify_ServerChanTag,

View File

@@ -86,6 +86,7 @@ class Setting(QWidget):
)
self.start.card_IfSelfStart.checkedChanged.connect(System.set_SelfStart)
self.security.card_changePASSWORD.clicked.connect(self.change_PASSWORD)
self.security.card_resetPASSWORD.clicked.connect(self.reset_PASSWORD)
self.updater.card_CheckUpdate.clicked.connect(
lambda: self.check_update(if_show=True)
)
@@ -119,7 +120,7 @@ class Setting(QWidget):
choice = MessageBox(
"授权声明",
"开启托管bilibili游戏隐私政策功能即代表您已完整阅读并同意《哔哩哔哩弹幕网用户使用协议》、《哔哩哔哩隐私政策》和《哔哩哔哩游戏中心用户协议》并授权AUTO_MAA在其认定需要时以其认定合适的方法替您处理相关弹窗\n\n是否同意授权?",
"开启托管bilibili游戏隐私政策功能即代表您已完整阅读并同意《哔哩哔哩弹幕网用户使用协议》、《哔哩哔哩隐私政策》和《哔哩哔哩游戏中心用户协议》并授权AUTO_MAA在其认定需要时以其认定合适的方法替您处理相关弹窗\n\n是否同意授权?",
self.window(),
)
if choice.exec():
@@ -147,7 +148,7 @@ class Setting(QWidget):
choice = MessageBox(
"风险声明",
"开启跳过MuMu启动广告功能即代表您已安装MuMu模拟器-12且允许AUTO_MAA以其认定合适的方法屏蔽MuMu启动广告并接受此操作带来的风险\n\n此功能即时生效,是否仍要开启此功能?",
"开启跳过MuMu启动广告功能即代表您已安装MuMu模拟器-12且允许AUTO_MAA以其认定合适的方法屏蔽MuMu启动广告并接受此操作带来的风险\n\n此功能即时生效,是否仍要开启此功能?",
self.window(),
)
if choice.exec():
@@ -259,6 +260,61 @@ class Setting(QWidget):
if choice.exec():
break
def reset_PASSWORD(self) -> None:
"""重置管理密钥"""
choice = MessageBox(
"确认",
"重置管理密钥将清空所有使用管理密钥加密的数据,您确认要重置管理密钥吗?",
self.window(),
)
if choice.exec():
choice = LineEditMessageBox(
self.window(),
"请输入文本提示框内的验证信息",
"AUTO_MAA绝赞DeBug中",
"明文",
)
if choice.exec() and choice.input.text() in [
"AUTO_MAA绝赞DeBug中",
"AUTO_MAA绝赞DeBug中!",
]:
# 获取新的管理密钥
while True:
choice = LineEditMessageBox(
self.window(), "请输入新的管理密钥", "新管理密钥", "密码"
)
if choice.exec() and choice.input.text() != "":
# 重置管理密钥
Crypto.reset_PASSWORD(choice.input.text())
MainInfoBar.push_info_bar(
"success", "操作成功", "管理密钥重置成功", 3000
)
break
else:
choice = MessageBox(
"确认",
"您没有输入新的管理密钥,是否取消修改管理密钥?",
self.window(),
)
if choice.exec():
break
else:
MainInfoBar.push_info_bar(
"info",
"验证未通过",
"请输入「AUTO_MAA绝赞DeBug中」后单击确认键",
3000,
)
def check_update(self, if_show: bool = False, if_first: bool = False) -> None:
"""检查版本更新,调起文件下载进程"""
@@ -670,7 +726,7 @@ class FunctionSettingCard(HeaderCardWidget):
self.card_BossKey = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="模拟器老板键",
content="请输入对应的模拟器老板键,请直接输入文字,多个键位之间请用“+”隔开。如:Alt+Q",
content="请输入对应的模拟器老板键,请直接输入文字,多个键位之间请用「+」隔开。如:Alt+Q",
text="请以文字形式输入模拟器老板快捷键",
qconfig=Config,
configItem=Config.function_BossKey,
@@ -981,7 +1037,7 @@ class NotifySettingCard(HeaderCardWidget):
self.card_ServerChanChannel = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="ServerChanChannel代码",
content="可以留空,留空则默认。可以多个,请使用“|”隔开",
content="可以留空,留空则默认。可以多个,请使用「|」隔开",
text="请输入需要推送的Channel代码SCT生效",
qconfig=Config,
configItem=Config.notify_ServerChanChannel,
@@ -990,7 +1046,7 @@ class NotifySettingCard(HeaderCardWidget):
self.card_ServerChanTag = LineEditSettingCard(
icon=FluentIcon.PAGE_RIGHT,
title="Tag内容",
content="可以留空,留空则默认。可以多个,请使用“|”隔开",
content="可以留空,留空则默认。可以多个,请使用「|」隔开",
text="请输入加入推送的TagSC3生效",
qconfig=Config,
configItem=Config.notify_ServerChanTag,
@@ -1056,9 +1112,17 @@ class SecuritySettingCard(HeaderCardWidget):
content="修改用于解密用户密码的管理密钥",
parent=self,
)
self.card_resetPASSWORD = PushSettingCard(
text="重置",
icon=FluentIcon.VPN,
title="重置管理密钥",
content="重置用于解密用户密码的管理密钥",
parent=self,
)
Layout = QVBoxLayout()
Layout.addWidget(self.card_changePASSWORD)
Layout.addWidget(self.card_resetPASSWORD)
self.viewLayout.addLayout(Layout)