mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Remove /wireguard/{config} endpoint
This commit is contained in:
		| @@ -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? | ||||
|   | ||||
		Reference in New Issue
	
	Block a user