teamsync-cluster 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: teamsync-cluster
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Verified licensed TeamSync kit bootstrap
5
5
  Author: TeamSync
6
6
  License: Proprietary
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "teamsync-cluster"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = "Verified licensed TeamSync kit bootstrap"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -1,2 +1,2 @@
1
1
  """Public download bootstrap. Installer implementation stays in private kits."""
2
- __version__ = "0.1.2"
2
+ __version__ = "0.1.4"
@@ -105,7 +105,7 @@ def _redeem(key, version, arch, license_only=False, request_id=None):
105
105
  body["host_fingerprint"] = hashlib.sha256(machine.read_bytes()).hexdigest()
106
106
  for attempt in range(3):
107
107
  request = urllib.request.Request(endpoint, data=json.dumps(body).encode(),
108
- headers={"Content-Type": "application/json", "User-Agent": "teamsync-cluster-bootstrap/0.1.2"}, method="POST")
108
+ headers={"Content-Type": "application/json", "User-Agent": "teamsync-cluster-bootstrap/0.1.4"}, method="POST")
109
109
  try:
110
110
  with _opener().open(request, timeout=60) as response:
111
111
  data = response.read(262145)
@@ -113,10 +113,16 @@ def _redeem(key, version, arch, license_only=False, request_id=None):
113
113
  raise FetchError("License response exceeds limit.")
114
114
  return json.loads(data)
115
115
  except urllib.error.HTTPError as exc:
116
+ if exc.code == 409:
117
+ raise FetchError("兌換重試期限已過;請聯絡支援確認授權用量,再移除 .teamsync-redeem.json 重試 / Redemption replay expired; contact support to check license usage before removing .teamsync-redeem.json and retrying.") from None
116
118
  if exc.code == 403:
117
119
  raise FetchError("License is invalid or unavailable. Contact TeamSync support.") from None
118
120
  if exc.code == 429:
119
121
  raise FetchError("Too many attempts. Wait one minute, then retry in the same destination.") from None
122
+ if exc.code == 422 and "request_id" in body and b"request_id" in exc.read(4096):
123
+ # Services older than v5.29 reject the retry nonce; redeem without it.
124
+ body.pop("request_id")
125
+ continue
120
126
  if exc.code < 500:
121
127
  raise FetchError("License service refused the request. Contact TeamSync support.") from None
122
128
  except (OSError, urllib.error.URLError, http.client.HTTPException, ValueError):
@@ -344,6 +350,7 @@ def fetch(args):
344
350
  # Preserve URLs immediately, including if later verification fails;
345
351
  # the license itself is not redeemed a second time on retry.
346
352
  _save(receipt, grant)
353
+ (destination / ".teamsync-redeem.json").unlink(missing_ok=True)
347
354
  version = _validate_grant(grant, arch, args.version)
348
355
  directory = destination / "downloads"
349
356
  directory.mkdir(mode=0o700, exist_ok=True)
@@ -409,6 +416,7 @@ def _renew(args):
409
416
  raise FetchError("Unexpected license renewal response.")
410
417
  verify_license(grant["license"], version=base["version"], arch=base["arch"])
411
418
  _save(root / "license.json", grant["license"])
419
+ (root / ".teamsync-redeem.json").unlink(missing_ok=True)
412
420
  print("License renewed: " + base["version"])
413
421
  return 0
414
422
 
@@ -432,7 +440,7 @@ def main(argv=None):
432
440
  os.environ.pop("TEAMSYNC_LICENSE_KEY", None)
433
441
  return _delegate(argv)
434
442
  parser = SecretSafeParser(prog="teamsync-cluster", description="Download a licensed TeamSync kit; other commands run its installer.")
435
- parser.add_argument("--version", action="version", version="teamsync-cluster bootstrap 0.1.2")
443
+ parser.add_argument("--version", action="version", version="teamsync-cluster bootstrap 0.1.4")
436
444
  sub = parser.add_subparsers(dest="command")
437
445
  command = sub.add_parser("fetch", help="Redeem once, resume downloads, verify, then unpack")
438
446
  keys = command.add_mutually_exclusive_group()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: teamsync-cluster
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Verified licensed TeamSync kit bootstrap
5
5
  Author: TeamSync
6
6
  License: Proprietary