Преглед изворни кода

Merge pull request #2058 from logseq/fix/version-of-check-updates

fix(desktop): broken version of checking updates manually
icremcr пре 4 година
родитељ
комит
bef8d0da68
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      src/electron/electron/updater.cljs

+ 6 - 1
src/electron/electron/updater.cljs

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