Update render function to use latest_version for download URL and cache handling

This commit is contained in:
hlohaus 2025-09-07 01:57:38 +02:00
parent 24ebab640c
commit 9b4727b2f1

View file

@ -39,9 +39,9 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
is_temp = True
else:
os.makedirs(cache_dir, exist_ok=True)
version = quote(unquote(request.query_string.decode())) or str(version.utils.current_version)
latest_version = quote(unquote(request.query_string.decode())) or str(latest_version)
if html is None:
response = requests.get(f"{download_url}{filename}{'?' + version if version and download_url == DOWNLOAD_URL else ''}")
response = requests.get(f"{download_url}{filename}{'?' + latest_version if latest_version and download_url == DOWNLOAD_URL else ''}")
if not response.ok:
found = None
for root, _, files in os.walk(cache_dir):
@ -57,7 +57,7 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
html = html.replace("../dist/", f"dist/")
html = html.replace("\"dist/", f"\"{STATIC_URL}dist/")
html = html.replace(JSDELIVR_URL, "/")
html = html.replace("{{ v }}", version)
html = html.replace("{{ v }}", latest_version)
if is_temp:
return html
with open(cache_file, 'w', encoding='utf-8') as f: