forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix(build): windows7 compatibility"
This reverts commit cef1861.
- Loading branch information
Showing
1 changed file
with
25 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))))))) | ||
|