Browse Source

fix(desktop): broken version of checking updates manually

Charlie 4 years ago
parent
commit
9da8ac6c68
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/electron/electron/updater.cljs

+ 5 - 0
src/electron/electron/updater.cljs

@@ -56,6 +56,11 @@
        (emit "checking-for-update" nil)
        (emit "checking-for-update" nil)
        (-> (p/let
        (-> (p/let
             [artifact (get-latest-artifact-info repo)
             [artifact (get-latest-artifact-info repo)
+
+             artifact (when-let [remote-version (and artifact (re-find #"\d+.\d+.\d+" (:url artifact)))]
+                        (if (and (. semver valid remote-version)
+                                 (. semver lt electron-version remote-version)) artifact))
+
              url (if-not artifact (do (emit "update-not-available" nil) (throw nil)) (:url artifact))
              url (if-not artifact (do (emit "update-not-available" nil) (throw nil)) (:url artifact))
              _ (if url (emit "update-available" (bean/->js artifact)) (throw (js/Error. "download url not exists")))
              _ (if url (emit "update-available" (bean/->js artifact)) (throw (js/Error. "download url not exists")))
                ;; start download FIXME: user's preference about auto download
                ;; start download FIXME: user's preference about auto download