chore: remove ar support

pull/10981/head
Tienson Qin 2024-08-08 11:44:32 +08:00
parent 75463c4df4
commit a6e0b0a092
2 changed files with 18 additions and 34 deletions

View File

@ -438,10 +438,6 @@
:on-click share-fn}
title])))))
(defn ar-url->http-url
[href]
(string/replace href #"^ar://" (str (state/get-arweave-gateway) "/")))
;; TODO: safe encoding asciis
;; TODO: image link to another link
(defn image-link [config url href label metadata full_text]
@ -460,9 +456,6 @@
(util/starts-with? href "http")
href
(util/starts-with? href "ar")
(ar-url->http-url href)
config/publishing?
(subs href 1)
@ -1172,9 +1165,6 @@
(util/starts-with? href "http")
href
(util/starts-with? href "ar")
(ar-url->http-url href)
config/publishing?
(subs href 1)
@ -1370,16 +1360,6 @@
(show-link? config metadata href full_text)
(media-link config url href label metadata full_text)
(= protocol "ar")
(->elem
:a.external-link
(cond->
{:href (ar-url->http-url href)
:target "_blank"}
title
(assoc :title title))
(map-inline config label))
:else
(->elem
:a.external-link

View File

@ -1481,23 +1481,27 @@
matched-alias]))
(p/catch #(js/console.error "Debug: Copy Asset Error#" %))))
(p/do! (js/console.debug "Debug: Writing Asset #" dir file-rpath)
(cond
(mobile-util/native-platform?)
(->
(p/do! (js/console.debug "Debug: Writing Asset #" dir file-rpath)
(cond
(mobile-util/native-platform?)
;; capacitor fs accepts Blob, File implements Blob
(p/let [buffer (.arrayBuffer file)
content (base64/encodeByteArray (js/Uint8Array. buffer))
fpath (path/path-join dir file-rpath)]
(capacitor-fs/<write-file-with-base64 fpath content))
(p/let [buffer (.arrayBuffer file)
content (base64/encodeByteArray (js/Uint8Array. buffer))
fpath (path/path-join dir file-rpath)]
(capacitor-fs/<write-file-with-base64 fpath content))
(config/db-based-graph? repo) ;; memory-fs
(p/let [buffer (.arrayBuffer file)
content (js/Uint8Array. buffer)]
(fs/write-file! repo dir file-rpath content nil))
(config/db-based-graph? repo) ;; memory-fs
(p/let [buffer (.arrayBuffer file)
content (js/Uint8Array. buffer)]
(fs/write-file! repo dir file-rpath content nil))
:else ; nfs
(fs/write-file! repo dir file-rpath (.stream file) nil))
[file-rpath file (path/path-join dir file-rpath) matched-alias])))))))
:else ; nfs
(fs/write-file! repo dir file-rpath (.stream file) nil))
[file-rpath file (path/path-join dir file-rpath) matched-alias])
(p/catch (fn [error]
(prn :paste-file-error)
(js/console.error error))))))))))
(defn delete-asset-of-block!
[{:keys [repo href full-text block-id local? delete-local?] :as _opts}]