Skip to content

Commit

Permalink
Revert "fix(build): windows7 compatibility"
Browse files Browse the repository at this point in the history
This reverts commit cef1861.
  • Loading branch information
andelf committed Oct 2, 2022
1 parent cef1861 commit af5bc77
Showing 1 changed file with 25 additions and 34 deletions.
59 changes: 25 additions & 34 deletions src/electron/electron/file_sync_rsapi.cljs
Original file line number Diff line number Diff line change
@@ -1,69 +1,60 @@
(ns electron.file-sync-rsapi
(:require ["os" :as os]
(:require ["@logseq/rsapi" :as rsapi]
[electron.window :as window]
[cljs-bean.core :as bean]
[clojure.string :as string]))
[cljs-bean.core :as bean]))

(if (and (= (.platform os) "win32")
(string/starts-with? (.release os) "6."))
(defonce rsapi nil)
(defonce rsapi (js/require "@logseq/rsapi")))

(defn key-gen []
(.keygen rsapi))
(defn key-gen [] (rsapi/keygen))

(defn set-env [graph-uuid env private-key public-key]
(.setEnv rsapi graph-uuid env private-key public-key))
(rsapi/setEnv graph-uuid env private-key public-key))

(defn set-progress-callback [callback]
(.setProgressCallback rsapi callback))
(rsapi/setProgressCallback callback))

(defn get-local-files-meta [graph-uuid base-path file-paths]
(.getLocalFilesMeta rsapi graph-uuid base-path (clj->js file-paths)))
(rsapi/getLocalFilesMeta graph-uuid base-path (clj->js file-paths)))

(defn get-local-all-files-meta [graph-uuid base-path]
(.getLocalAllFilesMeta rsapi graph-uuid base-path))
(rsapi/getLocalAllFilesMeta graph-uuid base-path))

(defn rename-local-file [graph-uuid base-path from to]
(.renameLocalFile rsapi graph-uuid base-path from to))
(rsapi/renameLocalFile graph-uuid base-path from to))

(defn delete-local-files [graph-uuid base-path file-paths]
(.deleteLocalFiles rsapi graph-uuid base-path (clj->js file-paths)))
(rsapi/deleteLocalFiles graph-uuid base-path (clj->js file-paths)))

(defn update-local-files [graph-uuid base-path file-paths token]
(.updateLocalFiles rsapi graph-uuid base-path (clj->js file-paths) token))
(rsapi/updateLocalFiles graph-uuid base-path (clj->js file-paths) token))

(defn download-version-files [graph-uuid base-path file-paths token]
(.updateLocalVersionFiles rsapi graph-uuid base-path (clj->js file-paths) token))
(rsapi/updateLocalVersionFiles graph-uuid base-path (clj->js file-paths) token))

(defn delete-remote-files [graph-uuid base-path file-paths txid token]
(.deleteRemoteFiles rsapi graph-uuid base-path (clj->js file-paths) txid token))
(rsapi/deleteRemoteFiles graph-uuid base-path (clj->js file-paths) txid token))

(defn update-remote-files [graph-uuid base-path file-paths txid token]
(.updateRemoteFiles rsapi graph-uuid base-path (clj->js file-paths) txid token true))
(rsapi/updateRemoteFiles graph-uuid base-path (clj->js file-paths) txid token true))

(defn encrypt-fnames [graph-uuid fnames]
(.encryptFnames rsapi graph-uuid (clj->js fnames)))
(rsapi/encryptFnames graph-uuid (clj->js fnames)))

(defn decrypt-fnames [graph-uuid fnames]
(.decryptFnames rsapi graph-uuid (clj->js fnames)))
(rsapi/decryptFnames graph-uuid (clj->js fnames)))

(defn encrypt-with-passphrase [passphrase data]
(.ageEncryptWithPassphrase rsapi passphrase data))
(rsapi/ageEncryptWithPassphrase passphrase data))

(defn decrypt-with-passphrase [passphrase data]
(.ageDecryptWithPassphrase rsapi passphrase data))
(rsapi/ageDecryptWithPassphrase passphrase data))

(defn cancel-all-requests []
(.cancelAllRequests rsapi))
(rsapi/cancelAllRequests))

(defonce progress-notify-chan "file-sync-progress")

(when rsapi
(set-progress-callback (fn [error progress-info]
(when-not error
(doseq [^js win (window/get-all-windows)]
(when-not (.isDestroyed win)
(.. win -webContents
(send progress-notify-chan (bean/->js progress-info)))))))))

(set-progress-callback (fn [error progress-info]
(when-not error
(doseq [^js win (window/get-all-windows)]
(when-not (.isDestroyed win)
(.. win -webContents
(send progress-notify-chan (bean/->js progress-info))))))))

0 comments on commit af5bc77

Please sign in to comment.