mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 23:19:38 +00:00
remove re-index from db-only version
This commit is contained in:
@@ -172,9 +172,9 @@
|
||||
reindex-link {:title (t :re-index)
|
||||
:hover-detail (t :re-index-detail)
|
||||
:options (cond->
|
||||
{:on-click
|
||||
(fn []
|
||||
(state/pub-event! [:graph/ask-for-re-index *multiple-windows? nil]))})}
|
||||
{:on-click
|
||||
(fn []
|
||||
(state/pub-event! [:graph/ask-for-re-index *multiple-windows? nil]))})}
|
||||
new-window-link (when (and (util/electron?)
|
||||
;; New Window button in menu bar of macOS is available.
|
||||
(not util/mac?))
|
||||
@@ -190,7 +190,8 @@
|
||||
:options {:on-click #(state/pub-event! [:graph/new-db-graph])}}
|
||||
{:title (t :all-graphs) :options {:href (rfe/href :repos)}}
|
||||
refresh-link
|
||||
reindex-link
|
||||
(when-not (config/db-only? current-repo)
|
||||
reindex-link)
|
||||
new-window-link])
|
||||
(remove nil?))))
|
||||
|
||||
|
||||
@@ -361,6 +361,11 @@
|
||||
(and (string? s)
|
||||
(string/starts-with? s local-db-prefix)))
|
||||
|
||||
(defn db-only?
|
||||
[s]
|
||||
(and (string? s)
|
||||
(string/starts-with? s db-version-prefix)))
|
||||
|
||||
(defn get-local-asset-absolute-path
|
||||
[s]
|
||||
(str "/" (string/replace s #"^[./]*" "")))
|
||||
@@ -382,6 +387,9 @@
|
||||
(js/console.error "BUG: nil repo")
|
||||
nil)
|
||||
|
||||
(db-only? repo-url)
|
||||
nil
|
||||
|
||||
(and (util/electron?) (local-db? repo-url))
|
||||
(get-local-dir repo-url)
|
||||
|
||||
|
||||
@@ -387,7 +387,8 @@
|
||||
;; FIXME: an ugly implementation for redirecting to page on new window is restored
|
||||
(repo-handler/graph-ready! repo)
|
||||
;; Replace initial fs watcher
|
||||
(fs-watcher/load-graph-files! repo)
|
||||
(when-not (config/db-only? repo)
|
||||
(fs-watcher/load-graph-files! repo))
|
||||
;; TODO(junyi): Notify user to update filename format when the UX is smooth enough
|
||||
;; (when-not config/test?
|
||||
;; (js/setTimeout
|
||||
|
||||
@@ -136,40 +136,41 @@
|
||||
|
||||
(defn exec-js-if-exists-&-allowed!
|
||||
[t]
|
||||
(when-let [href (or
|
||||
(state/get-custom-js-link)
|
||||
(config/get-custom-js-path))]
|
||||
(let [k (str "ls-js-allowed-" href)
|
||||
execed #(swap! *js-execed conj href)
|
||||
execed? (contains? @*js-execed href)
|
||||
ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
|
||||
(if r
|
||||
(storage/set k (js/Date.now))
|
||||
(storage/set k false))
|
||||
r)
|
||||
allowed! (storage/get k)
|
||||
should-ask? (or (nil? allowed!)
|
||||
(> (- (js/Date.now) allowed!) 604800000))]
|
||||
(when (and (not execed?)
|
||||
(not= false allowed!))
|
||||
(if (string/starts-with? href "http")
|
||||
(when (or (not should-ask?)
|
||||
(ask-allow))
|
||||
(load href #(do (js/console.log "[custom js]" href) (execed))))
|
||||
(let [repo-dir (config/get-repo-dir (state/get-current-repo))
|
||||
rpath (path/relative-path repo-dir href)]
|
||||
(p/let [exists? (fs/file-exists? repo-dir rpath)]
|
||||
(when exists?
|
||||
(util/p-handle
|
||||
(fs/read-file repo-dir rpath)
|
||||
#(when-let [scripts (and % (string/trim %))]
|
||||
(when-not (string/blank? scripts)
|
||||
(when (or (not should-ask?) (ask-allow))
|
||||
(try
|
||||
(js/eval scripts)
|
||||
(execed)
|
||||
(catch :default e
|
||||
(js/console.error "[custom js]" e)))))))))))))))
|
||||
(when-not (config/db-only? (state/get-current-repo))
|
||||
(when-let [href (or
|
||||
(state/get-custom-js-link)
|
||||
(config/get-custom-js-path))]
|
||||
(let [k (str "ls-js-allowed-" href)
|
||||
execed #(swap! *js-execed conj href)
|
||||
execed? (contains? @*js-execed href)
|
||||
ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
|
||||
(if r
|
||||
(storage/set k (js/Date.now))
|
||||
(storage/set k false))
|
||||
r)
|
||||
allowed! (storage/get k)
|
||||
should-ask? (or (nil? allowed!)
|
||||
(> (- (js/Date.now) allowed!) 604800000))]
|
||||
(when (and (not execed?)
|
||||
(not= false allowed!))
|
||||
(if (string/starts-with? href "http")
|
||||
(when (or (not should-ask?)
|
||||
(ask-allow))
|
||||
(load href #(do (js/console.log "[custom js]" href) (execed))))
|
||||
(let [repo-dir (config/get-repo-dir (state/get-current-repo))
|
||||
rpath (path/relative-path repo-dir href)]
|
||||
(p/let [exists? (fs/file-exists? repo-dir rpath)]
|
||||
(when exists?
|
||||
(util/p-handle
|
||||
(fs/read-file repo-dir rpath)
|
||||
#(when-let [scripts (and % (string/trim %))]
|
||||
(when-not (string/blank? scripts)
|
||||
(when (or (not should-ask?) (ask-allow))
|
||||
(try
|
||||
(js/eval scripts)
|
||||
(execed)
|
||||
(catch :default e
|
||||
(js/console.error "[custom js]" e))))))))))))))))
|
||||
|
||||
(defn toggle-wide-mode!
|
||||
[]
|
||||
|
||||
Reference in New Issue
Block a user