mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: open db graph urls
Also introduced var for logseq_db_ in deps
This commit is contained in:
@@ -245,7 +245,7 @@
|
||||
(->> (common-graph/read-directories dir)
|
||||
(remove (fn [s] (= s db/unlinked-graphs-dir)))
|
||||
(map graph-name->path)
|
||||
(map (fn [s] (str "logseq_db_" s))))))
|
||||
(map (fn [s] (str sqlite-util/db-version-prefix s))))))
|
||||
|
||||
(defn- get-graphs
|
||||
[]
|
||||
@@ -255,13 +255,15 @@
|
||||
|
||||
;; TODO support alias mechanism
|
||||
(defn get-graph-name
|
||||
"Given a graph's name of string, returns the graph's fullname.
|
||||
E.g., given `cat`, returns `logseq_local_<path_to_directory>/cat`
|
||||
Returns `nil` if no such graph exists."
|
||||
"Given a graph's name of string, returns the graph's fullname. For example, given
|
||||
`cat`, returns `logseq_local_<path_to_directory>/cat` for a file graph and
|
||||
`logseq_db_cat` for a db graph. Returns `nil` if no such graph exists."
|
||||
[graph-identifier]
|
||||
(->> (get-graphs)
|
||||
(some #(when (string/ends-with? (utils/normalize-lc %)
|
||||
(str "/" (utils/normalize-lc graph-identifier)))
|
||||
(some #(when (or
|
||||
(= (utils/normalize-lc %) (utils/normalize-lc (str sqlite-util/db-version-prefix graph-identifier)))
|
||||
(string/ends-with? (utils/normalize-lc %)
|
||||
(str "/" (utils/normalize-lc graph-identifier))))
|
||||
%))))
|
||||
|
||||
(defmethod handle :getGraphs [_window [_]]
|
||||
|
||||
@@ -229,9 +229,7 @@
|
||||
(let [remote? (:remote? (first (filter #(= current-repo (:url %)) repos)))
|
||||
repo-name (db/get-repo-name current-repo)
|
||||
short-repo-name (if repo-name
|
||||
(if (config/db-based-graph? repo-name)
|
||||
(string/replace-first repo-name config/db-version-prefix "")
|
||||
(db/get-short-repo-name repo-name))
|
||||
(db/get-short-repo-name repo-name)
|
||||
"Select a Graph")]
|
||||
[:a.item.group.flex.items-center.p-2.text-sm.font-medium.rounded-md
|
||||
|
||||
|
||||
@@ -36,15 +36,18 @@
|
||||
(defn get-short-repo-name
|
||||
"repo-name: from get-repo-name. Dir/Name => Name"
|
||||
[repo-name]
|
||||
(cond
|
||||
(util/electron?)
|
||||
(text/get-file-basename repo-name)
|
||||
(let [repo-name' (cond
|
||||
(util/electron?)
|
||||
(text/get-file-basename repo-name)
|
||||
|
||||
(mobile-util/native-platform?)
|
||||
(gp-util/safe-decode-uri-component (text/get-file-basename repo-name))
|
||||
(mobile-util/native-platform?)
|
||||
(gp-util/safe-decode-uri-component (text/get-file-basename repo-name))
|
||||
|
||||
:else
|
||||
repo-name))
|
||||
:else
|
||||
repo-name)]
|
||||
(if (config/db-based-graph? repo-name')
|
||||
(string/replace-first repo-name' config/db-version-prefix "")
|
||||
repo-name')))
|
||||
|
||||
(defn datascript-db
|
||||
[repo]
|
||||
|
||||
Reference in New Issue
Block a user