From 1c6903b3c0754dc41168dccc13000cb6ffa89459 Mon Sep 17 00:00:00 2001 From: Namonay Date: Mon, 2 Mar 2026 14:35:19 +0000 Subject: [PATCH] add: timer & reboot --- client/bs_shutdown.py | 4 ++-- server/src/data/app.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/bs_shutdown.py b/client/bs_shutdown.py index b251597..86ee7db 100644 --- a/client/bs_shutdown.py +++ b/client/bs_shutdown.py @@ -46,7 +46,7 @@ def set_shutdown(time, now): return LAST_VALUE = time print("[BS Shutdown] shutting down in " + str(time - now) + " seconds") - subprocess.run(["shutdown", "-s", "-t", str(time - now)]) + subprocess.run(["shutdown", "-r", "-t", str(time - now)]) def remove_shutdown(): @@ -84,4 +84,4 @@ def update(): if __name__ == '__main__': while True: update() - time.sleep(30) \ No newline at end of file + time.sleep(1800) \ No newline at end of file diff --git a/server/src/data/app.py b/server/src/data/app.py index f648bfe..cec4045 100644 --- a/server/src/data/app.py +++ b/server/src/data/app.py @@ -35,7 +35,7 @@ def get_db_connection(): conn = sqlite3.connect(DB_PATH) conn.row_factory = sqlite3.Row return conn - +# --- MAIN --- @app.route("/") def mainpage(): conn = get_db_connection() @@ -104,6 +104,8 @@ def delete(): conn.close() return redirect(url_for("mainpage")) +# --- END MAIN --- +# --- API --- @app.route("/lookup", methods=["POST"]) def lookup(): data = request.get_json() @@ -125,4 +127,5 @@ def lookup(): if item: return jsonify({"name": item["name"], "noshutdown": item["noshutdown"], "time": item["time"]}), 200 else: - return jsonify({"noshutdown": 0, "time": default_time}), 200 \ No newline at end of file + return jsonify({"noshutdown": 0, "time": default_time}), 200 +# --- END API --- \ No newline at end of file