Merge branch 'master' into refactor/page-parent

This commit is contained in:
Tienson Qin
2025-06-17 19:44:34 +08:00
33 changed files with 496 additions and 221 deletions

View File

@@ -11,6 +11,7 @@
[logseq.common.config :as common-config]
[logseq.common.path :as path]
[logseq.common.util :as common-util]
[logseq.db.frontend.asset :as db-asset]
[medley.core :as medley]
[missionary.core :as m]
[promesa.core :as p])
@@ -177,18 +178,10 @@
blob (js/Blob. (array binary) (clj->js {:type "image"}))]
(when blob (js/URL.createObjectURL blob)))))))
(defn- decode-digest
[^js/Uint8Array digest]
(.. (js/Array.from digest)
(map (fn [s] (.. s (toString 16) (padStart 2 "0"))))
(join "")))
(defn get-file-checksum
[^js/Blob file]
(-> (.arrayBuffer file)
(.then (fn [buf] (js/crypto.subtle.digest "SHA-256" buf)))
(.then (fn [dig] (js/Uint8Array. dig)))
(.then decode-digest)))
(.then db-asset/<get-file-array-buffer-checksum)))
(defn <get-all-assets
[]