new changes
This commit is contained in:
@@ -29,6 +29,11 @@ class CreateSiteRequest(BaseModel):
|
||||
ps: str = ""
|
||||
php_version: str = "74"
|
||||
force_https: bool = False
|
||||
proxy_upstream: str = ""
|
||||
proxy_websocket: bool = False
|
||||
dir_auth_path: str = ""
|
||||
dir_auth_user_file: str = ""
|
||||
php_deny_execute: bool = False
|
||||
|
||||
|
||||
class UpdateSiteRequest(BaseModel):
|
||||
@@ -37,6 +42,11 @@ class UpdateSiteRequest(BaseModel):
|
||||
ps: str | None = None
|
||||
php_version: str | None = None
|
||||
force_https: bool | None = None
|
||||
proxy_upstream: str | None = None
|
||||
proxy_websocket: bool | None = None
|
||||
dir_auth_path: str | None = None
|
||||
dir_auth_user_file: str | None = None
|
||||
php_deny_execute: bool | None = None
|
||||
|
||||
|
||||
@router.get("/list")
|
||||
@@ -66,6 +76,11 @@ async def site_create(
|
||||
ps=body.ps,
|
||||
php_version=body.php_version or "74",
|
||||
force_https=1 if body.force_https else 0,
|
||||
proxy_upstream=(body.proxy_upstream or "").strip(),
|
||||
proxy_websocket=1 if body.proxy_websocket else 0,
|
||||
dir_auth_path=(body.dir_auth_path or "").strip(),
|
||||
dir_auth_user_file=(body.dir_auth_user_file or "").strip(),
|
||||
php_deny_execute=1 if body.php_deny_execute else 0,
|
||||
)
|
||||
if not result["status"]:
|
||||
raise HTTPException(status_code=400, detail=result["msg"])
|
||||
@@ -126,12 +141,22 @@ async def site_update(
|
||||
):
|
||||
"""Update site domains, path, or note"""
|
||||
result = await update_site(
|
||||
db, site_id,
|
||||
db,
|
||||
site_id,
|
||||
path=body.path,
|
||||
domains=body.domains,
|
||||
ps=body.ps,
|
||||
php_version=body.php_version,
|
||||
force_https=None if body.force_https is None else (1 if body.force_https else 0),
|
||||
proxy_upstream=body.proxy_upstream,
|
||||
proxy_websocket=None
|
||||
if body.proxy_websocket is None
|
||||
else (1 if body.proxy_websocket else 0),
|
||||
dir_auth_path=body.dir_auth_path,
|
||||
dir_auth_user_file=body.dir_auth_user_file,
|
||||
php_deny_execute=None
|
||||
if body.php_deny_execute is None
|
||||
else (1 if body.php_deny_execute else 0),
|
||||
)
|
||||
if not result["status"]:
|
||||
raise HTTPException(status_code=400, detail=result["msg"])
|
||||
|
||||
Reference in New Issue
Block a user