-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f94e129
commit 684211c
Showing
14 changed files
with
2,529 additions
and
959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,20 @@ | |
__author__ = "DLmaster361 <[email protected]>" | ||
__license__ = "GPL-3.0 license" | ||
|
||
from .config import AppConfig, MaaConfig | ||
from .config import AppConfig, QueueConfig, MaaConfig | ||
from .models import MaaManager | ||
from .services import Notification, CryptoHandler | ||
from .services import Notification, CryptoHandler, SystemHandler | ||
from .ui import AUTO_MAA | ||
from .utils import Updater, version_text | ||
|
||
__all__ = [ | ||
"AppConfig", | ||
"QueueConfig", | ||
"MaaConfig", | ||
"MaaManager", | ||
"Notification", | ||
"CryptoHandler", | ||
"SystemHandler", | ||
"AUTO_MAA", | ||
"Updater", | ||
"version_text", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,15 +44,17 @@ def __init__(self, config: AppConfig): | |
def push_notification(self, title, message, ticker, t): | ||
"""推送系统通知""" | ||
|
||
notification.notify( | ||
title=title, | ||
message=message, | ||
app_name="AUTO_MAA", | ||
app_icon=str(self.config.app_path / "resources/icons/AUTO_MAA.ico"), | ||
timeout=t, | ||
ticker=ticker, | ||
toast=True, | ||
) | ||
if self.config.global_config.get(self.config.global_config.notify_IfPushPlyer): | ||
|
||
notification.notify( | ||
title=title, | ||
message=message, | ||
app_name="AUTO_MAA", | ||
app_icon=str(self.config.app_path / "resources/icons/AUTO_MAA.ico"), | ||
timeout=t, | ||
ticker=ticker, | ||
toast=True, | ||
) | ||
|
||
return True | ||
|
||
|
@@ -62,34 +64,43 @@ def send_mail(self, title, content): | |
# 声明:此邮箱为AUTO_MAA项目组资产,未经授权不得私自使用 | ||
# 注意:此声明注释只有使用者更换发信邮箱时才能删除,本条规则优先级高于GPLv3 | ||
|
||
# 第三方 SMTP 服务配置 | ||
mail_host = "smtp.163.com" # 设置服务器 | ||
mail_sender = "[email protected]" # 用户名 | ||
mail_key = "SYrq87nDLD4RNB5T" # 授权码 24/11/15 | ||
|
||
# 定义邮件正文 | ||
message = MIMEText(content, "plain", "utf-8") | ||
message["From"] = formataddr( | ||
(Header("AUTO_MAA通知服务", "utf-8").encode(), "[email protected]") | ||
) # 发件人显示的名字 | ||
message["To"] = formataddr( | ||
( | ||
Header("AUTO_MAA用户", "utf-8").encode(), | ||
self.config.content["Default"]["SelfSet.MailAddress"], | ||
) | ||
) # 收件人显示的名字 | ||
message["Subject"] = Header(title, "utf-8") | ||
|
||
try: | ||
smtpObj = smtplib.SMTP_SSL(mail_host, 465) # 465为SMTP_SSL默认端口 | ||
smtpObj.login(mail_sender, mail_key) | ||
smtpObj.sendmail( | ||
mail_sender, | ||
self.config.content["Default"]["SelfSet.MailAddress"], | ||
message.as_string(), | ||
) | ||
return True | ||
except smtplib.SMTPException as e: | ||
return f"发送邮件时出错:\n{e}" | ||
finally: | ||
smtpObj.quit() | ||
if self.config.global_config.get(self.config.global_config.notify_IfSendMail): | ||
|
||
# 第三方 SMTP 服务配置 | ||
mail_host = "smtp.163.com" # 设置服务器 | ||
mail_sender = "[email protected]" # 用户名 | ||
mail_key = "SYrq87nDLD4RNB5T" # 授权码 24/11/15 | ||
|
||
# 定义邮件正文 | ||
message = MIMEText(content, "plain", "utf-8") | ||
message["From"] = formataddr( | ||
( | ||
Header("AUTO_MAA通知服务", "utf-8").encode(), | ||
"[email protected]", | ||
) | ||
) # 发件人显示的名字 | ||
message["To"] = formataddr( | ||
( | ||
Header("AUTO_MAA用户", "utf-8").encode(), | ||
self.config.global_config.get( | ||
self.config.global_config.notify_MailAddress | ||
), | ||
) | ||
) # 收件人显示的名字 | ||
message["Subject"] = Header(title, "utf-8") | ||
|
||
try: | ||
smtpObj = smtplib.SMTP_SSL(mail_host, 465) # 465为SMTP_SSL默认端口 | ||
smtpObj.login(mail_sender, mail_key) | ||
smtpObj.sendmail( | ||
mail_sender, | ||
self.config.global_config.get( | ||
self.config.global_config.notify_MailAddress | ||
), | ||
message.as_string(), | ||
) | ||
return True | ||
except smtplib.SMTPException as e: | ||
return f"发送邮件时出错:\n{e}" | ||
finally: | ||
smtpObj.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
""" | ||
AUTO_MAA | ||
AUTO_MAA主程序 | ||
AUTO_MAA安全服务 | ||
v4.2 | ||
作者:DLmaster_361 | ||
""" | ||
|
Oops, something went wrong.