fix plugins on macOS
This commit is contained in:
+9
-2
@@ -9,6 +9,7 @@ License: GPL-3.0
|
|||||||
|
|
||||||
# Built-in imports
|
# Built-in imports
|
||||||
import io
|
import io
|
||||||
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
@@ -20,6 +21,7 @@ from pathlib import Path
|
|||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
# External library imports
|
# External library imports
|
||||||
|
import certifi
|
||||||
from PySide6.QtCore import QObject, QUrl, Signal
|
from PySide6.QtCore import QObject, QUrl, Signal
|
||||||
from PySide6.QtGui import QDesktopServices
|
from PySide6.QtGui import QDesktopServices
|
||||||
from PySide6.QtWidgets import QMainWindow, QMenu, QMessageBox
|
from PySide6.QtWidgets import QMainWindow, QMenu, QMessageBox
|
||||||
@@ -27,6 +29,11 @@ from PySide6.QtWidgets import QMainWindow, QMenu, QMessageBox
|
|||||||
from src.shared.shareddata import APP_NAME, CURRENT_VERSION, PLATFORM_NAME
|
from src.shared.shareddata import APP_NAME, CURRENT_VERSION, PLATFORM_NAME
|
||||||
|
|
||||||
|
|
||||||
|
def get_ssl_context() -> ssl.SSLContext:
|
||||||
|
"""Returns a cross-platform SSL context configured with certifi's CA bundle."""
|
||||||
|
return ssl.create_default_context(cafile=certifi.where())
|
||||||
|
|
||||||
|
|
||||||
def get_current_platform_id() -> str:
|
def get_current_platform_id() -> str:
|
||||||
"""Returns standardized platform identifier (win_x64, darwin_arm64, etc.)."""
|
"""Returns standardized platform identifier (win_x64, darwin_arm64, etc.)."""
|
||||||
sys_name = sys.platform
|
sys_name = sys.platform
|
||||||
@@ -282,7 +289,7 @@ class PluginManager(QObject):
|
|||||||
url,
|
url,
|
||||||
headers={"User-Agent": f"{APP_NAME}-PluginManager"},
|
headers={"User-Agent": f"{APP_NAME}-PluginManager"},
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req, timeout=5) as response:
|
with urllib.request.urlopen(req, timeout=5, context=get_ssl_context()) as response:
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
raw_data = response.read().decode("utf-8")
|
raw_data = response.read().decode("utf-8")
|
||||||
data = json.loads(raw_data)
|
data = json.loads(raw_data)
|
||||||
@@ -305,7 +312,7 @@ class PluginManager(QObject):
|
|||||||
headers={"User-Agent": f"{APP_NAME}-PluginManager"},
|
headers={"User-Agent": f"{APP_NAME}-PluginManager"},
|
||||||
)
|
)
|
||||||
|
|
||||||
with urllib.request.urlopen(req, timeout=15) as response:
|
with urllib.request.urlopen(req, timeout=15, context=get_ssl_context()) as response:
|
||||||
if response.status != 200:
|
if response.status != 200:
|
||||||
raise RuntimeError(f"Download failed with HTTP status code {response.status}")
|
raise RuntimeError(f"Download failed with HTTP status code {response.status}")
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import sys
|
|||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
|
||||||
CURRENT_VERSION = "1.7.1"
|
CURRENT_VERSION = "1.7.2"
|
||||||
APP_NAME = "flares"
|
APP_NAME = "flares"
|
||||||
APP_NAME_EXPANDED = "fNIRS Lightweight Analysis, Research, & Evaluation Suite"
|
APP_NAME_EXPANDED = "fNIRS Lightweight Analysis, Research, & Evaluation Suite"
|
||||||
API_URL = f"https://git.research.dezeeuw.ca/api/v1/repos/tyler/{APP_NAME}/releases"
|
API_URL = f"https://git.research.dezeeuw.ca/api/v1/repos/tyler/{APP_NAME}/releases"
|
||||||
|
|||||||
Reference in New Issue
Block a user