forked from rDrama/rDrama
1
0
Fork 0

fix issues for new instances

master
Aevann1 2022-09-05 22:37:38 +02:00
parent e793a1ab3a
commit 7404d94610
4 changed files with 10 additions and 6 deletions

View File

@ -89,13 +89,13 @@ def get_users(usernames, graceful=False):
return users
def get_account(id, v=None):
def get_account(id, v=None, graceful=False):
try: id = int(id)
except: abort(404)
user = g.db.get(User, id)
if not user: abort(404)
if not user and not graceful: abort(404)
if v:
block = g.db.query(UserBlock).filter(

View File

@ -26,8 +26,11 @@ def get_logged_in_user():
lo_user = session.get("lo_user")
if lo_user:
id = int(lo_user)
v = get_account(id)
if v:
v = get_account(id, graceful=True)
if not v:
session.clear()
return None
else:
nonce = session.get("login_nonce", 0)
if nonce < v.login_nonce or v.id != id: abort(401)

View File

@ -30,6 +30,7 @@ def leaderboard_thread():
users9 = []
for user in users8:
users9.append((user.id, votes3[user.id]))
if not users9: users9 = [(None,None)]
users9 = sorted(users9, key=lambda x: x[1], reverse=True)
users9_1, users9_2 = zip(*users9[:25])
@ -41,6 +42,7 @@ def leaderboard_thread():
users13 = []
for user in users14:
users13.append((user.id, votes3[user.id]-user.post_count-user.comment_count))
if not users13: users13 = [(None,None)]
users13 = sorted(users13, key=lambda x: x[1], reverse=True)
users13_1, users13_2 = zip(*users13[:25])

View File

@ -30,4 +30,3 @@ For returning contributors, we have noticed the following issues (if you can hel
1. Docker doesn't know when we add a new Python dependency, `docker-compose build` is needed.
2. DB schema changes are not applied automatically, the easiest way to deal with that is to delete the entire environment from the Docker GUI and do `docker-compose up`. Also wait five minutes for a "sneed" commit from Aevann meaning that the sql file was regenerated.
3. Old authorization cookies from the previous instance cause a weird 404 error, clear cookies for localhost to fix.