diff --git a/Flask/app.py b/Flask/app.py index 04ef774..706a18a 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -58,33 +58,37 @@ def update_jobs(): with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: configs = json.load(inFile) for i in configs: - h, m = configs[i]["time"].split(":") - print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m") - TriggerDict[i] = CronTrigger( - year="*", month="*", day="*", hour=h, minute=m, second="0" - ) - if configs[i]["enabled"]: - try : - scheduler.remove_job(i) # on reset le job - except Exception as e: - print(f"\033[33merror with deleting config {i} : {e}\033[0m") + try : + h, m = configs[i]["time"].split(":") + print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m") + TriggerDict[i] = CronTrigger( + year="*", month="*", day="*", hour=h, minute=m, second="0" + ) + if configs[i]["enabled"]: + try : + scheduler.remove_job(i) # on reset le job + except Exception as e: + print(f"\033[33merror with deleting config {i} : {e}\033[0m") + + try : + scheduler.add_job( # on relance le job + start_ms, # --- + trigger=TriggerDict[i], # --- + args=[i], # --- + name="Daily start", # --- + id=i # --- + ) + print("\033[36m" + f"successfully created config {i}" + "\033[0m") + except Exception as e: + print(f"\033[33merror with creating config {i} : {e}\033[0m") + else : + try : + scheduler.remove_job(i) + except Exception as e : + print(f"\033[33merror with deleting config {i} : {e}\033[0m") + except Exception as e: + print(e) - try : - scheduler.add_job( # on relance le job - start_ms, # --- - trigger=TriggerDict[i], # --- - args=[i], # --- - name="Daily start", # --- - id=i # --- - ) - print("\033[36m" + f"successfully created config {i}" + "\033[0m") - except Exception as e: - print(f"\033[33merror with creating config {i} : {e}\033[0m") - else : - try : - scheduler.remove_job(i) - except Exception as e : - print(f"\033[33merror with deleting config {i} : {e}\033[0m") def edit_version(): with open("/app/MsRewards-Reborn/version", "r") as f: diff --git a/Flask/templates/logs.html b/Flask/templates/logs.html index 04cbfc9..f1b2de3 100644 --- a/Flask/templates/logs.html +++ b/Flask/templates/logs.html @@ -39,10 +39,10 @@ {%if not current_user.is_authenticated %}

Already logged in

{% else %} -{{configs}} -{% for i in configs %} - + +{% for i in data %} + {% endfor %} {% endif %}