Compare commits
1 Commits
bb523842f5
...
90c7458309
Author | SHA1 | Date |
---|---|---|
kozabrada123 | 90c7458309 |
|
@ -100,7 +100,7 @@ jobs:
|
||||||
rustup target add wasm32-unknown-unknown
|
rustup target add wasm32-unknown-unknown
|
||||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
|
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
|
||||||
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
|
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt"
|
||||||
wasm-chrome:
|
wasm-chrome:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -128,4 +128,4 @@ jobs:
|
||||||
rustup target add wasm32-unknown-unknown
|
rustup target add wasm32-unknown-unknown
|
||||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
|
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
|
||||||
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
|
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt"
|
|
@ -15,10 +15,8 @@ default = ["client", "rt-multi-thread"]
|
||||||
backend = ["dep:poem", "dep:sqlx"]
|
backend = ["dep:poem", "dep:sqlx"]
|
||||||
rt-multi-thread = ["tokio/rt-multi-thread"]
|
rt-multi-thread = ["tokio/rt-multi-thread"]
|
||||||
rt = ["tokio/rt"]
|
rt = ["tokio/rt"]
|
||||||
client = []
|
client = ["voice"]
|
||||||
voice = ["voice_udp", "voice_gateway"]
|
voice = ["dep:discortp", "dep:crypto_secretbox"]
|
||||||
voice_udp = ["dep:discortp", "dep:crypto_secretbox"]
|
|
||||||
voice_gateway = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.34.0", features = ["macros", "sync"] }
|
tokio = { version = "1.34.0", features = ["macros", "sync"] }
|
||||||
|
|
|
@ -125,7 +125,7 @@ like "proxy connection checking" are already disabled on this version, which oth
|
||||||
### wasm
|
### wasm
|
||||||
|
|
||||||
To test for wasm, you will need to `cargo install wasm-pack`. You can then run
|
To test for wasm, you will need to `cargo install wasm-pack`. You can then run
|
||||||
`wasm-pack test --<chrome/firefox/safari> --headless -- --target wasm32-unknown-unknown --features="rt, client, voice_gateway" --no-default-features`
|
`wasm-pack test --<chrome/firefox/safari> --headless -- --target wasm32-unknown-unknown --features="rt, client" --no-default-features`
|
||||||
to run the tests for wasm.
|
to run the tests for wasm.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
|
@ -128,7 +128,7 @@ pub mod instance;
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
pub mod ratelimiter;
|
pub mod ratelimiter;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
#[cfg(all(feature = "client", any(feature = "voice_udp", feature = "voice_gateway")))]
|
#[cfg(feature = "client")]
|
||||||
pub mod voice;
|
pub mod voice;
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_gateway"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub mod tungstenite;
|
pub mod tungstenite;
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_gateway"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub use tungstenite::*;
|
pub use tungstenite::*;
|
||||||
|
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_gateway"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
pub mod wasm;
|
pub mod wasm;
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_gateway"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
pub use wasm::*;
|
pub use wasm::*;
|
||||||
|
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_gateway"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub type Sink = tungstenite::TungsteniteSink;
|
pub type Sink = tungstenite::TungsteniteSink;
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_gateway"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub type Stream = tungstenite::TungsteniteStream;
|
pub type Stream = tungstenite::TungsteniteStream;
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_gateway"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub type WebSocketBackend = tungstenite::TungsteniteBackend;
|
pub type WebSocketBackend = tungstenite::TungsteniteBackend;
|
||||||
|
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_gateway"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
pub type Sink = wasm::WasmSink;
|
pub type Sink = wasm::WasmSink;
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_gateway"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
pub type Stream = wasm::WasmStream;
|
pub type Stream = wasm::WasmStream;
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_gateway"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
pub type WebSocketBackend = wasm::WasmBackend;
|
pub type WebSocketBackend = wasm::WasmBackend;
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
//! Module for all voice functionality within chorus.
|
//! Module for all voice functionality within chorus.
|
||||||
|
|
||||||
#[cfg(feature = "voice_gateway")]
|
|
||||||
pub mod gateway;
|
|
||||||
mod crypto;
|
mod crypto;
|
||||||
#[cfg(all(feature = "voice_udp", feature = "voice_gateway"))]
|
pub mod gateway;
|
||||||
pub mod handler;
|
pub mod handler;
|
||||||
#[cfg(feature = "voice_udp")]
|
|
||||||
pub mod udp;
|
pub mod udp;
|
||||||
#[cfg(feature = "voice_udp")]
|
|
||||||
pub mod voice_data;
|
pub mod voice_data;
|
||||||
|
|
||||||
// Pub use this so users can interact with packet types if they want
|
// Pub use this so users can interact with packet types if they want
|
||||||
#[cfg(feature = "voice_udp")]
|
|
||||||
pub use discortp;
|
pub use discortp;
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_udp"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub mod tokio;
|
pub mod tokio;
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_udp"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub use tokio::*;
|
pub use tokio::*;
|
||||||
|
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_udp"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
|
pub mod wasm;
|
||||||
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
|
pub use wasm::*;
|
||||||
|
|
||||||
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub type UdpSocket = tokio::TokioSocket;
|
pub type UdpSocket = tokio::TokioSocket;
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "voice_udp"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
|
||||||
pub type UdpBackend = tokio::TokioBackend;
|
pub type UdpBackend = tokio::TokioBackend;
|
||||||
|
|
||||||
#[cfg(all(target_arch = "wasm32", feature = "voice_udp"))]
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
compile_error!("UDP Voice support is not (and will likely never be) supported for WASM. This is because UDP cannot be used in the browser. We are however looking into Webrtc for WASM voice support.");
|
pub type UdpSocket = wasm::WasmSocket;
|
||||||
|
#[cfg(all(target_arch = "wasm32", feature = "client"))]
|
||||||
|
pub type UdpBackend = wasm::WasmBackend;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
// TODO: Add wasm websockets
|
||||||
|
compile_error!("Udp voice support is not implemented yet for wasm.");
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct WasmBackend;
|
||||||
|
|
||||||
|
pub type WasmSocket;
|
||||||
|
|
||||||
|
impl WasmBackend {
|
||||||
|
pub async fn connect(url: SocketAddr) -> Result<WasmSocket, VoiceUdpError> {}
|
||||||
|
}
|
|
@ -3,9 +3,7 @@ use discortp::discord::IpDiscovery;
|
||||||
use crate::types::{SessionDescription, Snowflake, VoiceReady, VoiceServerUpdate};
|
use crate::types::{SessionDescription, Snowflake, VoiceReady, VoiceServerUpdate};
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
/// Saves data shared between parts of the voice architecture;
|
/// Saves data shared between parts of the voice architecture
|
||||||
///
|
|
||||||
/// Struct used to give the Udp connection data received from the gateway.
|
|
||||||
pub struct VoiceData {
|
pub struct VoiceData {
|
||||||
pub server_data: Option<VoiceServerUpdate>,
|
pub server_data: Option<VoiceServerUpdate>,
|
||||||
pub ready_data: Option<VoiceReady>,
|
pub ready_data: Option<VoiceReady>,
|
||||||
|
|
Loading…
Reference in New Issue