forked from MarseyWorld/MarseyWorld
fix issues for new instances
parent
e793a1ab3a
commit
7404d94610
|
@ -89,13 +89,13 @@ def get_users(usernames, graceful=False):
|
||||||
|
|
||||||
return users
|
return users
|
||||||
|
|
||||||
def get_account(id, v=None):
|
def get_account(id, v=None, graceful=False):
|
||||||
|
|
||||||
try: id = int(id)
|
try: id = int(id)
|
||||||
except: abort(404)
|
except: abort(404)
|
||||||
|
|
||||||
user = g.db.get(User, id)
|
user = g.db.get(User, id)
|
||||||
if not user: abort(404)
|
if not user and not graceful: abort(404)
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
block = g.db.query(UserBlock).filter(
|
block = g.db.query(UserBlock).filter(
|
||||||
|
|
|
@ -26,8 +26,11 @@ def get_logged_in_user():
|
||||||
lo_user = session.get("lo_user")
|
lo_user = session.get("lo_user")
|
||||||
if lo_user:
|
if lo_user:
|
||||||
id = int(lo_user)
|
id = int(lo_user)
|
||||||
v = get_account(id)
|
v = get_account(id, graceful=True)
|
||||||
if v:
|
if not v:
|
||||||
|
session.clear()
|
||||||
|
return None
|
||||||
|
else:
|
||||||
nonce = session.get("login_nonce", 0)
|
nonce = session.get("login_nonce", 0)
|
||||||
if nonce < v.login_nonce or v.id != id: abort(401)
|
if nonce < v.login_nonce or v.id != id: abort(401)
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ def leaderboard_thread():
|
||||||
users9 = []
|
users9 = []
|
||||||
for user in users8:
|
for user in users8:
|
||||||
users9.append((user.id, votes3[user.id]))
|
users9.append((user.id, votes3[user.id]))
|
||||||
|
if not users9: users9 = [(None,None)]
|
||||||
users9 = sorted(users9, key=lambda x: x[1], reverse=True)
|
users9 = sorted(users9, key=lambda x: x[1], reverse=True)
|
||||||
users9_1, users9_2 = zip(*users9[:25])
|
users9_1, users9_2 = zip(*users9[:25])
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ def leaderboard_thread():
|
||||||
users13 = []
|
users13 = []
|
||||||
for user in users14:
|
for user in users14:
|
||||||
users13.append((user.id, votes3[user.id]-user.post_count-user.comment_count))
|
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 = sorted(users13, key=lambda x: x[1], reverse=True)
|
||||||
users13_1, users13_2 = zip(*users13[:25])
|
users13_1, users13_2 = zip(*users13[:25])
|
||||||
|
|
||||||
|
|
|
@ -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.
|
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.
|
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.
|
|
||||||
|
|
Loading…
Reference in New Issue