diff --git a/avilla/elizabeth/perform/resource_fetch.py b/avilla/elizabeth/perform/resource_fetch.py index ebb2086e..36d2cddb 100644 --- a/avilla/elizabeth/perform/resource_fetch.py +++ b/avilla/elizabeth/perform/resource_fetch.py @@ -12,6 +12,7 @@ ElizabethResource, ElizabethVoiceResource, ) +from avilla.standard.qq.util import ssl_ctx if TYPE_CHECKING: from avilla.elizabeth.protocol import ElizabethProtocol # noqa @@ -28,5 +29,5 @@ async def fetch_resource(self, resource: ElizabethResource) -> bytes: if resource.url is None: raise UnknownTarget async with ClientSession() as session: - async with session.get(resource.url) as resp: + async with session.get(resource.url, ssl=ssl_ctx) as resp: return await resp.read() diff --git a/avilla/onebot/v11/perform/resource_fetch.py b/avilla/onebot/v11/perform/resource_fetch.py index 665739e5..d39a63e6 100644 --- a/avilla/onebot/v11/perform/resource_fetch.py +++ b/avilla/onebot/v11/perform/resource_fetch.py @@ -13,6 +13,7 @@ OneBot11Resource, OneBot11VideoResource, ) +from avilla.standard.qq.util import ssl_ctx if TYPE_CHECKING: from avilla.onebot.v11.protocol import OneBot11Protocol # noqa @@ -28,5 +29,5 @@ class OneBot11ResourceFetchPerform((m := ProtocolCollector["OneBot11Protocol"]() @m.entity(CoreCapability.fetch, resource=OneBot11VideoResource) async def fetch_resource(self, resource: OneBot11Resource) -> bytes: async with ClientSession() as session: - async with session.get(resource.url) as resp: + async with session.get(resource.url, ssl=ssl_ctx) as resp: return await resp.read() diff --git a/avilla/standard/qq/util.py b/avilla/standard/qq/util.py new file mode 100644 index 00000000..ba976b19 --- /dev/null +++ b/avilla/standard/qq/util.py @@ -0,0 +1,4 @@ +import ssl + +ssl_ctx = ssl.create_default_context() +ssl_ctx.set_ciphers("DEFAULT")