chore: remove nfs support

Assets will be stored in IndexedDB through memory fs on web.
This commit is contained in:
Tienson Qin
2025-05-13 18:40:58 +08:00
parent 5e1a968530
commit de88511bda
21 changed files with 87 additions and 564 deletions

View File

@@ -5,7 +5,6 @@
[frontend.common.thread-api :as thread-api :refer [def-thread-api]]
[frontend.config :as config]
[frontend.fs :as fs]
[frontend.fs.nfs :as nfs]
[frontend.mobile.util :as mobile-util]
[frontend.state :as state]
[frontend.util :as util]
@@ -187,21 +186,7 @@
(config/db-based-graph? (state/get-current-repo)) ; memory fs
(p/let [binary (fs/read-file repo-dir path {})
blob (js/Blob. (array binary) (clj->js {:type "image"}))]
(when blob (js/URL.createObjectURL blob)))
:else ;; nfs
(let [handle-path (str "handle/" full-path)
cached-url (get @*assets-url-cache (keyword handle-path))]
(if cached-url
(p/resolved cached-url)
;; Loading File from handle cache
;; Use await file handle, to ensure all handles are loaded.
(p/let [handle (nfs/await-get-nfs-file-handle repo handle-path)
file (and handle (.getFile handle))]
(when file
(p/let [url (js/URL.createObjectURL file)]
(swap! *assets-url-cache assoc (keyword handle-path) url)
url)))))))))
(when blob (js/URL.createObjectURL blob)))))))
(defn- decode-digest
[^js/Uint8Array digest]