feat: use sql for mobile storage
This commit is contained in:
parent
ab2bc11465
commit
9720ad368e
@ -25,8 +25,8 @@ export RANLIB_aarch64_linux_android="$NDK_HOME/toolchains/llvm/prebuilt/darwin-x
|
||||
# Additional environment variables for Rust cross-compilation
|
||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang"
|
||||
|
||||
# Only set global CC and AR for Android builds (when TAURI_ANDROID_BUILD is set)
|
||||
if [ "$TAURI_ANDROID_BUILD" = "true" ]; then
|
||||
# Only set global CC and AR for Android builds (when IS_ANDROID is set)
|
||||
if [ "$IS_ANDROID" = "true" ]; then
|
||||
export CC="$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang"
|
||||
export AR="$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
|
||||
echo "Global CC and AR set for Android build"
|
||||
|
||||
@ -342,41 +342,49 @@ __metadata:
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=f15485&locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=bfbced&locator=%40janhq%2Fassistant-extension%40workspace%3Aassistant-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/257621cb56db31a4dd3a2b509ec4c61217022e74bbd39cf6a1a172073654b9a65eee94ef9c1b4d4f5d2231d159c8818cb02846f3d88fe14f102f43169ad3737c
|
||||
peerDependencies:
|
||||
react: 19.0.0
|
||||
checksum: 10c0/67ebb430e1e8433441ce3b24d0ce88ce3f079d99c6518bf71492edeaefbc7a774b5f17c6f34282941e466a30787b711a0779ccb0fd28fe8376f1967edb581b53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=f15485&locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=bfbced&locator=%40janhq%2Fconversational-extension%40workspace%3Aconversational-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/257621cb56db31a4dd3a2b509ec4c61217022e74bbd39cf6a1a172073654b9a65eee94ef9c1b4d4f5d2231d159c8818cb02846f3d88fe14f102f43169ad3737c
|
||||
peerDependencies:
|
||||
react: 19.0.0
|
||||
checksum: 10c0/67ebb430e1e8433441ce3b24d0ce88ce3f079d99c6518bf71492edeaefbc7a774b5f17c6f34282941e466a30787b711a0779ccb0fd28fe8376f1967edb581b53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fdownload-extension%40workspace%3Adownload-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=f15485&locator=%40janhq%2Fdownload-extension%40workspace%3Adownload-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=bfbced&locator=%40janhq%2Fdownload-extension%40workspace%3Adownload-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/257621cb56db31a4dd3a2b509ec4c61217022e74bbd39cf6a1a172073654b9a65eee94ef9c1b4d4f5d2231d159c8818cb02846f3d88fe14f102f43169ad3737c
|
||||
peerDependencies:
|
||||
react: 19.0.0
|
||||
checksum: 10c0/67ebb430e1e8433441ce3b24d0ce88ce3f079d99c6518bf71492edeaefbc7a774b5f17c6f34282941e466a30787b711a0779ccb0fd28fe8376f1967edb581b53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@janhq/core@file:../../core/package.tgz::locator=%40janhq%2Fllamacpp-extension%40workspace%3Allamacpp-extension":
|
||||
version: 0.1.10
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=f15485&locator=%40janhq%2Fllamacpp-extension%40workspace%3Allamacpp-extension"
|
||||
resolution: "@janhq/core@file:../../core/package.tgz#../../core/package.tgz::hash=bfbced&locator=%40janhq%2Fllamacpp-extension%40workspace%3Allamacpp-extension"
|
||||
dependencies:
|
||||
rxjs: "npm:^7.8.1"
|
||||
ulidx: "npm:^2.3.0"
|
||||
checksum: 10c0/257621cb56db31a4dd3a2b509ec4c61217022e74bbd39cf6a1a172073654b9a65eee94ef9c1b4d4f5d2231d159c8818cb02846f3d88fe14f102f43169ad3737c
|
||||
peerDependencies:
|
||||
react: 19.0.0
|
||||
checksum: 10c0/67ebb430e1e8433441ce3b24d0ce88ce3f079d99c6518bf71492edeaefbc7a774b5f17c6f34282941e466a30787b711a0779ccb0fd28fe8376f1967edb581b53
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
10
package.json
10
package.json
@ -26,11 +26,11 @@
|
||||
"serve:web-app": "yarn workspace @janhq/web-app serve:web",
|
||||
"build:serve:web-app": "yarn build:web-app && yarn serve:web-app",
|
||||
"dev:tauri": "yarn build:icon && yarn copy:assets:tauri && cross-env IS_CLEAN=true tauri dev",
|
||||
"dev:ios": "yarn build:extensions-web && yarn copy:assets:mobile && RUSTC_WRAPPER= yarn tauri ios dev --features mobile",
|
||||
"dev:android": "yarn build:extensions-web && yarn copy:assets:mobile && cross-env IS_CLEAN=true TAURI_ANDROID_BUILD=true yarn tauri android dev --features mobile",
|
||||
"build:android": "yarn build:icon && yarn copy:assets:mobile && cross-env IS_CLEAN=true TAURI_ANDROID_BUILD=true yarn tauri android build -- --no-default-features --features mobile",
|
||||
"build:ios": "yarn copy:assets:mobile && yarn tauri ios build -- --no-default-features --features mobile",
|
||||
"build:ios:device": "yarn build:icon && yarn copy:assets:mobile && yarn tauri ios build -- --no-default-features --features mobile --export-method debugging",
|
||||
"dev:ios": "yarn copy:assets:mobile && RUSTC_WRAPPER= cross-env IS_IOS=true yarn tauri ios dev --features mobile",
|
||||
"dev:android": "yarn copy:assets:mobile && cross-env IS_ANDROID=true yarn tauri android dev --features mobile",
|
||||
"build:android": "yarn build:icon && yarn copy:assets:mobile && cross-env IS_CLEAN=true yarn tauri android build -- --no-default-features --features mobile",
|
||||
"build:ios": "yarn build:icon && yarn copy:assets:mobile && cross-env IS_IOS=true yarn tauri ios build -- --no-default-features --features mobile",
|
||||
"build:ios:device": "yarn build:icon && yarn copy:assets:mobile && cross-env IS_IOS=true yarn tauri ios build -- --no-default-features --features mobile --export-method debugging",
|
||||
"copy:assets:tauri": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\" && cpx \"LICENSE\" \"src-tauri/resources/\"",
|
||||
"copy:assets:mobile": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\" && cpx \"LICENSE\" \"src-tauri/resources/\"",
|
||||
"download:lib": "node ./scripts/download-lib.mjs",
|
||||
|
||||
513
src-tauri/Cargo.lock
generated
513
src-tauri/Cargo.lock
generated
@ -23,6 +23,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"sqlx",
|
||||
"tar",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
@ -107,6 +108,12 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
@ -344,6 +351,15 @@ dependencies = [
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atoi"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
@ -734,6 +750,12 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "const-random"
|
||||
version = "0.1.18"
|
||||
@ -865,6 +887,21 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
@ -1027,6 +1064,17 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"pem-rfc7468",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.4.0"
|
||||
@ -1068,6 +1116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"const-oid",
|
||||
"crypto-common",
|
||||
"subtle",
|
||||
]
|
||||
@ -1172,6 +1221,12 @@ dependencies = [
|
||||
"litrs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.2.1"
|
||||
@ -1214,6 +1269,15 @@ version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embed-resource"
|
||||
version = "3.0.5"
|
||||
@ -1315,6 +1379,17 @@ dependencies = [
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "etcetera"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"home",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "5.4.1"
|
||||
@ -1402,12 +1477,29 @@ dependencies = [
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
@ -1517,6 +1609,17 @@ dependencies = [
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-intrusive"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"lock_api",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.31"
|
||||
@ -1966,6 +2069,20 @@ name = "hashbrown"
|
||||
version = "0.15.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
|
||||
dependencies = [
|
||||
"hashbrown 0.15.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
@ -1991,6 +2108,15 @@ version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hkdf"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
|
||||
dependencies = [
|
||||
"hmac",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
@ -2566,6 +2692,9 @@ name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libappindicator"
|
||||
@ -2617,6 +2746,12 @@ dependencies = [
|
||||
"windows-targets 0.53.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.9"
|
||||
@ -2628,6 +2763,17 @@ dependencies = [
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.9.4"
|
||||
@ -2717,6 +2863,16 @@ version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.5"
|
||||
@ -2867,12 +3023,49 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint-dig"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"lazy_static",
|
||||
"libm",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-traits",
|
||||
"rand 0.8.5",
|
||||
"smallvec",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
@ -2880,6 +3073,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3426,6 +3620,15 @@ dependencies = [
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pem-rfc7468"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.1"
|
||||
@ -3589,6 +3792,27 @@ dependencies = [
|
||||
"futures-io",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs1"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
|
||||
dependencies = [
|
||||
"der",
|
||||
"pkcs8",
|
||||
"spki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
@ -4272,6 +4496,26 @@ dependencies = [
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rsa"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"digest",
|
||||
"num-bigint-dig",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"pkcs1",
|
||||
"pkcs8",
|
||||
"rand_core 0.6.4",
|
||||
"signature",
|
||||
"spki",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-ini"
|
||||
version = "0.21.2"
|
||||
@ -4780,6 +5024,16 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.7"
|
||||
@ -4815,6 +5069,9 @@ name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
@ -4884,6 +5141,213 @@ dependencies = [
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc"
|
||||
dependencies = [
|
||||
"sqlx-core",
|
||||
"sqlx-macros",
|
||||
"sqlx-mysql",
|
||||
"sqlx-postgres",
|
||||
"sqlx-sqlite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-core"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
"either",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
"futures-intrusive",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"hashbrown 0.15.4",
|
||||
"hashlink",
|
||||
"indexmap 2.10.0",
|
||||
"log",
|
||||
"memchr",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-macros"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"sqlx-core",
|
||||
"sqlx-macros-core",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-macros-core"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b"
|
||||
dependencies = [
|
||||
"dotenvy",
|
||||
"either",
|
||||
"heck 0.5.0",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sqlx-core",
|
||||
"sqlx-mysql",
|
||||
"sqlx-postgres",
|
||||
"sqlx-sqlite",
|
||||
"syn 2.0.104",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-mysql"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.22.1",
|
||||
"bitflags 2.9.1",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"crc",
|
||||
"digest",
|
||||
"dotenvy",
|
||||
"either",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"generic-array",
|
||||
"hex",
|
||||
"hkdf",
|
||||
"hmac",
|
||||
"itoa",
|
||||
"log",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"rand 0.8.5",
|
||||
"rsa",
|
||||
"serde",
|
||||
"sha1",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
"whoami",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-postgres"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.22.1",
|
||||
"bitflags 2.9.1",
|
||||
"byteorder",
|
||||
"crc",
|
||||
"dotenvy",
|
||||
"etcetera",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"hex",
|
||||
"hkdf",
|
||||
"hmac",
|
||||
"home",
|
||||
"itoa",
|
||||
"log",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"once_cell",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
"whoami",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-sqlite"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"flume",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-intrusive",
|
||||
"futures-util",
|
||||
"libsqlite3-sys",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"serde_urlencoded",
|
||||
"sqlx-core",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sse-stream"
|
||||
version = "0.2.1"
|
||||
@ -4934,6 +5398,17 @@ dependencies = [
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stringprep"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
"unicode-properties",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strip-ansi-escapes"
|
||||
version = "0.2.1"
|
||||
@ -6037,6 +6512,7 @@ version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
@ -6154,12 +6630,33 @@ dependencies = [
|
||||
"unic-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.12.0"
|
||||
@ -6376,6 +6873,12 @@ dependencies = [
|
||||
"wit-bindgen-rt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.100"
|
||||
@ -6629,6 +7132,16 @@ dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "whoami"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
|
||||
dependencies = [
|
||||
"libredox",
|
||||
"wasite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
||||
@ -35,6 +35,7 @@ mobile = [
|
||||
"tauri/protocol-asset",
|
||||
"tauri/test",
|
||||
"tauri/wry",
|
||||
"dep:sqlx",
|
||||
]
|
||||
test-tauri = [
|
||||
"tauri/wry",
|
||||
@ -83,6 +84,7 @@ tauri-plugin-opener = "2.2.7"
|
||||
tauri-plugin-os = "2.2.1"
|
||||
tauri-plugin-shell = "2.2.0"
|
||||
tauri-plugin-store = "2"
|
||||
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"], optional = true }
|
||||
thiserror = "2.0.12"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-util = "0.7.14"
|
||||
|
||||
@ -19,6 +19,15 @@ pub fn install_extensions<R: Runtime>(app: AppHandle<R>) {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_active_extensions<R: Runtime>(app: AppHandle<R>) -> Vec<serde_json::Value> {
|
||||
// On mobile platforms, extensions are pre-bundled in the frontend
|
||||
// Return empty array so frontend's MobileCoreService handles it
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
{
|
||||
return vec![];
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
let mut path = get_jan_extensions_path(app);
|
||||
path.push("extensions.json");
|
||||
log::info!("get jan extensions, path: {:?}", path);
|
||||
@ -50,4 +59,5 @@ pub fn get_active_extensions<R: Runtime>(app: AppHandle<R>) -> Vec<serde_json::V
|
||||
}
|
||||
};
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,13 @@ use super::{
|
||||
};
|
||||
|
||||
pub fn install_extensions<R: Runtime>(app: tauri::AppHandle<R>, force: bool) -> Result<(), String> {
|
||||
// Skip extension installation on mobile platforms
|
||||
// Mobile uses pre-bundled extensions loaded via MobileCoreService in the frontend
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let extensions_path = get_jan_extensions_path(app.clone());
|
||||
let pre_install_path = app
|
||||
.path()
|
||||
|
||||
@ -3,6 +3,7 @@ use std::io::Write;
|
||||
use tauri::Runtime;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::db;
|
||||
use super::helpers::{
|
||||
get_lock_for_thread, read_messages_from_file, update_thread_metadata, write_messages_to_file,
|
||||
};
|
||||
@ -14,12 +15,18 @@ use super::{
|
||||
},
|
||||
};
|
||||
|
||||
/// Lists all threads by reading their metadata from the threads directory.
|
||||
/// Lists all threads by reading their metadata from the threads directory or database.
|
||||
/// Returns a vector of thread metadata as JSON values.
|
||||
#[tauri::command]
|
||||
pub async fn list_threads<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
) -> Result<Vec<serde_json::Value>, String> {
|
||||
if db::should_use_sqlite() {
|
||||
// Use SQLite on mobile platforms
|
||||
return db::db_list_threads(app_handle).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
ensure_data_dirs(app_handle.clone())?;
|
||||
let data_dir = get_data_dir(app_handle.clone());
|
||||
let mut threads = Vec::new();
|
||||
@ -56,6 +63,11 @@ pub async fn create_thread<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
mut thread: serde_json::Value,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_create_thread(app_handle, thread).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
ensure_data_dirs(app_handle.clone())?;
|
||||
let uuid = Uuid::new_v4().to_string();
|
||||
thread["id"] = serde_json::Value::String(uuid.clone());
|
||||
@ -76,6 +88,11 @@ pub async fn modify_thread<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
thread: serde_json::Value,
|
||||
) -> Result<(), String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_modify_thread(app_handle, thread).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let thread_id = thread
|
||||
.get("id")
|
||||
.and_then(|id| id.as_str())
|
||||
@ -96,6 +113,11 @@ pub async fn delete_thread<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
thread_id: String,
|
||||
) -> Result<(), String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_delete_thread(app_handle, &thread_id).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let thread_dir = get_thread_dir(app_handle.clone(), &thread_id);
|
||||
if thread_dir.exists() {
|
||||
let _ = fs::remove_dir_all(thread_dir);
|
||||
@ -110,6 +132,11 @@ pub async fn list_messages<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
thread_id: String,
|
||||
) -> Result<Vec<serde_json::Value>, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_list_messages(app_handle, &thread_id).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
read_messages_from_file(app_handle, &thread_id)
|
||||
}
|
||||
|
||||
@ -120,6 +147,11 @@ pub async fn create_message<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
mut message: serde_json::Value,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_create_message(app_handle, message).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let thread_id = {
|
||||
let id = message
|
||||
.get("thread_id")
|
||||
@ -166,6 +198,11 @@ pub async fn modify_message<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
message: serde_json::Value,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_modify_message(app_handle, message).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let thread_id = message
|
||||
.get("thread_id")
|
||||
.and_then(|v| v.as_str())
|
||||
@ -204,6 +241,11 @@ pub async fn delete_message<R: Runtime>(
|
||||
thread_id: String,
|
||||
message_id: String,
|
||||
) -> Result<(), String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_delete_message(app_handle, &thread_id, &message_id).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
// Acquire per-thread lock before modifying
|
||||
{
|
||||
let lock = get_lock_for_thread(&thread_id).await;
|
||||
@ -227,6 +269,11 @@ pub async fn get_thread_assistant<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
thread_id: String,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_get_thread_assistant(app_handle, &thread_id).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let path = get_thread_metadata_path(app_handle, &thread_id);
|
||||
if !path.exists() {
|
||||
return Err("Thread not found".to_string());
|
||||
@ -252,6 +299,11 @@ pub async fn create_thread_assistant<R: Runtime>(
|
||||
thread_id: String,
|
||||
assistant: serde_json::Value,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_create_thread_assistant(app_handle, &thread_id, assistant).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let path = get_thread_metadata_path(app_handle.clone(), &thread_id);
|
||||
if !path.exists() {
|
||||
return Err("Thread not found".to_string());
|
||||
@ -277,6 +329,11 @@ pub async fn modify_thread_assistant<R: Runtime>(
|
||||
thread_id: String,
|
||||
assistant: serde_json::Value,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if db::should_use_sqlite() {
|
||||
return db::db_modify_thread_assistant(app_handle, &thread_id, assistant).await;
|
||||
}
|
||||
|
||||
// Use file-based storage on desktop
|
||||
let path = get_thread_metadata_path(app_handle.clone(), &thread_id);
|
||||
if !path.exists() {
|
||||
return Err("Thread not found".to_string());
|
||||
|
||||
406
src-tauri/src/core/threads/db.rs
Normal file
406
src-tauri/src/core/threads/db.rs
Normal file
@ -0,0 +1,406 @@
|
||||
/*!
|
||||
SQLite Database Module for Mobile Thread Storage
|
||||
|
||||
This module provides SQLite-based storage for threads and messages on mobile platforms.
|
||||
It ensures data persistence and retrieval work correctly on Android and iOS devices.
|
||||
|
||||
Note: This module is only compiled and used on mobile platforms (Android/iOS).
|
||||
On desktop, the file-based storage in helpers.rs is used instead.
|
||||
*/
|
||||
|
||||
#![allow(dead_code)] // Functions only used on mobile platforms
|
||||
|
||||
use serde_json::Value;
|
||||
use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions};
|
||||
use sqlx::Row;
|
||||
use std::str::FromStr;
|
||||
use std::sync::OnceLock;
|
||||
use tauri::{AppHandle, Manager, Runtime};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
const DB_NAME: &str = "jan.db";
|
||||
|
||||
/// Global database pool for mobile platforms
|
||||
static DB_POOL: OnceLock<Mutex<Option<SqlitePool>>> = OnceLock::new();
|
||||
|
||||
/// Check if the platform should use SQLite (mobile platforms)
|
||||
pub fn should_use_sqlite() -> bool {
|
||||
cfg!(any(target_os = "android", target_os = "ios"))
|
||||
}
|
||||
|
||||
/// Initialize database with connection pool and run migrations
|
||||
pub async fn init_database<R: Runtime>(app: &AppHandle<R>) -> Result<(), String> {
|
||||
if !should_use_sqlite() {
|
||||
return Ok(()); // Skip DB initialization on desktop
|
||||
}
|
||||
|
||||
// Get app data directory
|
||||
let app_data_dir = app
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.map_err(|e| format!("Failed to get app data dir: {}", e))?;
|
||||
|
||||
// Ensure directory exists
|
||||
std::fs::create_dir_all(&app_data_dir)
|
||||
.map_err(|e| format!("Failed to create app data dir: {}", e))?;
|
||||
|
||||
// Create database path
|
||||
let db_path = app_data_dir.join(DB_NAME);
|
||||
let db_url = format!("sqlite:{}", db_path.display());
|
||||
|
||||
log::info!("Initializing SQLite database at: {}", db_url);
|
||||
|
||||
// Create connection options
|
||||
let connect_options = SqliteConnectOptions::from_str(&db_url)
|
||||
.map_err(|e| format!("Failed to parse connection options: {}", e))?
|
||||
.create_if_missing(true);
|
||||
|
||||
// Create connection pool
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect_with(connect_options)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create connection pool: {}", e))?;
|
||||
|
||||
// Run migrations
|
||||
sqlx::query(
|
||||
r#"
|
||||
CREATE TABLE IF NOT EXISTS threads (
|
||||
id TEXT PRIMARY KEY,
|
||||
data TEXT NOT NULL,
|
||||
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
||||
updated_at INTEGER DEFAULT (strftime('%s', 'now'))
|
||||
);
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create threads table: {}", e))?;
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
id TEXT PRIMARY KEY,
|
||||
thread_id TEXT NOT NULL,
|
||||
data TEXT NOT NULL,
|
||||
created_at INTEGER DEFAULT (strftime('%s', 'now')),
|
||||
FOREIGN KEY (thread_id) REFERENCES threads(id) ON DELETE CASCADE
|
||||
);
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create messages table: {}", e))?;
|
||||
|
||||
// Create indexes
|
||||
sqlx::query(
|
||||
"CREATE INDEX IF NOT EXISTS idx_messages_thread_id ON messages(thread_id);",
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create thread_id index: {}", e))?;
|
||||
|
||||
sqlx::query(
|
||||
"CREATE INDEX IF NOT EXISTS idx_messages_created_at ON messages(created_at);",
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create created_at index: {}", e))?;
|
||||
|
||||
// Store pool globally
|
||||
DB_POOL
|
||||
.get_or_init(|| Mutex::new(None))
|
||||
.lock()
|
||||
.await
|
||||
.replace(pool);
|
||||
|
||||
log::info!("SQLite database initialized successfully for mobile platform");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get database pool
|
||||
async fn get_pool() -> Result<SqlitePool, String> {
|
||||
let pool_mutex = DB_POOL
|
||||
.get()
|
||||
.ok_or("Database not initialized")?;
|
||||
|
||||
let pool_guard = pool_mutex.lock().await;
|
||||
pool_guard
|
||||
.clone()
|
||||
.ok_or("Database pool not available".to_string())
|
||||
}
|
||||
|
||||
/// List all threads from database
|
||||
pub async fn db_list_threads<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
) -> Result<Vec<Value>, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let rows = sqlx::query("SELECT data FROM threads ORDER BY updated_at DESC")
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to list threads: {}", e))?;
|
||||
|
||||
let threads: Result<Vec<Value>, _> = rows
|
||||
.iter()
|
||||
.map(|row| {
|
||||
let data: String = row.get("data");
|
||||
serde_json::from_str(&data).map_err(|e| e.to_string())
|
||||
})
|
||||
.collect();
|
||||
|
||||
threads
|
||||
}
|
||||
|
||||
/// Create a new thread in database
|
||||
pub async fn db_create_thread<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
thread: Value,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let thread_id = thread
|
||||
.get("id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing thread id")?;
|
||||
|
||||
let data = serde_json::to_string(&thread).map_err(|e| e.to_string())?;
|
||||
|
||||
sqlx::query("INSERT INTO threads (id, data) VALUES (?1, ?2)")
|
||||
.bind(thread_id)
|
||||
.bind(&data)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create thread: {}", e))?;
|
||||
|
||||
Ok(thread)
|
||||
}
|
||||
|
||||
/// Modify an existing thread in database
|
||||
pub async fn db_modify_thread<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
thread: Value,
|
||||
) -> Result<(), String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let thread_id = thread
|
||||
.get("id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing thread id")?;
|
||||
|
||||
let data = serde_json::to_string(&thread).map_err(|e| e.to_string())?;
|
||||
|
||||
sqlx::query("UPDATE threads SET data = ?1, updated_at = strftime('%s', 'now') WHERE id = ?2")
|
||||
.bind(&data)
|
||||
.bind(thread_id)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to modify thread: {}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete a thread from database
|
||||
pub async fn db_delete_thread<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
thread_id: &str,
|
||||
) -> Result<(), String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
// Messages will be auto-deleted via CASCADE
|
||||
sqlx::query("DELETE FROM threads WHERE id = ?1")
|
||||
.bind(thread_id)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to delete thread: {}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// List all messages for a thread from database
|
||||
pub async fn db_list_messages<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
thread_id: &str,
|
||||
) -> Result<Vec<Value>, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let rows = sqlx::query(
|
||||
"SELECT data FROM messages WHERE thread_id = ?1 ORDER BY created_at ASC",
|
||||
)
|
||||
.bind(thread_id)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to list messages: {}", e))?;
|
||||
|
||||
let messages: Result<Vec<Value>, _> = rows
|
||||
.iter()
|
||||
.map(|row| {
|
||||
let data: String = row.get("data");
|
||||
serde_json::from_str(&data).map_err(|e| e.to_string())
|
||||
})
|
||||
.collect();
|
||||
|
||||
messages
|
||||
}
|
||||
|
||||
/// Create a new message in database
|
||||
pub async fn db_create_message<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
message: Value,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let message_id = message
|
||||
.get("id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing message id")?;
|
||||
|
||||
let thread_id = message
|
||||
.get("thread_id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing thread_id")?;
|
||||
|
||||
let data = serde_json::to_string(&message).map_err(|e| e.to_string())?;
|
||||
|
||||
sqlx::query("INSERT INTO messages (id, thread_id, data) VALUES (?1, ?2, ?3)")
|
||||
.bind(message_id)
|
||||
.bind(thread_id)
|
||||
.bind(&data)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create message: {}", e))?;
|
||||
|
||||
Ok(message)
|
||||
}
|
||||
|
||||
/// Modify an existing message in database
|
||||
pub async fn db_modify_message<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
message: Value,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let message_id = message
|
||||
.get("id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing message id")?;
|
||||
|
||||
let data = serde_json::to_string(&message).map_err(|e| e.to_string())?;
|
||||
|
||||
sqlx::query("UPDATE messages SET data = ?1 WHERE id = ?2")
|
||||
.bind(&data)
|
||||
.bind(message_id)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to modify message: {}", e))?;
|
||||
|
||||
Ok(message)
|
||||
}
|
||||
|
||||
/// Delete a message from database
|
||||
pub async fn db_delete_message<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
_thread_id: &str,
|
||||
message_id: &str,
|
||||
) -> Result<(), String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
sqlx::query("DELETE FROM messages WHERE id = ?1")
|
||||
.bind(message_id)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to delete message: {}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get thread assistant information from thread metadata
|
||||
pub async fn db_get_thread_assistant<R: Runtime>(
|
||||
_app_handle: AppHandle<R>,
|
||||
thread_id: &str,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let row = sqlx::query("SELECT data FROM threads WHERE id = ?1")
|
||||
.bind(thread_id)
|
||||
.fetch_optional(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get thread: {}", e))?
|
||||
.ok_or("Thread not found")?;
|
||||
|
||||
let data: String = row.get("data");
|
||||
let thread: Value = serde_json::from_str(&data).map_err(|e| e.to_string())?;
|
||||
|
||||
if let Some(assistants) = thread.get("assistants").and_then(|a| a.as_array()) {
|
||||
assistants
|
||||
.first()
|
||||
.cloned()
|
||||
.ok_or("Assistant not found".to_string())
|
||||
} else {
|
||||
Err("Assistant not found".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Create thread assistant in database
|
||||
pub async fn db_create_thread_assistant<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
thread_id: &str,
|
||||
assistant: Value,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let row = sqlx::query("SELECT data FROM threads WHERE id = ?1")
|
||||
.bind(thread_id)
|
||||
.fetch_optional(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get thread: {}", e))?
|
||||
.ok_or("Thread not found")?;
|
||||
|
||||
let data: String = row.get("data");
|
||||
let mut thread: Value = serde_json::from_str(&data).map_err(|e| e.to_string())?;
|
||||
|
||||
if let Some(assistants) = thread.get_mut("assistants").and_then(|a| a.as_array_mut()) {
|
||||
assistants.push(assistant.clone());
|
||||
} else {
|
||||
thread["assistants"] = Value::Array(vec![assistant.clone()]);
|
||||
}
|
||||
|
||||
db_modify_thread(app_handle, thread).await?;
|
||||
Ok(assistant)
|
||||
}
|
||||
|
||||
/// Modify thread assistant in database
|
||||
pub async fn db_modify_thread_assistant<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
thread_id: &str,
|
||||
assistant: Value,
|
||||
) -> Result<Value, String> {
|
||||
let pool = get_pool().await?;
|
||||
|
||||
let row = sqlx::query("SELECT data FROM threads WHERE id = ?1")
|
||||
.bind(thread_id)
|
||||
.fetch_optional(&pool)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get thread: {}", e))?
|
||||
.ok_or("Thread not found")?;
|
||||
|
||||
let data: String = row.get("data");
|
||||
let mut thread: Value = serde_json::from_str(&data).map_err(|e| e.to_string())?;
|
||||
|
||||
let assistant_id = assistant
|
||||
.get("id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing assistant id")?;
|
||||
|
||||
if let Some(assistants) = thread.get_mut("assistants").and_then(|a| a.as_array_mut()) {
|
||||
if let Some(index) = assistants
|
||||
.iter()
|
||||
.position(|a| a.get("id").and_then(|v| v.as_str()) == Some(assistant_id))
|
||||
{
|
||||
assistants[index] = assistant.clone();
|
||||
db_modify_thread(app_handle, thread).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(assistant)
|
||||
}
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
pub mod commands;
|
||||
mod constants;
|
||||
pub mod db;
|
||||
pub mod helpers;
|
||||
pub mod utils;
|
||||
|
||||
|
||||
@ -180,6 +180,18 @@ pub fn run() {
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
app.deep_link().register_all()?;
|
||||
}
|
||||
|
||||
// Initialize SQLite database for mobile platforms
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
{
|
||||
let app_handle = app.handle().clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
if let Err(e) = crate::core::threads::db::init_database(&app_handle).await {
|
||||
log::error!("Failed to initialize mobile database: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setup_mcp(app);
|
||||
Ok(())
|
||||
})
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
"identifier": "jan.ai.app",
|
||||
"build": {
|
||||
"devUrl": null,
|
||||
"frontendDist": "../web-app/dist"
|
||||
"frontendDist": "../web-app/dist",
|
||||
"beforeDevCommand": "cross-env IS_DEV=true IS_ANDROID=true yarn build:web",
|
||||
"beforeBuildCommand": "cross-env IS_ANDROID=true yarn build:web"
|
||||
},
|
||||
"app": {
|
||||
"security": {
|
||||
@ -11,7 +13,11 @@
|
||||
},
|
||||
"plugins": {},
|
||||
"bundle": {
|
||||
"resources": ["resources/LICENSE"],
|
||||
"active": true,
|
||||
"resources": [
|
||||
"resources/pre-install/**/*",
|
||||
"resources/LICENSE"
|
||||
],
|
||||
"externalBin": [],
|
||||
"android": {
|
||||
"minSdkVersion": 24
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
{
|
||||
"identifier": "jan.ai.app.ios",
|
||||
"build": {
|
||||
"devUrl": null,
|
||||
"frontendDist": "../web-app/dist"
|
||||
"frontendDist": "../web-app/dist",
|
||||
"beforeDevCommand": "cross-env IS_DEV=true IS_IOS=true yarn build:web",
|
||||
"beforeBuildCommand": "cross-env IS_IOS=true yarn build:web"
|
||||
},
|
||||
"identifier": "jan.ai.app",
|
||||
"app": {
|
||||
"security": {
|
||||
"capabilities": ["mobile"]
|
||||
@ -15,7 +17,10 @@
|
||||
"iOS": {
|
||||
"developmentTeam": "<DEVELOPMENT_TEAM_ID>"
|
||||
},
|
||||
"resources": ["resources/LICENSE"],
|
||||
"resources": [
|
||||
"resources/pre-install/**/*",
|
||||
"resources/LICENSE"
|
||||
],
|
||||
"externalBin": []
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ export const PlatformFeatures: Record<PlatformFeature, boolean> = {
|
||||
|
||||
// Extensions settings page - disabled for web
|
||||
[PlatformFeature.EXTENSIONS_SETTINGS]:
|
||||
isPlatformTauri() && !isPlatformIOS() && !isPlatformAndroid(),
|
||||
isPlatformTauri(),
|
||||
|
||||
// Assistant functionality - disabled for web
|
||||
[PlatformFeature.ASSISTANTS]: isPlatformTauri(),
|
||||
@ -75,8 +75,8 @@ export const PlatformFeatures: Record<PlatformFeature, boolean> = {
|
||||
// Shortcut
|
||||
[PlatformFeature.SHORTCUT]: !isPlatformIOS() && !isPlatformAndroid(),
|
||||
|
||||
// First message persisted thread - enabled for web only
|
||||
[PlatformFeature.FIRST_MESSAGE_PERSISTED_THREAD]: !isPlatformTauri(),
|
||||
// First message persisted thread - enabled for web and mobile platforms
|
||||
[PlatformFeature.FIRST_MESSAGE_PERSISTED_THREAD]: !isPlatformTauri() || isPlatformIOS() || isPlatformAndroid(),
|
||||
|
||||
// Temporary chat mode - enabled for web only
|
||||
[PlatformFeature.TEMPORARY_CHAT]: !isPlatformTauri(),
|
||||
|
||||
53
web-app/src/services/core/mobile.ts
Normal file
53
web-app/src/services/core/mobile.ts
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Mobile Core Service - Android/iOS implementation
|
||||
*
|
||||
* This service extends TauriCoreService but provides mobile-specific
|
||||
* extension loading. Instead of reading extensions from the filesystem,
|
||||
* it returns pre-bundled web extensions.
|
||||
*/
|
||||
|
||||
import { TauriCoreService } from './tauri'
|
||||
import type { ExtensionManifest } from '@/lib/extension'
|
||||
import JanConversationalExtension from '@janhq/conversational-extension'
|
||||
|
||||
export class MobileCoreService extends TauriCoreService {
|
||||
/**
|
||||
* Override getActiveExtensions to return pre-loaded web extensions
|
||||
* for mobile platforms where filesystem access is restricted.
|
||||
*/
|
||||
async getActiveExtensions(): Promise<ExtensionManifest[]> {
|
||||
|
||||
// Return conversational extension as a pre-loaded instance
|
||||
const conversationalExt = new JanConversationalExtension(
|
||||
'built-in',
|
||||
'@janhq/conversational-extension',
|
||||
'Conversational Extension',
|
||||
true,
|
||||
'Manages conversation threads and messages',
|
||||
'1.0.0'
|
||||
)
|
||||
|
||||
const extensions: ExtensionManifest[] = [
|
||||
{
|
||||
name: '@janhq/conversational-extension',
|
||||
productName: 'Conversational Extension',
|
||||
url: 'built-in', // Not loaded from file, but bundled
|
||||
active: true,
|
||||
description: 'Manages conversation threads and messages',
|
||||
version: '1.0.0',
|
||||
extensionInstance: conversationalExt, // Pre-instantiated!
|
||||
},
|
||||
]
|
||||
|
||||
return extensions
|
||||
}
|
||||
|
||||
/**
|
||||
* Mobile-specific install extensions implementation
|
||||
* On mobile, extensions are pre-bundled, so this is a no-op
|
||||
*/
|
||||
async installExtensions(): Promise<void> {
|
||||
console.log('[Mobile] Extensions are pre-bundled, skipping installation')
|
||||
// No-op on mobile - extensions are built-in
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
* then provides synchronous access to service instances throughout the app.
|
||||
*/
|
||||
|
||||
import { isPlatformTauri } from '@/lib/platform/utils'
|
||||
import { isPlatformTauri, isPlatformIOS, isPlatformAndroid } from '@/lib/platform/utils'
|
||||
|
||||
// Import default services
|
||||
import { DefaultThemeService } from './theme/default'
|
||||
@ -102,11 +102,14 @@ class PlatformServiceHub implements ServiceHub {
|
||||
|
||||
console.log(
|
||||
'Initializing service hub for platform:',
|
||||
isPlatformTauri() ? 'Tauri' : 'Web'
|
||||
isPlatformTauri() && !isPlatformIOS() && !isPlatformAndroid() ? 'Tauri' :
|
||||
isPlatformIOS() ? 'iOS' :
|
||||
isPlatformAndroid() ? 'Android' : 'Web'
|
||||
)
|
||||
|
||||
try {
|
||||
if (isPlatformTauri()) {
|
||||
if (isPlatformTauri() && !isPlatformIOS() && !isPlatformAndroid()) {
|
||||
// Desktop Tauri
|
||||
const [
|
||||
themeModule,
|
||||
windowModule,
|
||||
@ -150,6 +153,44 @@ class PlatformServiceHub implements ServiceHub {
|
||||
this.pathService = new pathModule.TauriPathService()
|
||||
this.coreService = new coreModule.TauriCoreService()
|
||||
this.deepLinkService = new deepLinkModule.TauriDeepLinkService()
|
||||
} else if (isPlatformIOS() || isPlatformAndroid()) {
|
||||
const [
|
||||
themeModule,
|
||||
windowModule,
|
||||
eventsModule,
|
||||
appModule,
|
||||
mcpModule,
|
||||
providersModule,
|
||||
dialogModule,
|
||||
openerModule,
|
||||
pathModule,
|
||||
coreModule,
|
||||
deepLinkModule,
|
||||
] = await Promise.all([
|
||||
import('./theme/tauri'),
|
||||
import('./window/tauri'),
|
||||
import('./events/tauri'),
|
||||
import('./app/tauri'),
|
||||
import('./mcp/tauri'),
|
||||
import('./providers/tauri'),
|
||||
import('./dialog/tauri'),
|
||||
import('./opener/tauri'),
|
||||
import('./path/tauri'),
|
||||
import('./core/mobile'), // Use mobile-specific core service
|
||||
import('./deeplink/tauri'),
|
||||
])
|
||||
|
||||
this.themeService = new themeModule.TauriThemeService()
|
||||
this.windowService = new windowModule.TauriWindowService()
|
||||
this.eventsService = new eventsModule.TauriEventsService()
|
||||
this.appService = new appModule.TauriAppService()
|
||||
this.mcpService = new mcpModule.TauriMCPService()
|
||||
this.providersService = new providersModule.TauriProvidersService()
|
||||
this.dialogService = new dialogModule.TauriDialogService()
|
||||
this.openerService = new openerModule.TauriOpenerService()
|
||||
this.pathService = new pathModule.TauriPathService()
|
||||
this.coreService = new coreModule.MobileCoreService() // Mobile service with pre-loaded extensions
|
||||
this.deepLinkService = new deepLinkModule.TauriDeepLinkService()
|
||||
} else {
|
||||
const [
|
||||
themeModule,
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
/* Url */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
"@/*": ["./src/*"],
|
||||
"@janhq/conversational-extension": ["../extensions/conversational-extension/src/index.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src"],
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
"@/*": ["./src/*"],
|
||||
"@janhq/conversational-extension": ["../extensions/conversational-extension/src/index.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ export default defineConfig(({ mode }) => {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
'@janhq/conversational-extension': path.resolve(__dirname, '../extensions/conversational-extension/src/index.ts'),
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user