Update to v8.16.0

This commit is contained in:
aapanel.com
2026-07-06 09:16:25 +08:00
parent 88012af9cf
commit c529749cf8
2034 changed files with 122712 additions and 38986 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ class CreateSSLMain:
"access_key":userInfo['access_key'],
"panel":1
}
cert_api = 'https://api.aapanel.com/aapanel_cert'
cert_api = f'{public.OfficialApiUrlBase()}/aapanel_cert'
result = json.loads(public.httpPost(cert_api,{'data': json.dumps(pdata)}))
if 'status' in result:
if result['status']:
+9 -2
View File
@@ -4,7 +4,12 @@ import requests
import os
import logging
import tempfile
import sys
os.chdir('/www/server/panel/')
if "/www/server/panel/class" not in sys.path:
sys.path.insert(0, "/www/server/panel/class")
import public
class UpdateSiteTotal:
# 类级别的常量定义,集中管理固定配置
@@ -12,9 +17,11 @@ class UpdateSiteTotal:
INSTALL_SCRIPT_TIMEOUT = 600 # 安装脚本超时时间(秒)
VERSION_CHECK_TIMEOUT = 10 # 版本检查超时时间(秒)
SCRIPT_DOWNLOAD_TIMEOUT = 15 # 脚本下载超时时间(秒)
site_total_path = '/www/server/site_total'
download_url = 'https://node.aapanel.com/site_total/'
try:
download_url = f'{public.OfficialDownloadBase()}/site_total/'
except:
download_url = 'https://node.aapanel.com'
version_url = download_url + 'version.txt'
install_sh = download_url + 'install.sh'
site_total_bin = os.path.join(site_total_path, 'site_total')
+71
View File
@@ -0,0 +1,71 @@
#coding: utf-8
# -------------------------------------------------------------------
# aapanel - agent notification CLI
# Standalone entry that sends a notification via mod/base/push_mod channels.
# Call directly for an immediate notify, or from a cron task for scheduled ones:
# btpython /www/server/panel/script/notify_cli.py --title "..." --message "..." --channels mail,discord
#
# send_notify() is the single source of truth for the sending logic - it is also
# imported by the agent Notify tool (panel_tools.Notify), so the CLI and the tool
# never diverge.
# -------------------------------------------------------------------
import sys
import os
import argparse
def send_notify(title, message, channels=None):
"""Send a notification to all enabled non-sms push channels.
channels: optional list of sender_type (e.g. ['mail','discord']); None = all enabled.
Returns a list of per-channel dicts {channel, ok, error}.
Caller must ensure panel root is on sys.path (so mod.base.* is importable)."""
from mod.base.push_mod.mods import SenderConfig
from mod.base.push_mod.system import PushSystem
ps = PushSystem()
wanted = set(channels) if channels else None
results = []
for s in SenderConfig().config:
if not s.get("used"):
continue
st = s.get("sender_type")
if st == "sms": # sms uses a template mechanism, not free text
continue
if wanted is not None and st not in wanted:
continue
try:
res = ps.sender_cls(st)(s).send_msg(msg=message, title=title)
results.append({"channel": st, "ok": not isinstance(res, str),
"error": res if isinstance(res, str) else None})
except Exception as e:
results.append({"channel": st, "ok": False, "error": str(e)})
return results
def main():
# Panel runtime environment - only needed when run as a standalone script.
os.chdir('/www/server/panel')
sys.path.insert(0, '/www/server/panel')
sys.path.insert(0, 'class/')
sys.path.insert(0, 'class_v2/')
parser = argparse.ArgumentParser(description="Send a notification via configured push channels.")
parser.add_argument("--title", required=True, help="Notification title")
parser.add_argument("--message", required=True, help="Notification body (markdown supported by most channels)")
parser.add_argument("--channels", default="",
help="Comma-separated sender_type list, e.g. 'mail,discord'. Empty = all enabled non-sms channels")
args = parser.parse_args()
channels = [c.strip() for c in args.channels.split(",") if c.strip()] or None
# Shell double-quotes don't parse \n/\t; convert literal escapes so a cron sBody like
# --message "line1\nline2" renders as two lines (Notify tool passes real newlines, unaffected).
message = args.message.replace('\\n', '\n').replace('\\t', '\t')
results = send_notify(args.title, message, channels)
sent = sum(1 for r in results if r["ok"])
print("notify sent %d/%d channels" % (sent, len(results)))
for r in results:
print(" - %s: %s" % (r["channel"], "ok" if r["ok"] else "fail: %s" % r.get("error")))
sys.exit(0 if sent > 0 else 1)
if __name__ == "__main__":
main()
+1 -1
View File
@@ -518,7 +518,7 @@ class ServicesHelper:
if self.nick_name == "panel":
if not os.path.exists(f"{SETUP_PATH}/panel/init.sh"):
from public import get_url
os.system(f"curl -k {get_url()}/install/update_7.x_en.sh|bash &")
os.system(f"curl -k {get_url()}/install/update_panel_en.sh|bash &")
cmd = ["bash", bash_path, act]
elif self.nick_name == "pdns":
+8 -2
View File
@@ -133,7 +133,10 @@ class Version:
self.update_time = 0
panel_packet_name = self.panel_packet_name()
url = f"https://node.aapanel.com/install/update/{panel_packet_name}-{self}.pl"
if "/www/server/panel/class" not in sys.path:
sys.path.insert(0, "/www/server/panel/class")
import public
url = f"{public.OfficialDownloadBase()}/install/update/{panel_packet_name}-{self}.pl"
try:
info = http_get(url)
info_dict = json.loads(info)
@@ -165,7 +168,10 @@ class Version:
print("WARNING: Failed to retrieve version checksum info. Please verify the source.")
panel_packet_name = self.panel_packet_name()
down_url = f"https://node.aapanel.com/install/update/{panel_packet_name}-{self}.zip"
if "/www/server/panel/class" not in sys.path:
sys.path.insert(0, "/www/server/panel/class")
import public
down_url = f"{public.OfficialDownloadBase()}/install/update/{panel_packet_name}-{self}.zip"
# 下载主文件
if not download_with_progress(down_url, filename):
return False