v1.0.15.3 — non-blocking logger (fix install freeze), URL-encode pack file paths, news ordering by mtime

This commit is contained in:
SashegDev
2026-08-13 19:56:42 +00:00
parent 26e0280d84
commit f706e8393c
3 changed files with 68 additions and 21 deletions
+6 -6
View File
@@ -4,7 +4,7 @@ import os
from contextlib import asynccontextmanager
from datetime import datetime
from pathlib import Path
from urllib.parse import urlparse
from urllib.parse import urlparse, quote
from typing import Optional
import httpx
@@ -1128,9 +1128,9 @@ async def get_pack_diff(
for path, entry in server_files.items():
client_hash = body.get(path)
if client_hash is None or client_hash != entry.hash:
url = f"/pack/{pack_name}/file/{path}"
url = f"/pack/{pack_name}/file/{quote(path, safe='/')}"
if preset:
url += f"?preset={preset}"
url += f"?preset={quote(preset, safe='')}"
to_download.append({
"path": path,
"url": url,
@@ -1969,8 +1969,9 @@ async def list_news():
return {"news": []}
news_list = []
for f in sorted(NEWS_DIR.iterdir()):
if f.is_file() and f.suffix == ".txt":
files = [f for f in NEWS_DIR.iterdir() if f.is_file() and f.suffix == ".txt"]
files.sort(key=lambda f: f.stat().st_mtime, reverse=True)
for f in files:
try:
content = f.read_text(encoding="utf-8").strip().split("\n")
if len(content) >= 4:
@@ -1988,7 +1989,6 @@ async def list_news():
except Exception as e:
logger.warning(f"Failed to read news file {f.name}: {e}")
news_list.reverse()
return {"news": news_list}