+ a curse lies in waiting for the night of the dead.
+ you and your friends are in danger.
+ stop it before it activates.
+
+ i'm willing to help you.
+ you will have to perform a ritual.
+ here are the steps.
+
+ you can perform them in any order, except for the final step.
+ i'll reveal that when all others are complete, just to be safe.
+
+
+ {% for quest in g.event_progress %}
+
+
+ {% if quest %}
+
+ {% else %}
+
+ {% endif %}
+
+ {% if loop.index == 1 %}
+ {# hecarim o chaos knight #}
+
+ unleash the horsemen
+
+
+ you'll need the help of the horsemen of the apocalypse to dispel the curse.
+ lead Chaos to victory in the battle of the ancients, or the War from the shadow isles to victory on the rift, and you'll gain their support.
+
+ {% elif loop.index == 2 %}
+ {# la zucca di balu e max #}
+
+ carve the ritual pumpkin
+
+
+ prepare a pumpkin, and empty its inside.
+ carve something on its exterior then put a light inside of it.
+ when dusk has come, take a picture, and post it to the owl captain.
+
+ find the 2038th sound of halloween.
+ then, follow the circle pattern.
+
+ it is rather dashing, isn't it?
+
+ {% elif loop.index == 4 %}
+
+ uproot the evil
+
+
+ listen to the sounds in here.
+ do you hear the evil that stole your voice?
+ answer it.
+
+
+ {% elif loop.index == 5 %}
+
+ remove the ghosts
+
+
+ during the ritual something strange might happen.
+ in that case, the ghosts probably will be to blame.
+ to be safe, i would remove them...
+
+ who should you call?
+
+ {% elif loop.index == 6 %}
+
+ conquer the mansion
+
+
+ a mansion has appeared.
+ prove yourself worthy, and find the words hidden deep inside.
+ only then i can trust you to completely perform the ritual.
+
+
+ {% elif loop.index == 7 %}
+
+
+
+
+
+
+ {% elif loop.index == 8 %}
+
+
+
+
+
+
+ {% elif loop.index == 9 %}
+
+
+
+
+
+
+ {% elif loop.index == 10 %}
+
+
+
+
+
+
+ {% endif %}
+
+ {% endfor %}
+
+
+
+
\ No newline at end of file
diff --git a/templates/ritual.html b/templates/ritual.html
deleted file mode 100644
index 9aa465cf..00000000
--- a/templates/ritual.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{% extends 'base.html' %}
-
-{% block pagetitle %}
- Rituale {{ n }}
-{% endblock %}
-
-{% block body %}
-
- Rituale {{ n }}
-
-
-
- {% if n == 1 %}
- {% elif n == 2 %}
- {% elif n == 3 %}
- {% elif n == 4 %}
- {% elif n == 5 %}
- {% elif n == 6 %}
- {% elif n == 7 %}
- {% elif n == 8 %}
- {% elif n == 9 %}
- {% elif n == 10 %}
- {% endif %}
-
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/webserver.py b/webserver.py
index bbe34ee2..35555c27 100644
--- a/webserver.py
+++ b/webserver.py
@@ -1,4 +1,5 @@
-from flask import Flask, render_template, request, abort, redirect, url_for, Markup, escape
+import secrets
+from flask import Flask, render_template, request, abort, redirect, url_for, Markup, escape, jsonify
from flask import session as fl_session
from flask import g as fl_g
import db
@@ -84,7 +85,6 @@ def page_profile(name: str):
css = db_session.query(db.ProfileData).filter_by(royal=user).one_or_none()
steam = db_session.query(db.Steam).filter_by(royal=user).one_or_none()
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
- # rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
ow = db_session.query(db.Overwatch).filter_by(royal=user).one_or_none()
@@ -333,6 +333,34 @@ def page_diario():
return render_template("diario.html", g=fl_g, entries=diario_entries)
+@app.route("/api/token")
+def page_token():
+ username = request.form.get("username", "")
+ password = request.form.get("password", "")
+ db_session = db.Session()
+ user = db_session.query(db.Royal).filter_by(username=username).one_or_none()
+ if user is None:
+ db_session.close()
+ abort(403)
+ return
+ if user.password is None:
+ db_session.close()
+ abort(403)
+ if bcrypt.checkpw(bytes(password, encoding="utf8"), user.password):
+ new_token = db.LoginToken(royal=user, token=secrets.token_urlsafe())
+ db_session.add(new_token)
+ db_session.commit()
+ db_session.close()
+ return jsonify({
+ "id": user.id,
+ "username": user.username,
+ "token": new_token.token
+ })
+ else:
+ abort(403)
+ return
+
+
@app.route("/spooky", methods=["POST"])
def page_spooky():
if request.form.get("solution", "") != "1":
@@ -348,41 +376,13 @@ def page_spooky():
return redirect(url_for("page_main"))
-@app.route("/ritual/", methods=["GET", "POST"])
-def page_ritual(n: int):
- user_id = fl_session.get("user_id")
- if not user_id:
- return redirect(url_for("page_login"))
- if request.method == "GET":
- return render_template("ritual.html", g=fl_g, n=n)
- elif request.method == "POST":
- if n == 1:
- pass
- elif n == 2:
- pass
- elif n == 3:
- pass
- elif n == 4:
- pass
- elif n == 5:
- pass
- elif n == 6:
- pass
- elif n == 7:
- pass
- elif n == 8:
- pass
- elif n == 9:
- pass
- elif n == 10:
- pass
- return redirect(url_for("page_ritual", n=n))
-
-
@app.before_request
def pre_request():
- fl_g["css"] = "spoopy.less" if db.Halloween.event_started() else "nryg.less"
- fl_g["rygconf"] = config
+ fl_g.event_started, fl_g.event_progress = db.Halloween.puzzle_status()
+ fl_g.time_left = datetime.datetime.fromtimestamp(1540999800) - datetime.datetime.now()
+ fl_g.display_on_main_site = (fl_g.time_left < datetime.timedelta(days=7)) or __debug__
+ fl_g.css = "spoopy.less" if (fl_g.event_started or __debug__) else "nryg.less"
+ fl_g.rygconf = config
if __name__ == "__main__":