cleanup
This commit is contained in:
parent
1d2b1db9df
commit
5c80751484
18
app.py
18
app.py
@ -387,24 +387,6 @@ def proxy_extra_urls():
|
|||||||
return jsonify({"error": str(e)}), 502
|
return jsonify({"error": str(e)}), 502
|
||||||
|
|
||||||
|
|
||||||
@app.route('/extra_urls_file', methods=['GET'])
|
|
||||||
def proxy_extra_urls_file():
|
|
||||||
"""Proxies the request to get the extra_urls.txt file from the backend."""
|
|
||||||
if not session.get("config_logged_in"):
|
|
||||||
return jsonify({'error': 'Unauthorized'}), 401
|
|
||||||
|
|
||||||
backend_url = f"{app.config['BACKEND_URL']}/extra_urls_file"
|
|
||||||
credentials = base64.b64decode(session["auth_credentials"]).decode()
|
|
||||||
username, password = credentials.split(":", 1)
|
|
||||||
auth = requests.auth.HTTPBasicAuth(username, password)
|
|
||||||
|
|
||||||
try:
|
|
||||||
response = requests.get(backend_url, auth=auth)
|
|
||||||
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__":
|
if __name__ == "__main__":
|
||||||
app.run(
|
app.run(
|
||||||
debug=app.config["DEBUG"],
|
debug=app.config["DEBUG"],
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
<input type="text" class="form-control" id="extra-url-input" placeholder="Enter Extra URL">
|
<input type="text" class="form-control" id="extra-url-input" placeholder="Enter Extra URL">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-primary" id="add-extra-url-btn">Add</button>
|
<button class="btn btn-primary" id="add-extra-url-btn">Add</button>
|
||||||
<button class="btn btn-secondary" id="view-extra-urls-file-btn">View extra_urls.txt</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
@ -251,11 +250,6 @@
|
|||||||
addExtraUrlBtn.addEventListener('click', addExtraUrl);
|
addExtraUrlBtn.addEventListener('click', addExtraUrl);
|
||||||
fetchExtraUrlsList();
|
fetchExtraUrlsList();
|
||||||
|
|
||||||
const viewExtraUrlsFileBtn = document.getElementById('view-extra-urls-file-btn');
|
|
||||||
viewExtraUrlsFileBtn.addEventListener('click', () => {
|
|
||||||
window.open("{{ url_for('proxy_extra_urls_file') }}", '_blank');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Other buttons
|
// Other buttons
|
||||||
document.getElementById('send-test-notification-btn').addEventListener('click', function() {
|
document.getElementById('send-test-notification-btn').addEventListener('click', function() {
|
||||||
fetch('{{ url_for("send_test_notification") }}', {
|
fetch('{{ url_for("send_test_notification") }}', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user