mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Remove /wireguard/{config} endpoint
This commit is contained in:
parent
f61e1b5c1a
commit
9c5c0cfb88
2 changed files with 0 additions and 18 deletions
|
@ -154,8 +154,3 @@ async def get_wireguard(api_key: APIKey = Depends(auth.get_api_key)):
|
|||
'client_config_active': wireguard.client_config_active()
|
||||
}
|
||||
|
||||
@app.get("/wireguard/{config}", tags=["WireGuard"])
|
||||
async def client_config_list(config, api_key: APIKey = Depends(auth.get_api_key)):
|
||||
return{
|
||||
'client_config': wireguard.client_config_list(config)
|
||||
}
|
||||
|
|
|
@ -19,18 +19,5 @@ def client_config_active():
|
|||
active_config = output.split("/etc/wireguard/")
|
||||
return(active_config[1])
|
||||
|
||||
def client_config_list(client_config):
|
||||
pattern = r'^[a-zA-Z0-9_-]+$'
|
||||
if not re.match(pattern, client_config):
|
||||
raise ValueError("Invalid client_config")
|
||||
|
||||
config_path = f"/etc/wireguard/{client_config}"
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
output = f.read().strip()
|
||||
return output.split('\n')
|
||||
except FileNotFoundError:
|
||||
raise FileNotFoundError("Client configuration file not found")
|
||||
|
||||
#TODO: where is the logfile??
|
||||
#TODO: is service connected?
|
||||
|
|
Loading…
Reference in a new issue