feat: dump players.json without userId
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -3,6 +3,6 @@
|
|||||||
/*.txt
|
/*.txt
|
||||||
|
|
||||||
/players.redb
|
/players.redb
|
||||||
/players.json*
|
|
||||||
|
|
||||||
/test.json
|
/players*.json*
|
||||||
|
/b50*.json*
|
||||||
20
utils/export_players.py
Normal file
20
utils/export_players.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import json
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
SALT = b"Lt2N5xgjJOqRsT5qVt7wWYw6SqOPZDI7"
|
||||||
|
|
||||||
|
|
||||||
|
def salted_hash_userid(player: dict):
|
||||||
|
uid = player["userId"]
|
||||||
|
hash_uid = hashlib.sha256(f"{uid}".encode("utf-8") + SALT)
|
||||||
|
player["userId"] = hash_uid.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with open("players.json", "r", encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
for entry in data:
|
||||||
|
salted_hash_userid(entry)
|
||||||
|
|
||||||
|
with open("players_pub.json", "w", encoding="utf-8") as f:
|
||||||
|
json.dump(data, f, ensure_ascii=False)
|
||||||
Reference in New Issue
Block a user