nightly: bump to 0.1.60 and finalize menu, resolver, settings cleanup

This commit is contained in:
2026-02-23 20:21:44 +01:00
parent 7ba24532ad
commit ef531ea0aa
8 changed files with 188 additions and 147 deletions

View File

@@ -8,8 +8,16 @@ from __future__ import annotations
from typing import Optional
_LAST_RESOLVE_ERROR = ""
def get_last_error() -> str:
return str(_LAST_RESOLVE_ERROR or "")
def resolve(url: str) -> Optional[str]:
global _LAST_RESOLVE_ERROR
_LAST_RESOLVE_ERROR = ""
if not url:
return None
try:
@@ -23,12 +31,14 @@ def resolve(url: str) -> Optional[str]:
hmf = hosted(url)
valid = getattr(hmf, "valid_url", None)
if callable(valid) and not valid():
_LAST_RESOLVE_ERROR = "invalid url"
return None
resolver = getattr(hmf, "resolve", None)
if callable(resolver):
result = resolver()
return str(result) if result else None
except Exception:
except Exception as exc:
_LAST_RESOLVE_ERROR = str(exc or "")
pass
try:
@@ -36,8 +46,8 @@ def resolve(url: str) -> Optional[str]:
if callable(resolve_fn):
result = resolve_fn(url)
return str(result) if result else None
except Exception:
except Exception as exc:
_LAST_RESOLVE_ERROR = str(exc or "")
return None
return None