mirror of
https://github.com/FAUSheppy/atlantis-event-dispatcher
synced 2025-12-06 06:21:36 +01:00
Compare commits
2 Commits
7fa965a92c
...
df1dfd8b0c
| Author | SHA1 | Date | |
|---|---|---|---|
| df1dfd8b0c | |||
| acf88ffa6e |
@@ -169,7 +169,7 @@ def webhooks():
|
||||
db.session.commit()
|
||||
return ("", 204)
|
||||
|
||||
@app.route('/downtime', methods=["DELETE","POST"])
|
||||
@app.route('/downtime', methods=["GET", "DELETE","POST"])
|
||||
def downtime():
|
||||
|
||||
# check static access token #
|
||||
@@ -179,11 +179,19 @@ def downtime():
|
||||
|
||||
if flask.request.method == "DELETE":
|
||||
app.config["DOWNTIME"] = datetime.datetime.now()
|
||||
return ('Downtime successfully disabled', 200)
|
||||
elif flask.request.method == "POST":
|
||||
minutes = int(flask.request.args.get("minutes") or 5)
|
||||
app.config["DOWNTIME"] = datetime.datetime.now() + datetime.timedelta(minutes=minutes)
|
||||
|
||||
return ('', 204)
|
||||
return ('Downtime set to {}'.format(app.config["DOWNTIME"].isoformat(), 204))
|
||||
elif flask.request.method == "GET":
|
||||
dt = app.config["DOWNTIME"]
|
||||
if dt < datetime.datetime.now():
|
||||
return flask.jsonify({"title" : "No Downtime set at the moment", "message" : ""})
|
||||
else:
|
||||
delta = int((dt - datetime.datetime.now()).total_seconds()/60)
|
||||
return flask.jsonify({"title" : "Downtime set for {}m until {}".format(delta, dt.isoformat()),
|
||||
"message" : ""})
|
||||
|
||||
|
||||
@app.route('/settings', methods=["GET", "POST"])
|
||||
|
||||
Reference in New Issue
Block a user