perf: 优化webui和主程序更新的协调

fix: 修复某些请求不能正确应用代理的问题
This commit is contained in:
Soulter
2025-01-21 01:08:15 +08:00
parent 529cd64d82
commit 5dd1488b5d
15 changed files with 67 additions and 50 deletions
+2 -2
View File
@@ -127,7 +127,7 @@ class Main(star.Star):
s3_file_url = f"{S3_URL}/{uuid.uuid4().hex}{ext}"
async with aiohttp.ClientSession(headers = {"Accept": "application/json"}) as session:
async with aiohttp.ClientSession(headers = {"Accept": "application/json"}, trust_env=True) as session:
async with session.put(s3_file_url, data=file) as resp:
if resp.status != 200:
raise Exception(f"Failed to upload image: {resp.status}")
@@ -159,7 +159,7 @@ class Main(star.Star):
async def download_image(self, image_url: str, workplace_path: str, filename: str) -> str:
'''Download image from url to workplace_path'''
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
async with session.get(image_url) as resp:
if resp.status != 200:
return ""