mirror of
https://github.com/andrey271192/WARP-Web-UI.git
synced 2026-09-20 11:55:34 +00:00
fix: mask WARP license in API
This commit is contained in:
7
app.py
7
app.py
@@ -231,7 +231,8 @@ def warp_status():
|
|||||||
|
|
||||||
|
|
||||||
def parse_registration(stdout: str):
|
def parse_registration(stdout: str):
|
||||||
info = {"raw": stdout, "account_type": None, "account_id": None, "device_id": None, "license_masked": None}
|
raw_lines = []
|
||||||
|
info = {"raw": "", "account_type": None, "account_id": None, "device_id": None, "license_masked": None}
|
||||||
for line in (stdout or "").splitlines():
|
for line in (stdout or "").splitlines():
|
||||||
l = line.strip()
|
l = line.strip()
|
||||||
if l.lower().startswith("account type:"):
|
if l.lower().startswith("account type:"):
|
||||||
@@ -244,6 +245,10 @@ def parse_registration(stdout: str):
|
|||||||
lic = l.split(":", 1)[1].strip()
|
lic = l.split(":", 1)[1].strip()
|
||||||
if lic:
|
if lic:
|
||||||
info["license_masked"] = lic[:4] + "…" + lic[-4:] if len(lic) > 10 else lic
|
info["license_masked"] = lic[:4] + "…" + lic[-4:] if len(lic) > 10 else lic
|
||||||
|
raw_lines.append("License: " + info["license_masked"])
|
||||||
|
continue
|
||||||
|
raw_lines.append(line)
|
||||||
|
info["raw"] = "\n".join(raw_lines)
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user