fix plugins on macOS

This commit is contained in:
2026-09-10 13:32:46 -07:00
parent 613d2b9103
commit 2a5e3f5606
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -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}")
+1 -1
View File
@@ -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"