fix(maa): 将通知判定过程全部移入push_notification中
This commit is contained in:
@@ -584,7 +584,7 @@ class MaaPlanConfig(LQConfig):
|
|||||||
|
|
||||||
class AppConfig(GlobalConfig):
|
class AppConfig(GlobalConfig):
|
||||||
|
|
||||||
VERSION = "4.3.8.3"
|
VERSION = "4.3.8.4"
|
||||||
|
|
||||||
gameid_refreshed = Signal()
|
gameid_refreshed = Signal()
|
||||||
PASSWORD_refreshed = Signal()
|
PASSWORD_refreshed = Signal()
|
||||||
|
|||||||
@@ -614,8 +614,8 @@ class MaaManager(QObject):
|
|||||||
f"喜报:用户 {user[0]} 公招出六星啦!",
|
f"喜报:用户 {user[0]} 公招出六星啦!",
|
||||||
{
|
{
|
||||||
"user_name": user_data["Info"]["Name"],
|
"user_name": user_data["Info"]["Name"],
|
||||||
"user_index": user[2],
|
|
||||||
},
|
},
|
||||||
|
user_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 执行MAA解压更新动作
|
# 执行MAA解压更新动作
|
||||||
@@ -641,27 +641,23 @@ class MaaManager(QObject):
|
|||||||
|
|
||||||
logger.info(f"{self.name} | 更新动作结束")
|
logger.info(f"{self.name} | 更新动作结束")
|
||||||
|
|
||||||
if Config.get(Config.notify_IfSendStatistic):
|
# 发送统计信息
|
||||||
|
statistics = Config.merge_maa_logs("指定项", user_logs_list)
|
||||||
statistics = Config.merge_maa_logs("指定项", user_logs_list)
|
statistics["user_index"] = user[2]
|
||||||
statistics["user_index"] = user[2]
|
statistics["user_info"] = user[0]
|
||||||
statistics["user_info"] = user[0]
|
statistics["start_time"] = user_start_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
statistics["start_time"] = user_start_time.strftime(
|
statistics["end_time"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
"%Y-%m-%d %H:%M:%S"
|
statistics["maa_result"] = (
|
||||||
)
|
"代理任务全部完成"
|
||||||
statistics["end_time"] = datetime.now().strftime(
|
if (run_book["Annihilation"] and run_book["Routine"])
|
||||||
"%Y-%m-%d %H:%M:%S"
|
else "代理任务未全部完成"
|
||||||
)
|
)
|
||||||
statistics["maa_result"] = (
|
self.push_notification(
|
||||||
"代理任务全部完成"
|
"统计信息",
|
||||||
if (run_book["Annihilation"] and run_book["Routine"])
|
f"{current_date} | 用户 {user[0]} 的自动代理统计报告",
|
||||||
else "代理任务未全部完成"
|
statistics,
|
||||||
)
|
user_data,
|
||||||
self.push_notification(
|
)
|
||||||
"统计信息",
|
|
||||||
f"{current_date} | 用户 {user[0]} 的自动代理统计报告",
|
|
||||||
statistics,
|
|
||||||
)
|
|
||||||
|
|
||||||
if run_book["Annihilation"] and run_book["Routine"]:
|
if run_book["Annihilation"] and run_book["Routine"]:
|
||||||
# 成功完成代理的用户修改相关参数
|
# 成功完成代理的用户修改相关参数
|
||||||
@@ -854,6 +850,17 @@ class MaaManager(QObject):
|
|||||||
self.data[_]["Config"]["Info"]["Name"] for _ in wait_index
|
self.data[_]["Config"]["Info"]["Name"] for _ in wait_index
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 生成结果文本
|
||||||
|
result_text = (
|
||||||
|
f"任务开始时间:{result["start_time"]},结束时间:{result["end_time"]}\n"
|
||||||
|
f"已完成数:{result["completed_count"]},未完成数:{result["uncompleted_count"]}\n\n"
|
||||||
|
)
|
||||||
|
if len(result["failed_user"]) > 0:
|
||||||
|
result_text += f"{self.mode[2:4]}未成功的用户:\n{"\n".join(result["failed_user"])}\n"
|
||||||
|
if len(result["waiting_user"]) > 0:
|
||||||
|
result_text += f"\n未开始{self.mode[2:4]}的用户:\n{"\n".join(result["waiting_user"])}\n"
|
||||||
|
|
||||||
# 推送代理结果通知
|
# 推送代理结果通知
|
||||||
Notify.push_plyer(
|
Notify.push_plyer(
|
||||||
title.replace("报告", "已完成!"),
|
title.replace("报告", "已完成!"),
|
||||||
@@ -861,15 +868,7 @@ class MaaManager(QObject):
|
|||||||
f"已完成用户数:{len(over_index)},未完成用户数:{len(error_index) + len(wait_index)}",
|
f"已完成用户数:{len(over_index)},未完成用户数:{len(error_index) + len(wait_index)}",
|
||||||
10,
|
10,
|
||||||
)
|
)
|
||||||
if Config.get(Config.notify_SendTaskResultTime) == "任何时刻" or (
|
self.push_notification("代理结果", title, result)
|
||||||
Config.get(Config.notify_SendTaskResultTime) == "仅失败时"
|
|
||||||
and len(error_index) + len(wait_index) != 0
|
|
||||||
):
|
|
||||||
result_text = self.push_notification("代理结果", title, result)
|
|
||||||
else:
|
|
||||||
result_text = self.push_notification(
|
|
||||||
"代理结果", title, result, if_get_text_only=True
|
|
||||||
)
|
|
||||||
|
|
||||||
self.agree_bilibili(False)
|
self.agree_bilibili(False)
|
||||||
self.log_monitor.deleteLater()
|
self.log_monitor.deleteLater()
|
||||||
@@ -1743,15 +1742,21 @@ class MaaManager(QObject):
|
|||||||
mode: str,
|
mode: str,
|
||||||
title: str,
|
title: str,
|
||||||
message: Union[str, dict],
|
message: Union[str, dict],
|
||||||
if_get_text_only: bool = False,
|
user_data: Dict[str, Dict[str, Union[str, int, bool]]] = None,
|
||||||
) -> str:
|
) -> None:
|
||||||
"""通过所有渠道推送通知"""
|
"""通过所有渠道推送通知"""
|
||||||
|
|
||||||
env = Environment(
|
env = Environment(
|
||||||
loader=FileSystemLoader(str(Config.app_path / "resources/html"))
|
loader=FileSystemLoader(str(Config.app_path / "resources/html"))
|
||||||
)
|
)
|
||||||
|
|
||||||
if mode == "代理结果":
|
if mode == "代理结果" and (
|
||||||
|
Config.get(Config.notify_SendTaskResultTime) == "任何时刻"
|
||||||
|
or (
|
||||||
|
Config.get(Config.notify_SendTaskResultTime) == "仅失败时"
|
||||||
|
and message["uncompleted_count"] != 0
|
||||||
|
)
|
||||||
|
):
|
||||||
# 生成文本通知内容
|
# 生成文本通知内容
|
||||||
message_text = (
|
message_text = (
|
||||||
f"任务开始时间:{message["start_time"]},结束时间:{message["end_time"]}\n"
|
f"任务开始时间:{message["start_time"]},结束时间:{message["end_time"]}\n"
|
||||||
@@ -1763,9 +1768,6 @@ class MaaManager(QObject):
|
|||||||
if len(message["waiting_user"]) > 0:
|
if len(message["waiting_user"]) > 0:
|
||||||
message_text += f"\n未开始{self.mode[2:4]}的用户:\n{"\n".join(message["waiting_user"])}\n"
|
message_text += f"\n未开始{self.mode[2:4]}的用户:\n{"\n".join(message["waiting_user"])}\n"
|
||||||
|
|
||||||
if if_get_text_only:
|
|
||||||
return message_text
|
|
||||||
|
|
||||||
# 生成HTML通知内容
|
# 生成HTML通知内容
|
||||||
message["failed_user"] = "、".join(message["failed_user"])
|
message["failed_user"] = "、".join(message["failed_user"])
|
||||||
message["waiting_user"] = "、".join(message["waiting_user"])
|
message["waiting_user"] = "、".join(message["waiting_user"])
|
||||||
@@ -1773,12 +1775,16 @@ class MaaManager(QObject):
|
|||||||
template = env.get_template("MAA_result.html")
|
template = env.get_template("MAA_result.html")
|
||||||
message_html = template.render(message)
|
message_html = template.render(message)
|
||||||
|
|
||||||
|
# ServerChan的换行是两个换行符。故而将\n替换为\n\n
|
||||||
|
serverchan_message = message_text.replace("\n", "\n\n")
|
||||||
|
|
||||||
# 发送全局通知
|
# 发送全局通知
|
||||||
|
|
||||||
if Config.get(Config.notify_IfSendMail):
|
if Config.get(Config.notify_IfSendMail):
|
||||||
Notify.send_mail(
|
Notify.send_mail(
|
||||||
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
||||||
)
|
)
|
||||||
serverchan_message = message_text.replace("\n", "\n\n")
|
|
||||||
if Config.get(Config.notify_IfServerChan):
|
if Config.get(Config.notify_IfServerChan):
|
||||||
Notify.ServerChanPush(
|
Notify.ServerChanPush(
|
||||||
title,
|
title,
|
||||||
@@ -1787,6 +1793,7 @@ class MaaManager(QObject):
|
|||||||
Config.get(Config.notify_ServerChanTag),
|
Config.get(Config.notify_ServerChanTag),
|
||||||
Config.get(Config.notify_ServerChanChannel),
|
Config.get(Config.notify_ServerChanChannel),
|
||||||
)
|
)
|
||||||
|
|
||||||
if Config.get(Config.notify_IfCompanyWebHookBot):
|
if Config.get(Config.notify_IfCompanyWebHookBot):
|
||||||
Notify.CompanyWebHookBotPush(
|
Notify.CompanyWebHookBotPush(
|
||||||
title,
|
title,
|
||||||
@@ -1794,10 +1801,8 @@ class MaaManager(QObject):
|
|||||||
Config.get(Config.notify_CompanyWebHookBotUrl),
|
Config.get(Config.notify_CompanyWebHookBotUrl),
|
||||||
)
|
)
|
||||||
|
|
||||||
return message_text
|
|
||||||
|
|
||||||
elif mode == "统计信息":
|
elif mode == "统计信息":
|
||||||
user_index = message.get("user_index")
|
|
||||||
# 生成文本通知内容
|
# 生成文本通知内容
|
||||||
formatted = []
|
formatted = []
|
||||||
for stage, items in message["drop_statistics"].items():
|
for stage, items in message["drop_statistics"].items():
|
||||||
@@ -1823,98 +1828,96 @@ class MaaManager(QObject):
|
|||||||
template = env.get_template("MAA_statistics.html")
|
template = env.get_template("MAA_statistics.html")
|
||||||
message_html = template.render(message)
|
message_html = template.render(message)
|
||||||
|
|
||||||
# 发送全局通知
|
|
||||||
if Config.get(Config.notify_IfSendMail):
|
|
||||||
Notify.send_mail(
|
|
||||||
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
|
||||||
)
|
|
||||||
# ServerChan的换行是两个换行符。故而将\n替换为\n\n
|
# ServerChan的换行是两个换行符。故而将\n替换为\n\n
|
||||||
serverchan_message = message_text.replace("\n", "\n\n")
|
serverchan_message = message_text.replace("\n", "\n\n")
|
||||||
if Config.get(Config.notify_IfServerChan):
|
|
||||||
Notify.ServerChanPush(
|
|
||||||
title,
|
|
||||||
f"{serverchan_message}\n\nAUTO_MAA 敬上",
|
|
||||||
Config.get(Config.notify_ServerChanKey),
|
|
||||||
Config.get(Config.notify_ServerChanTag),
|
|
||||||
Config.get(Config.notify_ServerChanChannel),
|
|
||||||
)
|
|
||||||
if Config.get(Config.notify_IfCompanyWebHookBot):
|
|
||||||
Notify.CompanyWebHookBotPush(
|
|
||||||
title,
|
|
||||||
f"{message_text}\n\nAUTO_MAA 敬上",
|
|
||||||
Config.get(Config.notify_CompanyWebHookBotUrl),
|
|
||||||
)
|
|
||||||
|
|
||||||
# 发送用户单独通知
|
# 发送全局通知
|
||||||
user_data = self.data.get(user_index, {}).get("Config", {})
|
if Config.get(Config.notify_IfSendStatistic):
|
||||||
if user_data["Notify"].get("IfSendStatistic", False):
|
|
||||||
if user_data.get("Notify") and user_data["Notify"].get(
|
|
||||||
"Enabled", False
|
|
||||||
):
|
|
||||||
# 发送邮件通知
|
|
||||||
if user_data.get("Notify", {}).get("IfSendMail", False):
|
|
||||||
userToAddress = user_data.get("Notify", {}).get("ToAddress")
|
|
||||||
if userToAddress:
|
|
||||||
Notify.send_mail("网页", title, message_text, userToAddress)
|
|
||||||
else:
|
|
||||||
logger.error(
|
|
||||||
f"{self.name} | 用户邮箱地址为空,无法发送用户单独的邮件通知"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 发送ServerChan通知
|
|
||||||
if user_data.get("Notify", {}).get("IfServerChan", False):
|
|
||||||
userServerChanKey = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanKey"
|
|
||||||
)
|
|
||||||
userServerChanTag = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanTag"
|
|
||||||
)
|
|
||||||
userServerChanChannel = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanChannel"
|
|
||||||
)
|
|
||||||
if userServerChanKey:
|
|
||||||
Notify.ServerChanPush(
|
|
||||||
title,
|
|
||||||
f"{serverchan_message}\n\nAUTO_MAA 敬上",
|
|
||||||
userServerChanKey,
|
|
||||||
userServerChanTag,
|
|
||||||
userServerChanChannel,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.error(
|
|
||||||
f"{self.name} |用户ServerChan密钥为空,无法发送用户单独的ServerChan通知"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 推送CompanyWebHookBot通知
|
|
||||||
if user_data.get("Notify", {}).get("IfCompanyWebHookBot", False):
|
|
||||||
userCompanyWebHookBotUrl = user_data.get("Notify", {}).get(
|
|
||||||
"CompanyWebHookBotUrl"
|
|
||||||
)
|
|
||||||
if userCompanyWebHookBotUrl:
|
|
||||||
Notify.CompanyWebHookBotPush(
|
|
||||||
title,
|
|
||||||
f"{message_text}\n\nAUTO_MAA 敬上",
|
|
||||||
userCompanyWebHookBotUrl,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.error(
|
|
||||||
f"{self.name} |用户CompanyWebHookBot密钥为空,无法发送用户单独的CompanyWebHookBot通知"
|
|
||||||
)
|
|
||||||
|
|
||||||
elif mode == "公招六星":
|
|
||||||
user_index = message.get("user_index")
|
|
||||||
# 生成HTML通知内容
|
|
||||||
template = env.get_template("MAA_six_star.html")
|
|
||||||
|
|
||||||
# 这里需要看一下,我给message加了个user_index
|
|
||||||
message_html = template.render(message)
|
|
||||||
|
|
||||||
if Config.get(Config.notify_IfSendSixStar):
|
|
||||||
# 发送全局通知
|
|
||||||
if Config.get(Config.notify_IfSendMail):
|
if Config.get(Config.notify_IfSendMail):
|
||||||
Notify.send_mail(
|
Notify.send_mail(
|
||||||
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if Config.get(Config.notify_IfServerChan):
|
||||||
|
Notify.ServerChanPush(
|
||||||
|
title,
|
||||||
|
f"{serverchan_message}\n\nAUTO_MAA 敬上",
|
||||||
|
Config.get(Config.notify_ServerChanKey),
|
||||||
|
Config.get(Config.notify_ServerChanTag),
|
||||||
|
Config.get(Config.notify_ServerChanChannel),
|
||||||
|
)
|
||||||
|
|
||||||
|
if Config.get(Config.notify_IfCompanyWebHookBot):
|
||||||
|
Notify.CompanyWebHookBotPush(
|
||||||
|
title,
|
||||||
|
f"{message_text}\n\nAUTO_MAA 敬上",
|
||||||
|
Config.get(Config.notify_CompanyWebHookBotUrl),
|
||||||
|
)
|
||||||
|
|
||||||
|
# 发送用户单独通知
|
||||||
|
if (
|
||||||
|
user_data["Notify"]["Enabled"]
|
||||||
|
and user_data["Notify"]["IfSendStatistic"]
|
||||||
|
):
|
||||||
|
|
||||||
|
# 发送邮件通知
|
||||||
|
if user_data["Notify"]["IfSendMail"]:
|
||||||
|
if user_data["Notify"]["ToAddress"]:
|
||||||
|
Notify.send_mail(
|
||||||
|
"网页",
|
||||||
|
title,
|
||||||
|
message_html,
|
||||||
|
user_data["Notify"]["ToAddress"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.error(
|
||||||
|
f"{self.name} | 用户邮箱地址为空,无法发送用户单独的邮件通知"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 发送ServerChan通知
|
||||||
|
if user_data["Notify"]["IfServerChan"]:
|
||||||
|
if user_data["Notify"]["ServerChanKey"]:
|
||||||
|
Notify.ServerChanPush(
|
||||||
|
title,
|
||||||
|
f"{serverchan_message}\n\nAUTO_MAA 敬上",
|
||||||
|
user_data["Notify"]["ServerChanKey"],
|
||||||
|
user_data["Notify"]["ServerChanTag"],
|
||||||
|
user_data["Notify"]["ServerChanChannel"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.error(
|
||||||
|
f"{self.name} |用户ServerChan密钥为空,无法发送用户单独的ServerChan通知"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 推送CompanyWebHookBot通知
|
||||||
|
if user_data["Notify"]["IfCompanyWebHookBot"]:
|
||||||
|
if user_data["Notify"]["CompanyWebHookBotUrl"]:
|
||||||
|
Notify.CompanyWebHookBotPush(
|
||||||
|
title,
|
||||||
|
f"{message_text}\n\nAUTO_MAA 敬上",
|
||||||
|
user_data["Notify"]["CompanyWebHookBotUrl"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.error(
|
||||||
|
f"{self.name} |用户CompanyWebHookBot密钥为空,无法发送用户单独的CompanyWebHookBot通知"
|
||||||
|
)
|
||||||
|
|
||||||
|
elif mode == "公招六星":
|
||||||
|
|
||||||
|
# 生成HTML通知内容
|
||||||
|
template = env.get_template("MAA_six_star.html")
|
||||||
|
|
||||||
|
message_html = template.render(message)
|
||||||
|
|
||||||
|
# 发送全局通知
|
||||||
|
if Config.get(Config.notify_IfSendSixStar):
|
||||||
|
|
||||||
|
if Config.get(Config.notify_IfSendMail):
|
||||||
|
Notify.send_mail(
|
||||||
|
"网页", title, message_html, Config.get(Config.notify_ToAddress)
|
||||||
|
)
|
||||||
|
|
||||||
if Config.get(Config.notify_IfServerChan):
|
if Config.get(Config.notify_IfServerChan):
|
||||||
Notify.ServerChanPush(
|
Notify.ServerChanPush(
|
||||||
title,
|
title,
|
||||||
@@ -1923,67 +1926,57 @@ class MaaManager(QObject):
|
|||||||
Config.get(Config.notify_ServerChanTag),
|
Config.get(Config.notify_ServerChanTag),
|
||||||
Config.get(Config.notify_ServerChanChannel),
|
Config.get(Config.notify_ServerChanChannel),
|
||||||
)
|
)
|
||||||
|
|
||||||
if Config.get(Config.notify_IfCompanyWebHookBot):
|
if Config.get(Config.notify_IfCompanyWebHookBot):
|
||||||
Notify.CompanyWebHookBotPush(
|
Notify.CompanyWebHookBotPush(
|
||||||
title,
|
title,
|
||||||
"好羡慕~\n\nAUTO_MAA 敬上",
|
"好羡慕~\n\nAUTO_MAA 敬上",
|
||||||
Config.get(Config.notify_CompanyWebHookBotUrl),
|
Config.get(Config.notify_CompanyWebHookBotUrl),
|
||||||
)
|
)
|
||||||
|
|
||||||
# 发送用户单独通知
|
# 发送用户单独通知
|
||||||
user_data = self.data.get(user_index, {}).get("Config", {})
|
if user_data["Notify"]["Enabled"] and user_data["Notify"]["IfSendSixStar"]:
|
||||||
|
|
||||||
# 判断是否单独发送六星
|
# 发送邮件通知
|
||||||
if user_data["Notify"].get("IfSendSixStar", False):
|
if user_data["Notify"]["IfSendMail"]:
|
||||||
if user_data.get("Notify") and user_data["Notify"].get(
|
if user_data["Notify"]["ToAddress"]:
|
||||||
"Enabled", False
|
Notify.send_mail(
|
||||||
):
|
"网页",
|
||||||
# 发送邮件通知
|
title,
|
||||||
if user_data.get("Notify", {}).get("IfSendMail", False):
|
message_html,
|
||||||
userToAddress = user_data.get("Notify", {}).get("ToAddress")
|
user_data["Notify"]["ToAddress"],
|
||||||
if userToAddress:
|
)
|
||||||
Notify.send_mail("网页", title, message_html, userToAddress)
|
else:
|
||||||
else:
|
logger.error(
|
||||||
logger.error(
|
f"{self.name} | 用户邮箱地址为空,无法发送用户单独的邮件通知"
|
||||||
f"{self.name} | 用户邮箱地址为空,无法发送用户单独的邮件通知"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# 发送ServerChan通知
|
# 发送ServerChan通知
|
||||||
if user_data.get("Notify", {}).get("IfServerChan", False):
|
if user_data["Notify"]["IfServerChan"]:
|
||||||
userServerChanKey = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanKey"
|
|
||||||
)
|
|
||||||
userServerChanTag = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanTag"
|
|
||||||
)
|
|
||||||
userServerChanChannel = user_data.get("Notify", {}).get(
|
|
||||||
"ServerChanChannel"
|
|
||||||
)
|
|
||||||
if userServerChanKey:
|
|
||||||
Notify.ServerChanPush(
|
|
||||||
title,
|
|
||||||
"好羡慕~\n\nAUTO_MAA 敬上",
|
|
||||||
userServerChanKey,
|
|
||||||
userServerChanTag,
|
|
||||||
userServerChanChannel,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.error(
|
|
||||||
f"{self.name} |用户ServerChan密钥为空,无法发送用户单独的ServerChan通知"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 推送CompanyWebHookBot通知
|
if user_data["Notify"]["ServerChanKey"]:
|
||||||
if user_data.get("Notify", {}).get("IfCompanyWebHookBot", False):
|
Notify.ServerChanPush(
|
||||||
userCompanyWebHookBotUrl = user_data.get("Notify", {}).get(
|
title,
|
||||||
"CompanyWebHookBotUrl"
|
"好羡慕~\n\nAUTO_MAA 敬上",
|
||||||
|
user_data["Notify"]["ServerChanKey"],
|
||||||
|
user_data["Notify"]["ServerChanTag"],
|
||||||
|
user_data["Notify"]["ServerChanChannel"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.error(
|
||||||
|
f"{self.name} |用户ServerChan密钥为空,无法发送用户单独的ServerChan通知"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 推送CompanyWebHookBot通知
|
||||||
|
if user_data["Notify"]["IfCompanyWebHookBot"]:
|
||||||
|
if user_data["Notify"]["CompanyWebHookBotUrl"]:
|
||||||
|
Notify.CompanyWebHookBotPush(
|
||||||
|
title,
|
||||||
|
"好羡慕~\n\nAUTO_MAA 敬上",
|
||||||
|
user_data["Notify"]["CompanyWebHookBotUrl"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.error(
|
||||||
|
f"{self.name} |用户CompanyWebHookBot密钥为空,无法发送用户单独的CompanyWebHookBot通知"
|
||||||
)
|
)
|
||||||
if userCompanyWebHookBotUrl:
|
|
||||||
Notify.CompanyWebHookBotPush(
|
|
||||||
title,
|
|
||||||
"好羡慕~\n\nAUTO_MAA 敬上",
|
|
||||||
userCompanyWebHookBotUrl,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.error(
|
|
||||||
f"{self.name} |用户CompanyWebHookBot密钥为空,无法发送用户单独的CompanyWebHookBot通知"
|
|
||||||
)
|
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -1003,22 +1003,27 @@ class UserNoticeSettingCard(PushAndSwitchButtonSettingCard):
|
|||||||
return f"{s[:4]}***{s[-4:]}" if len(s) > 8 else s
|
return f"{s[:4]}***{s[-4:]}" if len(s) > 8 else s
|
||||||
|
|
||||||
elif s.startswith(("http://", "https://")):
|
elif s.startswith(("http://", "https://")):
|
||||||
# Webhook URL:域名 + 路径尾4
|
# Webhook URL:域名前5 + 路径尾5
|
||||||
parsed_url = urlparse(s)
|
parsed_url = urlparse(s)
|
||||||
domain = parsed_url.netloc
|
domain = (
|
||||||
|
parsed_url.netloc[:5]
|
||||||
|
if len(parsed_url.netloc) > 5
|
||||||
|
else parsed_url.netloc
|
||||||
|
)
|
||||||
path_tail = (
|
path_tail = (
|
||||||
parsed_url.path[-4:]
|
parsed_url.path[-5:]
|
||||||
if len(parsed_url.path) > 4
|
if len(parsed_url.path) > 5
|
||||||
else parsed_url.path
|
else parsed_url.path
|
||||||
)
|
)
|
||||||
return f"{domain}"
|
return f"{domain}......{path_tail}"
|
||||||
|
|
||||||
elif "@" in s:
|
elif "@" in s:
|
||||||
# # 邮箱:显示@前最多3字符 + 域名
|
# 邮箱:@前4/7 + 域名
|
||||||
# username, domain = s.split("@", 1)
|
username, domain = s.split("@", 1)
|
||||||
# displayed_name = username[-3:] if len(username) > 3 else username
|
displayed_name = (
|
||||||
# 邮箱展示全部
|
f"{username[:4]}......" if len(username) > 7 else username
|
||||||
return f"{s}"
|
)
|
||||||
|
return f"{displayed_name}@{domain}"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# 普通字符串:末尾3字符
|
# 普通字符串:末尾3字符
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
{
|
{
|
||||||
"main_version": "4.3.8.3",
|
"main_version": "4.3.8.4",
|
||||||
"version_info": {
|
"version_info": {
|
||||||
|
"4.3.8.4": {
|
||||||
|
"新增功能": [
|
||||||
|
"支持为每一个用户执行独立通知"
|
||||||
|
]
|
||||||
|
},
|
||||||
"4.3.8.3": {
|
"4.3.8.3": {
|
||||||
"新增功能": [
|
"新增功能": [
|
||||||
"用户仪表盘支持直接控制用户状态"
|
"用户仪表盘支持直接控制用户状态"
|
||||||
|
|||||||
Reference in New Issue
Block a user