github downloader fix

This commit is contained in:
Flowseal
2026-05-08 14:36:47 +03:00
parent 33d3147c0b
commit e72a44d74b
5 changed files with 58 additions and 13 deletions

View File

@@ -14,7 +14,8 @@ from itertools import zip_longest
from pathlib import Path
from typing import Any, Dict, Optional, Tuple
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
from urllib.request import Request
from proxy.utils import build_github_opener
REPO = "Flowseal/tg-ws-proxy"
RELEASES_LATEST_API = f"https://api.github.com/repos/{REPO}/releases/latest"
@@ -135,7 +136,7 @@ def fetch_latest_release(
method="GET",
)
try:
with urlopen(req, timeout=timeout) as resp:
with build_github_opener().open(req, timeout=timeout) as resp:
code = getattr(resp, "status", None) or resp.getcode()
new_etag = resp.headers.get("ETag")
raw = resp.read().decode("utf-8", errors="replace")