14 Commits

Author SHA1 Message Date
samuel127849 51f05593ac Refactor ProxyOverides to be optional
Build Mumble Web 2 / linux_build (push) Successful in 1m37s
Build Mumble Web 2 / windows_build (push) Successful in 2m26s
2026-01-10 17:29:49 -07:00
samuel127849 eab8f1d6a7 Rename client config
Build Mumble Web 2 / linux_build (push) Successful in 1m28s
Build Mumble Web 2 / windows_build (push) Successful in 2m36s
2026-01-10 17:11:50 -07:00
samuel127849 4abb130a77 Address @sam
Build Mumble Web 2 / linux_build (push) Successful in 1m33s
Build Mumble Web 2 / windows_build (push) Successful in 2m23s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 14s
2026-01-10 23:26:21 +00:00
samuel127849 af35d72e4e Added persistant settings on desktop 2026-01-10 23:26:21 +00:00
samuel127849 889bdf6b80 Add configuration for rust analyzer for vscode. 2026-01-10 23:26:21 +00:00
liamwarfield 391d18a11e web: fix flash of unstyled content during load
Build Mumble Web 2 / linux_build (push) Successful in 1m28s
Build Mumble Web 2 / windows_build (push) Has been cancelled
Add background color to #main in loader styles to prevent white flash
while app CSS loads after WASM initialization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:24:15 -07:00
liamwarfield ca8a3d1b92 web: add loading screen while WASM fetches
Shows a themed spinner overlay while the large WASM bundle downloads,
improving perceived load time on slower connections.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:09:37 -07:00
restitux 5d2c2a93c7 ci: upgrade version of dioxus cli installed during linux build to 0.7.2 (#8)
Build Mumble Web 2 / linux_build (push) Successful in 1m42s
Build Mumble Web 2 / windows_build (push) Successful in 2m30s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 12s
Forgot to update this with the rest of the 0.7.2 migration

Reviewed-on: #8
2026-01-05 09:40:40 +00:00
restitux 96589e28c6 meta: update Dioxus to 0.7.2 (#6)
Build Mumble Web 2 / linux_build (push) Successful in 1m50s
Build Mumble Web 2 / windows_build (push) Successful in 4m16s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 14s
Build with latest container: https://git.ohea.xyz/mumble/mumble-web2/actions/runs/192/jobs/1

Reviewed-on: #6
2026-01-05 01:45:40 +00:00
restitux e7e7b945c5 gui: switch to upstream version of rfd (#7)
Build Mumble Web 2 / windows_build (push) Has been cancelled
Build Mumble Web 2 / linux_build (push) Has been cancelled
The PR was merged into upstream. They haven't cut a release yet though so we still need to pull from git.

Reviewed-on: #7
Reviewed-by: Sam Sartor <cap@samsartor.com>
2026-01-05 01:45:27 +00:00
restitux cd90cb628b ci: correct windows dockerfile path
Build Mumble Web 2 / linux_build (push) Successful in 1m41s
Build Mumble Web 2 / windows_build (push) Successful in 2m31s
Build Mumble Web 2 release builder containers / windows-release-builder-container-build (push) Successful in 17s
2025-12-05 14:24:43 -07:00
restitux 37613a65c4 web: fix audio on firefox
Build Mumble Web 2 / windows_build (push) Successful in 2m39s
Build Mumble Web 2 / linux_build (push) Successful in 4m57s
2025-12-05 01:54:12 -07:00
sam d6b482528f Load status from relative url (#5)
Build Mumble Web 2 / linux_build (push) Successful in 2m23s
Build Mumble Web 2 / windows_build (push) Successful in 2m33s
Remove public_url config option
Use proxy_url instead for example configs
Get status from relative endpoint, like /config
Show version on login page

Reviewed-on: #5
Co-authored-by: Sam Sartor <me@samsartor.com>
Co-committed-by: Sam Sartor <me@samsartor.com>
2025-12-05 07:00:38 +00:00
sam 5df7b0e082 Fix audio on windows (#3)
Build Mumble Web 2 / linux_build (push) Successful in 1m42s
Build Mumble Web 2 / windows_build (push) Successful in 2m43s
Reviewed-on: #3

Automatically choose supported profile
Play stream once created

Co-authored-by: Sam Sartor <me@samsartor.com>
Co-committed-by: Sam Sartor <me@samsartor.com>
2025-12-05 05:34:07 +00:00
20 changed files with 532 additions and 258 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install dioxus-cli
run: cargo binstall dioxus-cli --version 0.7.1
run: cargo binstall dioxus-cli --version 0.7.2
- uses: Swatinem/rust-cache@v2
@@ -22,6 +22,6 @@ jobs:
- name: Build Windows image
shell: bash
run: |
docker pull "$(grep -m1 '^FROM' Dockerfile | awk '{print $2}')"
docker pull "$(grep -m1 '^FROM' ./docker/windows-release-builder.Dockerfile | awk '{print $2}')"
docker build -t git.ohea.xyz/mumble/mumble-web2/windows-release-builder:latest -f ./docker/windows-release-builder.Dockerfile .
docker push git.ohea.xyz/mumble/mumble-web2/windows-release-builder:latest
+4
View File
@@ -0,0 +1,4 @@
{
"rust-analyzer.cargo.features": ["desktop","web"],
"rust-analyzer.cargo.noDefaultFeatures": false
}
Generated
+96 -77
View File
@@ -914,9 +914,9 @@ dependencies = [
[[package]]
name = "const-serialize"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd339aa356cc6452308fad2ee56623f900a8e68bc0ab9360a0ddb8270e5640c8"
checksum = "ad7154afa56de2f290e3c82c2c6dc4f5b282b6870903f56ef3509aba95866edc"
dependencies = [
"const-serialize-macro",
"serde",
@@ -924,9 +924,9 @@ dependencies = [
[[package]]
name = "const-serialize-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "797d158acb331e2a89d696343a27cd39bf7e36aaef33ba4799a5ef1526e24861"
checksum = "4f160aad86b4343e8d4e261fee9965c3005b2fd6bc117d172ab65948779e4acf"
dependencies = [
"proc-macro2",
"quote",
@@ -1479,9 +1479,9 @@ dependencies = [
[[package]]
name = "dioxus"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f76e820919058a685a1fdbb2ef4888c73ac77d623c39a7dfde2aa812947246be"
checksum = "3a115f9dbe5900c6044ee6a791e1b160c29989c6a8721eec099e01a964e5dae4"
dependencies = [
"dioxus-asset-resolver",
"dioxus-cli-config",
@@ -1507,9 +1507,9 @@ dependencies = [
[[package]]
name = "dioxus-asset-resolver"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6a124667ce5565c39fe2f33af45c21fe459c5bfcf7a8074ad12c9e9da5817c"
checksum = "6851ae49ba3988f1b77f6ef826eb142e811602129841c24bf5a4e103708d9844"
dependencies = [
"dioxus-cli-config",
"http",
@@ -1528,18 +1528,18 @@ dependencies = [
[[package]]
name = "dioxus-cli-config"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "babc8eaf90379352bc4820830749fd231feb9312433d4094b4e7b79d912b3d96"
checksum = "c59e9d9da2e7334fdae5d77e3989207aa549062f74ff1ca2171393bbdd7fda90"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "dioxus-config-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30018b5b95567cee42febbb444d5e5e47dbe3e91fa6e44b9e571edad0184cd36"
checksum = "9bd56be5ea6c9f416b25e9e3adc910c02127be75b6d1ecd567661f31920b27ba"
dependencies = [
"proc-macro2",
"quote",
@@ -1547,15 +1547,15 @@ dependencies = [
[[package]]
name = "dioxus-config-macros"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a16b25f8761253ed5ffa4d0789376310fbbc1bbaa8190fc2f374db82c6285a1"
checksum = "c49327465c2d434d00fb4c86bd35ae72155b479622e09352b950d9ab4807bf23"
[[package]]
name = "dioxus-core"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75468d08468919f783b0f7ee826802f4e8e66c5b5a0451245d861c211ca18216"
checksum = "7400cbd21a98e585a13f8c29574da9b8afb2fd343f712618042b6c71761f0933"
dependencies = [
"anyhow",
"const_format",
@@ -1571,14 +1571,13 @@ dependencies = [
"slotmap",
"subsecond",
"tracing",
"warnings",
]
[[package]]
name = "dioxus-core-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f145abdb2a3f858456cb4382390863cf0398c228ad0733618f48891da7687be3"
checksum = "e51c0eb7eb76dd5a0b9a116d94d29ca78924a1ed1fcb7ea072eda5045d3ac056"
dependencies = [
"convert_case 0.8.0",
"dioxus-rsx",
@@ -1589,15 +1588,15 @@ dependencies = [
[[package]]
name = "dioxus-core-types"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36f5ecf5a51de06d78aded3b5f7516a258f53117cba718bc5706317a3c04c844"
checksum = "0652ab5f9c2c32261d44a3155debbfd909ed03d03434d7f70f5a796bf255c519"
[[package]]
name = "dioxus-desktop"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f493c74ff09410c5eadf42abd031d4b3d4032a4d5a2411c77d1d0d5156ca3687"
checksum = "b24aa7e4aa87fce202c5e67d560cddd9ed67ad533f16b7d922916c04993766ff"
dependencies = [
"async-trait",
"base64",
@@ -1650,9 +1649,9 @@ dependencies = [
[[package]]
name = "dioxus-devtools"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb2c5019b7fa72e8e6b21ba99e9263bd390c9a30bbf09793b72f4b57ed7c3d7"
checksum = "9748128bcd102b10e58c765939807053ccab542206a939b8bab228077455c259"
dependencies = [
"dioxus-cli-config",
"dioxus-core",
@@ -1664,14 +1663,13 @@ dependencies = [
"thiserror 2.0.17",
"tracing",
"tungstenite 0.27.0",
"warnings",
]
[[package]]
name = "dioxus-devtools-types"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b007cec5b8548281921c4e4678926a3936e9d6757e951380685cc6121a6f974"
checksum = "48540ca8a0ab1ec81cd4db35f0c9713d43b158647fc1dcb0d79965fc3b41d96c"
dependencies = [
"dioxus-core",
"serde",
@@ -1680,9 +1678,9 @@ dependencies = [
[[package]]
name = "dioxus-document"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c55bcae9aaf150d4a141c61b3826da5a7ac23dfff09726568525cd46336e9a2"
checksum = "501a189b391d091c9aa02c05f5b25f5d0d17fa0e1016e000b0fdbb073d77cd6a"
dependencies = [
"dioxus-core",
"dioxus-core-macro",
@@ -1699,9 +1697,9 @@ dependencies = [
[[package]]
name = "dioxus-fullstack"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff04cef82d6639eb15186f626298645dbd92978bf66dc3efd2e5984a2ff4a1ff"
checksum = "54150804265defdb21a6f2d8914a45316a1e7fb70ab22c30cf836e8fe2f8081b"
dependencies = [
"anyhow",
"async-stream",
@@ -1756,9 +1754,9 @@ dependencies = [
[[package]]
name = "dioxus-fullstack-core"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41281c7cd4d311a50933256e19a5d91d0d950ad350dd3232bd4321fdd3a59fb0"
checksum = "d0a9be2ef4d701520eefef284d218fb35b159dccd6bccc02b5bad42945e2599d"
dependencies = [
"anyhow",
"axum-core",
@@ -1784,9 +1782,9 @@ dependencies = [
[[package]]
name = "dioxus-fullstack-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae73023c8b8fee2692fc50a28063336f0b6930e86727e30c1047c92d30805b49"
checksum = "a31ea4451fe8c9d2af24fb718a94966d5fd7e11325777e5b5a59085c5c85e5fb"
dependencies = [
"const_format",
"convert_case 0.8.0",
@@ -1798,9 +1796,9 @@ dependencies = [
[[package]]
name = "dioxus-history"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac73657da5c7a20629482d774b52f4a4f7cb57a520649f1d855d4073e809c98"
checksum = "55d704b3ba9504cb3c9cde49499b75546d1faaff2736f4c368aca6c061c48ac3"
dependencies = [
"dioxus-core",
"tracing",
@@ -1808,9 +1806,9 @@ dependencies = [
[[package]]
name = "dioxus-hooks"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffd445f16d64939e06cd71a1c63a665f383fda6b7882f4c6f8f1bd6efca2046"
checksum = "79c6d68be372eca8186a1c57ec49be67a6ea46022150b5e85ab6a6acde52d272"
dependencies = [
"dioxus-core",
"dioxus-signals",
@@ -1820,14 +1818,13 @@ dependencies = [
"rustversion",
"slab",
"tracing",
"warnings",
]
[[package]]
name = "dioxus-html"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f407fc73a9554a644872fcccc9faf762acad8f45158e3d67e42ab8dd42f4586"
checksum = "3aa87ecfa0f38ec286be25789a7f2d6c30778111f1fbff563da4bae41d171496"
dependencies = [
"async-trait",
"bytes",
@@ -1852,9 +1849,9 @@ dependencies = [
[[package]]
name = "dioxus-html-internal-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a968aae4bc92de87cbac3d0d043803b25a7c62c187841e61adcc9b49917c2b2a"
checksum = "49301d0e389378e8070b8b704110339a0d3358efad9f5ad483ffab3a8d406dae"
dependencies = [
"convert_case 0.8.0",
"proc-macro2",
@@ -1864,9 +1861,9 @@ dependencies = [
[[package]]
name = "dioxus-interpreter-js"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83ab170d89308399205f8ad3d43d8d419affe317016b41ca0695186f7593cba2"
checksum = "f5437a89d3ef7edfebc0f10acb065f1709cb7ffb678e3a4bb1416706d71f7c67"
dependencies = [
"dioxus-core",
"dioxus-core-types",
@@ -1884,9 +1881,9 @@ dependencies = [
[[package]]
name = "dioxus-logger"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42237934c6a67f5ed9a8c37e47ca980ee7cfec9e783a9a1f8c2e36c8b96ae74b"
checksum = "2b25ebfbc193cebcf5af5e19b8ee7c6adee486fbd1c12f11aea058b464da16f9"
dependencies = [
"dioxus-cli-config",
"tracing",
@@ -1896,21 +1893,22 @@ dependencies = [
[[package]]
name = "dioxus-rsx"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f026380dfda8b93ad995c0a90a62a17b8afeb246baff1b781a52c7b1b3ebd791"
checksum = "19d97c02689beff55767ba5f6e185ffd204c6a193e372f0fead8a3722c6f7eea"
dependencies = [
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
"rustversion",
"syn 2.0.108",
]
[[package]]
name = "dioxus-signals"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3895cc17ff5b43ada07743111be586e7a927ed7ec511457020e4235e13e63fe6"
checksum = "27fc4df7a31a7f02e5a0b40884bb66ee165226a05d75fce03baa44029e438762"
dependencies = [
"dioxus-core",
"futures-channel",
@@ -1924,20 +1922,21 @@ dependencies = [
[[package]]
name = "dioxus-stores"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8521729ac35f362476ac4eb7d1c4ab79e7e92a0facfdea3ee978c0ddf7108d37"
checksum = "e2dec3cd677078824a733de25ddbe8e987cfc8d98aec29b7d199e1fdb8452b96"
dependencies = [
"dioxus-core",
"dioxus-signals",
"dioxus-stores-macro",
"generational-box",
]
[[package]]
name = "dioxus-stores-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23a733d2684dc843e81954f6176b3353e4cfc71b6978a8e464591bb5536f610b"
checksum = "c9b7f085e374aaaa78403227b9bd83675c4078388d41a41b67dfbe4aa0bb64d5"
dependencies = [
"convert_case 0.8.0",
"proc-macro2",
@@ -1947,9 +1946,9 @@ dependencies = [
[[package]]
name = "dioxus-web"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76155ecd44535e7c096ec8c5aac4a945899e47567ead4869babdaa74f3f9bca0"
checksum = "315009f3a77c3c813415b3b8a8ea62a4d7a32dde9a666664b30862d4386e8456"
dependencies = [
"dioxus-cli-config",
"dioxus-core",
@@ -2271,6 +2270,17 @@ dependencies = [
"xxhash-rust",
]
[[package]]
name = "etcetera"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26c7b13d0780cb82722fd59f6f57f925e143427e4a75313a6c77243bf5326ae6"
dependencies = [
"cfg-if",
"home",
"windows-sys 0.59.0",
]
[[package]]
name = "euclid"
version = "0.22.11"
@@ -2664,9 +2674,9 @@ dependencies = [
[[package]]
name = "generational-box"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3c1ae09dfd2d455484a54b56129b9821241c4b0e412227806b6c3730cd18a29"
checksum = "e658d10252a15200ca4a1c67c7180fc0baffa3f92869bbd903025daf6f70fd65"
dependencies = [
"parking_lot",
"tracing",
@@ -3158,6 +3168,15 @@ version = "1.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad6880c8d4a9ebf39c6e8b77007ce223f646a4d21ce29d99f70cb16420545425"
[[package]]
name = "home"
version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "html-purifier"
version = "0.3.0"
@@ -3669,9 +3688,9 @@ dependencies = [
[[package]]
name = "lazy-js-bundle"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "409273b42d0e3ae7c8ce6b8cfbc6a27b7c7d83bbb94fc7f93f22cc9b90eea078"
checksum = "21972afec4627b7ba0de60b5269585b5ac2f56d559b0696f57eee6daf8a51b68"
[[package]]
name = "lazy_static"
@@ -3974,9 +3993,9 @@ dependencies = [
[[package]]
name = "manganis"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "124f8f094eb75783b38209ce4d534b9617da4efac652802d9bafe05043a3ec95"
checksum = "97c63ae68d25457a579b7714806088c5cb44c536cf624a53a17184878f9f0bcd"
dependencies = [
"const-serialize",
"manganis-core",
@@ -3985,9 +4004,9 @@ dependencies = [
[[package]]
name = "manganis-core"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fbd1fb8c5aabcc54c6b02dbc968e1c89c28f3e543f2789ef9e3ce45dbdf5df"
checksum = "88d071660b149f985cbab8b23f2004ea6dd5cf947b63a0843f0e2f46e6af7229"
dependencies = [
"const-serialize",
"dioxus-cli-config",
@@ -3997,9 +4016,9 @@ dependencies = [
[[package]]
name = "manganis-macro"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45d6fec2a8249739bb30b53a08ecbb217f76096c08f1053f38ec3981ba424c11"
checksum = "9793d1d33778245b4240c330a8f575d208ce077c7e7bab1c79064252ddd4a162"
dependencies = [
"dunce",
"macro-string",
@@ -4262,6 +4281,7 @@ dependencies = [
"dioxus",
"dioxus-asset-resolver",
"dioxus-web",
"etcetera",
"futures",
"futures-channel",
"gloo-timers",
@@ -5841,12 +5861,12 @@ dependencies = [
[[package]]
name = "rfd"
version = "0.16.0"
source = "git+https://github.com/samsartor/rfd.git#d8ffa02ecc5071f44a514ec7736dc0c1296a9845"
source = "git+https://github.com/PolyMeilex/rfd.git#f3258c56e7099572f1a3cffc30b3677dba88142c"
dependencies = [
"ashpd",
"block2",
"dispatch2",
"js-sys",
"libc",
"log",
"objc2",
"objc2-app-kit",
@@ -5854,11 +5874,10 @@ dependencies = [
"objc2-foundation",
"pollster",
"raw-window-handle 0.6.2",
"urlencoding",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
@@ -6996,9 +7015,9 @@ dependencies = [
[[package]]
name = "subsecond"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "834e8caec50249083ee6972a2f7645c4baadcb39d49ea801da1dc1d5e1c2ccb9"
checksum = "c09bc2c9ef0381b403ab8b58122961cb83266d16b1f55f9486d5857ba4a9ae26"
dependencies = [
"js-sys",
"libc",
@@ -7015,9 +7034,9 @@ dependencies = [
[[package]]
name = "subsecond-types"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6beffea67e72a7a530990b270fd0277971eae564fdc10c1e0080e928b477fab"
checksum = "d07aa455c66ddfdbb51507537402b961e027846468954ef8d974bce65dff9eb0"
dependencies = [
"serde",
]
+3 -5
View File
@@ -1,11 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
pub struct ClientConfig {
pub proxy_url: Option<String>,
pub status_url: Option<String>,
pub cert_hash: Option<Vec<u8>>,
pub any_server: bool,
pub struct ProxyOverides {
pub proxy_url: String,
pub cert_hash: Vec<u8>,
}
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
+1 -1
View File
@@ -1,4 +1,4 @@
public_url = "https://127.0.0.1:4433"
proxy_url = "https://127.0.0.1:4433/proxy"
https_listen_address = "127.0.0.1:4433"
http_listen_address = "127.0.0.1:8080"
mumble_server_url = "[SERVER_URL_HERE]"
-1
View File
@@ -1,4 +1,3 @@
public_url = "https://localhost:64444"
proxy_url = "https://127.0.0.1:4433/proxy"
https_listen_address = "127.0.0.1:4433"
http_listen_address = "127.0.0.1:4400"
+5 -1
View File
@@ -44,10 +44,14 @@ RUN choco install rustup.install -y --no-progress
RUN rustup toolchain install stable-x86_64-pc-windows-msvc
RUN rustup default stable-x86_64-pc-windows-msvc
# Install carog binstall
RUN Set-ExecutionPolicy Unrestricted -Scope Process; `
iex (Invoke-WebRequest "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1" -UseBasicParsing).Content
SHELL ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
# Install dioxus-cli from git HEAD with cargo
# This is to work around a bug in the windows builder upstream.
# Dioxus has released 0.7.2, but it seems to be broken for now.
RUN cargo install --git https://github.com/DioxusLabs/dioxus dioxus-cli
RUN cargo binstall dioxus-cli
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
+9 -7
View File
@@ -30,8 +30,6 @@ web-sys = { version = "^0.3.72", features = [
"EncodedAudioChunkInit",
"EncodedAudioChunkType",
"CodecState",
"MediaStreamTrackGenerator",
"MediaStreamTrackGeneratorInit",
"AudioContext",
"AudioContextOptions",
"MediaStream",
@@ -42,6 +40,7 @@ web-sys = { version = "^0.3.72", features = [
"AudioWorkletNode",
"AudioWorklet",
"AudioWorkletProcessor",
"MessagePort",
"MediaStreamConstraints",
"WorkletOptions",
"AudioEncoder",
@@ -64,10 +63,11 @@ 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.1" }
dioxus = { version = "0.7.2" }
once_cell = "1.19.0"
asynchronous-codec = { workspace = true }
futures = "^0.3.30"
@@ -88,16 +88,18 @@ tracing = "^0.1.40"
color-eyre = "^0.6.3"
crossbeam-queue = "^0.3.11"
lol_html = "^2.2.0"
rfd = { git = "https://github.com/samsartor/rfd.git", version = "^0.16.0", default-features = false }
rfd = { git = "https://github.com/PolyMeilex/rfd.git", version = "^0.16.0", default-features = false }
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.1"
dioxus-asset-resolver = "0.7.2"
# Denoising
# =========
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31", features = ["tract"] }
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31", features = [
"tract",
] }
crossbeam = "0.8.4"
[patch.crates-io]
@@ -129,5 +131,5 @@ desktop = [
"cpal",
"dasp_ring_buffer",
"rfd/xdg-portal",
"rfd/tokio",
"etcetera",
]
+1 -1
View File
@@ -23,7 +23,7 @@ watch_path = ["src", "assets"]
# CSS style file
style = []
# Javascript code file
script = []
script = ["loader.js"]
[web.resource.dev]
# serve: [dev-server] only
+5
View File
@@ -279,6 +279,11 @@ a:visited {
color: #b3c6b4;
}
&_version {
color: var(--txt-color);
font-weight: normal;
}
&_bttn {
font-weight: bold;
font-size: large;
@@ -1,7 +1,7 @@
const SAMPLE_RATE = 48000;
const PACKET_SAMPLES = 960;
class RustWorklet extends AudioWorkletProcessor {
class RustMicWorklet extends AudioWorkletProcessor {
constructor(options) {
super();
this.module = options.processorOptions;
@@ -31,7 +31,7 @@ class RustWorklet extends AudioWorkletProcessor {
}
this.buffer_offset -= PACKET_SAMPLES;
this.timestamp = null;
}
}
process(inputs) {
//console.log(inputs);
@@ -60,4 +60,44 @@ class RustWorklet extends AudioWorkletProcessor {
}
};
registerProcessor("rust_mic_worklet", RustWorklet);
class RustSpeakerWorklet extends AudioWorkletProcessor {
constructor() {
super();
this.queue = [];
this.readIndex = 0;
this.port.onmessage = (event) => {
this.queue.push(event.data)
};
}
process(inputs, outputs) {
if (this.queue.length) {
console.log(this.queue[0].samples.length, outputs[0][0].length);
}
const output = outputs[0];
for (let i = 0; i < output[0].length; i++) {
if (!this.queue.length) {
return true;
}
const current = this.queue[0];
for (let ch = 0; ch < output.length; ch++) {
output[ch][i] = current.samples[this.readIndex];
}
this.readIndex++;
if (this.readIndex >= current.samples.length) {
this.queue.shift();
this.readIndex = 0;
}
}
return true;
}
};
registerProcessor("rust_mic_worklet", RustMicWorklet);
registerProcessor("rust_speaker_worklet", RustSpeakerWorklet);
+56 -8
View File
@@ -1,7 +1,39 @@
use std::env;
use std::path::Path;
use std::process::Command;
fn main() {
fn version_env() -> Option<()> {
if env::var("MUMBLE_WEB2_VERSION").is_ok() {
return Some(());
}
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()?;
let git_hash = String::from_utf8(output.stdout).ok()?;
let git_hash = git_hash.trim(); // drop trailing newline
let status = Command::new("git")
.args(["status", "--porcelain"])
.output()
.ok()?;
let dirty = match status.stdout.is_empty() {
true => "",
false => "-dirty",
};
// Expose it as a compile-time env var
println!("cargo::rustc-env=MUMBLE_WEB2_VERSION=git-{git_hash}{dirty}");
// Optional: rebuild when HEAD changes
println!("cargo::rerun-if-changed=.git/HEAD");
Some(())
}
fn download_deepfilternet() {
// Define the target directory and file
let assets_dir = "assets";
let target_file = format!("{}/DeepFilterNet3_ll_onnx.tar.gz", assets_dir);
@@ -9,30 +41,46 @@ fn main() {
// Check if the file already exists
if target_path.exists() {
println!("cargo:warning=DeepFilterNet model already exists at {}", target_file);
println!(
"cargo::warning=DeepFilterNet model already exists at {}",
target_file
);
return;
}
println!("cargo:warning=Downloading DeepFilterNet model to {}...", target_file);
println!(
"cargo::warning=Downloading DeepFilterNet model to {}...",
target_file
);
// Download the file using curl
let url = "https://github.com/Rikorose/DeepFilterNet/raw/refs/heads/main/models/DeepFilterNet3_ll_onnx.tar.gz";
let status = Command::new("curl")
.args([
"-L", // Follow redirects
"-o", &target_file, // Output file
"-L", // Follow redirects
"-o",
&target_file, // Output file
url,
])
.status()
.expect("Failed to execute curl command. Make sure curl is installed.");
if !status.success() {
panic!("Failed to download DeepFilterNet model from {}", url);
println!("cargo::error=Failed to download DeepFilterNet model from {url}");
return;
}
println!("cargo:warning=Successfully downloaded DeepFilterNet model to {}", target_file);
println!(
"cargo::warning=Successfully downloaded DeepFilterNet model to {}",
target_file
);
// Rerun this build script if the target file is deleted
println!("cargo:rerun-if-changed={}", target_file);
println!("cargo::rerun-if-changed={}", target_file);
}
fn main() {
version_env();
download_deepfilternet();
}
+68
View File
@@ -0,0 +1,68 @@
// Loading screen that displays while WASM loads
(function() {
// Create and inject loader styles immediately (head exists)
var style = document.createElement('style');
style.textContent =
'.wasm-loader {' +
'position: fixed;' +
'top: 0;' +
'left: 0;' +
'width: 100%;' +
'height: 100%;' +
'background-color: oklch(0.15 0.01 338.64);' +
'display: flex;' +
'align-items: center;' +
'justify-content: center;' +
'z-index: 9999;' +
'transition: opacity 0.3s ease-out;' +
'}' +
'.wasm-loader.hidden {' +
'opacity: 0;' +
'pointer-events: none;' +
'}' +
'.wasm-spinner {' +
'width: 48px;' +
'height: 48px;' +
'border: 4px solid rgba(123, 173, 159, 0.2);' +
'border-top-color: #7bad9f;' +
'border-radius: 50%;' +
'animation: wasm-spin 1s linear infinite;' +
'}' +
'@keyframes wasm-spin {' +
'to { transform: rotate(360deg); }' +
'}' +
'#main {' +
'background-color: oklch(0.15 0.01 338.64);' +
'}';
document.head.appendChild(style);
function init() {
// Create loader element
var loader = document.createElement('div');
loader.className = 'wasm-loader';
loader.innerHTML = '<div class="wasm-spinner"></div>';
document.body.appendChild(loader);
// Watch for Dioxus to mount content in #main
var observer = new MutationObserver(function(mutations, obs) {
var main = document.getElementById('main');
if (main && main.children.length > 0) {
loader.classList.add('hidden');
setTimeout(function() { loader.remove(); }, 300);
obs.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
}
// Wait for body to exist
if (document.body) {
init();
} else {
document.addEventListener('DOMContentLoaded', init);
}
})();
+30 -34
View File
@@ -2,7 +2,7 @@
use dioxus::prelude::*;
use mime_guess::Mime;
use mumble_web2_common::{ClientConfig, ServerStatus};
use mumble_web2_common::{ProxyOverides, ServerStatus};
use ordermap::OrderSet;
use std::collections::HashMap;
@@ -23,7 +23,7 @@ pub enum Command {
Connect {
address: String,
username: String,
config: ClientConfig,
config: ProxyOverides,
},
SendChat {
markdown: String,
@@ -309,7 +309,7 @@ pub fn ChatView() -> Element {
}
#[component]
pub fn ControlView(config: Resource<ClientConfig>) -> Element {
pub fn ControlView(config: Resource<Option<ProxyOverides>>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let status = &STATE.status;
let server = STATE.server.read();
@@ -331,7 +331,8 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
let proxy_url = config
.read_unchecked()
.as_ref()
.and_then(|gui_config| gui_config.proxy_url.clone());
.and_then(|opt| opt.as_ref())
.map(|gui_config| gui_config.proxy_url.clone());
let connecting_color = "yellow";
let connected_color = "oklch(0.55 0.1184 141.35)";
@@ -508,7 +509,7 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
}
#[component]
pub fn ServerView(config: Resource<ClientConfig>) -> Element {
pub fn ServerView(config: Resource<Option<ProxyOverides>>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let server = STATE.server.read();
let Some(&UserState {
@@ -545,44 +546,27 @@ pub fn ServerView(config: Resource<ClientConfig>) -> Element {
)
}
async fn get_status(
client: &reqwest::Client,
status_url: &str,
) -> color_eyre::Result<ServerStatus> {
Ok(client
.get(status_url)
.send()
.await?
.json::<ServerStatus>()
.await?)
}
#[component]
pub fn LoginView(config: Resource<ClientConfig>) -> Element {
pub fn LoginView(config: Resource<Option<ProxyOverides>>) -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let last_status = use_signal(|| None::<color_eyre::Result<ServerStatus>>);
use_resource(move || async move {
let Some(config) = config.read().clone() else {
return;
};
let Some(status_url) = config.status_url else {
return;
};
let client = reqwest::Client::new();
loop {
*last_status.write_unchecked() = Some(get_status(&client, &status_url).await);
*last_status.write_unchecked() = Some(imp::get_status(&client).await);
imp::sleep(std::time::Duration::from_secs_f32(1.0)).await;
}
});
let mut address_input = use_signal(|| None::<String>);
let mut address_input = use_signal(|| imp::load_server_url());
let address = use_memo(move || {
if let Some(addr) = address_input() {
addr.clone()
} else {
config()
.and_then(|c| c.proxy_url.clone())
.flatten()
.map(|c| c.proxy_url.clone())
.unwrap_or_default()
}
});
@@ -593,10 +577,13 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
let do_connect = move |_| {
//let _ = set_default_username(&username.read());
let _ = imp::set_default_username(&username.read());
if config.read().as_ref().is_some_and(|opt| opt.is_none()) {
imp::set_default_server(&address.read());
}
net.send(Connect {
address: address.read().clone(),
username: username.read().clone(),
config: config.read().clone().unwrap_or_default(),
config: config.read().clone().flatten().unwrap_or_default(),
})
};
let status = &STATE.status;
@@ -630,13 +617,18 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
),
Connected => unreachable!(),
};
let version = option_env!("MUMBLE_WEB2_VERSION");
rsx!(
div {
class: "login",
h1 {
"Mumble Web"
match version {
Some(v) => rsx!(" " span { class: "login_version", "({v})" }),
None => rsx!(),
}
}
if config.read().as_ref().is_some_and(|cfg| cfg.any_server) {
if config.read().as_ref().is_some_and(|opt| opt.is_none()) {
div {
label {
for: "address-entry",
@@ -733,9 +725,9 @@ pub fn app() -> Element {
use_coroutine(|rx: UnboundedReceiver<Command>| super::network_entrypoint(rx));
let config = use_resource(|| async move {
match imp::load_config().await {
match imp::load_proxy_overides().await {
Ok(config) => config,
Err(_) => ClientConfig::default(),
Err(_) => None,
}
});
@@ -744,9 +736,13 @@ pub fn app() -> Element {
document::Link{ rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" }
document::Link{ rel: "stylesheet", href: STYLE }
match *STATE.status.read() {
Connected => rsx!(ServerView { config }),
_ => rsx!(LoginView { config }),
if config.read().is_none() {
div { class: "loading", "Loading..." }
} else {
match *STATE.status.read() {
Connected => rsx!(ServerView { config }),
_ => rsx!(LoginView { config }),
}
}
)
}
+3 -3
View File
@@ -97,13 +97,13 @@ impl AudioProcessor {
}
impl AudioProcessor {
pub fn process(&mut self, audio: &[f32], output: &mut Vec<f32>) {
pub fn process(&mut self, audio: &[f32], channels: usize, output: &mut Vec<f32>) {
let mut include_raw = true;
if self.denoise {
with_denoising_model(&self.spawn, |df| {
include_raw = false;
self.buffer.extend_from_slice(audio);
self.buffer.extend(audio.iter().step_by(channels).copied());
output.reserve(audio.len());
let hop = df.hop_size;
@@ -130,7 +130,7 @@ impl AudioProcessor {
}
if include_raw {
output.extend_from_slice(audio);
output.extend(audio.iter().step_by(channels).copied());
}
}
}
+111 -34
View File
@@ -1,11 +1,13 @@
use crate::app::Command;
use crate::effects::{AudioProcessor, AudioProcessorSender};
use color_eyre::eyre::{eyre, Context, Error};
use cpal::traits::{DeviceTrait, HostTrait};
use color_eyre::eyre::{bail, eyre, Error};
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait as _};
use dioxus::hooks::UnboundedReceiver;
use etcetera::{choose_app_strategy, AppStrategy, AppStrategyArgs};
use futures::io::{AsyncRead, AsyncWrite};
use mumble_protocol::control::ClientControlCodec;
use mumble_web2_common::ClientConfig;
use mumble_web2_common::{ProxyOverides, ServerStatus};
use std::collections::HashMap;
use std::mem::replace;
use std::net::ToSocketAddrs;
use std::sync::Arc;
@@ -43,7 +45,7 @@ const PACKET_SAMPLES: u32 = 960;
type Buffer = Arc<Mutex<dasp_ring_buffer::Bounded<Vec<i16>>>>;
impl AudioSystem {
pub fn new() -> Result<Self, Error> {
pub async fn new() -> Result<Self, Error> {
// TODO
let host = cpal::default_host();
let name = host.id();
@@ -64,10 +66,46 @@ impl AudioSystem {
self.processors.store(Some(processor))
}
fn choose_config(
&self,
configs: impl Iterator<Item = cpal::SupportedStreamConfigRange>,
) -> Result<cpal::StreamConfig, Error> {
let mut supported_configs: Vec<_> = configs
.filter_map(|cfg| cfg.try_with_sample_rate(cpal::SampleRate(SAMPLE_RATE)))
.filter(|cfg| cfg.sample_format() == cpal::SampleFormat::I16)
.map(|cfg| cpal::StreamConfig {
buffer_size: cpal::BufferSize::Fixed(match *cfg.buffer_size() {
cpal::SupportedBufferSize::Range { min, max } => 480.clamp(min, max),
cpal::SupportedBufferSize::Unknown => 480,
}),
..cfg.config()
})
.collect();
supported_configs.sort_by(|a, b| {
let cpal::BufferSize::Fixed(a_buf) = a.buffer_size else {
unreachable!()
};
let cpal::BufferSize::Fixed(b_buf) = b.buffer_size else {
unreachable!()
};
Ord::cmp(&a.channels, &b.channels).then(Ord::cmp(&a_buf, &b_buf))
});
supported_configs
.get(0)
.cloned()
.ok_or(eyre!("no supported stream configs"))
}
pub fn start_recording(
&mut self,
mut each: impl FnMut(Vec<u8>) + Send + 'static,
) -> Result<(), Error> {
let config = self.choose_config(self.input.supported_input_configs()?)?;
info!(
"creating recording on {:?} with {:#?}",
self.input.name()?,
config
);
let mut encoder =
opus::Encoder::new(SAMPLE_RATE, opus::Channels::Mono, opus::Application::Voip)?;
let mut current_processor = AudioProcessor::new_plain();
@@ -78,7 +116,7 @@ impl AudioSystem {
if let Some(new_processor) = processors.take() {
current_processor = new_processor;
}
current_processor.process(frame, &mut output_buffer);
current_processor.process(frame, config.channels as usize, &mut output_buffer);
if output_buffer.len() < PACKET_SAMPLES as usize {
return;
}
@@ -94,17 +132,12 @@ impl AudioSystem {
}
};
match self.input.build_input_stream(
&cpal::StreamConfig {
channels: 1,
sample_rate: cpal::SampleRate(SAMPLE_RATE),
buffer_size: cpal::BufferSize::Fixed(PACKET_SAMPLES),
},
data_callback,
error_callback,
None,
) {
match self
.input
.build_input_stream(&config, data_callback, error_callback, None)
{
Ok(stream) => {
stream.play()?;
self.recording_stream = Some(stream);
Ok(())
}
@@ -116,6 +149,12 @@ impl AudioSystem {
}
pub fn create_player(&mut self) -> Result<AudioPlayer, Error> {
let config = self.choose_config(self.input.supported_input_configs()?)?;
info!(
"creating player on {:?} with {:#?}",
self.output.name().ok(),
&config
);
let buffer = Arc::new(Mutex::new(dasp_ring_buffer::Bounded::from_raw_parts(
0,
0,
@@ -128,20 +167,16 @@ impl AudioSystem {
let stream = {
let buffer = buffer.clone();
self.output.build_output_stream(
&cpal::StreamConfig {
channels: 1,
sample_rate: cpal::SampleRate(SAMPLE_RATE),
buffer_size: cpal::BufferSize::Fixed(480), // 10ms playback delay
},
move |frame, info| {
&config,
move |frame, _info| {
let mut buffer = buffer.lock().unwrap();
for x in frame.iter_mut() {
for x in frame.chunks_mut(config.channels as usize) {
match buffer.pop() {
Some(y) => {
*x = y;
x.fill(y);
}
None => {
*x = 0;
x.fill(0);
}
}
}
@@ -150,6 +185,7 @@ impl AudioSystem {
None,
)?
};
stream.play()?;
Ok(AudioPlayer {
decoder,
stream,
@@ -248,7 +284,7 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
gui_config: &ProxyOverides,
) -> Result<(), Error> {
info!("connecting");
@@ -280,21 +316,62 @@ pub async fn network_connect(
crate::network_loop(username, event_rx, reader, writer).await
}
fn get_config_path() -> std::path::PathBuf {
let strategy = choose_app_strategy(AppStrategyArgs {
top_level_domain: "com".to_string(),
author: "Ohea Corp".to_string(),
app_name: "Mumble Web2".to_string(),
})
.expect("failed to choose app strategy");
strategy.config_dir().join("config.json")
}
fn load_config_map() -> HashMap<String, String> {
let config_path = get_config_path();
match std::fs::read_to_string(&config_path) {
Ok(contents) => serde_json::from_str(&contents).unwrap_or_default(),
Err(_) => HashMap::new(),
}
}
fn save_config_map(config: &HashMap<String, String>) -> color_eyre::Result<()> {
let config_path = get_config_path();
if let Some(parent) = config_path.parent() {
std::fs::create_dir_all(parent)?;
}
let contents = serde_json::to_string_pretty(config)?;
std::fs::write(&config_path, contents)?;
Ok(())
}
pub fn set_default_username(username: &str) -> Option<()> {
None
let mut config = load_config_map();
config.insert("username".to_string(), username.to_string());
save_config_map(&config).ok()
}
pub fn set_default_server(server: &str) -> Option<()> {
let mut config = load_config_map();
config.insert("server".to_string(), server.to_string());
save_config_map(&config).ok()
}
pub fn load_username() -> Option<String> {
return None;
let config = load_config_map();
config.get("username").cloned()
}
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
Ok(ClientConfig {
proxy_url: None,
status_url: None,
cert_hash: None,
any_server: true,
})
pub fn load_server_url() -> Option<String> {
let config = load_config_map();
config.get("server").cloned()
}
pub async fn load_proxy_overides() -> color_eyre::Result<Option<ProxyOverides>> {
Ok(None)
}
pub async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
bail!("status not supported on desktop yet")
}
pub fn init_logging() {
+82 -62
View File
@@ -6,7 +6,7 @@ use futures::{AsyncRead, AsyncWrite};
use gloo_timers::future::TimeoutFuture;
use js_sys::Float32Array;
use mumble_protocol::control::ClientControlCodec;
use mumble_web2_common::ClientConfig;
use mumble_web2_common::{ProxyOverides, ServerStatus};
use reqwest::Url;
use std::future::Future;
use std::time::Duration;
@@ -15,7 +15,6 @@ use tracing::{debug, error, info, instrument};
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::JsFuture;
use web_sys::js_sys::{Promise, Reflect, Uint8Array};
use web_sys::AudioContext;
use web_sys::AudioContextOptions;
use web_sys::AudioData;
use web_sys::AudioDecoder;
@@ -30,14 +29,13 @@ use web_sys::EncodedAudioChunkInit;
use web_sys::EncodedAudioChunkType;
use web_sys::MediaStream;
use web_sys::MediaStreamConstraints;
use web_sys::MediaStreamTrackGenerator;
use web_sys::MediaStreamTrackGeneratorInit;
use web_sys::MessageEvent;
use web_sys::WebTransport;
use web_sys::WebTransportBidirectionalStream;
use web_sys::WebTransportOptions;
use web_sys::WorkletOptions;
use web_sys::{console, window};
use web_sys::{AudioContext, AudioDataCopyToOptions};
pub use wasm_bindgen_futures::spawn_local as spawn;
@@ -78,12 +76,41 @@ pub struct AudioSystem {
processors: AudioProcessorSender,
}
async fn attach_worklet(audio_context: &AudioContext) -> Result<(), Error> {
// Create worklets to process mic and speaker audio
// Speaker audio processing worklet only required on
// browsers that don't support MediaStreamTrackGenerator
let options = WorkletOptions::new();
Reflect::set(
&options,
&"processorOptions".into(),
&wasm_bindgen::module(),
)
.ey()?;
let module = asset!("assets/rust_audio_worklet.js").to_string();
info!("loading mic worklet from {module:?}");
audio_context
.audio_worklet()
.ey()?
.add_module_with_options(&module, &options)
.ey()?
.into_future()
.await
.ey()?;
Ok(())
}
impl AudioSystem {
pub fn new() -> Result<Self, Error> {
pub async fn new() -> Result<Self, Error> {
// Create MediaStreams to playback decoded audio
// The audio context is used to reproduce audio.
let webctx = configure_audio_context();
attach_worklet(&webctx).await?;
let processors = AudioProcessorSender::default();
Ok(AudioSystem { webctx, processors })
}
@@ -104,18 +131,10 @@ impl AudioSystem {
}
pub fn create_player(&mut self) -> Result<AudioPlayer, Error> {
let audio_stream_generator =
MediaStreamTrackGenerator::new(&MediaStreamTrackGeneratorInit::new("audio")).ey()?;
let sink_node = AudioWorkletNode::new(&self.webctx, "rust_speaker_worklet").ey()?;
// Create MediaStream from MediaStreamTrackGenerator
let js_tracks = web_sys::js_sys::Array::new();
js_tracks.push(&audio_stream_generator);
let media_stream = MediaStream::new_with_tracks(&js_tracks).ey()?;
// Create MediaStreamAudioSourceNode
let audio_source = self.webctx.create_media_stream_source(&media_stream).ey()?;
// Connect output of audio_source to audio_context (browser audio)
audio_source
// Connect worklet to destination
sink_node
.connect_with_audio_node(&self.webctx.destination())
.ey()?;
@@ -124,28 +143,31 @@ impl AudioSystem {
error!("error decoding audio {:?}", e);
}) as Box<dyn FnMut(JsValue)>);
// This knows what MediaStreamTrackGenerator to use as it closes around it
let sink_port = sink_node.port().ey()?;
let output = Closure::wrap(Box::new(move |audio_data: AudioData| {
let writable = audio_stream_generator.writable();
if writable.locked() {
return;
}
if let Err(e) = writable.get_writer().map(|writer| {
spawn(async move {
if let Err(e) = JsFuture::from(writer.ready()).await.ey() {
error!("write chunk ready error {:?}", e);
}
if let Err(e) = JsFuture::from(writer.write_with_chunk(&audio_data))
.await
.ey()
{
error!("write chunk error {:?}", e);
};
writer.release_lock();
});
}) {
error!("error writing audio data {:?}", e);
// Extract planar PCM from AudioData into an ArrayBuffer or Float32Array
// Here we assume f32 samples, 1 channel for brevity.
let number_of_frames = audio_data.number_of_frames();
let js_buffer = Float32Array::new_with_length(number_of_frames);
let audio_data_copy_to_options = &AudioDataCopyToOptions::new(0);
audio_data_copy_to_options.set_format(web_sys::AudioSampleFormat::F32);
if let Err(e) = audio_data
.copy_to_with_buffer_source(&js_buffer.buffer(), &audio_data_copy_to_options)
{
error!("could not copy audio data to array {:?}", e);
}
// Post to the worklet; include sampleRate and channel count if needed.
let msg = js_sys::Object::new();
js_sys::Reflect::set(&msg, &"samples".into(), &js_buffer).unwrap();
sink_port.post_message(&msg).unwrap();
audio_data.close();
}) as Box<dyn FnMut(AudioData)>);
let audio_decoder = AudioDecoder::new(&AudioDecoderInit::new(
@@ -209,7 +231,7 @@ fn process_audio(frame: &JsValue, processor: &mut AudioProcessor) {
};
let input = samples.to_vec();
let mut output = Vec::with_capacity(input.len());
processor.process(&input, &mut output);
processor.process(&input, 1, &mut output);
samples.copy_from(&output);
}
@@ -234,25 +256,6 @@ async fn run_encoder_worklet(
.map_err(|e| JsError::new(&format!("not a stream: {e:?}")))
.ey()?;
let options = WorkletOptions::new();
Reflect::set(
&options,
&"processorOptions".into(),
&wasm_bindgen::module(),
)
.ey()?;
let module = asset!("assets/rust_mic_worklet.js").to_string();
info!("loading mic worklet from {module:?}");
audio_context
.audio_worklet()
.ey()?
.add_module_with_options(&module, &options)
.ey()?
.into_future()
.await
.ey()?;
let source = audio_context.create_media_stream_source(&stream).ey()?;
let worklet_node = AudioWorkletNode::new(audio_context, "rust_mic_worklet").ey()?;
@@ -326,7 +329,7 @@ pub async fn network_connect(
address: String,
username: String,
event_rx: &mut UnboundedReceiver<Command>,
gui_config: &ClientConfig,
gui_config: &ProxyOverides,
) -> Result<(), Error> {
info!("connecting");
@@ -339,8 +342,8 @@ pub async fn network_connect(
)
.ey()?;
if let Some(server_hash) = &gui_config.cert_hash {
let hash = web_sys::js_sys::Uint8Array::from(server_hash.as_slice());
if !gui_config.cert_hash.is_empty() {
let hash = web_sys::js_sys::Uint8Array::from(gui_config.cert_hash.as_slice());
web_sys::js_sys::Reflect::set(&object, &"value".into(), &hash).ey()?;
}
@@ -396,6 +399,10 @@ pub fn set_default_username(username: &str) -> Option<()> {
.ok()
}
pub fn set_default_server(username: &str) -> Option<()> {
None
}
pub fn load_username() -> Option<String> {
web_sys::window()
.unwrap()
@@ -405,13 +412,17 @@ pub fn load_username() -> Option<String> {
.ok()?
}
pub fn load_server_url() -> Option<String> {
None
}
pub fn absolute_url(path: &str) -> Result<Url, Error> {
let window: web_sys::Window = web_sys::window().expect("no global `window` exists");
let location = window.location();
Ok(Url::parse(&location.href().ey()?)?.join(path)?)
}
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
pub async fn load_proxy_overides() -> color_eyre::Result<Option<ProxyOverides>> {
let config_url = match option_env!("MUMBLE_WEB2_GUI_CONFIG_URL") {
Some(url) => Url::parse(url)?,
None => absolute_url("config")?,
@@ -420,10 +431,19 @@ pub async fn load_config() -> color_eyre::Result<ClientConfig> {
let config = reqwest::get(config_url)
.await?
.json::<ClientConfig>()
.json::<ProxyOverides>()
.await?;
Ok(config)
Ok(Some(config))
}
pub async fn get_status(client: &reqwest::Client) -> color_eyre::Result<ServerStatus> {
Ok(client
.get(absolute_url("status")?)
.send()
.await?
.json::<ServerStatus>()
.await?)
}
pub fn init_logging() {
+2 -2
View File
@@ -20,7 +20,7 @@ use mumble_protocol::voice::VoicePacket;
use mumble_protocol::voice::VoicePacketPayload;
use mumble_protocol::Clientbound;
use mumble_protocol::Serverbound;
use mumble_web2_common::ClientConfig;
use mumble_web2_common::ProxyOverides;
use once_cell::sync::Lazy;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
@@ -113,7 +113,7 @@ pub async fn network_loop<R: imp::ImpRead, W: imp::ImpWrite>(
});
}
let mut audio = imp::AudioSystem::new()?;
let mut audio = imp::AudioSystem::new().await?;
{
let send_chan = send_chan.clone();
let mut sequence_num = 0;
+11 -17
View File
@@ -1,10 +1,6 @@
use color_eyre::eyre::{anyhow, bail, Context, Result};
use color_eyre::owo_colors::OwoColorize;
use mumble_web2_common::{ClientConfig, ServerStatus};
use once_cell::sync::OnceCell;
use mumble_web2_common::{ProxyOverides, ServerStatus};
use rand::Rng;
use rcgen::date_time_ymd;
use rustls::server;
use salvo::conn::rustls::{Keycert, RustlsConfig};
use salvo::cors::{AllowOrigin, Cors};
use salvo::logging::Logger;
@@ -38,7 +34,6 @@ fn default_cert_alt_names() -> Vec<String> {
#[derive(Debug, Deserialize, Serialize)]
struct Config {
public_url: Url,
proxy_url: Option<Url>,
https_listen_address: SocketAddr,
http_listen_address: Option<SocketAddr>,
@@ -82,14 +77,13 @@ async fn main() -> Result<()> {
.install_default()
.map_err(|e| anyhow!("could not install crypto provider {e:?}"))?;
let mut client_config = ClientConfig {
proxy_url: match &server_config.proxy_url {
Some(url) => Some(url.to_string()),
None => Some(server_config.public_url.join("proxy")?.to_string()),
},
status_url: Some(server_config.public_url.join("status")?.to_string()),
cert_hash: None,
any_server: false,
let mut client_config = ProxyOverides {
proxy_url: server_config
.proxy_url
.as_ref()
.map(|url| url.to_string())
.unwrap_or_default(),
cert_hash: Vec::new(),
};
let (cert, key) = match (&server_config.cert_path, &server_config.key_path) {
@@ -108,7 +102,7 @@ async fn main() -> Result<()> {
let cert = cert_params.self_signed(&key_pair)?;
let hash = hmac_sha256::Hash::hash(cert.der().as_ref());
client_config.cert_hash = Some(hash.into());
client_config.cert_hash = hash.into();
(cert.pem().into(), key_pair.serialize_pem().into())
}
@@ -258,13 +252,13 @@ impl StatusCraft {
#[derive(Clone)]
pub struct ConfigCraft {
server_config: Arc<Config>,
client_config: ClientConfig,
client_config: ProxyOverides,
}
#[craft]
impl ConfigCraft {
#[craft(handler)]
async fn get_config(&self) -> Json<ClientConfig> {
async fn get_config(&self) -> Json<ProxyOverides> {
Json(self.client_config.clone())
}