diff --git a/main.py b/main.py index c85bc4d..e7210f5 100644 --- a/main.py +++ b/main.py @@ -190,6 +190,29 @@ def add_server(): ) ) +@app.route("/del_server", methods=["POST"]) +def del_server(): + if request.method == "POST": + with open(CFG_PATH, "r") as file: + config = yaml.safe_load(file) or {} + + local_server_id = request.form.get("local_server_id") + try: + config["servers"].pop(local_server_id) + except KeyError as e: + pass + for client_id, client_config in config["clients"].items(): + try: + client_config["servers"].remove(local_server_id) + except ValueError as e: + pass + + with open(CFG_PATH, "w") as file: + yaml.safe_dump(config, file) + log.info("Deleting server %s", request.form.get("local_server_id")) + update_state() + return redirect(url_for("index", nt="server has been deleted")) + @app.route("/add_client", methods=["POST"]) def add_client(): diff --git a/static/layout.css b/static/layout.css index bca6992..b50b0c9 100644 --- a/static/layout.css +++ b/static/layout.css @@ -18,24 +18,13 @@ a { * -- HELPER STYLES -- * Over-riding some of the .pure-button styles to make my buttons look unique */ -.primary-button, -.secondary-button { - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; - border-radius: 20px; +.button { + border-radius: 6px; } -.primary-button { - color: #fff; - background: #1b98f8; - margin: 1em 0; -} -.secondary-button { - background: #fff; - border: 1px solid #ddd; - color: #666; - padding: 0.5em 2em; - font-size: 80%; +.delete-button { + background: #a20c0c; + border: 1px solid #010101; + color: #ffffff; } /* diff --git a/templates/index.html b/templates/index.html index d667595..aa8457b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -81,11 +81,6 @@

- - - - - {% set ns = namespace(total_bytes=0) %} @@ -137,10 +132,14 @@ - - + +
+ + +
+