From 6f7497cbe9f58fccc3326674afd21e9a47bc264d Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 3 Feb 2025 09:47:10 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fix(utils):=20=E4=BF=AE=E5=A4=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=99=A8=E6=96=87=E4=BB=B6=E5=A4=B9=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/Updater.py | 2 +- resources/version.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/Updater.py b/app/utils/Updater.py index 364288f..3ba46fa 100644 --- a/app/utils/Updater.py +++ b/app/utils/Updater.py @@ -319,7 +319,7 @@ class AUTO_MAA_Updater(QApplication): if __name__ == "__main__": # 获取软件自身的路径 - app_path = Path.cwd() + app_path = Path(sys.argv[0]).resolve().parent # 从本地版本信息文件获取当前版本信息 if (app_path / "resources/version.json").exists(): diff --git a/resources/version.json b/resources/version.json index cf63ea1..e026a4a 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "main_version": "4.2.2.1", - "updater_version": "1.1.1.0", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n## 程序优化\n- 无", + "updater_version": "1.1.1.1", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复更新器文件夹定位问题\n## 程序优化\n- 无", "proxy_list": [ "", "https://gitproxy.click/", From a5b4f6f59f1f5502459f4ea70b7cf581ef277b97 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 3 Feb 2025 16:20:26 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix(gui):=20=E4=BF=AE=E5=A4=8D=E4=B8=BB?= =?UTF-8?q?=E8=B0=83=E5=BA=A6=E5=8F=B0=E8=BF=90=E8=A1=8C=E6=97=B6=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=8F=98=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/task_manager.py | 4 ++-- app/core/timer.py | 2 +- app/ui/dispatch_center.py | 21 ++++++++++++++++----- resources/version.json | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/core/task_manager.py b/app/core/task_manager.py index eda3b9c..70ae791 100644 --- a/app/core/task_manager.py +++ b/app/core/task_manager.py @@ -217,10 +217,10 @@ class TaskManager(QObject): lambda logs: self.remove_task(name, logs) ) - if "新窗口" in mode: + if "新调度台" in mode: self.create_gui.emit(self.task_list[name]) - elif "主窗口" in mode: + elif "主调度台" in mode: self.connect_gui.emit(self.task_list[name]) self.task_list[name].start() diff --git a/app/core/timer.py b/app/core/timer.py index 67029eb..bcf5909 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -81,7 +81,7 @@ class MainTimer(QWidget): ): logger.info(f"定时任务:{name}") - Task_manager.add_task("自动代理_新窗口", name, info) + Task_manager.add_task("自动代理_新调度台", name, info) def set_silence(self): """设置静默模式""" diff --git a/app/ui/dispatch_center.py b/app/ui/dispatch_center.py index 4c0abc6..d8161e9 100644 --- a/app/ui/dispatch_center.py +++ b/app/ui/dispatch_center.py @@ -77,7 +77,6 @@ class DispatchCenter(QWidget): onClick=self.update_top_bar, icon=FluentIcon.CAFE, ) - self.update_top_bar() self.Layout.addWidget(self.pivot, 0, Qt.AlignHCenter) self.Layout.addWidget(self.stackedWidget) @@ -120,6 +119,12 @@ class DispatchCenter(QWidget): def connect_main_board(self, task: Task) -> None: """连接主调度台""" + self.script_list["主调度台"].top_bar.Lable.setText( + f"{task.name} - {task.mode.replace("_主调度台","")}模式" + ) + self.script_list["主调度台"].top_bar.Lable.show() + self.script_list["主调度台"].top_bar.object.hide() + self.script_list["主调度台"].top_bar.mode.hide() self.script_list["主调度台"].top_bar.button.clicked.disconnect() self.script_list["主调度台"].top_bar.button.setText("中止任务") self.script_list["主调度台"].top_bar.button.clicked.connect( @@ -145,6 +150,9 @@ class DispatchCenter(QWidget): def disconnect_main_board(self, name: str) -> None: """断开主调度台""" + self.script_list["主调度台"].top_bar.Lable.hide() + self.script_list["主调度台"].top_bar.object.show() + self.script_list["主调度台"].top_bar.mode.show() self.script_list["主调度台"].top_bar.button.clicked.disconnect() self.script_list["主调度台"].top_bar.button.setText("开始任务") self.script_list["主调度台"].top_bar.button.clicked.connect( @@ -170,6 +178,8 @@ class DispatchCenter(QWidget): self.script_list["主调度台"].top_bar.object.clear() self.script_list["主调度台"].top_bar.object.addItems(list) + self.script_list["主调度台"].top_bar.object.setCurrentIndex(-1) + self.script_list["主调度台"].top_bar.mode.setCurrentIndex(-1) class DispatchBox(QWidget): @@ -208,17 +218,18 @@ class DispatchBox(QWidget): if name == "主调度台": + self.Lable = SubtitleLabel("", self) + self.Lable.hide() self.object = ComboBox() - self.object.setCurrentIndex(-1) self.object.setPlaceholderText("请选择调度对象") self.mode = ComboBox() self.mode.addItems(["自动代理", "人工排查"]) - self.mode.setCurrentIndex(-1) self.mode.setPlaceholderText("请选择调度模式") self.button = PushButton("开始任务") self.button.clicked.connect(self.start_task) + Layout.addWidget(self.Lable) Layout.addWidget(self.object) Layout.addWidget(self.mode) Layout.addStretch(1) @@ -265,7 +276,7 @@ class DispatchBox(QWidget): info = json.load(f) logger.info(f"用户添加任务:{name}") - Task_manager.add_task(f"{self.mode.currentText()}_主窗口", name, info) + Task_manager.add_task(f"{self.mode.currentText()}_主调度台", name, info) elif self.object.currentText().split(" - ")[0] == "实例": @@ -275,7 +286,7 @@ class DispatchBox(QWidget): logger.info(f"用户添加任务:{name}") Task_manager.add_task( - f"{self.mode.currentText()}_主窗口", "用户自定义队列", info + f"{self.mode.currentText()}_主调度台", "用户自定义队列", info ) class DispatchInfoCard(HeaderCardWidget): diff --git a/resources/version.json b/resources/version.json index e026a4a..3d21641 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "main_version": "4.2.2.1", "updater_version": "1.1.1.1", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复更新器文件夹定位问题\n## 程序优化\n- 无", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复更新器文件夹定位问题\n- 修复主调度台运行时选项变动问题\n## 程序优化\n- 无", "proxy_list": [ "", "https://gitproxy.click/", From c51f9ad90148fd6829200e1428d6eba2d07ebffb Mon Sep 17 00:00:00 2001 From: heziziziscool Date: Mon, 3 Feb 2025 19:22:36 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E6=B8=A0?= =?UTF-8?q?=E9=81=93Server=E9=85=B1=E4=B8=8E=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E7=BE=A4=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 8 +++ app/models/MAA.py | 8 +++ app/services/notification.py | 62 +++++++++++++++++- app/ui/setting.py | 120 ++++++++++++++++++++++++++++++++--- requirements.txt | 3 +- 5 files changed, 190 insertions(+), 11 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 167927b..f832252 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -556,6 +556,14 @@ class GlobalConfig(QConfig): "Notify", "IfSendErrorOnly", False, BoolValidator() ) notify_MailAddress = ConfigItem("Notify", "MailAddress", "") + notify_IfServerChan = ConfigItem("Notify", "IfServerChan", False, BoolValidator()) + notify_ServerChanKey = ConfigItem("Notify", "ServerChanKey", "") + notify_ServerChanChannel = ConfigItem("Notify", "ServerChanChannel", "") + notify_ServerChanTag = ConfigItem("Notify", "ServerChanTag", "") + notify_IfCompanyWebHookBot = ConfigItem("Notify", "IfCompanyWebHookBot", False, BoolValidator()) + notify_CompanyWebHookBotUrl = ConfigItem("Notify", "CompanyWebHookBotUrl", "") + notify_IfPushDeer = ConfigItem("Notify", "IfPushDeer", False, BoolValidator()) + notify_IfPushDeerKey = ConfigItem("Notify", "PushDeerKey", "") update_IfAutoUpdate = ConfigItem("Update", "IfAutoUpdate", False, BoolValidator()) diff --git a/app/models/MAA.py b/app/models/MAA.py index ca17242..24b1b94 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -528,6 +528,14 @@ class MaaManager(QObject): f"{self.mode[:4]}任务报告", f"{end_log}\n\nAUTO_MAA 敬上\n\n我们根据您在 AUTO_MAA 中的设置发送了这封电子邮件,本邮件无需回复\n", ) + Notify.ServerChanPush( + f"{self.mode[:4]}任务报告", + f"{end_log}\n\nAUTO_MAA 敬上", + ) + Notify.CompanyWebHookBotPush( + f"{self.mode[:4]}任务报告", + f"{end_log}AUTO_MAA 敬上", + ) self.accomplish.emit({"Time": begin_time, "History": end_log}) diff --git a/app/services/notification.py b/app/services/notification.py index 07865ec..c566cdd 100644 --- a/app/services/notification.py +++ b/app/services/notification.py @@ -24,13 +24,16 @@ AUTO_MAA通知服务 v4.2 作者:DLmaster_361 """ - +import requests +from loguru import logger from plyer import notification import smtplib from email.mime.text import MIMEText from email.header import Header from email.utils import formataddr +from serverchan_sdk import sc_send + from app.core import Config @@ -96,5 +99,62 @@ class Notification: finally: smtpObj.quit() + def ServerChanPush(self, title, content): + """使用Server酱推送通知""" + + if Config.global_config.get(Config.global_config.notify_IfServerChan): + send_key = Config.global_config.get(Config.global_config.notify_ServerChanKey) + option = {} + is_valid = lambda s: s == "" or (s == '|'.join(s.split('|')) and (s.count('|') == 0 or all(s.split('|')))) + """ + is_valid => True, 如果启用的话需要正确设置Tag和Channel。 + 允许空的Tag和Channel即不启用,但不允许例如a||b,|a|b,a|b|,|||| + """ + send_tag = Config.global_config.get(Config.global_config.notify_ServerChanTag) + send_channel = Config.global_config.get(Config.global_config.notify_ServerChanChannel) + + if is_valid(send_tag): + option['tags'] = send_tag + else: + option['tags'] = '' + logger.warning('请正确设置Auto_MAA中ServerChan的Tag。') + + if is_valid(send_channel): + option['channel'] = send_channel + else: + option['channel'] = '' + logger.warning('请正确设置Auto_MAA中ServerChan的Channel。') + + response = sc_send(send_key, title, content, option) + if response["code"] == 0: + logger.info("Server酱推送通知成功") + return True + else: + logger.info("Server酱推送通知失败") + logger.error(response) + return f'使用Server酱推送通知时出错:\n{response["data"]['error']}' + + def CompanyWebHookBotPush(self, title, content): + """使用企业微信群机器人推送通知""" + if Config.global_config.get(Config.global_config.notify_IfCompanyWebHookBot): + content = f'{title}\n{content}' + data = { + "msgtype": "text", + "text": { + "content": content + } + } + response = requests.post( + url=Config.global_config.get(Config.global_config.notify_CompanyWebHookBotUrl), + json=data + ) + if response.json()["errcode"] == 0: + logger.info("企业微信群机器人推送通知成功") + return True + else: + logger.info("企业微信群机器人推送通知失败") + logger.error(response.json()) + return f'使用企业微信群机器人推送通知时出错:\n{response.json()["errmsg"]}' + Notify = Notification() diff --git a/app/ui/setting.py b/app/ui/setting.py index 0631c2c..1ef9a57 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -519,6 +519,13 @@ class NotifySettingCard(HeaderCardWidget): Layout = QVBoxLayout() + self.card_IfSendErrorOnly = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="仅推送异常信息", + content="仅在任务出现异常时推送通知", + configItem=Config.global_config.notify_IfSendErrorOnly, + ) + self.card_IfPushPlyer = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="推送系统通知", @@ -527,9 +534,13 @@ class NotifySettingCard(HeaderCardWidget): ) self.card_SendMail = self.SendMailSettingCard(self) - + self.card_ServerChan = self.ServerChanSettingCard(self) + self.card_CompanyWebhookBot = self.CompanyWechatPushSettingCard(self) + Layout.addWidget(self.card_IfSendErrorOnly) Layout.addWidget(self.card_IfPushPlyer) Layout.addWidget(self.card_SendMail) + Layout.addWidget(self.card_ServerChan) + Layout.addWidget(self.card_CompanyWebhookBot) self.viewLayout.addLayout(Layout) @@ -561,16 +572,8 @@ class NotifySettingCard(HeaderCardWidget): configItem=Config.global_config.notify_MailAddress, ) - self.card_IfSendErrorOnly = SwitchSettingCard( - icon=FluentIcon.PAGE_RIGHT, - title="仅推送异常信息", - content="仅在任务出现异常时推送通知", - configItem=Config.global_config.notify_IfSendErrorOnly, - ) - Layout.addWidget(self.card_IfSendMail) Layout.addWidget(self.MailAddress) - Layout.addWidget(self.card_IfSendErrorOnly) # 调整内部布局 self.viewLayout.setContentsMargins(0, 0, 0, 0) @@ -578,6 +581,94 @@ class NotifySettingCard(HeaderCardWidget): self.addGroupWidget(widget) + class ServerChanSettingCard(ExpandGroupSettingCard): + def __init__(self, parent=None): + super().__init__( + FluentIcon.SETTING, + "ServerChan推送", + "通过ServerChan推送推送任务结果", + parent, + ) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + self.card_IfServerChan = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="SeverChan推送", + content="是否SeverChan推送", + configItem=Config.global_config.notify_IfServerChan, + ) + + self.ServerChanKey = LineEditSettingCard( + text="请输入SendKey", + icon=FluentIcon.PAGE_RIGHT, + title="SendKey", + content="Server酱的SendKey(SC3与SCT都可以)", + configItem=Config.global_config.notify_ServerChanKey, + ) + + self.ServerChanChannel = LineEditSettingCard( + text="请输入需要推送的Channel代码(SCT生效)", + icon=FluentIcon.PAGE_RIGHT, + title="ServerChanChannel代码", + content="可以留空,留空则默认。可以多个,请使用|隔开", + configItem=Config.global_config.notify_ServerChanChannel, + ) + + self.ServerChanTag = LineEditSettingCard( + text="请输入加入推送的Tag(SC3生效)", + icon=FluentIcon.PAGE_RIGHT, + title="Tag内容", + content="可以留空,留空则默认。可以多个,请使用|隔开", + configItem=Config.global_config.notify_ServerChanTag, + ) + Layout.addWidget(self.card_IfServerChan) + Layout.addWidget(self.ServerChanKey) + Layout.addWidget(self.ServerChanChannel) + Layout.addWidget(self.ServerChanTag) + self.viewLayout.setContentsMargins(0, 0, 0, 0) + self.viewLayout.setSpacing(0) + self.addGroupWidget(widget) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + class CompanyWechatPushSettingCard(ExpandGroupSettingCard): + def __init__(self, parent=None): + super().__init__( + FluentIcon.SETTING, + "企业微信机器人推送", + "通过企业微信机器人Webhook推送推送任务结果", + parent, + ) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + self.card_IfCompanyWechat = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="企业微信机器人推送", + content="是否启用企业微信机器人推送", + configItem=Config.global_config.notify_IfCompanyWebHookBot, + ) + + self.CompanyWebHookBotUrl = LineEditSettingCard( + text="请输入Webhook的Url", + icon=FluentIcon.PAGE_RIGHT, + title="WebhookUrl", + content="企业微信群机器人的Webhook地址", + configItem=Config.global_config.notify_CompanyWebHookBotUrl, + ) + + Layout.addWidget(self.card_IfCompanyWechat) + Layout.addWidget(self.CompanyWebHookBotUrl) + self.viewLayout.setContentsMargins(0, 0, 0, 0) + self.viewLayout.setSpacing(0) + self.addGroupWidget(widget) + widget = QWidget() + Layout = QVBoxLayout(widget) + class SecuritySettingCard(HeaderCardWidget): @@ -642,10 +733,20 @@ class OtherSettingCard(HeaderCardWidget): title="公告", content="查看AUTO_MAA的最新公告", ) + + self.card_UserDocs = HyperlinkCard( + url="https://docs.qq.com/aio/DQ2NwUHRiWGtMWHBy", + text="访问用户文档", + icon=FluentIcon.PAGE_RIGHT, + title="用户文档", + content="查看AUTO_MAA的使用教程和文档", + ) + self.card_Association = self.AssociationSettingCard() Layout = QVBoxLayout() Layout.addWidget(self.card_Notice) + Layout.addWidget(self.card_UserDocs) Layout.addWidget(self.card_Association) self.viewLayout.addLayout(Layout) @@ -659,6 +760,7 @@ class OtherSettingCard(HeaderCardWidget): parent, ) + self.card_GitHubRepository = HyperlinkCard( url="https://github.com/DLmaster361/AUTO_MAA", text="访问GitHub仓库", diff --git a/requirements.txt b/requirements.txt index 07223d6..00552c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ pywin32 pyautogui pycryptodome requests -nuitka==2.6 \ No newline at end of file +nuitka==2.6 +serverchan_sdk \ No newline at end of file From 4e4d1d068fea67cbd87682d626d40623cc3d1c50 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 3 Feb 2025 20:12:19 +0800 Subject: [PATCH 04/11] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 4 ++-- resources/version.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 00552c2..95ceb9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,5 +8,5 @@ pywin32 pyautogui pycryptodome requests -nuitka==2.6 -serverchan_sdk \ No newline at end of file +serverchan_sdk +nuitka==2.6 \ No newline at end of file diff --git a/resources/version.json b/resources/version.json index cf63ea1..d47c1a0 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { - "main_version": "4.2.2.1", + "main_version": "4.2.2.2", "updater_version": "1.1.1.0", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n## 程序优化\n- 无", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n## 程序优化\n- 无", "proxy_list": [ "", "https://gitproxy.click/", From 6f0aec329b0e6c1b22e2162261e567c8c88996df Mon Sep 17 00:00:00 2001 From: heziziziscool Date: Tue, 4 Feb 2025 14:07:45 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E6=B8=A0?= =?UTF-8?q?=E9=81=93Server=E9=85=B1=E4=B8=8E=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E7=BE=A4=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 8 +++ app/models/MAA.py | 8 +++ app/services/notification.py | 62 +++++++++++++++++- app/ui/setting.py | 120 ++++++++++++++++++++++++++++++++--- requirements.txt | 3 +- 5 files changed, 190 insertions(+), 11 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 167927b..f832252 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -556,6 +556,14 @@ class GlobalConfig(QConfig): "Notify", "IfSendErrorOnly", False, BoolValidator() ) notify_MailAddress = ConfigItem("Notify", "MailAddress", "") + notify_IfServerChan = ConfigItem("Notify", "IfServerChan", False, BoolValidator()) + notify_ServerChanKey = ConfigItem("Notify", "ServerChanKey", "") + notify_ServerChanChannel = ConfigItem("Notify", "ServerChanChannel", "") + notify_ServerChanTag = ConfigItem("Notify", "ServerChanTag", "") + notify_IfCompanyWebHookBot = ConfigItem("Notify", "IfCompanyWebHookBot", False, BoolValidator()) + notify_CompanyWebHookBotUrl = ConfigItem("Notify", "CompanyWebHookBotUrl", "") + notify_IfPushDeer = ConfigItem("Notify", "IfPushDeer", False, BoolValidator()) + notify_IfPushDeerKey = ConfigItem("Notify", "PushDeerKey", "") update_IfAutoUpdate = ConfigItem("Update", "IfAutoUpdate", False, BoolValidator()) diff --git a/app/models/MAA.py b/app/models/MAA.py index ca17242..24b1b94 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -528,6 +528,14 @@ class MaaManager(QObject): f"{self.mode[:4]}任务报告", f"{end_log}\n\nAUTO_MAA 敬上\n\n我们根据您在 AUTO_MAA 中的设置发送了这封电子邮件,本邮件无需回复\n", ) + Notify.ServerChanPush( + f"{self.mode[:4]}任务报告", + f"{end_log}\n\nAUTO_MAA 敬上", + ) + Notify.CompanyWebHookBotPush( + f"{self.mode[:4]}任务报告", + f"{end_log}AUTO_MAA 敬上", + ) self.accomplish.emit({"Time": begin_time, "History": end_log}) diff --git a/app/services/notification.py b/app/services/notification.py index 07865ec..c566cdd 100644 --- a/app/services/notification.py +++ b/app/services/notification.py @@ -24,13 +24,16 @@ AUTO_MAA通知服务 v4.2 作者:DLmaster_361 """ - +import requests +from loguru import logger from plyer import notification import smtplib from email.mime.text import MIMEText from email.header import Header from email.utils import formataddr +from serverchan_sdk import sc_send + from app.core import Config @@ -96,5 +99,62 @@ class Notification: finally: smtpObj.quit() + def ServerChanPush(self, title, content): + """使用Server酱推送通知""" + + if Config.global_config.get(Config.global_config.notify_IfServerChan): + send_key = Config.global_config.get(Config.global_config.notify_ServerChanKey) + option = {} + is_valid = lambda s: s == "" or (s == '|'.join(s.split('|')) and (s.count('|') == 0 or all(s.split('|')))) + """ + is_valid => True, 如果启用的话需要正确设置Tag和Channel。 + 允许空的Tag和Channel即不启用,但不允许例如a||b,|a|b,a|b|,|||| + """ + send_tag = Config.global_config.get(Config.global_config.notify_ServerChanTag) + send_channel = Config.global_config.get(Config.global_config.notify_ServerChanChannel) + + if is_valid(send_tag): + option['tags'] = send_tag + else: + option['tags'] = '' + logger.warning('请正确设置Auto_MAA中ServerChan的Tag。') + + if is_valid(send_channel): + option['channel'] = send_channel + else: + option['channel'] = '' + logger.warning('请正确设置Auto_MAA中ServerChan的Channel。') + + response = sc_send(send_key, title, content, option) + if response["code"] == 0: + logger.info("Server酱推送通知成功") + return True + else: + logger.info("Server酱推送通知失败") + logger.error(response) + return f'使用Server酱推送通知时出错:\n{response["data"]['error']}' + + def CompanyWebHookBotPush(self, title, content): + """使用企业微信群机器人推送通知""" + if Config.global_config.get(Config.global_config.notify_IfCompanyWebHookBot): + content = f'{title}\n{content}' + data = { + "msgtype": "text", + "text": { + "content": content + } + } + response = requests.post( + url=Config.global_config.get(Config.global_config.notify_CompanyWebHookBotUrl), + json=data + ) + if response.json()["errcode"] == 0: + logger.info("企业微信群机器人推送通知成功") + return True + else: + logger.info("企业微信群机器人推送通知失败") + logger.error(response.json()) + return f'使用企业微信群机器人推送通知时出错:\n{response.json()["errmsg"]}' + Notify = Notification() diff --git a/app/ui/setting.py b/app/ui/setting.py index 0631c2c..1ef9a57 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -519,6 +519,13 @@ class NotifySettingCard(HeaderCardWidget): Layout = QVBoxLayout() + self.card_IfSendErrorOnly = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="仅推送异常信息", + content="仅在任务出现异常时推送通知", + configItem=Config.global_config.notify_IfSendErrorOnly, + ) + self.card_IfPushPlyer = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="推送系统通知", @@ -527,9 +534,13 @@ class NotifySettingCard(HeaderCardWidget): ) self.card_SendMail = self.SendMailSettingCard(self) - + self.card_ServerChan = self.ServerChanSettingCard(self) + self.card_CompanyWebhookBot = self.CompanyWechatPushSettingCard(self) + Layout.addWidget(self.card_IfSendErrorOnly) Layout.addWidget(self.card_IfPushPlyer) Layout.addWidget(self.card_SendMail) + Layout.addWidget(self.card_ServerChan) + Layout.addWidget(self.card_CompanyWebhookBot) self.viewLayout.addLayout(Layout) @@ -561,16 +572,8 @@ class NotifySettingCard(HeaderCardWidget): configItem=Config.global_config.notify_MailAddress, ) - self.card_IfSendErrorOnly = SwitchSettingCard( - icon=FluentIcon.PAGE_RIGHT, - title="仅推送异常信息", - content="仅在任务出现异常时推送通知", - configItem=Config.global_config.notify_IfSendErrorOnly, - ) - Layout.addWidget(self.card_IfSendMail) Layout.addWidget(self.MailAddress) - Layout.addWidget(self.card_IfSendErrorOnly) # 调整内部布局 self.viewLayout.setContentsMargins(0, 0, 0, 0) @@ -578,6 +581,94 @@ class NotifySettingCard(HeaderCardWidget): self.addGroupWidget(widget) + class ServerChanSettingCard(ExpandGroupSettingCard): + def __init__(self, parent=None): + super().__init__( + FluentIcon.SETTING, + "ServerChan推送", + "通过ServerChan推送推送任务结果", + parent, + ) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + self.card_IfServerChan = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="SeverChan推送", + content="是否SeverChan推送", + configItem=Config.global_config.notify_IfServerChan, + ) + + self.ServerChanKey = LineEditSettingCard( + text="请输入SendKey", + icon=FluentIcon.PAGE_RIGHT, + title="SendKey", + content="Server酱的SendKey(SC3与SCT都可以)", + configItem=Config.global_config.notify_ServerChanKey, + ) + + self.ServerChanChannel = LineEditSettingCard( + text="请输入需要推送的Channel代码(SCT生效)", + icon=FluentIcon.PAGE_RIGHT, + title="ServerChanChannel代码", + content="可以留空,留空则默认。可以多个,请使用|隔开", + configItem=Config.global_config.notify_ServerChanChannel, + ) + + self.ServerChanTag = LineEditSettingCard( + text="请输入加入推送的Tag(SC3生效)", + icon=FluentIcon.PAGE_RIGHT, + title="Tag内容", + content="可以留空,留空则默认。可以多个,请使用|隔开", + configItem=Config.global_config.notify_ServerChanTag, + ) + Layout.addWidget(self.card_IfServerChan) + Layout.addWidget(self.ServerChanKey) + Layout.addWidget(self.ServerChanChannel) + Layout.addWidget(self.ServerChanTag) + self.viewLayout.setContentsMargins(0, 0, 0, 0) + self.viewLayout.setSpacing(0) + self.addGroupWidget(widget) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + class CompanyWechatPushSettingCard(ExpandGroupSettingCard): + def __init__(self, parent=None): + super().__init__( + FluentIcon.SETTING, + "企业微信机器人推送", + "通过企业微信机器人Webhook推送推送任务结果", + parent, + ) + + widget = QWidget() + Layout = QVBoxLayout(widget) + + self.card_IfCompanyWechat = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="企业微信机器人推送", + content="是否启用企业微信机器人推送", + configItem=Config.global_config.notify_IfCompanyWebHookBot, + ) + + self.CompanyWebHookBotUrl = LineEditSettingCard( + text="请输入Webhook的Url", + icon=FluentIcon.PAGE_RIGHT, + title="WebhookUrl", + content="企业微信群机器人的Webhook地址", + configItem=Config.global_config.notify_CompanyWebHookBotUrl, + ) + + Layout.addWidget(self.card_IfCompanyWechat) + Layout.addWidget(self.CompanyWebHookBotUrl) + self.viewLayout.setContentsMargins(0, 0, 0, 0) + self.viewLayout.setSpacing(0) + self.addGroupWidget(widget) + widget = QWidget() + Layout = QVBoxLayout(widget) + class SecuritySettingCard(HeaderCardWidget): @@ -642,10 +733,20 @@ class OtherSettingCard(HeaderCardWidget): title="公告", content="查看AUTO_MAA的最新公告", ) + + self.card_UserDocs = HyperlinkCard( + url="https://docs.qq.com/aio/DQ2NwUHRiWGtMWHBy", + text="访问用户文档", + icon=FluentIcon.PAGE_RIGHT, + title="用户文档", + content="查看AUTO_MAA的使用教程和文档", + ) + self.card_Association = self.AssociationSettingCard() Layout = QVBoxLayout() Layout.addWidget(self.card_Notice) + Layout.addWidget(self.card_UserDocs) Layout.addWidget(self.card_Association) self.viewLayout.addLayout(Layout) @@ -659,6 +760,7 @@ class OtherSettingCard(HeaderCardWidget): parent, ) + self.card_GitHubRepository = HyperlinkCard( url="https://github.com/DLmaster361/AUTO_MAA", text="访问GitHub仓库", diff --git a/requirements.txt b/requirements.txt index 07223d6..00552c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ pywin32 pyautogui pycryptodome requests -nuitka==2.6 \ No newline at end of file +nuitka==2.6 +serverchan_sdk \ No newline at end of file From 427c2332f5a0ef5f2848456b14872b81d1c51638 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 14:08:13 +0800 Subject: [PATCH 06/11] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 4 ++-- resources/version.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 00552c2..95ceb9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,5 +8,5 @@ pywin32 pyautogui pycryptodome requests -nuitka==2.6 -serverchan_sdk \ No newline at end of file +serverchan_sdk +nuitka==2.6 \ No newline at end of file diff --git a/resources/version.json b/resources/version.json index 3d21641..d47c1a0 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { - "main_version": "4.2.2.1", - "updater_version": "1.1.1.1", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复更新器文件夹定位问题\n- 修复主调度台运行时选项变动问题\n## 程序优化\n- 无", + "main_version": "4.2.2.2", + "updater_version": "1.1.1.0", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n## 程序优化\n- 无", "proxy_list": [ "", "https://gitproxy.click/", From a0731331a8ebf7a91c9e4b2d4d8745603ecf0cb8 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 15:17:15 +0800 Subject: [PATCH 07/11] =?UTF-8?q?fix(gui):=20=E4=BF=AE=E5=A4=8D=E9=AB=98?= =?UTF-8?q?=E7=BA=A7MAA=E9=85=8D=E7=BD=AE=E5=BA=8F=E5=8F=B7=E9=94=99?= =?UTF-8?q?=E4=BD=8D=EF=BC=9B=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=BA=A7=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=97=A0=E6=B3=95=E9=85=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/MAA.py | 16 +++++++++------- app/ui/member_manager.py | 12 ++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/models/MAA.py b/app/models/MAA.py index 24b1b94..27b8fcb 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -113,13 +113,15 @@ class MaaManager(QObject): return None # 整理用户数据,筛选需代理的用户 - self.data = sorted(self.data, key=lambda x: (-len(x[15]), x[16])) - user_list: List[List[str, str, int]] = [ - [_[0], "等待", index] - for index, _ in enumerate(self.data) - if (_[3] != 0 and _[4] == "y") - ] - self.create_user_list.emit(user_list) + if "设置MAA" not in self.mode: + + self.data = sorted(self.data, key=lambda x: (-len(x[15]), x[16])) + user_list: List[List[str, str, int]] = [ + [_[0], "等待", index] + for index, _ in enumerate(self.data) + if (_[3] != 0 and _[4] == "y") + ] + self.create_user_list.emit(user_list) # 自动代理模式 if self.mode == "自动代理": diff --git a/app/ui/member_manager.py b/app/ui/member_manager.py index 5a45589..ed60c90 100644 --- a/app/ui/member_manager.py +++ b/app/ui/member_manager.py @@ -683,6 +683,7 @@ class MaaSettingBox(QWidget): Config.cur.execute("SELECT * FROM adminx WHERE True") data = Config.cur.fetchall() + data = sorted(data, key=lambda x: (-len(x[15]), x[16])) if self.user_list.pivot.currentRouteKey() == f"{self.name}_简洁用户列表": @@ -876,6 +877,9 @@ class MaaSettingBox(QWidget): self.user_list_simple.itemChanged.connect( lambda item: self.change_user_Item(item, "simple") ) + self.user_list_beta.itemChanged.connect( + lambda item: self.change_user_Item(item, "beta") + ) self.stackedWidget.addWidget(self.user_list_simple) self.pivot.addItem( @@ -1353,6 +1357,10 @@ class MaaSettingBox(QWidget): return None if row == 0: + logger.warning("向上移动用户时已到达最上端") + MainInfoBar.push_info_bar( + "warning", "已经是第一个用户", "无法向上移动", 5000 + ) return None Config.cur.execute( @@ -1450,6 +1458,10 @@ class MaaSettingBox(QWidget): return None if row == current_numb - 1: + logger.warning("向下移动用户时已到达最下端") + MainInfoBar.push_info_bar( + "warning", "已经是最后一个用户", "无法向下移动", 5000 + ) return None Config.cur.execute( From 022e59e65c0c540ab3d91c8ef51114bf57740d10 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 15:56:21 +0800 Subject: [PATCH 08/11] =?UTF-8?q?fix(gha):=20pr=E6=97=B6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app.yml | 5 ----- .github/workflows/build-pre.yml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 8b14e97..d9d28d7 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -26,11 +26,6 @@ on: paths-ignore: - '**.md' - 'LICENSE' - pull_request: - branches: [ "main" ] - paths-ignore: - - '**.md' - - 'LICENSE' permissions: contents: read diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index a8c7dbb..8e20581 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -26,11 +26,6 @@ on: paths-ignore: - '**.md' - 'LICENSE' - pull_request: - branches: [ "dev" ] - paths-ignore: - - '**.md' - - 'LICENSE' permissions: contents: read From b7f09141f11c2c3dd04c74b4111d3fa3e9419700 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 18:27:19 +0800 Subject: [PATCH 09/11] =?UTF-8?q?feat(core):=20=E6=B7=BB=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=B1=BB=E5=88=AB=E5=8F=AF=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 8 +++++++- app/ui/main_window.py | 1 + app/ui/setting.py | 21 +++++++++++++-------- app/utils/Updater.py | 10 +++++++++- resources/version.json | 2 +- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index f832252..1496a6e 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -39,6 +39,7 @@ from qfluentwidgets import ( FolderValidator, BoolValidator, RangeValidator, + OptionsValidator, qconfig, ) @@ -560,12 +561,17 @@ class GlobalConfig(QConfig): notify_ServerChanKey = ConfigItem("Notify", "ServerChanKey", "") notify_ServerChanChannel = ConfigItem("Notify", "ServerChanChannel", "") notify_ServerChanTag = ConfigItem("Notify", "ServerChanTag", "") - notify_IfCompanyWebHookBot = ConfigItem("Notify", "IfCompanyWebHookBot", False, BoolValidator()) + notify_IfCompanyWebHookBot = ConfigItem( + "Notify", "IfCompanyWebHookBot", False, BoolValidator() + ) notify_CompanyWebHookBotUrl = ConfigItem("Notify", "CompanyWebHookBotUrl", "") notify_IfPushDeer = ConfigItem("Notify", "IfPushDeer", False, BoolValidator()) notify_IfPushDeerKey = ConfigItem("Notify", "PushDeerKey", "") update_IfAutoUpdate = ConfigItem("Update", "IfAutoUpdate", False, BoolValidator()) + update_UpdateType = OptionsConfigItem( + "Update", "UpdateType", "main", OptionsValidator(["main", "dev"]) + ) class QueueConfig(QConfig): diff --git a/app/ui/main_window.py b/app/ui/main_window.py index 47a5a22..e5de864 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -182,6 +182,7 @@ class AUTO_MAA(MSFluentWindow): # 加载配置 qconfig.load(Config.config_path, Config.global_config) + Config.global_config.save() # 检查密码 self.setting.check_PASSWORD() diff --git a/app/ui/setting.py b/app/ui/setting.py index 1ef9a57..f902c37 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -42,6 +42,7 @@ from qfluentwidgets import ( SwitchSettingCard, ExpandGroupSettingCard, PushSettingCard, + ComboBoxSettingCard, ) from datetime import datetime import json @@ -207,7 +208,7 @@ class Setting(QWidget): for _ in range(3): try: response = requests.get( - "https://gitee.com/DLmaster_361/AUTO_MAA/raw/main/resources/version.json" + f"https://gitee.com/DLmaster_361/AUTO_MAA/raw/{Config.global_config.get(Config.global_config.update_UpdateType)}/resources/version.json" ) version_remote = response.json() break @@ -249,7 +250,7 @@ class Setting(QWidget): for _ in range(3): try: response = requests.get( - "https://gitee.com/DLmaster_361/AUTO_MAA/raw/main/resources/version.json" + f"https://gitee.com/DLmaster_361/AUTO_MAA/raw/{Config.global_config.get(Config.global_config.update_UpdateType)}/resources/version.json" ) version_remote = response.json() break @@ -666,6 +667,7 @@ class NotifySettingCard(HeaderCardWidget): self.viewLayout.setContentsMargins(0, 0, 0, 0) self.viewLayout.setSpacing(0) self.addGroupWidget(widget) + widget = QWidget() Layout = QVBoxLayout(widget) @@ -695,18 +697,21 @@ class UpdaterSettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("更新") - Layout = QVBoxLayout() - self.card_IfAutoUpdate = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="自动检查更新", content="将在启动时自动检查AUTO_MAA是否有新版本", configItem=Config.global_config.update_IfAutoUpdate, ) - + self.card_UpdateType = ComboBoxSettingCard( + configItem=Config.global_config.update_UpdateType, + icon=FluentIcon.PAGE_RIGHT, + title="版本更新类别", + content="选择AUTO_MAA的更新类别", + texts=["稳定版", "公测版"], + ) self.card_CheckUpdate = PushSettingCard( text="检查更新", icon=FluentIcon.UPDATE, @@ -714,9 +719,10 @@ class UpdaterSettingCard(HeaderCardWidget): content="检查AUTO_MAA是否有新版本", ) + Layout = QVBoxLayout() Layout.addWidget(self.card_IfAutoUpdate) + Layout.addWidget(self.card_UpdateType) Layout.addWidget(self.card_CheckUpdate) - self.viewLayout.addLayout(Layout) @@ -760,7 +766,6 @@ class OtherSettingCard(HeaderCardWidget): parent, ) - self.card_GitHubRepository = HyperlinkCard( url="https://github.com/DLmaster361/AUTO_MAA", text="访问GitHub仓库", diff --git a/app/utils/Updater.py b/app/utils/Updater.py index 3ba46fa..1b27cba 100644 --- a/app/utils/Updater.py +++ b/app/utils/Updater.py @@ -333,11 +333,19 @@ if __name__ == "__main__": else: main_version_current = [0, 0, 0, 0] + # 从本地配置文件获取更新类型 + if (app_path / "config/config.json").exists(): + with (app_path / "config/config.json").open(mode="r", encoding="utf-8") as f: + config = json.load(f) + update_type = config["Update"]["UpdateType"] + else: + update_type = "main" + # 从远程服务器获取最新版本信息 for _ in range(3): try: response = requests.get( - "https://gitee.com/DLmaster_361/AUTO_MAA/raw/main/resources/version.json" + f"https://gitee.com/DLmaster_361/AUTO_MAA/raw/{update_type}/resources/version.json" ) version_remote = response.json() main_version_remote = list( diff --git a/resources/version.json b/resources/version.json index d47c1a0..af668c3 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "main_version": "4.2.2.2", "updater_version": "1.1.1.0", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n## 程序优化\n- 无", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 无", "proxy_list": [ "", "https://gitproxy.click/", From 0574e9c6cba35e333bab71aa77a4ab1708c1eb22 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 18:48:58 +0800 Subject: [PATCH 10/11] =?UTF-8?q?fix(gui):=20=E8=B0=83=E6=95=B4=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=80=89=E9=A1=B9=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/setting.py | 125 +++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 86 deletions(-) diff --git a/app/ui/setting.py b/app/ui/setting.py index f902c37..60d44b4 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -391,24 +391,19 @@ class FunctionSettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("功能") - Layout = QVBoxLayout() - self.card_IfAllowSleep = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="启动时阻止系统休眠", content="仅阻止电脑自动休眠,不会影响屏幕是否熄灭", configItem=Config.global_config.function_IfAllowSleep, ) - self.card_IfSilence = self.SilenceSettingCard(self) - # 添加各组到设置卡中 + Layout = QVBoxLayout() Layout.addWidget(self.card_IfAllowSleep) Layout.addWidget(self.card_IfSilence) - self.viewLayout.addLayout(Layout) class SilenceSettingCard(ExpandGroupSettingCard): @@ -421,16 +416,12 @@ class FunctionSettingCard(HeaderCardWidget): parent, ) - widget = QWidget() - Layout = QVBoxLayout(widget) - self.card_IfSilence = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="静默模式", content="是否启用静默模式", configItem=Config.global_config.function_IfSilence, ) - self.card_BossKey = LineEditSettingCard( text="请输入安卓模拟器老版键", icon=FluentIcon.PAGE_RIGHT, @@ -439,13 +430,12 @@ class FunctionSettingCard(HeaderCardWidget): configItem=Config.global_config.function_BossKey, ) + widget = QWidget() + Layout = QVBoxLayout(widget) Layout.addWidget(self.card_IfSilence) Layout.addWidget(self.card_BossKey) - - # 调整内部布局 self.viewLayout.setContentsMargins(0, 0, 0, 0) self.viewLayout.setSpacing(0) - self.addGroupWidget(widget) @@ -453,18 +443,14 @@ class StartSettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("启动") - Layout = QVBoxLayout() - self.card_IfSelfStart = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="开机时自动启动", content="将AUTO_MAA添加到开机启动项", configItem=Config.global_config.start_IfSelfStart, ) - self.card_IfRunDirectly = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="启动后直接运行", @@ -472,12 +458,9 @@ class StartSettingCard(HeaderCardWidget): configItem=Config.global_config.start_IfRunDirectly, ) - # 添加各组到设置卡中 - Layout.addWidget( - self.card_IfSelfStart, - ) + Layout = QVBoxLayout() + Layout.addWidget(self.card_IfSelfStart) Layout.addWidget(self.card_IfRunDirectly) - self.viewLayout.addLayout(Layout) @@ -485,18 +468,14 @@ class UiSettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("界面") - Layout = QVBoxLayout() - self.card_IfShowTray = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="显示托盘图标", content="常态显示托盘图标", configItem=Config.global_config.ui_IfShowTray, ) - self.card_IfToTray = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="最小化到托盘", @@ -504,10 +483,9 @@ class UiSettingCard(HeaderCardWidget): configItem=Config.global_config.ui_IfToTray, ) - # 添加各组到设置卡中 + Layout = QVBoxLayout() Layout.addWidget(self.card_IfShowTray) Layout.addWidget(self.card_IfToTray) - self.viewLayout.addLayout(Layout) @@ -518,31 +496,28 @@ class NotifySettingCard(HeaderCardWidget): self.setTitle("通知") - Layout = QVBoxLayout() - self.card_IfSendErrorOnly = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="仅推送异常信息", content="仅在任务出现异常时推送通知", configItem=Config.global_config.notify_IfSendErrorOnly, ) - self.card_IfPushPlyer = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="推送系统通知", content="推送系统级通知,不会在通知中心停留", configItem=Config.global_config.notify_IfPushPlyer, ) - self.card_SendMail = self.SendMailSettingCard(self) self.card_ServerChan = self.ServerChanSettingCard(self) self.card_CompanyWebhookBot = self.CompanyWechatPushSettingCard(self) + + Layout = QVBoxLayout() Layout.addWidget(self.card_IfSendErrorOnly) Layout.addWidget(self.card_IfPushPlyer) Layout.addWidget(self.card_SendMail) Layout.addWidget(self.card_ServerChan) Layout.addWidget(self.card_CompanyWebhookBot) - self.viewLayout.addLayout(Layout) class SendMailSettingCard(ExpandGroupSettingCard): @@ -555,17 +530,13 @@ class NotifySettingCard(HeaderCardWidget): parent, ) - widget = QWidget() - Layout = QVBoxLayout(widget) - self.card_IfSendMail = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, title="推送邮件通知", content="是否启用邮件通知功能", configItem=Config.global_config.notify_IfSendMail, ) - - self.MailAddress = LineEditSettingCard( + self.card_MailAddress = LineEditSettingCard( text="请输入邮箱地址", icon=FluentIcon.PAGE_RIGHT, title="邮箱地址", @@ -573,88 +544,77 @@ class NotifySettingCard(HeaderCardWidget): configItem=Config.global_config.notify_MailAddress, ) + widget = QWidget() + Layout = QVBoxLayout(widget) Layout.addWidget(self.card_IfSendMail) - Layout.addWidget(self.MailAddress) - - # 调整内部布局 + Layout.addWidget(self.card_MailAddress) self.viewLayout.setContentsMargins(0, 0, 0, 0) self.viewLayout.setSpacing(0) - self.addGroupWidget(widget) class ServerChanSettingCard(ExpandGroupSettingCard): def __init__(self, parent=None): super().__init__( FluentIcon.SETTING, - "ServerChan推送", - "通过ServerChan推送推送任务结果", + "推送ServerChan通知", + "通过ServerChan通知推送任务结果", parent, ) - widget = QWidget() - Layout = QVBoxLayout(widget) - self.card_IfServerChan = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, - title="SeverChan推送", - content="是否SeverChan推送", + title="推送SeverChan通知", + content="是否启用SeverChan通知功能", configItem=Config.global_config.notify_IfServerChan, ) - - self.ServerChanKey = LineEditSettingCard( + self.card_ServerChanKey = LineEditSettingCard( text="请输入SendKey", icon=FluentIcon.PAGE_RIGHT, title="SendKey", content="Server酱的SendKey(SC3与SCT都可以)", configItem=Config.global_config.notify_ServerChanKey, ) - - self.ServerChanChannel = LineEditSettingCard( - text="请输入需要推送的Channel代码(SCT生效)", + self.card_ServerChanChannel = LineEditSettingCard( + text="请输入需要推送的Channel代码(SCT生效)", icon=FluentIcon.PAGE_RIGHT, title="ServerChanChannel代码", - content="可以留空,留空则默认。可以多个,请使用|隔开", + content="可以留空,留空则默认。可以多个,请使用“|”隔开", configItem=Config.global_config.notify_ServerChanChannel, ) - - self.ServerChanTag = LineEditSettingCard( + self.card_ServerChanTag = LineEditSettingCard( text="请输入加入推送的Tag(SC3生效)", icon=FluentIcon.PAGE_RIGHT, title="Tag内容", - content="可以留空,留空则默认。可以多个,请使用|隔开", + content="可以留空,留空则默认。可以多个,请使用“|”隔开", configItem=Config.global_config.notify_ServerChanTag, ) + + widget = QWidget() + Layout = QVBoxLayout(widget) Layout.addWidget(self.card_IfServerChan) - Layout.addWidget(self.ServerChanKey) - Layout.addWidget(self.ServerChanChannel) - Layout.addWidget(self.ServerChanTag) + Layout.addWidget(self.card_ServerChanKey) + Layout.addWidget(self.card_ServerChanChannel) + Layout.addWidget(self.card_ServerChanTag) self.viewLayout.setContentsMargins(0, 0, 0, 0) self.viewLayout.setSpacing(0) self.addGroupWidget(widget) - widget = QWidget() - Layout = QVBoxLayout(widget) - class CompanyWechatPushSettingCard(ExpandGroupSettingCard): def __init__(self, parent=None): super().__init__( FluentIcon.SETTING, - "企业微信机器人推送", - "通过企业微信机器人Webhook推送推送任务结果", + "推送企业微信机器人通知", + "通过企业微信机器人Webhook通知推送任务结果", parent, ) - widget = QWidget() - Layout = QVBoxLayout(widget) - self.card_IfCompanyWechat = SwitchSettingCard( icon=FluentIcon.PAGE_RIGHT, - title="企业微信机器人推送", - content="是否启用企业微信机器人推送", + title="推送企业微信机器人通知", + content="是否启用企业微信机器人通知功能", configItem=Config.global_config.notify_IfCompanyWebHookBot, ) - - self.CompanyWebHookBotUrl = LineEditSettingCard( + self.card_CompanyWebHookBotUrl = LineEditSettingCard( text="请输入Webhook的Url", icon=FluentIcon.PAGE_RIGHT, title="WebhookUrl", @@ -662,25 +622,21 @@ class NotifySettingCard(HeaderCardWidget): configItem=Config.global_config.notify_CompanyWebHookBotUrl, ) + widget = QWidget() + Layout = QVBoxLayout(widget) Layout.addWidget(self.card_IfCompanyWechat) - Layout.addWidget(self.CompanyWebHookBotUrl) + Layout.addWidget(self.card_CompanyWebHookBotUrl) self.viewLayout.setContentsMargins(0, 0, 0, 0) self.viewLayout.setSpacing(0) self.addGroupWidget(widget) - widget = QWidget() - Layout = QVBoxLayout(widget) - class SecuritySettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("安全") - Layout = QVBoxLayout() - self.card_changePASSWORD = PushSettingCard( text="修改", icon=FluentIcon.VPN, @@ -688,8 +644,8 @@ class SecuritySettingCard(HeaderCardWidget): content="修改用于解密用户密码的管理密钥", ) + Layout = QVBoxLayout() Layout.addWidget(self.card_changePASSWORD) - self.viewLayout.addLayout(Layout) @@ -730,7 +686,6 @@ class OtherSettingCard(HeaderCardWidget): def __init__(self, parent=None): super().__init__(parent) - self.setTitle("其他") self.card_Notice = PushSettingCard( @@ -739,15 +694,13 @@ class OtherSettingCard(HeaderCardWidget): title="公告", content="查看AUTO_MAA的最新公告", ) - self.card_UserDocs = HyperlinkCard( url="https://docs.qq.com/aio/DQ2NwUHRiWGtMWHBy", - text="访问用户文档", + text="查看使用指南", icon=FluentIcon.PAGE_RIGHT, - title="用户文档", + title="使用指南", content="查看AUTO_MAA的使用教程和文档", ) - self.card_Association = self.AssociationSettingCard() Layout = QVBoxLayout() From c34ca0dea978322673290e8184f4bbbe05817922 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Tue, 4 Feb 2025 18:56:09 +0800 Subject: [PATCH 11/11] =?UTF-8?q?fix(utils):=20=E6=9B=B4=E6=96=B0=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/Updater.py | 2 +- res/version.json | 4 ++-- resources/version.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/utils/Updater.py b/app/utils/Updater.py index 1b27cba..20b3755 100644 --- a/app/utils/Updater.py +++ b/app/utils/Updater.py @@ -225,12 +225,12 @@ class UpdateProcess(QThread): self.info.emit("获取远端代理信息失败,将使用默认代理地址") PROXY_list = [ "", + "https://ghfast.top", "https://gitproxy.click/", "https://cdn.moran233.xyz/", "https://gh.llkk.cc/", "https://github.akams.cn/", "https://www.ghproxy.cn/", - "https://ghp.ci/", ] time.sleep(1) diff --git a/res/version.json b/res/version.json index aec2af5..6ce50cc 100644 --- a/res/version.json +++ b/res/version.json @@ -4,11 +4,11 @@ "announcement": "\n# 这是一个中转版本,此版本后更换程序架构方式。\n# 由于更新方法无法通用,您需要在完成本次更新后再次检查更新以获取最新版本。\n", "proxy_list":[ "", + "https://ghfast.top", "https://gitproxy.click/", "https://cdn.moran233.xyz/", "https://gh.llkk.cc/", "https://github.akams.cn/", - "https://www.ghproxy.cn/", - "https://ghp.ci/" + "https://www.ghproxy.cn/" ] } \ No newline at end of file diff --git a/resources/version.json b/resources/version.json index af668c3..0d0a94c 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,14 +1,14 @@ { "main_version": "4.2.2.2", - "updater_version": "1.1.1.0", + "updater_version": "1.1.1.2", "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 无", "proxy_list": [ "", + "https://ghfast.top", "https://gitproxy.click/", "https://cdn.moran233.xyz/", "https://gh.llkk.cc/", "https://github.akams.cn/", - "https://www.ghproxy.cn/", - "https://ghp.ci/" + "https://www.ghproxy.cn/" ] } \ No newline at end of file