feat(core): 添加更新类别可选项
This commit is contained in:
@@ -39,6 +39,7 @@ from qfluentwidgets import (
|
|||||||
FolderValidator,
|
FolderValidator,
|
||||||
BoolValidator,
|
BoolValidator,
|
||||||
RangeValidator,
|
RangeValidator,
|
||||||
|
OptionsValidator,
|
||||||
qconfig,
|
qconfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -560,12 +561,17 @@ class GlobalConfig(QConfig):
|
|||||||
notify_ServerChanKey = ConfigItem("Notify", "ServerChanKey", "")
|
notify_ServerChanKey = ConfigItem("Notify", "ServerChanKey", "")
|
||||||
notify_ServerChanChannel = ConfigItem("Notify", "ServerChanChannel", "")
|
notify_ServerChanChannel = ConfigItem("Notify", "ServerChanChannel", "")
|
||||||
notify_ServerChanTag = ConfigItem("Notify", "ServerChanTag", "")
|
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_CompanyWebHookBotUrl = ConfigItem("Notify", "CompanyWebHookBotUrl", "")
|
||||||
notify_IfPushDeer = ConfigItem("Notify", "IfPushDeer", False, BoolValidator())
|
notify_IfPushDeer = ConfigItem("Notify", "IfPushDeer", False, BoolValidator())
|
||||||
notify_IfPushDeerKey = ConfigItem("Notify", "PushDeerKey", "")
|
notify_IfPushDeerKey = ConfigItem("Notify", "PushDeerKey", "")
|
||||||
|
|
||||||
update_IfAutoUpdate = ConfigItem("Update", "IfAutoUpdate", False, BoolValidator())
|
update_IfAutoUpdate = ConfigItem("Update", "IfAutoUpdate", False, BoolValidator())
|
||||||
|
update_UpdateType = OptionsConfigItem(
|
||||||
|
"Update", "UpdateType", "main", OptionsValidator(["main", "dev"])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class QueueConfig(QConfig):
|
class QueueConfig(QConfig):
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ class AUTO_MAA(MSFluentWindow):
|
|||||||
|
|
||||||
# 加载配置
|
# 加载配置
|
||||||
qconfig.load(Config.config_path, Config.global_config)
|
qconfig.load(Config.config_path, Config.global_config)
|
||||||
|
Config.global_config.save()
|
||||||
|
|
||||||
# 检查密码
|
# 检查密码
|
||||||
self.setting.check_PASSWORD()
|
self.setting.check_PASSWORD()
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ from qfluentwidgets import (
|
|||||||
SwitchSettingCard,
|
SwitchSettingCard,
|
||||||
ExpandGroupSettingCard,
|
ExpandGroupSettingCard,
|
||||||
PushSettingCard,
|
PushSettingCard,
|
||||||
|
ComboBoxSettingCard,
|
||||||
)
|
)
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
@@ -207,7 +208,7 @@ class Setting(QWidget):
|
|||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
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()
|
version_remote = response.json()
|
||||||
break
|
break
|
||||||
@@ -249,7 +250,7 @@ class Setting(QWidget):
|
|||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
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()
|
version_remote = response.json()
|
||||||
break
|
break
|
||||||
@@ -666,6 +667,7 @@ class NotifySettingCard(HeaderCardWidget):
|
|||||||
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.viewLayout.setSpacing(0)
|
self.viewLayout.setSpacing(0)
|
||||||
self.addGroupWidget(widget)
|
self.addGroupWidget(widget)
|
||||||
|
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
Layout = QVBoxLayout(widget)
|
Layout = QVBoxLayout(widget)
|
||||||
|
|
||||||
@@ -695,18 +697,21 @@ class UpdaterSettingCard(HeaderCardWidget):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.setTitle("更新")
|
self.setTitle("更新")
|
||||||
|
|
||||||
Layout = QVBoxLayout()
|
|
||||||
|
|
||||||
self.card_IfAutoUpdate = SwitchSettingCard(
|
self.card_IfAutoUpdate = SwitchSettingCard(
|
||||||
icon=FluentIcon.PAGE_RIGHT,
|
icon=FluentIcon.PAGE_RIGHT,
|
||||||
title="自动检查更新",
|
title="自动检查更新",
|
||||||
content="将在启动时自动检查AUTO_MAA是否有新版本",
|
content="将在启动时自动检查AUTO_MAA是否有新版本",
|
||||||
configItem=Config.global_config.update_IfAutoUpdate,
|
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(
|
self.card_CheckUpdate = PushSettingCard(
|
||||||
text="检查更新",
|
text="检查更新",
|
||||||
icon=FluentIcon.UPDATE,
|
icon=FluentIcon.UPDATE,
|
||||||
@@ -714,9 +719,10 @@ class UpdaterSettingCard(HeaderCardWidget):
|
|||||||
content="检查AUTO_MAA是否有新版本",
|
content="检查AUTO_MAA是否有新版本",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Layout = QVBoxLayout()
|
||||||
Layout.addWidget(self.card_IfAutoUpdate)
|
Layout.addWidget(self.card_IfAutoUpdate)
|
||||||
|
Layout.addWidget(self.card_UpdateType)
|
||||||
Layout.addWidget(self.card_CheckUpdate)
|
Layout.addWidget(self.card_CheckUpdate)
|
||||||
|
|
||||||
self.viewLayout.addLayout(Layout)
|
self.viewLayout.addLayout(Layout)
|
||||||
|
|
||||||
|
|
||||||
@@ -760,7 +766,6 @@ class OtherSettingCard(HeaderCardWidget):
|
|||||||
parent,
|
parent,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
self.card_GitHubRepository = HyperlinkCard(
|
self.card_GitHubRepository = HyperlinkCard(
|
||||||
url="https://github.com/DLmaster361/AUTO_MAA",
|
url="https://github.com/DLmaster361/AUTO_MAA",
|
||||||
text="访问GitHub仓库",
|
text="访问GitHub仓库",
|
||||||
|
|||||||
@@ -333,11 +333,19 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
main_version_current = [0, 0, 0, 0]
|
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):
|
for _ in range(3):
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
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()
|
version_remote = response.json()
|
||||||
main_version_remote = list(
|
main_version_remote = list(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"main_version": "4.2.2.2",
|
"main_version": "4.2.2.2",
|
||||||
"updater_version": "1.1.1.0",
|
"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": [
|
"proxy_list": [
|
||||||
"",
|
"",
|
||||||
"https://gitproxy.click/",
|
"https://gitproxy.click/",
|
||||||
|
|||||||
Reference in New Issue
Block a user