feat: dump players.json without userId
This commit is contained in:
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