bugfix
This commit is contained in:
@@ -658,7 +658,7 @@ async def admin_setup_script(
|
||||
domain: str,
|
||||
server_name: str,
|
||||
os: str = "linux",
|
||||
authorization: str = Header(None),
|
||||
token: str = "",
|
||||
db: AsyncSession = Depends(get_db),
|
||||
_: bool = Depends(require_auth),
|
||||
):
|
||||
@@ -673,18 +673,13 @@ async def admin_setup_script(
|
||||
ext = "ps1" if os == "windows" else "sh"
|
||||
download_url = f"{base_url}/admin/api/script/download?domain={domain}&server_name={server_name}&os={os}"
|
||||
|
||||
# 提取 admin token 用于嵌入脚本
|
||||
admin_token = ""
|
||||
if authorization and authorization.startswith("Bearer "):
|
||||
admin_token = authorization[7:]
|
||||
|
||||
template_name = "setup-cert.ps1.j2" if os == "windows" else "setup-cert.sh.j2"
|
||||
tpl = jinja_env.get_template(template_name)
|
||||
script = tpl.render(
|
||||
domain=domain,
|
||||
server_name=server_name,
|
||||
download_url=download_url,
|
||||
admin_token=admin_token,
|
||||
admin_token=token,
|
||||
)
|
||||
filename = f"setup-{domain.replace('*', '_')}.{ext}"
|
||||
return PlainTextResponse(
|
||||
|
||||
Reference in New Issue
Block a user