Enrich vip-track ntfy/avatar lookup, add wechat-users API CRUD, and mount admin user-list inside the SPA shell instead of a fullscreen back-button overlay. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
692 B
Python
21 lines
692 B
Python
# -*- coding: utf-8 -*-
|
|
from pathlib import Path
|
|
import re
|
|
p = Path("/www/server/panel/vhost/nginx/proxy/vip.hackrobot.cn/886f743b90957775e40b8bbb4aa07c67_vip.hackrobot.cn.conf")
|
|
t = p.read_text(encoding="utf-8")
|
|
if "vip-track.js" in t:
|
|
print("inject already present")
|
|
raise SystemExit(0)
|
|
m = re.search(r"location \^~ /\s*\{", t)
|
|
if not m:
|
|
raise SystemExit("proxy location not found")
|
|
insert = """
|
|
proxy_set_header Accept-Encoding "";
|
|
sub_filter_types text/html;
|
|
sub_filter '</body>' '<script src="/vip-track.js" defer></script></body>';
|
|
sub_filter_once on;
|
|
"""
|
|
t2 = t[: m.end()] + insert + t[m.end() :]
|
|
p.write_text(t2, encoding="utf-8")
|
|
print("proxy inject ok")
|