fixed stuff

This commit is contained in:
piair 2023-08-25 14:50:38 +02:00
parent 8acdcae7de
commit c712395d39
2 changed files with 33 additions and 29 deletions

View File

@ -58,33 +58,37 @@ def update_jobs():
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
configs = json.load(inFile) configs = json.load(inFile)
for i in configs: for i in configs:
h, m = configs[i]["time"].split(":") try :
print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m") h, m = configs[i]["time"].split(":")
TriggerDict[i] = CronTrigger( print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m")
year="*", month="*", day="*", hour=h, minute=m, second="0" TriggerDict[i] = CronTrigger(
) year="*", month="*", day="*", hour=h, minute=m, second="0"
if configs[i]["enabled"]: )
try : if configs[i]["enabled"]:
scheduler.remove_job(i) # on reset le job try :
except Exception as e: scheduler.remove_job(i) # on reset le job
print(f"\033[33merror with deleting config {i} : {e}\033[0m") 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(): def edit_version():
with open("/app/MsRewards-Reborn/version", "r") as f: with open("/app/MsRewards-Reborn/version", "r") as f:

View File

@ -39,10 +39,10 @@
{%if not current_user.is_authenticated %} {%if not current_user.is_authenticated %}
<h1>Already logged in</h1> <h1>Already logged in</h1>
{% else %} {% else %}
{{configs}}
{% for i in configs %}
<option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option>
{% for i in data %}
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}