feat(core): 初步完成托管bilibili游戏隐私政策功能
This commit is contained in:
@@ -544,6 +544,9 @@ class GlobalConfig(QConfig):
|
|||||||
)
|
)
|
||||||
function_IfSilence = ConfigItem("Function", "IfSilence", False, BoolValidator())
|
function_IfSilence = ConfigItem("Function", "IfSilence", False, BoolValidator())
|
||||||
function_BossKey = ConfigItem("Function", "BossKey", "")
|
function_BossKey = ConfigItem("Function", "BossKey", "")
|
||||||
|
function_IfAgreeBilibili = ConfigItem(
|
||||||
|
"Function", "IfAgreeBilibili", False, BoolValidator()
|
||||||
|
)
|
||||||
|
|
||||||
start_IfSelfStart = ConfigItem("Start", "IfSelfStart", False, BoolValidator())
|
start_IfSelfStart = ConfigItem("Start", "IfSelfStart", False, BoolValidator())
|
||||||
start_IfRunDirectly = ConfigItem("Start", "IfRunDirectly", False, BoolValidator())
|
start_IfRunDirectly = ConfigItem("Start", "IfRunDirectly", False, BoolValidator())
|
||||||
|
|||||||
@@ -92,41 +92,41 @@ class Task(QThread):
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
self.member_dict = self.search_member()
|
self.member_dict = self.search_member()
|
||||||
self.task_list = [
|
self.task_dict = [
|
||||||
[value, "等待"]
|
[value, "等待"]
|
||||||
for _, value in self.info["Queue"].items()
|
for _, value in self.info["Queue"].items()
|
||||||
if value != "禁用"
|
if value != "禁用"
|
||||||
]
|
]
|
||||||
|
|
||||||
self.create_task_list.emit(self.task_list)
|
self.create_task_list.emit(self.task_dict)
|
||||||
|
|
||||||
for i in range(len(self.task_list)):
|
for i in range(len(self.task_dict)):
|
||||||
|
|
||||||
if self.isInterruptionRequested():
|
if self.isInterruptionRequested():
|
||||||
break
|
break
|
||||||
|
|
||||||
self.task_list[i][1] = "运行"
|
self.task_dict[i][1] = "运行"
|
||||||
self.update_task_list.emit(self.task_list)
|
self.update_task_list.emit(self.task_dict)
|
||||||
|
|
||||||
if self.task_list[i][0] in Config.running_list:
|
if self.task_dict[i][0] in Config.running_list:
|
||||||
|
|
||||||
self.task_list[i][1] = "跳过"
|
self.task_dict[i][1] = "跳过"
|
||||||
self.update_task_list.emit(self.task_list)
|
self.update_task_list.emit(self.task_dict)
|
||||||
logger.info(f"跳过任务:{self.task_list[i][0]}")
|
logger.info(f"跳过任务:{self.task_dict[i][0]}")
|
||||||
self.push_info_bar.emit(
|
self.push_info_bar.emit(
|
||||||
"info", "跳过任务", self.task_list[i][0], 3000
|
"info", "跳过任务", self.task_dict[i][0], 3000
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
Config.running_list.append(self.task_list[i][0])
|
Config.running_list.append(self.task_dict[i][0])
|
||||||
logger.info(f"任务开始:{self.task_list[i][0]}")
|
logger.info(f"任务开始:{self.task_dict[i][0]}")
|
||||||
self.push_info_bar.emit("info", "任务开始", self.task_list[i][0], 3000)
|
self.push_info_bar.emit("info", "任务开始", self.task_dict[i][0], 3000)
|
||||||
|
|
||||||
if self.member_dict[self.task_list[i][0]][0] == "Maa":
|
if self.member_dict[self.task_dict[i][0]][0] == "Maa":
|
||||||
|
|
||||||
self.task = MaaManager(
|
self.task = MaaManager(
|
||||||
self.mode[0:4],
|
self.mode[0:4],
|
||||||
self.member_dict[self.task_list[i][0]][1],
|
self.member_dict[self.task_dict[i][0]][1],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.task.question.connect(self.question.emit)
|
self.task.question.connect(self.question.emit)
|
||||||
@@ -138,7 +138,7 @@ class Task(QThread):
|
|||||||
self.task.update_log_text.connect(self.update_log_text.emit)
|
self.task.update_log_text.connect(self.update_log_text.emit)
|
||||||
self.task.update_user_info.connect(
|
self.task.update_user_info.connect(
|
||||||
lambda modes, uids, days, lasts, notes, numbs: self.update_user_info.emit(
|
lambda modes, uids, days, lasts, notes, numbs: self.update_user_info.emit(
|
||||||
self.member_dict[self.task_list[i][0]][1],
|
self.member_dict[self.task_dict[i][0]][1],
|
||||||
modes,
|
modes,
|
||||||
uids,
|
uids,
|
||||||
days,
|
days,
|
||||||
@@ -148,16 +148,16 @@ class Task(QThread):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.task.accomplish.connect(
|
self.task.accomplish.connect(
|
||||||
lambda log: self.save_log(self.task_list[i][0], log)
|
lambda log: self.save_log(self.task_dict[i][0], log)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.task.run()
|
self.task.run()
|
||||||
|
|
||||||
Config.running_list.remove(self.task_list[i][0])
|
Config.running_list.remove(self.task_dict[i][0])
|
||||||
|
|
||||||
self.task_list[i][1] = "完成"
|
self.task_dict[i][1] = "完成"
|
||||||
logger.info(f"任务完成:{self.task_list[i][0]}")
|
logger.info(f"任务完成:{self.task_dict[i][0]}")
|
||||||
self.push_info_bar.emit("info", "任务完成", self.task_list[i][0], 3000)
|
self.push_info_bar.emit("info", "任务完成", self.task_dict[i][0], 3000)
|
||||||
|
|
||||||
self.accomplish.emit(self.logs)
|
self.accomplish.emit(self.logs)
|
||||||
|
|
||||||
@@ -190,14 +190,14 @@ class TaskManager(QObject):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TaskManager, self).__init__()
|
super(TaskManager, self).__init__()
|
||||||
|
|
||||||
self.task_list: Dict[str, Task] = {}
|
self.task_dict: Dict[str, Task] = {}
|
||||||
|
|
||||||
def add_task(
|
def add_task(
|
||||||
self, mode: str, name: str, info: Dict[str, Dict[str, Union[str, int, bool]]]
|
self, mode: str, name: str, info: Dict[str, Dict[str, Union[str, int, bool]]]
|
||||||
):
|
):
|
||||||
"""添加任务"""
|
"""添加任务"""
|
||||||
|
|
||||||
if name in Config.running_list or name in self.task_list:
|
if name in Config.running_list or name in self.task_dict:
|
||||||
|
|
||||||
logger.warning(f"任务已存在:{name}")
|
logger.warning(f"任务已存在:{name}")
|
||||||
MainInfoBar.push_info_bar("warning", "任务已存在", name, 5000)
|
MainInfoBar.push_info_bar("warning", "任务已存在", name, 5000)
|
||||||
@@ -207,23 +207,23 @@ class TaskManager(QObject):
|
|||||||
MainInfoBar.push_info_bar("info", "任务开始", name, 3000)
|
MainInfoBar.push_info_bar("info", "任务开始", name, 3000)
|
||||||
|
|
||||||
Config.running_list.append(name)
|
Config.running_list.append(name)
|
||||||
self.task_list[name] = Task(mode, name, info)
|
self.task_dict[name] = Task(mode, name, info)
|
||||||
self.task_list[name].question.connect(
|
self.task_dict[name].question.connect(
|
||||||
lambda title, content: self.push_dialog(name, title, content)
|
lambda title, content: self.push_dialog(name, title, content)
|
||||||
)
|
)
|
||||||
self.task_list[name].push_info_bar.connect(MainInfoBar.push_info_bar)
|
self.task_dict[name].push_info_bar.connect(MainInfoBar.push_info_bar)
|
||||||
self.task_list[name].update_user_info.connect(Config.change_user_info)
|
self.task_dict[name].update_user_info.connect(Config.change_user_info)
|
||||||
self.task_list[name].accomplish.connect(
|
self.task_dict[name].accomplish.connect(
|
||||||
lambda logs: self.remove_task(mode, name, logs)
|
lambda logs: self.remove_task(mode, name, logs)
|
||||||
)
|
)
|
||||||
|
|
||||||
if "新调度台" in mode:
|
if "新调度台" in mode:
|
||||||
self.create_gui.emit(self.task_list[name])
|
self.create_gui.emit(self.task_dict[name])
|
||||||
|
|
||||||
elif "主调度台" in mode:
|
elif "主调度台" in mode:
|
||||||
self.connect_gui.emit(self.task_list[name])
|
self.connect_gui.emit(self.task_dict[name])
|
||||||
|
|
||||||
self.task_list[name].start()
|
self.task_dict[name].start()
|
||||||
|
|
||||||
def stop_task(self, name: str):
|
def stop_task(self, name: str):
|
||||||
"""中止任务"""
|
"""中止任务"""
|
||||||
@@ -233,19 +233,19 @@ class TaskManager(QObject):
|
|||||||
|
|
||||||
if name == "ALL":
|
if name == "ALL":
|
||||||
|
|
||||||
for name in self.task_list:
|
for name in self.task_dict:
|
||||||
|
|
||||||
self.task_list[name].task.requestInterruption()
|
self.task_dict[name].task.requestInterruption()
|
||||||
self.task_list[name].requestInterruption()
|
self.task_dict[name].requestInterruption()
|
||||||
self.task_list[name].quit()
|
self.task_dict[name].quit()
|
||||||
self.task_list[name].wait()
|
self.task_dict[name].wait()
|
||||||
|
|
||||||
elif name in self.task_list:
|
elif name in self.task_dict:
|
||||||
|
|
||||||
self.task_list[name].task.requestInterruption()
|
self.task_dict[name].task.requestInterruption()
|
||||||
self.task_list[name].requestInterruption()
|
self.task_dict[name].requestInterruption()
|
||||||
self.task_list[name].quit()
|
self.task_dict[name].quit()
|
||||||
self.task_list[name].wait()
|
self.task_dict[name].wait()
|
||||||
|
|
||||||
def remove_task(self, mode: str, name: str, logs: str):
|
def remove_task(self, mode: str, name: str, logs: str):
|
||||||
"""任务结束后的处理"""
|
"""任务结束后的处理"""
|
||||||
@@ -271,7 +271,7 @@ class TaskManager(QObject):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.task_list.pop(name)
|
self.task_dict.pop(name)
|
||||||
Config.running_list.remove(name)
|
Config.running_list.remove(name)
|
||||||
|
|
||||||
if "调度队列" in name and "人工排查" not in mode:
|
if "调度队列" in name and "人工排查" not in mode:
|
||||||
@@ -288,7 +288,7 @@ class TaskManager(QObject):
|
|||||||
choice.yesButton.setText("是")
|
choice.yesButton.setText("是")
|
||||||
choice.cancelButton.setText("否")
|
choice.cancelButton.setText("否")
|
||||||
|
|
||||||
self.task_list[name].question_response.emit(bool(choice.exec_()))
|
self.task_dict[name].question_response.emit(bool(choice.exec_()))
|
||||||
|
|
||||||
|
|
||||||
Task_manager = TaskManager()
|
Task_manager = TaskManager()
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ MAA功能组件
|
|||||||
v4.2
|
v4.2
|
||||||
作者:DLmaster_361
|
作者:DLmaster_361
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from PySide6.QtCore import QObject, Signal, QEventLoop
|
from PySide6.QtCore import QObject, Signal, QEventLoop
|
||||||
@@ -90,6 +89,7 @@ class MaaManager(QObject):
|
|||||||
self.maa_set_path = self.maa_root_path / "config/gui.json"
|
self.maa_set_path = self.maa_root_path / "config/gui.json"
|
||||||
self.maa_log_path = self.maa_root_path / "debug/gui.log"
|
self.maa_log_path = self.maa_root_path / "debug/gui.log"
|
||||||
self.maa_exe_path = self.maa_root_path / "MAA.exe"
|
self.maa_exe_path = self.maa_root_path / "MAA.exe"
|
||||||
|
self.maa_tasks_path = self.maa_root_path / "resource/tasks.json"
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""主进程,运行MAA代理进程"""
|
"""主进程,运行MAA代理进程"""
|
||||||
@@ -529,6 +529,7 @@ class MaaManager(QObject):
|
|||||||
f"{end_log}AUTO_MAA 敬上",
|
f"{end_log}AUTO_MAA 敬上",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.agree_bilibili(False)
|
||||||
self.accomplish.emit({"Time": begin_time, "History": end_log})
|
self.accomplish.emit({"Time": begin_time, "History": end_log})
|
||||||
|
|
||||||
def requestInterruption(self) -> None:
|
def requestInterruption(self) -> None:
|
||||||
@@ -650,6 +651,14 @@ class MaaManager(QObject):
|
|||||||
with self.maa_set_path.open(mode="r", encoding="utf-8") as f:
|
with self.maa_set_path.open(mode="r", encoding="utf-8") as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
|
if (self.data[index][15] == "simple" and self.data[index][2] == "Bilibili") or (
|
||||||
|
self.data[index][15] == "beta"
|
||||||
|
and data["Configurations"]["Default"]["Start.ClientType"] == "Bilibili"
|
||||||
|
):
|
||||||
|
self.agree_bilibili(True)
|
||||||
|
else:
|
||||||
|
self.agree_bilibili(False)
|
||||||
|
|
||||||
# 自动代理配置
|
# 自动代理配置
|
||||||
if "自动代理" in mode:
|
if "自动代理" in mode:
|
||||||
|
|
||||||
@@ -1011,6 +1020,34 @@ class MaaManager(QObject):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def agree_bilibili(self, if_agree):
|
||||||
|
"""向MAA写入Bilibili协议相关任务"""
|
||||||
|
|
||||||
|
with self.maa_tasks_path.open(mode="r", encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
if if_agree and Config.global_config.get(
|
||||||
|
Config.global_config.function_IfAgreeBilibili
|
||||||
|
):
|
||||||
|
data["BilibiliAgreement_AUTO"] = {
|
||||||
|
"algorithm": "OcrDetect",
|
||||||
|
"action": "ClickSelf",
|
||||||
|
"text": ["同意"],
|
||||||
|
"maxTimes": 5,
|
||||||
|
"Doc": "关闭B服用户协议",
|
||||||
|
"next": ["StartUpThemes#next"],
|
||||||
|
}
|
||||||
|
if "BilibiliAgreement_AUTO" not in data["StartUpThemes"]["next"]:
|
||||||
|
data["StartUpThemes"]["next"].insert(0, "BilibiliAgreement_AUTO")
|
||||||
|
else:
|
||||||
|
if "BilibiliAgreement_AUTO" in data:
|
||||||
|
data.pop("BilibiliAgreement_AUTO")
|
||||||
|
if "BilibiliAgreement_AUTO" in data["StartUpThemes"]["next"]:
|
||||||
|
data["StartUpThemes"]["next"].remove("BilibiliAgreement_AUTO")
|
||||||
|
|
||||||
|
with self.maa_tasks_path.open(mode="w", encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||||
|
|
||||||
def get_emulator_path(self):
|
def get_emulator_path(self):
|
||||||
"""获取模拟器路径"""
|
"""获取模拟器路径"""
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ class Setting(QWidget):
|
|||||||
self.other = OtherSettingCard(self)
|
self.other = OtherSettingCard(self)
|
||||||
|
|
||||||
self.function.card_IfAllowSleep.checkedChanged.connect(System.set_Sleep)
|
self.function.card_IfAllowSleep.checkedChanged.connect(System.set_Sleep)
|
||||||
|
self.function.card_IfAgreeBilibili.checkedChanged.connect(self.agree_bilibili)
|
||||||
self.start.card_IfSelfStart.checkedChanged.connect(System.set_SelfStart)
|
self.start.card_IfSelfStart.checkedChanged.connect(System.set_SelfStart)
|
||||||
self.security.card_changePASSWORD.clicked.connect(self.change_PASSWORD)
|
self.security.card_changePASSWORD.clicked.connect(self.change_PASSWORD)
|
||||||
self.updater.card_CheckUpdate.clicked.connect(self.get_update)
|
self.updater.card_CheckUpdate.clicked.connect(self.get_update)
|
||||||
@@ -102,6 +103,31 @@ class Setting(QWidget):
|
|||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
def agree_bilibili(self) -> None:
|
||||||
|
"""授权bilibili游戏隐私政策"""
|
||||||
|
|
||||||
|
if not Config.global_config.get(Config.global_config.function_IfAgreeBilibili):
|
||||||
|
logger.info("取消授权bilibili游戏隐私政策")
|
||||||
|
MainInfoBar.push_info_bar(
|
||||||
|
"info", "操作成功", "已取消授权bilibili游戏隐私政策", 3000
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
|
choice = MessageBox(
|
||||||
|
"授权声明",
|
||||||
|
"开启“托管bilibili游戏隐私政策”功能,即代表您已完整阅读并同意《哔哩哔哩弹幕网用户使用协议》、《哔哩哔哩隐私政策》和《哔哩哔哩游戏中心用户协议》,并授权AUTO_MAA在其认定需要时以其认定合适的方法替您处理相关弹窗\n\n是否同意授权?",
|
||||||
|
self.window(),
|
||||||
|
)
|
||||||
|
if choice.exec():
|
||||||
|
logger.success("确认授权bilibili游戏隐私政策")
|
||||||
|
MainInfoBar.push_info_bar(
|
||||||
|
"success", "操作成功", "已确认授权bilibili游戏隐私政策", 3000
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
Config.global_config.set(
|
||||||
|
Config.global_config.function_IfAgreeBilibili, False
|
||||||
|
)
|
||||||
|
|
||||||
def check_PASSWORD(self) -> None:
|
def check_PASSWORD(self) -> None:
|
||||||
"""检查并配置管理密钥"""
|
"""检查并配置管理密钥"""
|
||||||
|
|
||||||
@@ -127,8 +153,7 @@ class Setting(QWidget):
|
|||||||
)
|
)
|
||||||
choice.cancelButton.hide()
|
choice.cancelButton.hide()
|
||||||
choice.buttonLayout.insertStretch(1)
|
choice.buttonLayout.insertStretch(1)
|
||||||
if choice.exec():
|
choice.exec()
|
||||||
pass
|
|
||||||
|
|
||||||
def change_PASSWORD(self) -> None:
|
def change_PASSWORD(self) -> None:
|
||||||
"""修改管理密钥"""
|
"""修改管理密钥"""
|
||||||
@@ -183,8 +208,7 @@ class Setting(QWidget):
|
|||||||
choice = MessageBox("错误", "管理密钥错误", self.window())
|
choice = MessageBox("错误", "管理密钥错误", self.window())
|
||||||
choice.cancelButton.hide()
|
choice.cancelButton.hide()
|
||||||
choice.buttonLayout.insertStretch(1)
|
choice.buttonLayout.insertStretch(1)
|
||||||
if choice.exec():
|
choice.exec()
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
choice = MessageBox(
|
choice = MessageBox(
|
||||||
"确认",
|
"确认",
|
||||||
@@ -400,10 +424,17 @@ class FunctionSettingCard(HeaderCardWidget):
|
|||||||
configItem=Config.global_config.function_IfAllowSleep,
|
configItem=Config.global_config.function_IfAllowSleep,
|
||||||
)
|
)
|
||||||
self.card_IfSilence = self.SilenceSettingCard(self)
|
self.card_IfSilence = self.SilenceSettingCard(self)
|
||||||
|
self.card_IfAgreeBilibili = SwitchSettingCard(
|
||||||
|
icon=FluentIcon.PAGE_RIGHT,
|
||||||
|
title="托管bilibili游戏隐私政策",
|
||||||
|
content="授权AUTO_MAA同意bilibili游戏隐私政策",
|
||||||
|
configItem=Config.global_config.function_IfAgreeBilibili,
|
||||||
|
)
|
||||||
|
|
||||||
Layout = QVBoxLayout()
|
Layout = QVBoxLayout()
|
||||||
Layout.addWidget(self.card_IfAllowSleep)
|
Layout.addWidget(self.card_IfAllowSleep)
|
||||||
Layout.addWidget(self.card_IfSilence)
|
Layout.addWidget(self.card_IfSilence)
|
||||||
|
Layout.addWidget(self.card_IfAgreeBilibili)
|
||||||
self.viewLayout.addLayout(Layout)
|
self.viewLayout.addLayout(Layout)
|
||||||
|
|
||||||
class SilenceSettingCard(ExpandGroupSettingCard):
|
class SilenceSettingCard(ExpandGroupSettingCard):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"main_version": "4.2.2.4",
|
"main_version": "4.2.2.5",
|
||||||
"updater_version": "1.1.1.3",
|
"updater_version": "1.1.1.3",
|
||||||
"announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n- 修复窗口记忆功能失效问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑\n- 调整MAA设置目录时打开当前已配置的目录位置",
|
"announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n- 初步完成`托管bilibili游戏隐私政策`功能\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n- 修复窗口记忆功能失效问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑\n- 调整MAA设置目录时打开当前已配置的目录位置",
|
||||||
"proxy_list": [
|
"proxy_list": [
|
||||||
"",
|
"",
|
||||||
"https://gitproxy.click/",
|
"https://gitproxy.click/",
|
||||||
|
|||||||
Reference in New Issue
Block a user