diff options
| -rw-r--r-- | backend/browser.py | 4 | ||||
| -rw-r--r-- | backend/helpers.py | 7 | ||||
| -rw-r--r-- | backend/utilities.py | 4 | ||||
| -rw-r--r-- | requirements.txt | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/backend/browser.py b/backend/browser.py index c491f17a..df0c478c 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -13,6 +13,8 @@ from subprocess import Popen import json +import helpers + class PluginInstallContext: def __init__(self, artifact, name, version, hash) -> None: self.artifact = artifact @@ -72,7 +74,7 @@ class PluginBrowser: self.log.info(f"Installing {name} (Version: {version})") async with ClientSession() as client: self.log.debug(f"Fetching {artifact}") - res = await client.get(artifact) + res = await client.get(artifact, ssl=helpers.get_ssl_context()) if res.status == 200: self.log.debug("Got 200. Reading...") data = await res.read() diff --git a/backend/helpers.py b/backend/helpers.py new file mode 100644 index 00000000..a75f1075 --- /dev/null +++ b/backend/helpers.py @@ -0,0 +1,7 @@ +import ssl +import certifi + +ssl_ctx = ssl.create_default_context(cafile=certifi.where()) + +def get_ssl_context(): + return ssl_ctx
\ No newline at end of file diff --git a/backend/utilities.py b/backend/utilities.py index 570ed568..834faeb2 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -4,7 +4,7 @@ from json.decoder import JSONDecodeError from aiohttp import ClientSession, web from injector import inject_to_tab - +import helpers class Utilities: def __init__(self, context) -> None: @@ -48,7 +48,7 @@ class Utilities: async def http_request(self, method="", url="", **kwargs): async with ClientSession() as web: - async with web.request(method, url, **kwargs) as res: + async with web.request(method, url, ssl=helpers.get_ssl_context(), **kwargs) as res: return { "status": res.status, "headers": dict(res.headers), diff --git a/requirements.txt b/requirements.txt index 15fdb135..520ec8e6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ aiohttp==3.8.1 aiohttp-jinja2==1.5.0 aiohttp_cors==0.7.0 watchdog==2.1.7 +certifi==2022.6.15
\ No newline at end of file |
