mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
bugfixes
This commit is contained in:
parent
ae71ab8073
commit
62aca02aab
3
app.py
3
app.py
@ -25,6 +25,7 @@ except FileNotFoundError:
|
|||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
app.config['SESSION_TYPE'] = 'redis'
|
app.config['SESSION_TYPE'] = 'redis'
|
||||||
|
app.config['SESSION_COOKIE_HTTPONLY'] = False
|
||||||
app.cache = Cache(app, config={'CACHE_TYPE': 'redis'})
|
app.cache = Cache(app, config={'CACHE_TYPE': 'redis'})
|
||||||
sess = Session()
|
sess = Session()
|
||||||
sess.init_app(app)
|
sess.init_app(app)
|
||||||
@ -354,7 +355,7 @@ def route_api_scores_get():
|
|||||||
})
|
})
|
||||||
|
|
||||||
user = db.users.find_one({'username': username})
|
user = db.users.find_one({'username': username})
|
||||||
return jsonify({'scores': scores, 'username': user['username'], 'display_name': user['display_name']})
|
return jsonify({'status': 'ok', 'scores': scores, 'username': user['username'], 'display_name': user['display_name']})
|
||||||
|
|
||||||
|
|
||||||
def make_preview(song_id, song_type, preview):
|
def make_preview(song_id, song_type, preview):
|
||||||
|
@ -157,7 +157,7 @@ class Loader{
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
if(gameConfig._accounts){
|
if(gameConfig._accounts){
|
||||||
var token = Cookies.get("token")
|
var token = Cookies.get("session")
|
||||||
if(token){
|
if(token){
|
||||||
this.addPromise(this.ajax("/api/scores/get").then(response => {
|
this.addPromise(this.ajax("/api/scores/get").then(response => {
|
||||||
response = JSON.parse(response)
|
response = JSON.parse(response)
|
||||||
|
@ -51,13 +51,20 @@ class ScoreStorage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prepareScores(scores){
|
||||||
|
var output = []
|
||||||
|
for (var k in scores) {
|
||||||
|
songs.push({'hash': k, 'score': scores[k]})
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
save(localOnly){
|
save(localOnly){
|
||||||
for(var hash in this.scores){
|
for(var hash in this.scores){
|
||||||
this.writeString(hash)
|
this.writeString(hash)
|
||||||
}
|
}
|
||||||
this.write()
|
this.write()
|
||||||
return this.sendToServer({
|
return this.sendToServer({
|
||||||
scores: this.scoreStrings,
|
scores: this.prepareScores(this.scoreStrings),
|
||||||
is_import: true
|
is_import: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -163,7 +170,7 @@ class ScoreStorage{
|
|||||||
}
|
}
|
||||||
this.write()
|
this.write()
|
||||||
this.sendToServer({
|
this.sendToServer({
|
||||||
scores: this.scoreStrings,
|
scores: this.prepareScores(this.scoreStrings),
|
||||||
is_import: true
|
is_import: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -181,7 +188,7 @@ class ScoreStorage{
|
|||||||
account.loggedIn = false
|
account.loggedIn = false
|
||||||
delete account.username
|
delete account.username
|
||||||
delete account.displayName
|
delete account.displayName
|
||||||
Cookies.remove("token")
|
Cookies.remove("session")
|
||||||
this.load()
|
this.load()
|
||||||
pageEvents.send("logout")
|
pageEvents.send("logout")
|
||||||
return Promise.reject()
|
return Promise.reject()
|
||||||
|
Loading…
Reference in New Issue
Block a user