chore: refresh public mirror

This commit is contained in:
chen qiang
2026-08-17 11:43:13 +08:00
parent 1738c4f849
commit 5351e53b65
4 changed files with 16 additions and 4 deletions
+8 -3
View File
@@ -2002,7 +2002,7 @@ def cmd_login(secret_key: str, client_code: str = ""):
def _device_key_path() -> str:
return os.path.join(get_script_dir(), "device-key.json")
return os.path.join(os.path.expanduser("~"), ".oracle-jump-query", "device-key.json")
def _load_device_key() -> Dict[str, Any]:
@@ -2012,7 +2012,8 @@ def _load_device_key() -> Dict[str, Any]:
def _save_device_key(item: Dict[str, Any]) -> None:
path = _device_key_path()
with open(path, "w", encoding="utf-8") as f:
os.makedirs(os.path.dirname(path), mode=0o700, exist_ok=True)
with open(path, "x", encoding="utf-8") as f:
json.dump(item, f, ensure_ascii=False, indent=2)
try:
os.chmod(path, 0o600)
@@ -2043,7 +2044,11 @@ def cmd_device_register(device_name: str = ""):
private = Ed25519PrivateKey.generate()
public = private.public_key().public_bytes_raw()
key = {"device_id": "device-" + secrets.token_hex(12), "private_key": base64.b64encode(private.private_bytes_raw()).decode("ascii"), "public_key": base64.b64encode(public).decode("ascii"), "key_fingerprint": hashlib.sha256(public).hexdigest()}
_save_device_key(key)
try:
_save_device_key(key)
except FileExistsError:
# Another Skill process created the stable key first; never overwrite it.
key = _load_device_key()
mac_hash, mac_masked = _device_identity()
body = {"device_id": key["device_id"], "device_name": device_name or platform.node() or "Trusted device", "computer_name": platform.node(), "os_name": platform.platform(), "key_algorithm": "ED25519", "public_key": key["public_key"], "key_fingerprint": key["key_fingerprint"], "mac_hash": mac_hash, "mac_masked": mac_masked, "description": "Registered by oracle-jump-query skill"}
try: