9006a082b0
Build Mumble Web 2 / linux_build (push) Successful in 1m24s
Build Mumble Web 2 / windows_build (push) Successful in 2m36s
Build Mumble Web 2 / android_build (push) Successful in 5m57s
Build android container / android-release-builder-container-build (push) Successful in -4s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 16s
# Summary Introduces a trait-based platform abstraction layer that makes the boundary between platform-specific and shared code explicit and compile-time verified. The TLDR version of this new trait stuff works: 1. Define a `PlatformInterface` trait. 2. Each platform defines a zero-sized struct implementing the trait (ex `WebPlatform`). 3. Create an ifdef'd type alias on those structs: ```rust #[cfg(feature = "web")] pub type Platform = web::WebPlatform; #[cfg(all(feature = "desktop"))] pub type Platform = desktop::DesktopPlatform; #[cfg(all(feature = "mobile", not(feature = "web")))] pub type Platform = mobile::MobilePlatform; ``` 5. Add a compile time assertion that `Platform` implements `PlatformInterface`. # Motivation Previously, platform code used a mix of pub use re-exports and #[cfg] blocks that made it difficult to understand what each platform must implement. The new trait-based approach provides: - Clear documentation of the platform contract - Compile-time verification that all platforms implement required functionality - Ability to cargo check without feature flags (via stub platform) # Changes New traits in imp/mod.rs: - PlatformInterface - logging, permissions, network, config, storage. Overall this the trait that platforms must satify to compile. - AudioSystemInterface - audio system initialization and recording - AudioPlayerInterface - opus audio playback Type aliases: - Platform, AudioSystem, AudioPlayer resolve to the correct types based on feature flags Call site updates: - Changed from imp::function() to Platform::function() syntax - Removed ImpRead/ImpWrite helper traits in favor of direct bounds # Testing Manual testing reveals that Web and Desktop still work, I (Liam) have not tested the mobile version beyond compilation. Co-authored-by: Liam Warfield <liam.warfield@gmail.com> Reviewed-on: #18 Co-authored-by: Sam Sartor <me@samsartor.com> Co-committed-by: Sam Sartor <me@samsartor.com>
158 lines
4.0 KiB
TOML
158 lines
4.0 KiB
TOML
[package]
|
|
name = "mumble-web2-gui"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
# Web Dependencies
|
|
# ================
|
|
dioxus-web = { version = "0.7.1", optional = true }
|
|
wasm-bindgen = { version = "^0.2.92", optional = true }
|
|
wasm-bindgen-futures = { version = "^0.4.42", optional = true }
|
|
wasm-streams = { version = "^0.4.0", optional = true }
|
|
serde-wasm-bindgen = { version = "^0.6.5", optional = true }
|
|
js-sys = { version = "^0.3.70", 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",
|
|
"AudioContext",
|
|
"AudioContextOptions",
|
|
"MediaStream",
|
|
"GainNode",
|
|
"MediaStreamAudioSourceNode",
|
|
"BaseAudioContext",
|
|
"AudioDestinationNode",
|
|
"AudioWorkletNode",
|
|
"AudioWorklet",
|
|
"AudioWorkletProcessor",
|
|
"MessagePort",
|
|
"MediaStreamConstraints",
|
|
"WorkletOptions",
|
|
"AudioEncoder",
|
|
"AudioEncoderInit",
|
|
"AudioDataInit",
|
|
"HtmlAnchorElement",
|
|
"Url",
|
|
"Blob",
|
|
"AudioDataCopyToOptions",
|
|
"AudioSampleFormat",
|
|
"Storage",
|
|
], optional = true }
|
|
gloo-timers = { version = "^0.3.0", features = ["futures"], optional = true }
|
|
tracing-web = { version = "^0.1.3", optional = true }
|
|
|
|
# Desktop Dependecies
|
|
# ===================
|
|
tokio = { version = "^1.41.1", features = ["net", "rt"], optional = true }
|
|
tokio-rustls = { version = "^0.26.0", optional = true }
|
|
opus = { version = "0.3.0", optional = true }
|
|
cpal = { version = "0.15.3", optional = true }
|
|
dasp_ring_buffer = { version = "0.11.0", optional = true }
|
|
etcetera = { version = "0.10.0", optional = true }
|
|
|
|
# Base Dependencies
|
|
# ================
|
|
dioxus = { version = "0.7.2" }
|
|
once_cell = "1.19.0"
|
|
asynchronous-codec = { workspace = true }
|
|
futures = "^0.3.30"
|
|
merge-io = "^0.3.0"
|
|
mumble-protocol = { workspace = true }
|
|
serde_json = "1"
|
|
tokio-util = { version = "^0.7.11", features = ["codec", "compat"] }
|
|
byteorder = "1.5"
|
|
ogg = "^0.9.1"
|
|
ordermap = "^0.5.3"
|
|
html-purifier = "^0.3.0"
|
|
markdown = "^0.3.0"
|
|
futures-channel = "^0.3.30"
|
|
mumble-web2-common = { workspace = true }
|
|
serde = { workspace = true }
|
|
tracing-subscriber = { version = "^0.3.18", features = ["ansi"] }
|
|
tracing = "^0.1.40"
|
|
color-eyre = "^0.6.3"
|
|
crossbeam-queue = "^0.3.11"
|
|
lol_html = "^2.2.0"
|
|
base64 = "^0.22"
|
|
mime_guess = "^2.0.5"
|
|
async_cell = "^0.2.3"
|
|
reqwest = { version = "^0.12.22", features = ["json"] }
|
|
dioxus-asset-resolver = "0.7.2"
|
|
|
|
|
|
# Denoising
|
|
# =========
|
|
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31", features = [
|
|
"tract",
|
|
] }
|
|
crossbeam = "0.8.4"
|
|
|
|
# Platform Integration
|
|
# ====================
|
|
# rfd only supports windows, macos, linux, and wasm32. No support for Android or iOS
|
|
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "macos", target_arch = "wasm32"))'.dependencies]
|
|
rfd = { git = "https://github.com/PolyMeilex/rfd.git", version = "^0.16.0", default-features = false, optional = true }
|
|
|
|
# Android dependencies for requesting permissions
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
android-permissions = "0.1.2"
|
|
jni = "0.21.1"
|
|
ndk-context = "0.1.1"
|
|
|
|
[patch.crates-io]
|
|
tract-hir = "=0.12.4"
|
|
tract-core = "=0.12.4"
|
|
tract-onnx = "=0.12.4"
|
|
tract-pulse = "=0.12.4"
|
|
|
|
[features]
|
|
web = [
|
|
"dioxus/web",
|
|
"dioxus-web",
|
|
"wasm-bindgen",
|
|
"wasm-bindgen-futures",
|
|
"wasm-streams",
|
|
"serde-wasm-bindgen",
|
|
"js-sys",
|
|
"web-sys",
|
|
"gloo-timers",
|
|
"tracing-web",
|
|
"deep_filter/wasm",
|
|
"rfd",
|
|
]
|
|
desktop = [
|
|
"dioxus/desktop",
|
|
"tokio",
|
|
"tokio-rustls",
|
|
"tracing-subscriber/env-filter",
|
|
"opus",
|
|
"cpal",
|
|
"dasp_ring_buffer",
|
|
"rfd/xdg-portal",
|
|
"etcetera",
|
|
]
|
|
mobile = [
|
|
"dioxus/mobile",
|
|
"tokio",
|
|
"tokio-rustls",
|
|
"tracing-subscriber/env-filter",
|
|
"opus",
|
|
"cpal",
|
|
"dasp_ring_buffer",
|
|
]
|