refactor(quality): clean up unused imports, variables, and redundant f-strings
This commit is contained in:
@@ -6,7 +6,6 @@ Repo: https://gitea.eibl.tech/me0nline/LOGAR-LICENSING.git
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import importlib.util
|
import importlib.util
|
||||||
|
|
||||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import subprocess
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import warnings
|
import warnings
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
from typing import Optional, Dict, Any, List
|
from typing import Optional
|
||||||
|
|
||||||
# Suppress cryptography / pgpy deprecation notices
|
# Suppress cryptography / pgpy deprecation notices
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|||||||
+3
-4
@@ -443,7 +443,7 @@ def load_or_init_config(config_path: str = CONFIG_FILE_NAME) -> Dict[str, Any]:
|
|||||||
with open(config_path, "w", encoding="utf-8") as f:
|
with open(config_path, "w", encoding="utf-8") as f:
|
||||||
json.dump(config, f, indent=2)
|
json.dump(config, f, indent=2)
|
||||||
|
|
||||||
print(f"[+] Successfully generated new server config and OpenPGP keypair.")
|
print("[+] Successfully generated new server config and OpenPGP keypair.")
|
||||||
print(f"[+] Server Encryption Fingerprint: {fingerprint}")
|
print(f"[+] Server Encryption Fingerprint: {fingerprint}")
|
||||||
print(f"[+] Saved to: {os.path.abspath(config_path)}")
|
print(f"[+] Saved to: {os.path.abspath(config_path)}")
|
||||||
return config
|
return config
|
||||||
@@ -1896,7 +1896,6 @@ def serve_webui(request: Request = None):
|
|||||||
pct = summary["percentage"]
|
pct = summary["percentage"]
|
||||||
bar_color = "#10b981" if pct < 70 else ("#f59e0b" if pct < 90 else "#ef4444")
|
bar_color = "#10b981" if pct < 70 else ("#f59e0b" if pct < 90 else "#ef4444")
|
||||||
badge_status_cls = "badge-active" if summary["status"] == "ACTIVE" else ("badge-warning" if summary["status"] == "SELF-SIGNED" else "badge-revoked")
|
badge_status_cls = "badge-active" if summary["status"] == "ACTIVE" else ("badge-warning" if summary["status"] == "SELF-SIGNED" else "badge-revoked")
|
||||||
total_nodes = summary["active_seats"] + summary["revoked_seats"]
|
|
||||||
|
|
||||||
detected_host = (request.headers.get("host", "").split(":")[0] if request and request.headers else "") or config.get("tcp_host", "127.0.0.1")
|
detected_host = (request.headers.get("host", "").split(":")[0] if request and request.headers else "") or config.get("tcp_host", "127.0.0.1")
|
||||||
if detected_host in ("0.0.0.0", "localhost", ""):
|
if detected_host in ("0.0.0.0", "localhost", ""):
|
||||||
@@ -2649,7 +2648,7 @@ def main():
|
|||||||
force_renew=True
|
force_renew=True
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"[+] Successfully imported and activated signed license!")
|
print("[+] Successfully imported and activated signed license!")
|
||||||
print(f" - Granted Seats: {new_seats}")
|
print(f" - Granted Seats: {new_seats}")
|
||||||
print(f" - License ID: {res.get('license_id') or info.get('license_id')}")
|
print(f" - License ID: {res.get('license_id') or info.get('license_id')}")
|
||||||
print(f" - Expires: {info.get('not_valid_after') or res.get('expires_at') or 'N/A'}")
|
print(f" - Expires: {info.get('not_valid_after') or res.get('expires_at') or 'N/A'}")
|
||||||
@@ -2722,7 +2721,7 @@ def main():
|
|||||||
cert_dir=cert_dir,
|
cert_dir=cert_dir,
|
||||||
force_renew=True
|
force_renew=True
|
||||||
)
|
)
|
||||||
print(f"[+] License successfully synchronized with master server!")
|
print("[+] License successfully synchronized with master server!")
|
||||||
print(f" - Active Seat Quota: {new_seats}")
|
print(f" - Active Seat Quota: {new_seats}")
|
||||||
print(f" - License ID: {info.get('license_id')}")
|
print(f" - License ID: {info.get('license_id')}")
|
||||||
print(f" - Expires: {info.get('not_valid_after')}")
|
print(f" - Expires: {info.get('not_valid_after')}")
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import argparse
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import warnings
|
import warnings
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timezone, timedelta
|
||||||
from typing import Optional, Dict, Any, List
|
from typing import Optional
|
||||||
|
|
||||||
# Suppress cryptography / pgpy deprecation notices
|
# Suppress cryptography / pgpy deprecation notices
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|||||||
Reference in New Issue
Block a user