diff --git a/app.py b/app.py index bbbf66a..2d8a78e 100644 --- a/app.py +++ b/app.py @@ -359,6 +359,34 @@ def proxy_dns(): return jsonify({"error": str(e)}), 502 +@app.route('/extra_urls', methods=['GET', 'POST', 'DELETE']) +def proxy_extra_urls(): + """Proxies extra URL management requests to the backend.""" + if not session.get("config_logged_in"): + return jsonify({'error': 'Unauthorized'}), 401 + + backend_url = f"{app.config['BACKEND_URL']}/extra_urls" + credentials = base64.b64decode(session["auth_credentials"]).decode() + username, password = credentials.split(":", 1) + auth = requests.auth.HTTPBasicAuth(username, password) + + try: + if request.method == 'GET': + response = requests.get(backend_url, auth=auth) + elif request.method == 'POST': + response = requests.post(backend_url, auth=auth, json=request.get_json()) + if response.ok: + cache.clear() + elif request.method == 'DELETE': + response = requests.delete(backend_url, auth=auth, json=request.get_json()) + if response.ok: + cache.clear() + + return Response(response.content, status=response.status_code, mimetype=response.headers['Content-Type']) + except requests.exceptions.RequestException as e: + return jsonify({"error": str(e)}), 502 + + if __name__ == "__main__": app.run( debug=app.config["DEBUG"], diff --git a/templates/config_dashboard.html b/templates/config_dashboard.html index 50d46b6..7f6ffe3 100644 --- a/templates/config_dashboard.html +++ b/templates/config_dashboard.html @@ -3,35 +3,78 @@ {% block title %}Config Dashboard{% endblock %} {% block content %} -
Welcome to the configuration page.
- - +DNS Entry | +Actions | +
---|
Extra URL | +Actions | +
---|
DNS Entry | -Actions | -
---|