mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
- Open the post-install menu from the PBS menu - List only the customizable options that apply to PBS - Offer the PBS no-subscription repository through the native repository API - Upgrade PBS with the package list shown before applying it - Remove and restore the subscription notice on the PBS web interface - Install Figurine on PBS without the Proxmox VE aliases - Offer the Helper-Scripts PBS post-install and microcode scripts - Tune firewall bridges after the systemd udev rules in the automated post-install - Add PBS repository policy tests and syntax checks - Document the PBS differences on the post-install page - Use backups in the Spanish PBS update message
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
"""Links between ProxMenux Monitors for the node selector in the header."""
|
|
|
|
from flask import Blueprint, jsonify, request
|
|
import monitor_links
|
|
from jwt_middleware import require_auth, require_admin_scope
|
|
|
|
monitor_links_bp = Blueprint("monitor_links", __name__)
|
|
|
|
|
|
@monitor_links_bp.after_request
|
|
def no_cache(response):
|
|
response.headers["Cache-Control"] = "no-store"
|
|
return response
|
|
|
|
|
|
@monitor_links_bp.route("/api/monitor-links")
|
|
@require_auth
|
|
def list_links():
|
|
return jsonify(monitor_links.cached_links(include_hidden=request.args.get("all") == "1"))
|
|
|
|
|
|
@monitor_links_bp.route("/api/monitor-links", methods=["POST"])
|
|
@require_admin_scope
|
|
def add_link():
|
|
try:
|
|
key = monitor_links.add_link(request.get_json(silent=True))
|
|
monitor_links.refresh()
|
|
return jsonify(success=True, key=key)
|
|
except monitor_links.LinkError as exc:
|
|
return jsonify(error=str(exc)), 400
|
|
except OSError:
|
|
return jsonify(error="Could not save the node list."), 500
|
|
|
|
|
|
@monitor_links_bp.route("/api/monitor-links/<path:key>", methods=["PATCH"])
|
|
@require_admin_scope
|
|
def update_link(key):
|
|
try:
|
|
monitor_links.update_link(key, request.get_json(silent=True))
|
|
monitor_links.refresh()
|
|
return jsonify(success=True)
|
|
except monitor_links.LinkError as exc:
|
|
return jsonify(error=str(exc)), 400
|
|
except OSError:
|
|
return jsonify(error="Could not save the node list."), 500
|
|
|
|
|
|
@monitor_links_bp.route("/api/monitor-links/<path:key>", methods=["DELETE"])
|
|
@require_admin_scope
|
|
def delete_link(key):
|
|
try:
|
|
monitor_links.delete_link(key)
|
|
monitor_links.refresh()
|
|
return jsonify(success=True)
|
|
except monitor_links.LinkError as exc:
|
|
return jsonify(error=str(exc)), 400
|
|
except OSError:
|
|
return jsonify(error="Could not save the node list."), 500
|