Core: Update UUID handling to be more easily sharable between libraries (#5088)

moves uuid caching to appdata and uuid generation to be a random uuid instead of getnode's hardware address driven identifier and updates docs to point to the shared cache
This commit is contained in:
qwint
2025-07-15 00:10:40 -05:00
committed by GitHub
parent ec3f168a09
commit f45410c917
2 changed files with 15 additions and 5 deletions

View File

@@ -413,13 +413,23 @@ def get_adjuster_settings(game_name: str) -> Namespace:
@cache_argsless
def get_unique_identifier():
uuid = persistent_load().get("client", {}).get("uuid", None)
common_path = cache_path("common.json")
if os.path.exists(common_path):
with open(common_path) as f:
common_file = json.load(f)
uuid = common_file.get("uuid", None)
else:
common_file = {}
uuid = None
if uuid:
return uuid
import uuid
uuid = uuid.getnode()
persistent_store("client", "uuid", uuid)
from uuid import uuid4
uuid = str(uuid4())
common_file["uuid"] = uuid
with open(common_path, "w") as f:
json.dump(common_file, f, separators=(",", ":"))
return uuid