Show ani-cli version in config runtime info

This commit is contained in:
Dymas
2026-05-25 16:10:18 +02:00
parent 58f96cb6dd
commit 8549944be1
7 changed files with 50 additions and 9 deletions
+19 -1
View File
@@ -6,7 +6,9 @@ import json
import mimetypes
import os
import shutil
import subprocess
import traceback
from functools import lru_cache
from dataclasses import dataclass
from http.cookies import SimpleCookie
from http import HTTPStatus
@@ -72,6 +74,22 @@ def dependency_status():
return result
@lru_cache(maxsize=1)
def installed_ani_cli_version():
try:
completed = subprocess.run(
[ANI_CLI, "--version"],
check=True,
capture_output=True,
text=True,
timeout=6,
)
except (OSError, subprocess.SubprocessError):
return "Unavailable"
version = str(completed.stdout or completed.stderr or "").strip()
return version or "Unavailable"
class Handler(BaseHTTPRequestHandler):
server_version = "AniCliWeb/1.0"
remote_token_cookie_name = "ani_cli_web_token"
@@ -380,7 +398,7 @@ class Handler(BaseHTTPRequestHandler):
elif parsed.path == "/api/config":
self.json(Handler._context(self).get_config_snapshot())
elif parsed.path == "/api/version":
self.json({"name": APP_NAME, "version": VERSION})
self.json({"name": APP_NAME, "version": VERSION, "ani_cli_version": installed_ani_cli_version()})
elif parsed.path == "/api/dependencies":
self.json(dependency_status())
elif parsed.path == "/api/search":