vc
This commit is contained in:
parent
08af62a95c
commit
0088bc5d21
2 changed files with 15 additions and 18 deletions
|
@ -77,7 +77,7 @@ def publish(pid, v):
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
cache.delete_memoized(User.userpagelisting)
|
cache.delete_memoized(User.userpagelisting)
|
||||||
|
|
||||||
if v.admin_level > 0 and ("[changelog]" in post.title or "(changelog)" in post.title):
|
if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
|
||||||
send_discord_message(f"{request.host_url}{post.permalink[1:]}")
|
send_discord_message(f"{request.host_url}{post.permalink[1:]}")
|
||||||
cache.delete_memoized(changeloglist)
|
cache.delete_memoized(changeloglist)
|
||||||
|
|
||||||
|
@ -1075,7 +1075,7 @@ def submit_post(v):
|
||||||
|
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
cache.delete_memoized(User.userpagelisting)
|
cache.delete_memoized(User.userpagelisting)
|
||||||
if v.admin_level > 0 and ("[changelog]" in new_post.title or "(changelog)" in new_post.title) and not new_post.private:
|
if v.admin_level > 0 and ("[changelog]" in new_post.title.lower() or "(changelog)" in new_post.title.lower()) and not new_post.private:
|
||||||
send_discord_message(f"{request.host_url}{new_post.permalink[1:]}")
|
send_discord_message(f"{request.host_url}{new_post.permalink[1:]}")
|
||||||
cache.delete_memoized(changeloglist)
|
cache.delete_memoized(changeloglist)
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,12 @@ def participation_stats(v):
|
||||||
|
|
||||||
day = now - 86400
|
day = now - 86400
|
||||||
|
|
||||||
data = {"marseys": g.db.query(Marsey.name).count(),
|
return render_template("admin/content_stats.html", v=v, title="Content Statistics", data=stats())
|
||||||
|
|
||||||
|
|
||||||
|
@cache.memoize(timeout=86400)
|
||||||
|
def stats():
|
||||||
|
return {"marseys": g.db.query(Marsey.name).count(),
|
||||||
"users": g.db.query(User.id).count(),
|
"users": g.db.query(User.id).count(),
|
||||||
"private_users": g.db.query(User.id).filter_by(is_private=True).count(),
|
"private_users": g.db.query(User.id).filter_by(is_private=True).count(),
|
||||||
"banned_users": g.db.query(User.id).filter(User.is_banned > 0).count(),
|
"banned_users": g.db.query(User.id).filter(User.is_banned > 0).count(),
|
||||||
|
@ -85,10 +90,6 @@ def participation_stats(v):
|
||||||
"awards_given": g.db.query(AwardRelationship.id).filter(or_(AwardRelationship.submission_id != None, AwardRelationship.comment_id != None)).count()
|
"awards_given": g.db.query(AwardRelationship.id).filter(or_(AwardRelationship.submission_id != None, AwardRelationship.comment_id != None)).count()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return render_template("admin/content_stats.html", v=v, title="Content Statistics", data=data)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/chart")
|
@app.get("/chart")
|
||||||
@cache.memoize(timeout=86400)
|
@cache.memoize(timeout=86400)
|
||||||
def chart():
|
def chart():
|
||||||
|
@ -301,13 +302,13 @@ def submit_contact(v):
|
||||||
return render_template("contact.html", v=v, msg="Your message has been sent.")
|
return render_template("contact.html", v=v, msg="Your message has been sent.")
|
||||||
|
|
||||||
@app.get('/archives')
|
@app.get('/archives')
|
||||||
@auth_required
|
@cache.memoize(timeout=86400)
|
||||||
def archivesindex(v):
|
def archivesindex():
|
||||||
return redirect("/archives/index.html")
|
return redirect("/archives/index.html")
|
||||||
|
|
||||||
@app.get('/archives/<path:path>')
|
@app.get('/archives/<path:path>')
|
||||||
@auth_required
|
@cache.memoize(timeout=86400)
|
||||||
def archives(v, path):
|
def archives(path):
|
||||||
resp = make_response(send_from_directory('/archives', path))
|
resp = make_response(send_from_directory('/archives', path))
|
||||||
if request.path.endswith('.css'): resp.headers.add("Content-Type", "text/css")
|
if request.path.endswith('.css'): resp.headers.add("Content-Type", "text/css")
|
||||||
return resp
|
return resp
|
||||||
|
@ -352,19 +353,15 @@ def robots_txt():
|
||||||
@app.get("/settings")
|
@app.get("/settings")
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings(v):
|
def settings(v):
|
||||||
|
|
||||||
|
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/settings/profile")
|
@app.get("/settings/profile")
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_profile(v):
|
def settings_profile(v):
|
||||||
|
return render_template("settings_profile.html", v=v)
|
||||||
|
|
||||||
|
|
||||||
return render_template("settings_profile.html",
|
|
||||||
v=v)
|
|
||||||
|
|
||||||
@app.get("/badges")
|
@app.get("/badges")
|
||||||
@auth_required
|
@auth_required
|
||||||
def badges(v):
|
def badges(v):
|
||||||
|
@ -400,8 +397,8 @@ def formatting(v):
|
||||||
return render_template("formatting.html", v=v)
|
return render_template("formatting.html", v=v)
|
||||||
|
|
||||||
@app.get("/service-worker.js")
|
@app.get("/service-worker.js")
|
||||||
@auth_required
|
@cache.memoize(timeout=86400)
|
||||||
def serviceworker(v):
|
def serviceworker():
|
||||||
with open("files/assets/js/service-worker.js", "r") as f: return Response(f.read(), mimetype='application/javascript')
|
with open("files/assets/js/service-worker.js", "r") as f: return Response(f.read(), mimetype='application/javascript')
|
||||||
|
|
||||||
@app.get("/settings/security")
|
@app.get("/settings/security")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue