refactor: Use Tauri WebSocket

This commit is contained in:
MystiPanda
2024-01-14 17:30:18 +08:00
parent 99740c1324
commit ba7242a815
9 changed files with 142 additions and 47 deletions

93
src-tauri/Cargo.lock generated
View File

@@ -595,6 +595,7 @@ dependencies = [
"sysproxy",
"tauri",
"tauri-build",
"tauri-plugin-websocket",
"tokio",
"warp",
"which 5.0.0",
@@ -1786,7 +1787,7 @@ dependencies = [
"futures-core",
"futures-sink",
"futures-util",
"http",
"http 0.2.11",
"indexmap 2.1.0",
"slab",
"tokio",
@@ -1833,7 +1834,7 @@ dependencies = [
"base64 0.21.5",
"bytes",
"headers-core",
"http",
"http 0.2.11",
"httpdate",
"mime",
"sha1",
@@ -1845,7 +1846,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429"
dependencies = [
"http",
"http 0.2.11",
]
[[package]]
@@ -1923,6 +1924,17 @@ dependencies = [
"itoa 1.0.9",
]
[[package]]
name = "http"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
dependencies = [
"bytes",
"fnv",
"itoa 1.0.9",
]
[[package]]
name = "http-body"
version = "0.4.5"
@@ -1930,7 +1942,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
"bytes",
"http",
"http 0.2.11",
"pin-project-lite",
]
@@ -1969,7 +1981,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"httparse",
"httpdate",
@@ -1989,7 +2001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
dependencies = [
"futures-util",
"http",
"http 0.2.11",
"hyper",
"rustls",
"tokio",
@@ -2631,7 +2643,7 @@ dependencies = [
"bytes",
"encoding_rs",
"futures-util",
"http",
"http 0.2.11",
"httparse",
"log 0.4.20",
"memchr",
@@ -3696,7 +3708,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"hyper",
"hyper-rustls",
@@ -4620,7 +4632,7 @@ dependencies = [
"glob",
"gtk",
"heck 0.4.1",
"http",
"http 0.2.11",
"ignore",
"infer 0.9.0",
"minisign-verify",
@@ -4719,6 +4731,23 @@ dependencies = [
"tauri-utils",
]
[[package]]
name = "tauri-plugin-websocket"
version = "0.0.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#0cdbde386fd7225810a5a57b039d551d08995b29"
dependencies = [
"futures-util",
"http 1.0.0",
"log 0.4.20",
"rand 0.8.5",
"serde",
"serde_json",
"tauri",
"thiserror",
"tokio",
"tokio-tungstenite 0.21.0",
]
[[package]]
name = "tauri-runtime"
version = "0.14.1"
@@ -4726,7 +4755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07f8e9e53e00e9f41212c115749e87d5cd2a9eebccafca77a19722eeecd56d43"
dependencies = [
"gtk",
"http",
"http 0.2.11",
"http-range",
"rand 0.8.5",
"raw-window-handle",
@@ -5057,7 +5086,21 @@ dependencies = [
"futures-util",
"log 0.4.20",
"tokio",
"tungstenite",
"tungstenite 0.20.1",
]
[[package]]
name = "tokio-tungstenite"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38"
dependencies = [
"futures-util",
"log 0.4.20",
"native-tls",
"tokio",
"tokio-native-tls",
"tungstenite 0.21.0",
]
[[package]]
@@ -5234,7 +5277,7 @@ dependencies = [
"byteorder",
"bytes",
"data-encoding",
"http",
"http 0.2.11",
"httparse",
"log 0.4.20",
"rand 0.8.5",
@@ -5244,6 +5287,26 @@ dependencies = [
"utf-8",
]
[[package]]
name = "tungstenite"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
dependencies = [
"byteorder",
"bytes",
"data-encoding",
"http 1.0.0",
"httparse",
"log 0.4.20",
"native-tls",
"rand 0.8.5",
"sha1",
"thiserror",
"url",
"utf-8",
]
[[package]]
name = "typemap-ors"
version = "1.0.0"
@@ -5472,7 +5535,7 @@ dependencies = [
"futures-channel",
"futures-util",
"headers",
"http",
"http 0.2.11",
"hyper",
"log 0.4.20",
"mime",
@@ -5487,7 +5550,7 @@ dependencies = [
"serde_urlencoded",
"tokio",
"tokio-stream",
"tokio-tungstenite",
"tokio-tungstenite 0.20.1",
"tokio-util",
"tower-service",
"tracing",
@@ -6182,7 +6245,7 @@ dependencies = [
"glib",
"gtk",
"html5ever 0.25.2",
"http",
"http 0.2.11",
"kuchiki",
"libc",
"log 0.4.20",