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

fix(desktop): broken version of checking updates manually
pull/2062/head
icremcr 2021-06-01 10:56:30 +08:00 committed by GitHub
commit bef8d0da68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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))