feat: add tauri devtools

This commit is contained in:
reya 2024-02-15 14:41:32 +07:00
parent 1de8c7240d
commit a0d9a729dd
4 changed files with 386 additions and 1 deletions

379
src-tauri/Cargo.lock generated
View File

@ -389,6 +389,28 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "async-stream"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
dependencies = [
"async-stream-impl",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-stream-impl"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "async-task"
version = "4.7.0"
@ -493,6 +515,51 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "axum"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
dependencies = [
"async-trait",
"axum-core",
"bitflags 1.3.2",
"bytes",
"futures-util",
"http",
"http-body",
"hyper",
"itoa 1.0.10",
"matchit",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"rustversion",
"serde",
"sync_wrapper",
"tower",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http",
"http-body",
"mime",
"rustversion",
"tower-layer",
"tower-service",
]
[[package]]
name = "backtrace"
version = "0.3.69"
@ -1004,6 +1071,16 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "colored"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
"lazy_static",
"windows-sys 0.48.0",
]
[[package]]
name = "combine"
version = "4.6.6"
@ -1367,6 +1444,43 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "devtools-core"
version = "0.3.0"
source = "git+https://github.com/crabnebula-dev/devtools#3c9f774f1d4972d6ef5e482592e8e35aeab72c37"
dependencies = [
"async-stream",
"bytes",
"devtools-wire-format",
"futures",
"http",
"prost-types",
"ringbuf",
"thiserror",
"tokio",
"tokio-stream",
"tonic",
"tonic-health",
"tonic-web",
"tower-http",
"tower-layer",
"tracing",
"tracing-core",
"tracing-subscriber",
]
[[package]]
name = "devtools-wire-format"
version = "0.4.0"
source = "git+https://github.com/crabnebula-dev/devtools#3c9f774f1d4972d6ef5e482592e8e35aeab72c37"
dependencies = [
"bitflags 2.4.2",
"prost",
"prost-types",
"tonic",
"tracing-core",
]
[[package]]
name = "digest"
version = "0.10.7"
@ -2498,6 +2612,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
[[package]]
name = "http-range-header"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f"
[[package]]
name = "httparse"
version = "1.8.0"
@ -2548,6 +2668,18 @@ dependencies = [
"tokio-rustls",
]
[[package]]
name = "hyper-timeout"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
"hyper",
"pin-project-lite",
"tokio",
"tokio-io-timeout",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
@ -2807,6 +2939,15 @@ dependencies = [
"once_cell",
]
[[package]]
name = "itertools"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.8"
@ -3075,6 +3216,18 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4"
[[package]]
name = "local-ip-address"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "612ed4ea9ce5acfb5d26339302528a5e1e59dfed95e9e11af3c083236ff1d15d"
dependencies = [
"libc",
"neli",
"thiserror",
"windows-sys 0.48.0",
]
[[package]]
name = "lock_api"
version = "0.4.11"
@ -3120,6 +3273,7 @@ dependencies = [
"tauri-plugin-autostart",
"tauri-plugin-cli",
"tauri-plugin-clipboard-manager",
"tauri-plugin-devtools",
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-http",
@ -3205,6 +3359,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
[[package]]
name = "matchit"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
name = "memchr"
version = "2.7.1"
@ -3348,6 +3508,31 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e664971378a3987224f7a0e10059782035e89899ae403718ee07de85bec42afe"
[[package]]
name = "neli"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1100229e06604150b3becd61a4965d5c70f3be1759544ea7274166f4be41ef43"
dependencies = [
"byteorder",
"libc",
"log",
"neli-proc-macros",
]
[[package]]
name = "neli-proc-macros"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c168194d373b1e134786274020dae7fc5513d565ea2ebb9bc9ff17ffb69106d4"
dependencies = [
"either",
"proc-macro2",
"quote",
"serde",
"syn 1.0.109",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.4"
@ -4197,6 +4382,38 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-derive"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "prost-types"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e"
dependencies = [
"prost",
]
[[package]]
name = "quick-xml"
version = "0.30.0"
@ -4482,6 +4699,15 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "ringbuf"
version = "0.4.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbd88a807ef07d0f243843ecccf4e7383638e536284fc0adf1663790faec4ef"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "rusqlite"
version = "0.28.0"
@ -5400,6 +5626,7 @@ dependencies = [
"tauri-utils",
"thiserror",
"tokio",
"tracing",
"tray-icon",
"url",
"webkit2gtk",
@ -5532,6 +5759,31 @@ dependencies = [
"thiserror",
]
[[package]]
name = "tauri-plugin-devtools"
version = "2.0.0-beta.0"
source = "git+https://github.com/crabnebula-dev/devtools#3c9f774f1d4972d6ef5e482592e8e35aeab72c37"
dependencies = [
"async-stream",
"bytes",
"cocoa",
"colored",
"devtools-core",
"futures",
"local-ip-address",
"objc",
"serde",
"serde_json",
"swift-rs",
"tauri",
"tauri-plugin",
"tokio",
"tonic",
"tonic-health",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "tauri-plugin-dialog"
version = "2.0.0-beta.0"
@ -5785,6 +6037,7 @@ dependencies = [
"tao",
"tauri-runtime",
"tauri-utils",
"tracing",
"webkit2gtk",
"webview2-com",
"windows 0.52.0",
@ -6011,6 +6264,16 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "tokio-io-timeout"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
dependencies = [
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-macros"
version = "2.2.0"
@ -6054,6 +6317,17 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-stream"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
]
[[package]]
name = "tokio-tungstenite"
version = "0.20.1"
@ -6151,6 +6425,110 @@ dependencies = [
"winnow",
]
[[package]]
name = "tonic"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e"
dependencies = [
"async-stream",
"async-trait",
"axum",
"base64",
"bytes",
"h2",
"http",
"http-body",
"hyper",
"hyper-timeout",
"percent-encoding",
"pin-project",
"prost",
"tokio",
"tokio-stream",
"tower",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tonic-health"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f80db390246dfb46553481f6024f0082ba00178ea495dbb99e70ba9a4fafb5e1"
dependencies = [
"async-stream",
"prost",
"tokio",
"tokio-stream",
"tonic",
]
[[package]]
name = "tonic-web"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fddb2a37b247e6adcb9f239f4e5cefdcc5ed526141a416b943929f13aea2cce"
dependencies = [
"base64",
"bytes",
"http",
"http-body",
"hyper",
"pin-project",
"tokio-stream",
"tonic",
"tower-http",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
"indexmap 1.9.3",
"pin-project",
"pin-project-lite",
"rand 0.8.5",
"slab",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower-http"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
dependencies = [
"bitflags 2.4.2",
"bytes",
"futures-core",
"futures-util",
"http",
"http-body",
"http-range-header",
"pin-project-lite",
"tower-layer",
"tower-service",
]
[[package]]
name = "tower-layer"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
[[package]]
name = "tower-service"
version = "0.3.2"
@ -7175,6 +7553,7 @@ dependencies = [
"soup3",
"tao-macros",
"thiserror",
"tracing",
"url",
"webkit2gtk",
"webkit2gtk-sys",

View File

@ -21,6 +21,7 @@ tauri = { version = "2.0.0-beta", features = [
"native-tls-vendored",
"protocol-asset",
] }
tauri-plugin-devtools = { git = "https://github.com/crabnebula-dev/devtools" }
tauri-plugin-cli = "2.0.0-beta"
tauri-plugin-clipboard-manager = "2.0.0-beta"
tauri-plugin-dialog = "2.0.0-beta"

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,11 @@ pub struct Nostr {
}
fn main() {
#[cfg(debug_assertions)]
let devtools = tauri_plugin_devtools::init();
let mut ctx = tauri::generate_context!();
tauri::Builder::default()
.setup(|app| {
let handle = app.handle().clone();
@ -126,6 +130,7 @@ fn main() {
Ok(())
})
.plugin(devtools)
.plugin(tauri_plugin_store::Builder::default().build())
.plugin(tauri_plugin_theme::init(ctx.config_mut()))
.plugin(tauri_plugin_clipboard_manager::init())