From 9aaf5fb50f8ba045080240b3fa51cc86b0ca1fc0 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 27 May 2023 00:04:50 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20Change=20BBS=20OSS=20Host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config.py | 1 + modules/apihelper/client/components/hyperion.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core/config.py b/core/config.py index fab896e4..24904ce8 100644 --- a/core/config.py +++ b/core/config.py @@ -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""" diff --git a/modules/apihelper/client/components/hyperion.py b/modules/apihelper/client/components/hyperion.py index 3c8d7e61..fb75a667 100644 --- a/modules/apihelper/client/components/hyperion.py +++ b/modules/apihelper/client/components/hyperion.py @@ -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 )