setting home path now works
This commit is contained in:
parent
75d172fc3f
commit
2ac3c9a45a
16 changed files with 764 additions and 71 deletions
10
package-lock.json
generated
10
package-lock.json
generated
|
|
@ -5,6 +5,7 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@tauri-apps/plugin-dialog": "^2.2.0",
|
||||
"@tauri-apps/plugin-sql": "^2.2.0"
|
||||
}
|
||||
},
|
||||
|
|
@ -18,6 +19,15 @@
|
|||
"url": "https://opencollective.com/tauri"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-dialog": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.2.0.tgz",
|
||||
"integrity": "sha512-6bLkYK68zyK31418AK5fNccCdVuRnNpbxquCl8IqgFByOgWFivbiIlvb79wpSXi0O+8k8RCSsIpOquebusRVSg==",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-sql": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-sql/-/plugin-sql-2.2.0.tgz",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@tauri-apps/plugin-dialog": "^2.2.0",
|
||||
"@tauri-apps/plugin-sql": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
rust-toolchain.toml
Normal file
3
rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly"
|
||||
components = [ "rustfmt", "rustc-dev" ]
|
||||
3
src-tauri/.cargo/config.toml
Normal file
3
src-tauri/.cargo/config.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||
537
src-tauri/Cargo.lock
generated
537
src-tauri/Cargo.lock
generated
|
|
@ -1,6 +1,6 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
|
|
@ -162,6 +162,7 @@ name = "apographe"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"comrak",
|
||||
"confy",
|
||||
"fuzzy-matcher",
|
||||
"html_tag",
|
||||
"serde",
|
||||
|
|
@ -170,6 +171,7 @@ dependencies = [
|
|||
"sqlx",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-dialog",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-log",
|
||||
"tauri-plugin-shell",
|
||||
|
|
@ -181,6 +183,61 @@ version = "0.7.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "ashpd"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9c39d707614dbcc6bed00015539f488d8e3fe3e66ed60961efc0c90f4b380b3"
|
||||
dependencies = [
|
||||
"enumflags2",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"rand 0.8.5",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"serde_repr",
|
||||
"tokio",
|
||||
"url",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-broadcast"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
|
||||
dependencies = [
|
||||
"event-listener 5.4.0",
|
||||
"event-listener-strategy",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-recursion"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atk"
|
||||
version = "0.18.0"
|
||||
|
|
@ -338,7 +395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro-crate 2.0.2",
|
||||
"proc-macro-crate 2.0.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
|
|
@ -678,6 +735,27 @@ dependencies = [
|
|||
"xdg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "confy"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"toml 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
|
|
@ -953,6 +1031,15 @@ dependencies = [
|
|||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "directories"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
|
|
@ -991,6 +1078,15 @@ dependencies = [
|
|||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dlopen2"
|
||||
version = "0.7.0"
|
||||
|
|
@ -1020,6 +1116,12 @@ version = "0.15.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
|
||||
|
||||
[[package]]
|
||||
name = "dpi"
|
||||
version = "0.1.1"
|
||||
|
|
@ -1091,12 +1193,39 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "endi"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf"
|
||||
|
||||
[[package]]
|
||||
name = "entities"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
|
||||
|
||||
[[package]]
|
||||
name = "enumflags2"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147"
|
||||
dependencies = [
|
||||
"enumflags2_derive",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumflags2_derive"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.2"
|
||||
|
|
@ -1125,12 +1254,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1139,6 +1268,27 @@ version = "2.5.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "5.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener-strategy"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2"
|
||||
dependencies = [
|
||||
"event-listener 5.4.0",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fancy-regex"
|
||||
version = "0.11.0"
|
||||
|
|
@ -1322,6 +1472,19 @@ version = "0.3.31"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.31"
|
||||
|
|
@ -1591,7 +1754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro-crate 2.0.2",
|
||||
"proc-macro-crate 2.0.0",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -2464,6 +2627,19 @@ version = "1.0.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases 0.2.1",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.14"
|
||||
|
|
@ -2510,7 +2686,7 @@ version = "0.7.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
|
||||
dependencies = [
|
||||
"proc-macro-crate 2.0.2",
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
|
|
@ -2643,6 +2819,7 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
|
|||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"dispatch",
|
||||
"libc",
|
||||
"objc2",
|
||||
]
|
||||
|
|
@ -2850,6 +3027,16 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "ordered-stream"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_pipe"
|
||||
version = "1.2.1"
|
||||
|
|
@ -2885,6 +3072,12 @@ dependencies = [
|
|||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
|
|
@ -3131,7 +3324,7 @@ checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016"
|
|||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"indexmap 2.6.0",
|
||||
"quick-xml",
|
||||
"quick-xml 0.32.0",
|
||||
"serde",
|
||||
"time",
|
||||
]
|
||||
|
|
@ -3182,14 +3375,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "2.0.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24"
|
||||
checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
|
||||
dependencies = [
|
||||
"toml_datetime",
|
||||
"toml_edit 0.20.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35"
|
||||
dependencies = [
|
||||
"toml_edit 0.22.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
|
|
@ -3258,6 +3459,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.37.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
|
|
@ -3464,6 +3674,31 @@ dependencies = [
|
|||
"windows-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rfd"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a24763657bff09769a8ccf12c8b8a50416fb035fe199263b4c5071e4e3f006f"
|
||||
dependencies = [
|
||||
"ashpd",
|
||||
"block2",
|
||||
"core-foundation 0.10.0",
|
||||
"core-foundation-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"gtk-sys",
|
||||
"js-sys",
|
||||
"log",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
"raw-window-handle",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rkyv"
|
||||
version = "0.7.45"
|
||||
|
|
@ -3526,15 +3761,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.40"
|
||||
version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3588,6 +3823,12 @@ dependencies = [
|
|||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
|
|
@ -3842,6 +4083,15 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.7"
|
||||
|
|
@ -3987,7 +4237,7 @@ dependencies = [
|
|||
"crossbeam-queue",
|
||||
"dotenvy",
|
||||
"either",
|
||||
"event-listener",
|
||||
"event-listener 2.5.3",
|
||||
"flume",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
|
@ -4052,6 +4302,12 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.8.7"
|
||||
|
|
@ -4390,10 +4646,28 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.0.3"
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96ba7d46e86db8c830d143ef90ab5a453328365b0cc834c24edea4267b16aba0"
|
||||
checksum = "8b59fd750551b1066744ab956a1cd6b1ea3e1b3763b0b9153ac27a044d596426"
|
||||
dependencies = [
|
||||
"log",
|
||||
"raw-window-handle",
|
||||
"rfd",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"tauri-plugin-fs",
|
||||
"thiserror 2.0.3",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1a1edf18000f02903a7c2e5997fb89aca455ecbc0acc15c6535afbb883be223"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dunce",
|
||||
|
|
@ -4405,7 +4679,9 @@ dependencies = [
|
|||
"serde_repr",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 1.0.69",
|
||||
"tauri-utils",
|
||||
"thiserror 2.0.3",
|
||||
"toml 0.8.2",
|
||||
"url",
|
||||
"uuid",
|
||||
]
|
||||
|
|
@ -4705,7 +4981,9 @@ dependencies = [
|
|||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
|
|
@ -4769,9 +5047,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.3"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
@ -4786,7 +5064,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4799,7 +5077,18 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
|
||||
dependencies = [
|
||||
"indexmap 2.6.0",
|
||||
"toml_datetime",
|
||||
"winnow 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4815,9 +5104,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
|
|
@ -4872,6 +5173,17 @@ version = "1.17.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "uds_windows"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"tempfile",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-property"
|
||||
version = "0.9.0"
|
||||
|
|
@ -5180,6 +5492,66 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
"rustix",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"rustix",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.32.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.31.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml 0.37.2",
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-sys"
|
||||
version = "0.31.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
|
||||
dependencies = [
|
||||
"dlib",
|
||||
"log",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.72"
|
||||
|
|
@ -5631,6 +6003,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
|
|
@ -5741,6 +6122,16 @@ version = "2.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
|
||||
|
||||
[[package]]
|
||||
name = "xdg-home"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
|
|
@ -5774,6 +6165,63 @@ dependencies = [
|
|||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "5.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59c333f648ea1b647bc95dc1d34807c8e25ed7a6feff3394034dc4776054b236"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-recursion",
|
||||
"async-trait",
|
||||
"enumflags2",
|
||||
"event-listener 5.4.0",
|
||||
"futures-core",
|
||||
"futures-lite",
|
||||
"hex",
|
||||
"nix",
|
||||
"ordered-stream",
|
||||
"serde",
|
||||
"serde_repr",
|
||||
"static_assertions",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"windows-sys 0.59.0",
|
||||
"winnow 0.7.3",
|
||||
"xdg-home",
|
||||
"zbus_macros",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "5.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f325ad10eb0d0a3eb060203494c3b7ec3162a01a59db75d2deee100339709fc0"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.3.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus_names"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"winnow 0.7.3",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
|
|
@ -5837,3 +6285,46 @@ dependencies = [
|
|||
"quote",
|
||||
"syn 2.0.87",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "5.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2df9ee044893fcffbdc25de30546edef3e32341466811ca18421e3cd6c5a3ac"
|
||||
dependencies = [
|
||||
"endi",
|
||||
"enumflags2",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"url",
|
||||
"winnow 0.7.3",
|
||||
"zvariant_derive",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "5.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74170caa85b8b84cc4935f2d56a57c7a15ea6185ccdd7eadb57e6edd90f94b2f"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.3.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_utils"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"syn 2.0.87",
|
||||
"winnow 0.7.3",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
cargo-features = ["codegen-backend"]
|
||||
|
||||
[package]
|
||||
name = "apographe"
|
||||
version = "0.1.0"
|
||||
|
|
@ -29,3 +31,8 @@ shellexpand = "3.1.0"
|
|||
html_tag = "0.1.3"
|
||||
fuzzy-matcher = "0.3"
|
||||
sqlx = { version = "0.6.2", features = ["runtime-tokio-native-tls", "sqlite"] }
|
||||
confy = "0.6.1"
|
||||
tauri-plugin-dialog = "2"
|
||||
|
||||
[profile.dev]
|
||||
codegen-backend = "cranelift"
|
||||
|
|
|
|||
|
|
@ -8,13 +8,18 @@
|
|||
"permissions": [
|
||||
{
|
||||
"identifier": "fs:allow-read",
|
||||
"allow": [{ "path": "$HOME/**" }]
|
||||
"allow": [
|
||||
{
|
||||
"path": "$HOME/**"
|
||||
}
|
||||
]
|
||||
},
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
"log:default",
|
||||
"fs:allow-home-read-recursive",
|
||||
"fs:scope-home-recursive",
|
||||
"fs:read-all"
|
||||
"fs:read-all",
|
||||
"dialog:default"
|
||||
]
|
||||
}
|
||||
}
|
||||
3
src-tauri/rust-toolchain.toml
Normal file
3
src-tauri/rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly"
|
||||
components = [ "rustfmt", "rustc-dev" ]
|
||||
66
src-tauri/src/config.rs
Normal file
66
src-tauri/src/config.rs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Mutex,
|
||||
};
|
||||
use tauri::Manager;
|
||||
#[derive(Default, Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub core_cfg: CoreCFG,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct CoreCFG {
|
||||
pub home_path: Option<PathBuf>,
|
||||
pub current_file: Option<PathBuf>,
|
||||
}
|
||||
impl Default for CoreCFG {
|
||||
fn default() -> Self {
|
||||
CoreCFG {
|
||||
home_path: None,
|
||||
current_file: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_config(path: Option<PathBuf>) -> Config {
|
||||
match path {
|
||||
Some(p) => confy::load_path(p).expect("Configuration could not be loaded"),
|
||||
None => confy::load("apographe", Some("config"))
|
||||
.ok()
|
||||
.unwrap_or_else(|| {
|
||||
let config: Config = Config::default();
|
||||
let _ = confy::store("aphorme", Some("config"), Config::default());
|
||||
config
|
||||
}),
|
||||
}
|
||||
}
|
||||
#[tauri::command]
|
||||
pub fn get_basepath(app_handle: tauri::AppHandle) -> Option<String> {
|
||||
let config = app_handle.state::<Mutex<Config>>();
|
||||
|
||||
// Lock the mutex to get mutable access:
|
||||
let config = config.lock().unwrap();
|
||||
let base_path = config.core_cfg.home_path.clone();
|
||||
return base_path.map(|p| p.to_string_lossy().into_owned());
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_basepath(app_handle: tauri::AppHandle, path: String) -> bool {
|
||||
|
||||
if let Ok(resolved_path) = shellexpand::full(&path)
|
||||
{
|
||||
let basepath = Path::new(&resolved_path.to_string()).to_path_buf();
|
||||
if !basepath.is_dir(){
|
||||
println!("{:?}", basepath);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
let config = app_handle.state::<Mutex<Config>>();
|
||||
// Lock the mutex to get mutable access:
|
||||
let mut config = config.lock().unwrap();
|
||||
config.core_cfg.home_path = Some(basepath);
|
||||
return true;
|
||||
}
|
||||
else {return false};
|
||||
}
|
||||
|
|
@ -6,14 +6,13 @@ use std::{
|
|||
|
||||
use sqlx::{migrate::MigrateDatabase, Sqlite, SqlitePool};
|
||||
use tauri::{ipc::RuntimeCapability, App, AssetResolver, Manager, Url};
|
||||
|
||||
async fn populate_file_db(db: &SqlitePool) {}
|
||||
#[tauri::command]
|
||||
pub async fn initialize_database(
|
||||
app_handle: tauri::AppHandle,
|
||||
basepath: String,
|
||||
pathtemplate: String,
|
||||
) {
|
||||
println!("hello");
|
||||
let db_path = Path::new("Documents")
|
||||
.join(Path::new("Knowledgebase"))
|
||||
.join("db.sqlite");
|
||||
|
|
@ -31,27 +30,24 @@ pub async fn initialize_database(
|
|||
.await
|
||||
.unwrap_or(false)
|
||||
{
|
||||
println!("Creating database {}", unicode_db_path);
|
||||
match Sqlite::create_database(&unicode_db_path).await {
|
||||
Ok(_) => println!("Create db success"),
|
||||
Err(error) => panic!("error: {}", error),
|
||||
}
|
||||
} else {
|
||||
println!("Database already exists");
|
||||
}
|
||||
let db = SqlitePool::connect(unicode_db_path).await.unwrap();
|
||||
let result = sqlx::query(
|
||||
"CREATE TABLE IF NOT EXISTS files
|
||||
(
|
||||
id INTEGER PRIMARY KEY NOT NULL,
|
||||
relative_path TEXT NOT NULL
|
||||
relative_path TEXT NOT NULL,
|
||||
file_name TEXT NOT NULL
|
||||
);",
|
||||
)
|
||||
.execute(&db)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!("Create file table result: {:?}", result);
|
||||
let result = sqlx::query(
|
||||
"CREATE TABLE IF NOT EXISTS file_diffs
|
||||
(
|
||||
|
|
@ -65,7 +61,6 @@ pub async fn initialize_database(
|
|||
.execute(&db)
|
||||
.await
|
||||
.unwrap();
|
||||
println!("Create diff table result: {:?}", result);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
|
|||
13
src-tauri/src/file_access.rs
Normal file
13
src-tauri/src/file_access.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// #[tauri::command]
|
||||
// pub fn open_file(app_handle: tauri::AppHandle, relative_path: String) -> Option<String> {
|
||||
// let mut file = File::open("foo.txt")?;
|
||||
// let mut contents = String::new();
|
||||
// file.read_to_string(&mut contents)?;
|
||||
// assert_eq!(contents, "Hello, world!");
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
use std::{path::Path, sync::Mutex};
|
||||
|
||||
use crate::Config;
|
||||
use tauri::Manager;
|
||||
|
|
@ -1,19 +1,24 @@
|
|||
mod config;
|
||||
mod database;
|
||||
mod file_access;
|
||||
mod file_tree;
|
||||
mod markdown_parser;
|
||||
mod search;
|
||||
use std::env;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
use config::{get_basepath, load_config, set_basepath, Config};
|
||||
use database::initialize_database;
|
||||
use file_tree::dir_tree_html;
|
||||
use markdown_parser::parse_markdown;
|
||||
use search::search_files;
|
||||
use std::env;
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_log::Builder::new().build())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
|
|
@ -23,13 +28,18 @@ pub fn run() {
|
|||
scope.allow_directory(tauri::path::BaseDirectory::Home.variable(), true);
|
||||
app.set_theme(Some(tauri::Theme::Dark));
|
||||
|
||||
let config = load_config(None);
|
||||
app.manage(Mutex::new(config)); //RWLock
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
initialize_database,
|
||||
dir_tree_html,
|
||||
parse_markdown,
|
||||
search_files
|
||||
search_files,
|
||||
get_basepath,
|
||||
set_basepath,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@ use std::{
|
|||
env,
|
||||
path::{absolute, Path},
|
||||
};
|
||||
use crate::get_basepath;
|
||||
#[tauri::command]
|
||||
pub fn parse_markdown(document: &str, pathtemplate: &str, basepath: &str) -> String {
|
||||
pub fn parse_markdown(app_handle: tauri::AppHandle, document: &str, pathtemplate: &str) -> String {
|
||||
let rendered_markdown: String;
|
||||
let path = "/foo/bar.txt";
|
||||
println!("{:?}", shellexpand::full(path));
|
||||
let arena = Arena::new();
|
||||
|
||||
// Parse the document into a root `AstNode`
|
||||
let mut options = Options::default();
|
||||
options.render.unsafe_ = true;
|
||||
|
|
@ -18,31 +16,36 @@ pub fn parse_markdown(document: &str, pathtemplate: &str, basepath: &str) -> Str
|
|||
|
||||
// Iterate over all the descendants of root.
|
||||
|
||||
if let Ok(resolved_basepath) = shellexpand::full(&basepath) {
|
||||
println!(
|
||||
"{:?}",
|
||||
env::set_current_dir(&resolved_basepath.into_owned())
|
||||
);
|
||||
}
|
||||
|
||||
for node in root.descendants() {
|
||||
if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value {
|
||||
let image_path = Path::new(&image_node.url).to_path_buf();
|
||||
|
||||
let absolute_image_path_res = absolute(image_node.url.clone());
|
||||
|
||||
let absolute_image_path = absolute_image_path_res.unwrap_or(image_path.clone());
|
||||
let absolute_image_path_str = absolute_image_path.as_path().to_string_lossy();
|
||||
if let Ok(resolved_path) = shellexpand::full(&absolute_image_path_str) {
|
||||
image_node.url = pathtemplate.replace("FILEPATH", &resolved_path);
|
||||
}
|
||||
println!("{}", image_node.url);
|
||||
if let Some(basepath) = get_basepath(app_handle) {
|
||||
|
||||
if let Ok(resolved_basepath) = shellexpand::full(&basepath) {
|
||||
println!(
|
||||
"{:?}",
|
||||
env::set_current_dir(&resolved_basepath.into_owned())
|
||||
);
|
||||
}
|
||||
|
||||
for node in root.descendants() {
|
||||
if let NodeValue::Image(ref mut image_node) = node.data.borrow_mut().value {
|
||||
let image_path = Path::new(&image_node.url).to_path_buf();
|
||||
|
||||
let absolute_image_path_res = absolute(image_node.url.clone());
|
||||
|
||||
let absolute_image_path = absolute_image_path_res.unwrap_or(image_path.clone());
|
||||
let absolute_image_path_str = absolute_image_path.as_path().to_string_lossy();
|
||||
if let Ok(resolved_path) = shellexpand::full(&absolute_image_path_str) {
|
||||
image_node.url = pathtemplate.replace("FILEPATH", &resolved_path);
|
||||
}
|
||||
println!("{}", image_node.url);
|
||||
}
|
||||
}
|
||||
let mut html = vec![];
|
||||
format_html(root, &options, &mut html).unwrap();
|
||||
// println!("{}", String::from_utf8(html.clone()).unwrap());
|
||||
rendered_markdown = String::from_utf8(html).unwrap();
|
||||
return rendered_markdown.to_owned();
|
||||
}
|
||||
let mut html = vec![];
|
||||
format_html(root, &options, &mut html).unwrap();
|
||||
// println!("{}", String::from_utf8(html.clone()).unwrap());
|
||||
rendered_markdown = String::from_utf8(html).unwrap();
|
||||
return rendered_markdown.to_owned();
|
||||
return String::new()
|
||||
// String::from_str("lololo").unwrap()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,18 @@
|
|||
<body>
|
||||
<dialog id="file-search-dialog">
|
||||
|
||||
<div id="file-search-dialog-input" contenteditable></div>
|
||||
<div id="file-search-results"/>
|
||||
<div class="input-field" id="file-search-dialog-input" contenteditable></div>
|
||||
<div id="file-search-results" />
|
||||
</dialog>
|
||||
|
||||
<dialog id="setup-dialog">
|
||||
|
||||
<div class="dialog-text"> Home Directory of Knowledgebase </div>
|
||||
<div class="row">
|
||||
<div class="input-field" id="knowledgebase-path" contenteditable></div>
|
||||
<div class="button" id="knowledgebase-button">Select</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<div class="main">
|
||||
<div class="top-bar">
|
||||
|
|
@ -53,4 +61,4 @@
|
|||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
32
src/main.js
32
src/main.js
|
|
@ -1,4 +1,5 @@
|
|||
const { convertFileSrc, invoke } = window.__TAURI__.core;
|
||||
const { open } = window.__TAURI__.dialog;
|
||||
|
||||
let text = "";
|
||||
let placeholder_path = "FILEPATH";
|
||||
|
|
@ -11,6 +12,37 @@ invoke("initialize_database", { basepath: "~/Documents/Knowledgebase", pathtempl
|
|||
(ret) => {
|
||||
}
|
||||
);
|
||||
invoke("get_basepath").then(
|
||||
(ret) => {
|
||||
if (!ret){
|
||||
const setup_dialog = document.getElementById("setup-dialog");
|
||||
setup_dialog.show();
|
||||
|
||||
}else{
|
||||
console.log(ret);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
document.getElementById("knowledgebase-button").onclick = async function () {
|
||||
const file = await open({
|
||||
multiple: false,
|
||||
directory: true,
|
||||
});
|
||||
|
||||
const path_text = document.getElementById("knowledgebase-path");
|
||||
path_text.innerText = file;
|
||||
invoke("set_basepath", {path: file}).then(
|
||||
(ret) => {
|
||||
if (ret){
|
||||
const setup_dialog = document.getElementById("setup-dialog");
|
||||
console.log("hiding");
|
||||
setup_dialog.close();
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(file);
|
||||
};
|
||||
//
|
||||
export function render_markdown() {
|
||||
text = textarea.innerText;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
:root {
|
||||
--main-bg-color: #2f2f2f;
|
||||
--highlight-color: #3f3f3f;
|
||||
--bright-highlight-color: #4f4f4f;
|
||||
--text-color: #f6f6f6;
|
||||
--accent-color: #5f5f5f;
|
||||
--sidebar-width: 3em;
|
||||
|
|
@ -222,14 +223,56 @@ dialog {
|
|||
/* display: flex; */
|
||||
/* flex-direction: column; */
|
||||
overflow: hidden;
|
||||
color: var(--text-color);
|
||||
font-size: .5cm;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: var(--accent-color);
|
||||
/* Green */
|
||||
color: white;
|
||||
border: solid;
|
||||
border-color: transparent;
|
||||
padding: 5px 3px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
|
||||
border: solid;
|
||||
border-color: var(--bright-highlight-color);
|
||||
}
|
||||
|
||||
.button:active {
|
||||
border: solid;
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
.input-field {
|
||||
border: solid;
|
||||
border-color: var(--accent-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
#knowledgebase-button {
|
||||
width: 19%;
|
||||
}
|
||||
|
||||
#knowledgebase-path {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#file-search-dialog-input {
|
||||
border: solid;
|
||||
border-color: var(--accent-color);
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 10px;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
#file-search-results {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue