|
1 | 1 | (ns logseq.graph-parser.config
|
2 | 2 | "App config that is shared between graph-parser and rest of app"
|
3 | 3 | (:require [clojure.set :as set]
|
4 |
| - [clojure.string :as string])) |
| 4 | + [clojure.string :as string] |
| 5 | + [goog.object :as gobj])) |
5 | 6 |
|
6 | 7 | (def app-name
|
7 | 8 | "Copy of frontend.config/app-name. Too small to couple to main app"
|
8 | 9 | "logseq")
|
9 | 10 |
|
10 | 11 | (defonce asset-protocol "assets://")
|
11 | 12 | (defonce capacitor-protocol "capacitor://")
|
12 |
| -(defonce capacitor-protocol-with-prefix (str capacitor-protocol "localhost/_capacitor_file_")) |
| 13 | +(defonce capacitor-prefix "_capacitor_file_") |
| 14 | +(defonce capacitor-protocol-with-prefix (str capacitor-protocol "localhost/" capacitor-prefix)) |
| 15 | +(defonce capacitor-x-protocol-with-prefix (str (gobj/getValueByKeys js/globalThis "location" "href") capacitor-prefix)) |
13 | 16 |
|
14 | 17 | (defonce local-assets-dir "assets")
|
15 | 18 |
|
|
22 | 25 | [s]
|
23 | 26 | (when (string? s)
|
24 | 27 | (or (string/starts-with? s asset-protocol)
|
25 |
| - (string/starts-with? s capacitor-protocol)))) |
| 28 | + (string/starts-with? s capacitor-protocol) |
| 29 | + (string/starts-with? s capacitor-x-protocol-with-prefix)))) |
26 | 30 |
|
27 | 31 | (defn remove-asset-protocol
|
28 | 32 | [s]
|
29 | 33 | (if (local-protocol-asset? s)
|
30 | 34 | (-> s
|
31 | 35 | (string/replace-first asset-protocol "")
|
32 |
| - (string/replace-first capacitor-protocol-with-prefix "file://")) |
| 36 | + (string/replace-first capacitor-protocol-with-prefix "file://") |
| 37 | + (string/replace-first capacitor-x-protocol-with-prefix "file://")) |
33 | 38 | s))
|
34 | 39 |
|
35 | 40 | (defonce default-draw-directory "draws")
|
|
0 commit comments