mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
Some bug fixes
This commit is contained in:
parent
929471698f
commit
ad62ac800c
2
app.py
2
app.py
@ -205,7 +205,7 @@ def route_api_register():
|
|||||||
return api_error('username_in_use')
|
return api_error('username_in_use')
|
||||||
|
|
||||||
password = data.get('password', '').encode('utf-8')
|
password = data.get('password', '').encode('utf-8')
|
||||||
if not 8 <= len(password) <= 5000:
|
if not 6 <= len(password) <= 5000:
|
||||||
return api_error('invalid_password')
|
return api_error('invalid_password')
|
||||||
|
|
||||||
salt = bcrypt.gensalt()
|
salt = bcrypt.gensalt()
|
||||||
|
@ -256,7 +256,7 @@ class Account{
|
|||||||
account.displayName = response.display_name
|
account.displayName = response.display_name
|
||||||
var loadScores = scores => {
|
var loadScores = scores => {
|
||||||
scoreStorage.load(scores)
|
scoreStorage.load(scores)
|
||||||
this.onEnd(false, true)
|
this.onEnd(false, true, true)
|
||||||
pageEvents.send("login", account.username)
|
pageEvents.send("login", account.username)
|
||||||
}
|
}
|
||||||
if(this.mode === "login"){
|
if(this.mode === "login"){
|
||||||
@ -267,7 +267,7 @@ class Account{
|
|||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
scoreStorage.save().catch(() => {}).finally(() => {
|
scoreStorage.save().catch(() => {}).finally(() => {
|
||||||
this.onEnd(false, true)
|
this.onEnd(false, true, true)
|
||||||
pageEvents.send("login", account.username)
|
pageEvents.send("login", account.username)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -294,7 +294,7 @@ class Account{
|
|||||||
delete account.username
|
delete account.username
|
||||||
delete account.displayName
|
delete account.displayName
|
||||||
var loadScores = scores => {
|
var loadScores = scores => {
|
||||||
Cookies.remove("token")
|
Cookies.remove("session")
|
||||||
scoreStorage.load()
|
scoreStorage.load()
|
||||||
this.onEnd(false, true)
|
this.onEnd(false, true)
|
||||||
pageEvents.send("logout")
|
pageEvents.send("logout")
|
||||||
@ -341,7 +341,7 @@ class Account{
|
|||||||
account.loggedIn = false
|
account.loggedIn = false
|
||||||
delete account.username
|
delete account.username
|
||||||
delete account.displayName
|
delete account.displayName
|
||||||
Cookies.remove("token")
|
Cookies.remove("session")
|
||||||
scoreStorage.load()
|
scoreStorage.load()
|
||||||
pageEvents.send("logout")
|
pageEvents.send("logout")
|
||||||
return Promise.resolve
|
return Promise.resolve
|
||||||
@ -351,6 +351,8 @@ class Account{
|
|||||||
if(!noNameChange && newName !== account.displayName){
|
if(!noNameChange && newName !== account.displayName){
|
||||||
promises.push(this.request("account/display_name", {
|
promises.push(this.request("account/display_name", {
|
||||||
display_name: newName
|
display_name: newName
|
||||||
|
}).then(() => {
|
||||||
|
account.displayName = newName
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
var error = false
|
var error = false
|
||||||
@ -368,7 +370,7 @@ class Account{
|
|||||||
this.onEnd(false, true)
|
this.onEnd(false, true)
|
||||||
}, errorFunc).catch(errorFunc)
|
}, errorFunc).catch(errorFunc)
|
||||||
}
|
}
|
||||||
onEnd(event, noSound){
|
onEnd(event, noSound, noReset){
|
||||||
var touched = false
|
var touched = false
|
||||||
if(event){
|
if(event){
|
||||||
if(event.type === "touchstart"){
|
if(event.type === "touchstart"){
|
||||||
@ -381,7 +383,7 @@ class Account{
|
|||||||
if(this.locked){
|
if(this.locked){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.clean()
|
this.clean(false, noReset)
|
||||||
assets.sounds["se_don"].play()
|
assets.sounds["se_don"].play()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new SongSelect(false, false, touched)
|
new SongSelect(false, false, touched)
|
||||||
@ -391,7 +393,7 @@ class Account{
|
|||||||
this.lock(true)
|
this.lock(true)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
var request = new XMLHttpRequest()
|
var request = new XMLHttpRequest()
|
||||||
request.open(obj ? "POST" : "GET", "api/" + url)
|
request.open("POST", "api/" + url)
|
||||||
pageEvents.load(request).then(() => {
|
pageEvents.load(request).then(() => {
|
||||||
this.lock(false)
|
this.lock(false)
|
||||||
if(request.status !== 200){
|
if(request.status !== 200){
|
||||||
@ -433,7 +435,7 @@ class Account{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clean(eventsOnly){
|
clean(eventsOnly, noReset){
|
||||||
if(!eventsOnly){
|
if(!eventsOnly){
|
||||||
cancelTouch = true
|
cancelTouch = true
|
||||||
this.keyboard.clean()
|
this.keyboard.clean()
|
||||||
@ -447,8 +449,10 @@ class Account{
|
|||||||
for(var i = 0; i < this.inputForms.length; i++){
|
for(var i = 0; i < this.inputForms.length; i++){
|
||||||
pageEvents.remove(this.inputForms[i], ["keydown", "keyup", "keypress"])
|
pageEvents.remove(this.inputForms[i], ["keydown", "keyup", "keypress"])
|
||||||
}
|
}
|
||||||
|
if(!noReset){
|
||||||
this.accountPass.reset()
|
this.accountPass.reset()
|
||||||
this.accountDel.reset()
|
this.accountDel.reset()
|
||||||
|
}
|
||||||
delete this.displayname
|
delete this.displayname
|
||||||
delete this.accountPassButton
|
delete this.accountPassButton
|
||||||
delete this.accountPass
|
delete this.accountPass
|
||||||
@ -460,7 +464,7 @@ class Account{
|
|||||||
delete this.saveButton
|
delete this.saveButton
|
||||||
delete this.inputForms
|
delete this.inputForms
|
||||||
}else if(this.mode === "login" || this.mode === "register"){
|
}else if(this.mode === "login" || this.mode === "register"){
|
||||||
if(!eventsOnly){
|
if(!eventsOnly && !noReset){
|
||||||
this.form.reset()
|
this.form.reset()
|
||||||
}
|
}
|
||||||
pageEvents.remove(this.form, "submit")
|
pageEvents.remove(this.form, "submit")
|
||||||
|
@ -9,7 +9,7 @@ class ScoreStorage{
|
|||||||
load(strings){
|
load(strings){
|
||||||
this.scores = {}
|
this.scores = {}
|
||||||
if(strings){
|
if(strings){
|
||||||
this.scoreStrings = strings
|
this.scoreStrings = this.prepareStrings(strings)
|
||||||
}else if(account.loggedIn){
|
}else if(account.loggedIn){
|
||||||
return
|
return
|
||||||
}else{
|
}else{
|
||||||
@ -58,6 +58,13 @@ class ScoreStorage{
|
|||||||
}
|
}
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
prepareStrings(scores){
|
||||||
|
var output = {}
|
||||||
|
for(var k in scores){
|
||||||
|
output[scores[k].hash] = scores[k].score
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
save(localOnly){
|
save(localOnly){
|
||||||
for(var hash in this.scores){
|
for(var hash in this.scores){
|
||||||
this.writeString(hash)
|
this.writeString(hash)
|
||||||
|
@ -202,7 +202,16 @@
|
|||||||
logout: "ログアウト",
|
logout: "ログアウト",
|
||||||
back: "もどる",
|
back: "もどる",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
save: "Save"
|
save: "Save",
|
||||||
|
displayName: "Displayed Name",
|
||||||
|
changePassword: "Change Password",
|
||||||
|
currentNewRepeat: [
|
||||||
|
"Current Password",
|
||||||
|
"New Password",
|
||||||
|
"Repeat New Password"
|
||||||
|
],
|
||||||
|
deleteAccount: "Delete Account",
|
||||||
|
verifyPassword: "Verify password to delete this account"
|
||||||
}
|
}
|
||||||
this.browserSupport = {
|
this.browserSupport = {
|
||||||
browserWarning: "サポートされていないブラウザを実行しています (%s)",
|
browserWarning: "サポートされていないブラウザを実行しています (%s)",
|
||||||
@ -645,7 +654,16 @@ function StringsCn(){
|
|||||||
logout: "登出",
|
logout: "登出",
|
||||||
back: "返回",
|
back: "返回",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
save: "Save"
|
save: "Save",
|
||||||
|
displayName: "Displayed Name",
|
||||||
|
changePassword: "Change Password",
|
||||||
|
currentNewRepeat: [
|
||||||
|
"Current Password",
|
||||||
|
"New Password",
|
||||||
|
"Repeat New Password"
|
||||||
|
],
|
||||||
|
deleteAccount: "Delete Account",
|
||||||
|
verifyPassword: "Verify password to delete this account"
|
||||||
}
|
}
|
||||||
this.browserSupport = {
|
this.browserSupport = {
|
||||||
browserWarning: "You are running an unsupported browser (%s)",
|
browserWarning: "You are running an unsupported browser (%s)",
|
||||||
@ -862,7 +880,16 @@ function StringsTw(){
|
|||||||
logout: "登出",
|
logout: "登出",
|
||||||
back: "返回",
|
back: "返回",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
save: "Save"
|
save: "Save",
|
||||||
|
displayName: "Displayed Name",
|
||||||
|
changePassword: "Change Password",
|
||||||
|
currentNewRepeat: [
|
||||||
|
"Current Password",
|
||||||
|
"New Password",
|
||||||
|
"Repeat New Password"
|
||||||
|
],
|
||||||
|
deleteAccount: "Delete Account",
|
||||||
|
verifyPassword: "Verify password to delete this account"
|
||||||
}
|
}
|
||||||
this.browserSupport = {
|
this.browserSupport = {
|
||||||
browserWarning: "You are running an unsupported browser (%s)",
|
browserWarning: "You are running an unsupported browser (%s)",
|
||||||
@ -1079,7 +1106,16 @@ function StringsKo(){
|
|||||||
logout: "로그 아웃",
|
logout: "로그 아웃",
|
||||||
back: "돌아간다",
|
back: "돌아간다",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
save: "Save"
|
save: "Save",
|
||||||
|
displayName: "Displayed Name",
|
||||||
|
changePassword: "Change Password",
|
||||||
|
currentNewRepeat: [
|
||||||
|
"Current Password",
|
||||||
|
"New Password",
|
||||||
|
"Repeat New Password"
|
||||||
|
],
|
||||||
|
deleteAccount: "Delete Account",
|
||||||
|
verifyPassword: "Verify password to delete this account"
|
||||||
}
|
}
|
||||||
this.browserSupport = {
|
this.browserSupport = {
|
||||||
browserWarning: "You are running an unsupported browser (%s)",
|
browserWarning: "You are running an unsupported browser (%s)",
|
||||||
|
@ -394,11 +394,10 @@
|
|||||||
h: 130
|
h: 130
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.multiplayer !== 2){
|
|
||||||
this.nameplateCache.get({
|
this.nameplateCache.get({
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
x: 167,
|
x: 167,
|
||||||
y: 160,
|
y: this.multiplayer === 2 ? 565 : 160,
|
||||||
w: 219,
|
w: 219,
|
||||||
h: 53,
|
h: 53,
|
||||||
id: "1p",
|
id: "1p",
|
||||||
@ -418,7 +417,6 @@
|
|||||||
blue: this.multiplayer === 2
|
blue: this.multiplayer === 2
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
ctx.fillStyle = "#000"
|
ctx.fillStyle = "#000"
|
||||||
ctx.fillRect(
|
ctx.fillRect(
|
||||||
@ -582,7 +580,7 @@
|
|||||||
this.nameplateCache.get({
|
this.nameplateCache.get({
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
x: 320,
|
x: 320,
|
||||||
y: this.multiplayer === 2 ? frameTop + 305 : frameTop + 20,
|
y: this.multiplayer === 2 ? 460 : 20,
|
||||||
w: 273,
|
w: 273,
|
||||||
h: 66,
|
h: 66,
|
||||||
id: "1p",
|
id: "1p",
|
||||||
|
Loading…
Reference in New Issue
Block a user