Support Change BBS OSS Host

This commit is contained in:
xtaodada 2023-05-27 00:04:50 +08:00
parent 640daf1e89
commit 9aaf5fb50f
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 3 additions and 0 deletions

View File

@ -118,6 +118,7 @@ class ApplicationConfig(Settings):
proxy_url: Optional[AnyUrl] = None
"""代理链接"""
upload_bbs_host: Optional[AnyUrl] = "https://upload-bbs.miyoushe.com"
bot_token: str = ""
"""BOT的token"""

View File

@ -3,6 +3,7 @@ import os
import re
from typing import List
from core.config import config
from ..base.hyperionrequest import HyperionRequest
from ...models.genshin.hyperion import PostInfo, ArtworkImage
from ...typedefs import JSON_DATA
@ -122,6 +123,7 @@ class Hyperion:
filename = os.path.basename(url)
_, file_extension = os.path.splitext(filename)
is_image = bool(file_extension in ".jpg" or file_extension in ".png")
url = url.replace("https://upload-bbs.miyoushe.com", config.upload_bbs_host)
response = await self.client.get(
url, params=self.get_images_params(resize=2000) if is_image else None, de_json=False
)