Spaces:
Sleeping
Sleeping
Update licensing_client.py
Browse files- licensing_client.py +14 -1
licensing_client.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
# SYSTEM: ADVANCED RESOURCE & CONCURRENCY THREAD MANAGER
|
| 4 |
# FIX: DYNAMIC FILE-BASED TRANSACTION SHARING FOR MULTI-WORKERS
|
| 5 |
# DEBUGGING: CONTAINER RAW LOGS TRACER WITH STDOUT FLUSHING
|
|
|
|
| 6 |
# AUTHOR: Abu Alone © 2026
|
| 7 |
# =========================================================
|
| 8 |
|
|
@@ -196,6 +197,18 @@ def verify_and_get_license_info(key_input: str, device_id: str) -> tuple:
|
|
| 196 |
print(f" • Raw Plain Text Content (Dữ liệu thô từ Server):\n{response.text}", flush=True)
|
| 197 |
print("📥 " + "—"*55 + "\n", flush=True)
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
if response.status_code == 200:
|
| 200 |
res_data = response.json()
|
| 201 |
if res_data.get("status") == "success":
|
|
@@ -271,7 +284,7 @@ def allocate_render_thread(key_input: str, device_id: str, is_vip: bool) -> tupl
|
|
| 271 |
if thread["status"] == "rendering":
|
| 272 |
if is_vip and token and thread["key"] == token:
|
| 273 |
return False, "❌ This VIP Key is already running a rendering process! Multi-thread allocation denied."
|
| 274 |
-
if not is_vip
|
| 275 |
return False, "❌ Your device is currently rendering a video. Please wait until it completes!"
|
| 276 |
|
| 277 |
target_slot = None
|
|
|
|
| 3 |
# SYSTEM: ADVANCED RESOURCE & CONCURRENCY THREAD MANAGER
|
| 4 |
# FIX: DYNAMIC FILE-BASED TRANSACTION SHARING FOR MULTI-WORKERS
|
| 5 |
# DEBUGGING: CONTAINER RAW LOGS TRACER WITH STDOUT FLUSHING
|
| 6 |
+
# FALLBACK INTEGRATION: AUTOMATIC ROUTE PATH RECOVERY (FIX 404)
|
| 7 |
# AUTHOR: Abu Alone © 2026
|
| 8 |
# =========================================================
|
| 9 |
|
|
|
|
| 197 |
print(f" • Raw Plain Text Content (Dữ liệu thô từ Server):\n{response.text}", flush=True)
|
| 198 |
print("📥 " + "—"*55 + "\n", flush=True)
|
| 199 |
|
| 200 |
+
# --------------------------------------------------
|
| 201 |
+
# THÊM LOGIC: TỰ ĐỘNG CHUYỂN ĐỔI TUYẾN ĐƯỜNG KHI DÍNH LỖI ĐỊNH VỊ 404 NOT FOUND
|
| 202 |
+
# --------------------------------------------------
|
| 203 |
+
if response.status_code == 404:
|
| 204 |
+
fallback_url = f"{SERVER_URL}/verify-key"
|
| 205 |
+
print(f"⚠️ [404 DETECTED] Không tìm thấy endpoint /api/verify-key. Đang tự động kích hoạt Route dự phòng: {fallback_url}", flush=True)
|
| 206 |
+
start_time = time.time()
|
| 207 |
+
response = requests.post(fallback_url, json=payload, headers=headers, timeout=10)
|
| 208 |
+
duration = time.time() - start_time
|
| 209 |
+
print(f"📡 [FALLBACK RESPONSE] Kết quả từ route dự phòng sau {duration:.3f} giây: Code {response.status_code}", flush=True)
|
| 210 |
+
print(f" • Raw Content dự phòng:\n{response.text}", flush=True)
|
| 211 |
+
|
| 212 |
if response.status_code == 200:
|
| 213 |
res_data = response.json()
|
| 214 |
if res_data.get("status") == "success":
|
|
|
|
| 284 |
if thread["status"] == "rendering":
|
| 285 |
if is_vip and token and thread["key"] == token:
|
| 286 |
return False, "❌ This VIP Key is already running a rendering process! Multi-thread allocation denied."
|
| 287 |
+
if not is_vip& device_id and thread["device"] == device_id:
|
| 288 |
return False, "❌ Your device is currently rendering a video. Please wait until it completes!"
|
| 289 |
|
| 290 |
target_slot = None
|