Fix always creating new account

This commit is contained in:
Li 2023-01-29 17:50:18 -08:00
parent 301067be0d
commit fe17f5e854
2 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@ -160,3 +160,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
settings.json

View File

@ -68,19 +68,24 @@ def genPlayFabSignature(requestBody, timestamp):
sha256 = hashlib.sha256()
sha256.update(requestBody.encode("UTF-8") + b"." + timestamp.encode("UTF-8") + b"." + configGet("PLAYER_SECRET").encode("UTF-8"))
return base64.b64encode(sha256.digest())
def configLoad():
global PLAYFAB_SETTINGS
global SETTING_FILE
if os.path.exists(SETTING_FILE):
PLAYFAB_SETTINGS = json.loads(open(SETTING_FILE, "r").read())
def configGet(key):
global PLAYFAB_SETTINGS
configLoad()
if key in PLAYFAB_SETTINGS:
return PLAYFAB_SETTINGS[key]
return None
def configSet(key, newValue):
global PLAYFAB_SETTINGS
if os.path.exists(SETTING_FILE):
PLAYFAB_SETTINGS = json.loads(open(SETTING_FILE, "r").read())
global PLAYFAB_SETTINGS
configLoad()
PLAYFAB_SETTINGS[key] = newValue
open(SETTING_FILE, "w").write(json.dumps(PLAYFAB_SETTINGS))
return newValue
@ -167,4 +172,5 @@ def Search(query, sfilter, orderBy, select, top, skip):
"select": select,
"top": top,
"skip": skip
})
})