补充 world geo nginx snippet、OpenAPI/geo 热更新脚本,以及 popadmin package_name 定价补丁,便于运维对齐。 Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
751 B
Python
23 lines
751 B
Python
#!/usr/bin/env python3
|
|
from pathlib import Path
|
|
p = Path("/opt/spark-server/internal/transport/http/auth.go")
|
|
t = p.read_text()
|
|
bad = "strings.HasPrefix(path, /api/admin/)"
|
|
good = 'strings.HasPrefix(path, "/api/admin/")'
|
|
if bad in t:
|
|
t = t.replace(bad, good)
|
|
print("fixed broken quote")
|
|
t = t.replace("if adminPath(path) {\n\t\t\treturn true\n\t\t}", 'if strings.HasPrefix(path, "/api/admin/") {\n\t\t\treturn true\n\t\t}')
|
|
# remove AppID assignment if present
|
|
lines = []
|
|
for line in t.splitlines(True):
|
|
if "rc.AppID = principal.AppID" in line:
|
|
continue
|
|
lines.append(line)
|
|
t = "".join(lines)
|
|
p.write_text(t)
|
|
assert "adminPath(" not in t
|
|
assert "rc.AppID" not in t
|
|
assert '"/v1/subscriptions/plans"' in t
|
|
print("auth.go ready")
|