save usernames
This commit is contained in:
Generated
+14
-14
@@ -2504,9 +2504,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.70"
|
version = "0.3.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
|
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
@@ -4941,9 +4941,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.93"
|
version = "0.2.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
|
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@@ -4952,9 +4952,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.93"
|
version = "0.2.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
|
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"log",
|
"log",
|
||||||
@@ -4979,9 +4979,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.93"
|
version = "0.2.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
|
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -4989,9 +4989,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.93"
|
version = "0.2.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
|
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -5002,9 +5002,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.93"
|
version = "0.2.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
|
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-streams"
|
name = "wasm-streams"
|
||||||
@@ -5021,9 +5021,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.70"
|
version = "0.3.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
|
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|||||||
+58
-5
@@ -5,21 +5,64 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus = { version = "0.5.6" }
|
dioxus = { version = "0.5.6" }
|
||||||
dioxus-web = { version="0.5.6", optional = true }
|
dioxus-web = { version = "0.5.6", optional = true }
|
||||||
manganis = "0.2.2"
|
manganis = "0.2.2"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
asynchronous-codec = "0.6.2"
|
asynchronous-codec = "0.6.2"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
merge-io = "0.3.0"
|
merge-io = "0.3.0"
|
||||||
mumble-protocol = { version = "0.5.0", package = "mumble-protocol-2x", default-features = false, features = ["asynchronous-codec"]}
|
mumble-protocol = { version = "0.5.0", package = "mumble-protocol-2x", default-features = false, features = [
|
||||||
|
"asynchronous-codec",
|
||||||
|
] }
|
||||||
serde_json = "1.0.117"
|
serde_json = "1.0.117"
|
||||||
tokio-util = { version = "0.7.11", features = ["codec", "compat"]}
|
tokio-util = { version = "0.7.11", features = ["codec", "compat"] }
|
||||||
wasm-bindgen = { version = "0.2.92", optional = true }
|
wasm-bindgen = { version = "0.2.92", optional = true }
|
||||||
wasm-bindgen-futures = { version = "0.4.42", optional = true }
|
wasm-bindgen-futures = { version = "0.4.42", optional = true }
|
||||||
wasm-streams = { version = "0.4.0", optional = true }
|
wasm-streams = { version = "0.4.0", optional = true }
|
||||||
serde-wasm-bindgen = { version = "0.6.5", optional = true }
|
serde-wasm-bindgen = { version = "0.6.5", optional = true }
|
||||||
js-sys = { version = "0.3.70", optional = true }
|
js-sys = { version = "0.3.70", optional = true }
|
||||||
web-sys = { version = "0.3.70", features = ["WebTransport", "console", "WebTransportOptions", "WebTransportBidirectionalStream", "WebTransportSendStream", "WebTransportReceiveStream", "Navigator", "MediaDevices", "AudioDecoder", "AudioDecoderInit", "AudioData", "AudioEncoderConfig", "AudioDecoderConfig", "EncodedAudioChunk", "EncodedAudioChunkInit", "EncodedAudioChunkType", "CodecState", "MediaStreamTrackGenerator", "MediaStreamTrackGeneratorInit", "AudioContext", "AudioContextOptions", "MediaStream", "GainNode", "MediaStreamAudioSourceNode", "BaseAudioContext", "AudioDestinationNode", "AudioWorkletNode", "AudioWorklet", "AudioWorkletProcessor", "MediaStreamConstraints", "WorkletOptions", "AudioEncoder", "AudioEncoderInit", "AudioDataInit", "HtmlAnchorElement", "Url", "Blob", "AudioDataCopyToOptions", "AudioSampleFormat"], optional = true }
|
web-sys = { version = "0.3.72", features = [
|
||||||
|
"WebTransport",
|
||||||
|
"console",
|
||||||
|
"WebTransportOptions",
|
||||||
|
"WebTransportBidirectionalStream",
|
||||||
|
"WebTransportSendStream",
|
||||||
|
"WebTransportReceiveStream",
|
||||||
|
"Navigator",
|
||||||
|
"MediaDevices",
|
||||||
|
"AudioDecoder",
|
||||||
|
"AudioDecoderInit",
|
||||||
|
"AudioData",
|
||||||
|
"AudioEncoderConfig",
|
||||||
|
"AudioDecoderConfig",
|
||||||
|
"EncodedAudioChunk",
|
||||||
|
"EncodedAudioChunkInit",
|
||||||
|
"EncodedAudioChunkType",
|
||||||
|
"CodecState",
|
||||||
|
"MediaStreamTrackGenerator",
|
||||||
|
"MediaStreamTrackGeneratorInit",
|
||||||
|
"AudioContext",
|
||||||
|
"AudioContextOptions",
|
||||||
|
"MediaStream",
|
||||||
|
"GainNode",
|
||||||
|
"MediaStreamAudioSourceNode",
|
||||||
|
"BaseAudioContext",
|
||||||
|
"AudioDestinationNode",
|
||||||
|
"AudioWorkletNode",
|
||||||
|
"AudioWorklet",
|
||||||
|
"AudioWorkletProcessor",
|
||||||
|
"MediaStreamConstraints",
|
||||||
|
"WorkletOptions",
|
||||||
|
"AudioEncoder",
|
||||||
|
"AudioEncoderInit",
|
||||||
|
"AudioDataInit",
|
||||||
|
"HtmlAnchorElement",
|
||||||
|
"Url",
|
||||||
|
"Blob",
|
||||||
|
"AudioDataCopyToOptions",
|
||||||
|
"AudioSampleFormat",
|
||||||
|
"Storage",
|
||||||
|
] }
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
byteorder = "1.5.0"
|
byteorder = "1.5.0"
|
||||||
ogg = "0.9.1"
|
ogg = "0.9.1"
|
||||||
@@ -33,5 +76,15 @@ tokio = { version = "1.41.1", features = ["net", "rt"], optional = true }
|
|||||||
tokio-rustls = { version = "0.26.0", optional = true }
|
tokio-rustls = { version = "0.26.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
web = ["dioxus/web", "dioxus-web", "wasm-bindgen", "wasm-bindgen-futures", "wasm-streams", "serde-wasm-bindgen", "js-sys", "web-sys", "gloo-timers"]
|
web = [
|
||||||
|
"dioxus/web",
|
||||||
|
"dioxus-web",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"wasm-streams",
|
||||||
|
"serde-wasm-bindgen",
|
||||||
|
"js-sys",
|
||||||
|
"web-sys",
|
||||||
|
"gloo-timers",
|
||||||
|
]
|
||||||
desktop = ["dioxus/desktop", "tokio", "tokio-rustls"]
|
desktop = ["dioxus/desktop", "tokio", "tokio-rustls"]
|
||||||
|
|||||||
+7
-1
@@ -5,6 +5,8 @@ use ordermap::OrderSet;
|
|||||||
use sir::{css, global_css};
|
use sir::{css, global_css};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use crate::imp;
|
||||||
|
|
||||||
pub type ChannelId = u32;
|
pub type ChannelId = u32;
|
||||||
pub type UserId = u32;
|
pub type UserId = u32;
|
||||||
|
|
||||||
@@ -372,10 +374,12 @@ pub fn ServerView() -> Element {
|
|||||||
#[component]
|
#[component]
|
||||||
pub fn LoginView() -> Element {
|
pub fn LoginView() -> Element {
|
||||||
let net: Coroutine<Command> = use_coroutine_handle();
|
let net: Coroutine<Command> = use_coroutine_handle();
|
||||||
let mut username = use_signal(|| "".to_string());
|
|
||||||
let default_address = option_env!("MUMBLEWEB2_WEBTRANSPORT_SERVER_ADDRESS").unwrap_or("");
|
let default_address = option_env!("MUMBLEWEB2_WEBTRANSPORT_SERVER_ADDRESS").unwrap_or("");
|
||||||
let mut address = use_signal(|| default_address.to_string());
|
let mut address = use_signal(|| default_address.to_string());
|
||||||
|
|
||||||
|
let previous_username = imp::load_username();
|
||||||
|
let mut username = use_signal(|| previous_username.unwrap_or(String::new()));
|
||||||
|
|
||||||
let error = css!(
|
let error = css!(
|
||||||
"
|
"
|
||||||
color: red;
|
color: red;
|
||||||
@@ -403,6 +407,8 @@ pub fn LoginView() -> Element {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let do_connect = move |_| {
|
let do_connect = move |_| {
|
||||||
|
//let _ = set_default_username(&username.read());
|
||||||
|
let _ = imp::set_default_username(&username.read());
|
||||||
net.send(Connect {
|
net.send(Connect {
|
||||||
address: address.read().clone(),
|
address: address.read().clone(),
|
||||||
username: username.read().clone(),
|
username: username.read().clone(),
|
||||||
|
|||||||
@@ -169,3 +169,11 @@ pub async fn network_connect(
|
|||||||
|
|
||||||
super::network_loop(username, event_rx, reader, writer).await
|
super::network_loop(username, event_rx, reader, writer).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_default_username(username: &str) -> Option<()> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_username() -> Option<String> {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|||||||
+19
-2
@@ -260,7 +260,7 @@ async fn create_encoder_worklet(
|
|||||||
let output: Closure<dyn FnMut(EncodedAudioChunk)> =
|
let output: Closure<dyn FnMut(EncodedAudioChunk)> =
|
||||||
Closure::new(move |audio_data: EncodedAudioChunk| {
|
Closure::new(move |audio_data: EncodedAudioChunk| {
|
||||||
let mut array = vec![0u8; audio_data.byte_length() as usize];
|
let mut array = vec![0u8; audio_data.byte_length() as usize];
|
||||||
audio_data.copy_to_with_u8_array(&mut array);
|
audio_data.copy_to_with_u8_slice(&mut array);
|
||||||
|
|
||||||
download_buffer.borrow_mut().push(array.clone());
|
download_buffer.borrow_mut().push(array.clone());
|
||||||
if download_buffer.borrow().len() > 200 {
|
if download_buffer.borrow().len() > 200 {
|
||||||
@@ -309,7 +309,7 @@ async fn create_encoder_worklet(
|
|||||||
let x = web_sys::AudioDataCopyToOptions::new(0);
|
let x = web_sys::AudioDataCopyToOptions::new(0);
|
||||||
x.set_format(web_sys::AudioSampleFormat::F32);
|
x.set_format(web_sys::AudioSampleFormat::F32);
|
||||||
let mut sub_buffer = vec![0; data.allocation_size(&x).unwrap() as usize];
|
let mut sub_buffer = vec![0; data.allocation_size(&x).unwrap() as usize];
|
||||||
data.copy_to_with_u8_array(&mut sub_buffer, &x);
|
data.copy_to_with_u8_slice(&mut sub_buffer, &x);
|
||||||
download_buffer.borrow_mut().append(&mut sub_buffer);
|
download_buffer.borrow_mut().append(&mut sub_buffer);
|
||||||
if download_buffer.borrow().len() > 48000 * 10 * 4 {
|
if download_buffer.borrow().len() > 48000 * 10 * 4 {
|
||||||
//pub fn download_data(data: Vec<u8>, filename: &str) -> Result<(), JsValue> {
|
//pub fn download_data(data: Vec<u8>, filename: &str) -> Result<(), JsValue> {
|
||||||
@@ -405,3 +405,20 @@ pub async fn network_connect(
|
|||||||
|
|
||||||
super::network_loop(username, event_rx, reader, writer).await
|
super::network_loop(username, event_rx, reader, writer).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_default_username(username: &str) -> Option<()> {
|
||||||
|
web_sys::window()?
|
||||||
|
.local_storage()
|
||||||
|
.ok()??
|
||||||
|
.set_item("username", username)
|
||||||
|
.ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_username() -> Option<String> {
|
||||||
|
web_sys::window()
|
||||||
|
.unwrap()
|
||||||
|
.local_storage()
|
||||||
|
.ok()??
|
||||||
|
.get_item("username")
|
||||||
|
.ok()?
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user