From a0ea44be2114c3b3f81f1ef1c0cfab20c278811b Mon Sep 17 00:00:00 2001 From: Sebastian Mezger Date: Fri, 27 Sep 2024 20:25:16 +0200 Subject: [PATCH] Add a name to a Sunalyzer instance (#84) * fixes * fix Readme.md, reference correct repo * fix reference of css files to give custom.css highest prio * fix typos in localization.js * fix numberic * add name feature to name Sunalyzer instances --- backend/server.py | 11 +++++++++++ site/index.html | 2 +- site/js/main.js | 14 ++++++++++++++ templates/config.yml | 5 ++++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/backend/server.py b/backend/server.py index 8b00e02..c5b1b4f 100644 --- a/backend/server.py +++ b/backend/server.py @@ -368,6 +368,17 @@ def handle_request(): data = {"state": "error"} return json.dumps(data) +@app.route("/name", methods=['GET']) +def handle_name(): + + try: + return json.dumps(config.config_data['sunalyzer']['name']) + logging.debug(f"Server: REST request of type 'name' received") + except Exception: + logging.exception("Error while handling HTTP request") + data = {"state": "error"} + return json.dumps(data) + # Main loop def main(): diff --git a/site/index.html b/site/index.html index 0746d1f..45f41dc 100644 --- a/site/index.html +++ b/site/index.html @@ -21,7 +21,7 @@ - Sunalyzer + Sunalyzer