Browse Source

Apparently SSL is hard on QT...

Ian Walton 3 years ago
parent
commit
8a4d127e30
2 changed files with 11 additions and 0 deletions
  1. 7 0
      native/jmpUpdatePlugin.js
  2. 4 0
      src/system/SystemComponent.cpp

+ 7 - 0
native/jmpUpdatePlugin.js

@@ -8,6 +8,13 @@ class jmpUpdatePlugin {
             const api = await window.apiPromise;
 
             const onUpdateNotify = async (url) => {
+                if (url == "SSL_UNAVAILABLE") {
+                    // Windows (and possibly macOS) don't ship with SSL in QT......
+                    // So we get to do a full request to GitHub here :(
+                    const checkUrl = "https://github.com/jellyfin/jellyfin-media-player/releases/latest";
+                    url = (await fetch(checkUrl)).url;
+                }
+
                 const urlSegments = url.split("/");
                 const version = urlSegments[urlSegments.length - 1].substring(1);
                 const currentVersion = navigator.userAgent.split(" ")[1];

+ 4 - 0
src/system/SystemComponent.cpp

@@ -338,6 +338,7 @@ QString SystemComponent::getNativeShellScript()
 void SystemComponent::checkForUpdates()
 {
   if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "checkForUpdates").toBool()) {
+#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
     QNetworkAccessManager *manager = new QNetworkAccessManager(this);
     QString checkUrl = "https://github.com/jellyfin/jellyfin-media-player/releases/latest";
     QUrl qCheckUrl = QUrl(checkUrl);
@@ -346,6 +347,9 @@ void SystemComponent::checkForUpdates()
 
     connect(manager, &QNetworkAccessManager::finished, this, &SystemComponent::updateInfoHandler);
     manager->get(req);
+#else
+    emit updateInfoEmitted("SSL_UNAVAILABLE");
+#endif
   }
 }