mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00
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:
18
Utils.py
18
Utils.py
@@ -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
|
||||
|
||||
|
||||
|
@@ -294,7 +294,7 @@ Sent by the client to initiate a connection to an Archipelago game session.
|
||||
| password | str | If the game session requires a password, it should be passed here. |
|
||||
| game | str | The name of the game the client is playing. Example: `A Link to the Past` |
|
||||
| name | str | The player name for this client. |
|
||||
| uuid | str | Unique identifier for player client. |
|
||||
| uuid | str | Unique identifier for player. Cached in the user cache \Archipelago\Cache\common.json |
|
||||
| version | [NetworkVersion](#NetworkVersion) | An object representing the Archipelago version this client supports. |
|
||||
| items_handling | int | Flags configuring which items should be sent by the server. Read below for individual flags. |
|
||||
| tags | list\[str\] | Denotes special features or capabilities that the sender is capable of. [Tags](#Tags) |
|
||||
|
Reference in New Issue
Block a user