Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c1479a3ee | |||
| 55412f5778 | |||
| 2982a7f8d8 | |||
| b1970cf23f | |||
| a11fb4f10e | |||
| 40bb8e18ef | |||
| 128791bccd | |||
| e8d41f7e92 | |||
| 1e28442356 | |||
| c645722d21 | |||
| b9e293cca4 | |||
| 97bdb1a143 | |||
| 70634065ac | |||
| 1efd32892e | |||
| 1ff302816e | |||
| ebcf5ce4ce | |||
| 4e30be3ebd | |||
| 987cfd57d2 | |||
| fea6800bea |
@@ -0,0 +1,85 @@
|
||||
name: Build Mumble Web 2
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
linux_build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Install cargo binstall
|
||||
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.2
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build dioxus project
|
||||
run: dx build --platform web --release -p mumble-web2-gui
|
||||
|
||||
- name: Upload mumble-web2-gui Artifact
|
||||
uses: https://gitea.com/actions/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: mumble-web2-gui
|
||||
path: target/dx/mumble-web2-gui/release/web/public
|
||||
retention-days: 5
|
||||
|
||||
- name: Build proxy
|
||||
run: cargo build --release -p mumble-web2-proxy
|
||||
|
||||
- name: Upload mumble-web2-proxy Artifact
|
||||
uses: https://gitea.com/actions/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: mumble-web2-proxy
|
||||
path: target/release/mumble-web2-proxy
|
||||
retention-days: 5
|
||||
|
||||
windows_build:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Restore Rust cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
rust-${{ runner.os }}-
|
||||
|
||||
- name: Pull builder container
|
||||
run: docker pull git.ohea.xyz/mumble/mumble-web2/windows-release-builder:latest
|
||||
|
||||
- name: Bundle dioxus project
|
||||
run: docker run `
|
||||
--mount "type=bind,source=${PWD},target=C:\app" `
|
||||
--workdir "C:\app\gui" `
|
||||
git.ohea.xyz/mumble/mumble-web2/windows-release-builder:latest `
|
||||
C:\Users\ContainerAdministrator\.cargo\bin\dx.exe bundle --verbose --trace -p mumble-web2-gui --release --windows
|
||||
|
||||
- name: Save Rust cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Upload mumble-web2-gui Windows Artifact
|
||||
uses: https://gitea.com/actions/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: mumble-web2-gui-windows
|
||||
path: gui/dist
|
||||
retention-days: 5
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Build Mumble Web 2 release builder containers
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 4 * * *"
|
||||
|
||||
jobs:
|
||||
windows-release-builder-container-build:
|
||||
runs-on: windows
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.ohea.xyz
|
||||
username: ${{ secrets.CI_REGISTRY_USER }}
|
||||
password: ${{ secrets.CI_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build Windows image
|
||||
shell: bash
|
||||
run: |
|
||||
docker pull "$(grep -m1 '^FROM' 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
|
||||
+2
-1
@@ -4,5 +4,6 @@ server_hash.txt
|
||||
.aider*
|
||||
**.pem
|
||||
proxy/bundle
|
||||
config.toml
|
||||
/config.toml
|
||||
proxy/config.toml
|
||||
gui/assets/*_onnx.tar.gz
|
||||
|
||||
Generated
+3116
-1930
File diff suppressed because it is too large
Load Diff
@@ -2,13 +2,12 @@
|
||||
|
||||
## Running Desktop
|
||||
|
||||
1. `cargo install dioxus-cli --version 0.6.3`
|
||||
1. `cargo install dioxus-cli --version 0.7.2`
|
||||
2. `dx run -p mumble-web2-gui --platform desktop --release`
|
||||
|
||||
|
||||
## Running Web (development)
|
||||
|
||||
1. `cargo install dioxus-cli --version 0.6.3`
|
||||
1. `cargo install dioxus-cli --version 0.7.2`
|
||||
3. `dx serve -p mumble-web2-gui --platform web`
|
||||
2. `cd docker && docker compose up`
|
||||
4. connect to `https://localhost:64444`
|
||||
@@ -16,7 +15,7 @@
|
||||
|
||||
## Running Web (with `proxy` only)
|
||||
|
||||
1. `cargo install dioxus-cli --version 0.6.3`
|
||||
1. `cargo install dioxus-cli --version 0.7.2`
|
||||
2. `dx build -p mumble-web2-gui --platform web --release`
|
||||
3. `cp config.toml.example config.toml`
|
||||
4. `cargo run -p mumble-web2-proxy` in the background
|
||||
|
||||
@@ -5,6 +5,7 @@ pub struct ClientConfig {
|
||||
pub proxy_url: Option<String>,
|
||||
pub status_url: Option<String>,
|
||||
pub cert_hash: Option<Vec<u8>>,
|
||||
pub any_server: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM rust:1-bookworm AS base
|
||||
|
||||
# Install cargo-binstall for faster CLI installation
|
||||
#RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
|
||||
RUN apt-get update && apt-get install -y screen
|
||||
|
||||
# Install dioxus-cli version 0.6.3 specifically
|
||||
RUN cargo install dioxus-cli --version 0.6.3
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Add wasm32 target for web development
|
||||
RUN rustup target add wasm32-unknown-unknown
|
||||
|
||||
# Set environment variables
|
||||
ENV PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
# Default command (can be overridden in docker-compose)
|
||||
CMD ["dx", "--help"]
|
||||
|
||||
@@ -40,7 +40,7 @@ services:
|
||||
ports:
|
||||
- "4433:4433/tcp"
|
||||
- "4433:4433/udp"
|
||||
command: ["cargo", "run", "-p", "mumble-web2-proxy"]
|
||||
command: ["cargo", "run", "-p", "mumble-web2-proxy", "--locked"]
|
||||
network_mode: host
|
||||
|
||||
mumble-server:
|
||||
@@ -48,8 +48,6 @@ services:
|
||||
ports:
|
||||
- "64738:64738/tcp"
|
||||
- "64738:64738/udp"
|
||||
environment:
|
||||
- MUMBLE_CONFIG_WELCOMETEXT=Welcome to the Mumble server
|
||||
network_mode: host
|
||||
#volumes:
|
||||
# caddy_data:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
public_url = "https://127.0.0.1:4433"
|
||||
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"
|
||||
mumble_server_url = "127.0.0.1:64738"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# escape=`
|
||||
|
||||
# Use a Windows Server Core 2025 image that matches our build host.
|
||||
# If the version doesn't match the build host we cannot run
|
||||
# this container. I'm not sure with what specificity it has to
|
||||
# match, so let's pin this and then upgrade it as we upgrade
|
||||
# the host.
|
||||
FROM mcr.microsoft.com/windows/servercore:10.0.26100.7171
|
||||
|
||||
ENV CMAKE_VERSION=3.31.10
|
||||
ENV CMAKE_ARCH=windows-x86_64
|
||||
|
||||
# Restore the default Windows shell for correct batch processing.
|
||||
SHELL ["cmd", "/S", "/C"]
|
||||
|
||||
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
|
||||
&& ( start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
|
||||
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
|
||||
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
|
||||
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
|
||||
--add Microsoft.VisualStudio.Workload.NativeDesktop `
|
||||
|| IF "%ERRORLEVEL%"=="3010" EXIT 0 )
|
||||
|
||||
SHELL ["powershell", "-NoLogo", "-ExecutionPolicy", "Bypass", "-Command"]
|
||||
|
||||
RUN $ErrorActionPreference = 'Stop'; `
|
||||
$url = \"https://github.com/Kitware/CMake/releases/download/v$env:CMAKE_VERSION/cmake-$env:CMAKE_VERSION-$env:CMAKE_ARCH.zip\"; `
|
||||
$out = 'C:\\cmake.zip'; `
|
||||
(New-Object System.Net.WebClient).DownloadFile($url, $out); `
|
||||
Expand-Archive -Path $out -DestinationPath 'C:\\'; `
|
||||
Remove-Item $out; `
|
||||
$cmakeDir = \"C:\\cmake-$env:CMAKE_VERSION-$env:CMAKE_ARCH\\bin\"; `
|
||||
[Environment]::SetEnvironmentVariable('PATH', $cmakeDir + ';' + $env:PATH, 'Machine')
|
||||
|
||||
# Install Chocolatey
|
||||
RUN Set-ExecutionPolicy Bypass -Scope Process; `
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = `
|
||||
[System.Net.SecurityProtocolType]::Tls12; `
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
|
||||
RUN choco install git -y --no-progress
|
||||
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
|
||||
|
||||
RUN Set-ExecutionPolicy Unrestricted -Scope Process; `
|
||||
iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
|
||||
|
||||
SHELL ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
|
||||
|
||||
RUN cargo binstall dioxus-cli --version 0.7.2
|
||||
|
||||
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
|
||||
+43
-37
@@ -6,13 +6,13 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# Web Dependencies
|
||||
# ================
|
||||
dioxus-web = { version = "0.6.3", 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 = [
|
||||
dioxus-web = { version = "0.7.2", 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",
|
||||
@@ -54,55 +54,58 @@ web-sys = { version = "0.3.72", features = [
|
||||
"AudioSampleFormat",
|
||||
"Storage",
|
||||
], optional = true }
|
||||
gloo-timers = { version = "0.3.0", features = ["futures"], optional = true }
|
||||
tracing-web = { version = "0.1.3", optional = true }
|
||||
gloo-timers = { version = "^0.3.0", features = ["futures"], optional = true }
|
||||
tracing-web = { version = "^0.1.3", optional = true }
|
||||
|
||||
# Desktop Dependecies
|
||||
# ===================
|
||||
dioxus-desktop = { version = "0.6.3", optional = true }
|
||||
tokio = { version = "1.41.1", features = ["net", "rt"], optional = true }
|
||||
tokio-rustls = { version = "0.26.0", optional = true }
|
||||
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 }
|
||||
|
||||
# Base Dependencies
|
||||
# ================
|
||||
dioxus = { version = "0.6.3" }
|
||||
dioxus = { version = "0.7.2" }
|
||||
once_cell = "1.19.0"
|
||||
asynchronous-codec = { workspace = true }
|
||||
futures = "0.3.30"
|
||||
merge-io = "0.3.0"
|
||||
futures = "^0.3.30"
|
||||
merge-io = "^0.3.0"
|
||||
mumble-protocol = { workspace = true }
|
||||
serde_json = "1.0.117"
|
||||
tokio-util = { version = "0.7.11", features = ["codec", "compat"] }
|
||||
byteorder = "1.5.0"
|
||||
ogg = "0.9.1"
|
||||
ordermap = "0.5.3"
|
||||
html-purifier = "0.3.0"
|
||||
markdown = "0.3.0"
|
||||
futures-channel = "0.3.30"
|
||||
sir = { git = "https://gitlab.com/samsartor/sir", features = [
|
||||
"dioxus",
|
||||
] } # dioxus 0.6
|
||||
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"
|
||||
rfd = "0.15.2"
|
||||
base64 = "0.22"
|
||||
mime_guess = "2.0.5"
|
||||
async_cell = "0.2.3"
|
||||
reqwest = { version = "0.12.22", features = ["json"] }
|
||||
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"
|
||||
rfd = { git = "https://github.com/samsartor/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.2"
|
||||
|
||||
# Denoising
|
||||
# =========
|
||||
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31" }
|
||||
deep_filter = { git = "https://github.com/Rikorose/DeepFilterNet.git", rev = "d375b2d8309e0935d165700c91da9de862a99c31", features = ["tract"] }
|
||||
crossbeam = "0.8.4"
|
||||
|
||||
[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",
|
||||
@@ -115,6 +118,7 @@ web = [
|
||||
"web-sys",
|
||||
"gloo-timers",
|
||||
"tracing-web",
|
||||
"deep_filter/wasm",
|
||||
]
|
||||
desktop = [
|
||||
"dioxus/desktop",
|
||||
@@ -124,4 +128,6 @@ desktop = [
|
||||
"opus",
|
||||
"cpal",
|
||||
"dasp_ring_buffer",
|
||||
"rfd/xdg-portal",
|
||||
"rfd/tokio",
|
||||
]
|
||||
|
||||
@@ -31,3 +31,14 @@ script = []
|
||||
style = []
|
||||
# Javascript code file
|
||||
script = []
|
||||
|
||||
[bundle]
|
||||
identifier = "xyz.ohea.mumble-web-2"
|
||||
publisher = "OheaCorp"
|
||||
icon = [
|
||||
"icons/32x32.png",
|
||||
"icons/256x256.png",
|
||||
"assets/favicon.ico",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico",
|
||||
]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 288 KiB |
@@ -0,0 +1,305 @@
|
||||
:root {
|
||||
--txt-color: oklch(0.9 0 99);
|
||||
--bg-color: oklch(0.15 0.01 338.64);
|
||||
--light-bg-color: oklch(0.25 0.01 338.64);
|
||||
--login-bg-color: #5d7680;
|
||||
--primary-btn-color: #7bad9f;
|
||||
--accent-normal: #7bad9f;
|
||||
--accent-muted: #ff746c;
|
||||
--accent-deafened: #464459;
|
||||
--line-width: 2px;
|
||||
--line-color: oklch(0.7 0 0.99);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#main {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
background-color: var(--bg-color);
|
||||
overflow: auto;
|
||||
color: var(--txt-color);
|
||||
|
||||
font-family: Nunito;
|
||||
font-size: 15pt;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
hr {
|
||||
color: var(--line-color);
|
||||
background-color: var(--line-color);
|
||||
height: var(--line-width);
|
||||
border: none;
|
||||
}
|
||||
|
||||
button {
|
||||
font-weight: bold;
|
||||
font-size: medium;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: var(--txt-color);
|
||||
background-color: var(--primary-btn-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input {
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
input:focus-visible {
|
||||
border: none;
|
||||
outline: solid var(--line-width) var(--accent-normal);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: var(--accent-normal);
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: var(--accent-muted);
|
||||
}
|
||||
|
||||
.userpil {
|
||||
border-radius: 100px;
|
||||
padding: 4px 8px;
|
||||
width: fit-content;
|
||||
|
||||
img {
|
||||
height: 1em;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
&.is_self {
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
|
||||
.channel {
|
||||
&_details {
|
||||
flex: 0 0 100%;
|
||||
|
||||
summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
summary:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
&_children {
|
||||
border-left: solid var(--line-color) var(--line-width);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-left: 5px;
|
||||
padding-left: 11px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.chat {
|
||||
&_panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&_history {
|
||||
overflow-y: auto;
|
||||
flex: 1 0 0;
|
||||
}
|
||||
|
||||
&_message {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 16px;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&_box_wrapper {
|
||||
padding: 16px;
|
||||
border-top: solid var(--line-color) var(--line-width);
|
||||
}
|
||||
|
||||
&_box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 16px;
|
||||
|
||||
background-color: var(--light-bg-color);
|
||||
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
|
||||
padding-left: 8px;
|
||||
padding-right: 16px;
|
||||
|
||||
border-radius: 8px;
|
||||
|
||||
input {
|
||||
color: white;
|
||||
background-color: var(--light-bg-color);
|
||||
|
||||
font-size: larger;
|
||||
|
||||
flex-grow: 1;
|
||||
|
||||
border: none;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user_edit_button {
|
||||
background-color: oklch(0.53 0.1431 264.18);
|
||||
border-radius: 50%;
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
.button_row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
.spacer {
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.toggle_button {
|
||||
padding: 8px;
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
|
||||
background-color: unset;
|
||||
|
||||
border: solid rgb(255 255 255 / 0.1) 3px;
|
||||
border-radius: 10px;
|
||||
color: rgb(255 255 255 / 50%);
|
||||
|
||||
transition: all 0.5s ease-in-out;
|
||||
|
||||
&.is_on {
|
||||
background-color: oklch(0.5 0.1381 21.71 / 20.12%);
|
||||
color: oklch(0.53 0.1505 21.71 / 89.38%);
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48;
|
||||
vertical-align: middle;
|
||||
font-size: 35px;
|
||||
}
|
||||
}
|
||||
|
||||
.server {
|
||||
&_grid {
|
||||
display: grid;
|
||||
height: 100%;
|
||||
background-color: var(--bg-color);
|
||||
|
||||
grid-template-rows: 1fr auto;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
grid-template-areas:
|
||||
"tree chat"
|
||||
"control chat";
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
grid-template-rows: auto 1fr 1fr;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-areas:
|
||||
"tree"
|
||||
"control"
|
||||
"chat";
|
||||
}
|
||||
}
|
||||
|
||||
&_channel_box {
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
grid-area: tree;
|
||||
}
|
||||
|
||||
&_chat_box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
grid-area: chat;
|
||||
border-left: solid var(--line-color) var(--line-width);
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
border-left: unset;
|
||||
border-top: solid var(--line-color) var(--line-width);
|
||||
}
|
||||
}
|
||||
|
||||
&_control_box {
|
||||
padding: 16px;
|
||||
margin: 16px;
|
||||
background-color: var(--light-bg-color);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
grid-area: control;
|
||||
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.login {
|
||||
max-width: 50vw;
|
||||
align-self: center;
|
||||
padding: 32px;
|
||||
border-radius: 16px;
|
||||
background-color: var(--login-bg-color);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
|
||||
input,
|
||||
button {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #b3c6b4;
|
||||
}
|
||||
|
||||
&_bttn {
|
||||
font-weight: bold;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
&_error {
|
||||
|
||||
background-color: white;
|
||||
border-radius: 4px;
|
||||
overflow: auto;
|
||||
padding: 4px;
|
||||
color: red;
|
||||
|
||||
pre {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
|
||||
&_status {
|
||||
&.is_error {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
// Define the target directory and file
|
||||
let assets_dir = "assets";
|
||||
let target_file = format!("{}/DeepFilterNet3_ll_onnx.tar.gz", assets_dir);
|
||||
let target_path = Path::new(&target_file);
|
||||
|
||||
// Check if the file already exists
|
||||
if target_path.exists() {
|
||||
println!("cargo:warning=DeepFilterNet model already exists at {}", target_file);
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
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: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);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 967 B |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
+99
-448
@@ -1,13 +1,10 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use base64::{display::Base64Display, prelude::BASE64_URL_SAFE};
|
||||
use dioxus::prelude::*;
|
||||
use mime_guess::Mime;
|
||||
use mumble_web2_common::{ClientConfig, ServerStatus};
|
||||
use ordermap::OrderSet;
|
||||
use sir::{css, global_css};
|
||||
use std::collections::HashMap;
|
||||
use tracing::error;
|
||||
|
||||
use crate::imp;
|
||||
|
||||
@@ -140,25 +137,6 @@ impl UserIcon {
|
||||
|
||||
#[component]
|
||||
pub fn UserPill(name: String, icon: UserIcon, isself: bool) -> Element {
|
||||
let pill = css!(
|
||||
"
|
||||
border-radius: 100px;
|
||||
padding: 4px 8px;
|
||||
width: fit-content;
|
||||
|
||||
img {
|
||||
height: 1em;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
let pill_self = css!(
|
||||
"
|
||||
font-weight: bolder;
|
||||
"
|
||||
);
|
||||
|
||||
let color = match icon {
|
||||
UserIcon::Normal => "var(--accent-normal)",
|
||||
UserIcon::Muted => "var(--accent-muted)",
|
||||
@@ -168,7 +146,7 @@ pub fn UserPill(name: String, icon: UserIcon, isself: bool) -> Element {
|
||||
|
||||
rsx!(
|
||||
div {
|
||||
class: match isself { true => format!("{pill} {pill_self}"), false => format!("{pill}") },
|
||||
class: match isself { true => "userpil is_self", false => "userpil" },
|
||||
style: "background-color: {color}",
|
||||
{ icon.url().map(|url| rsx!(img { src: url })) }
|
||||
"\u{00A0}{name}\u{00A0}"
|
||||
@@ -202,34 +180,9 @@ pub fn Channel(id: ChannelId) -> Element {
|
||||
return rsx!("missing channel {id}");
|
||||
};
|
||||
|
||||
let channel_details = css!(
|
||||
"
|
||||
flex: 0 0 100%;
|
||||
|
||||
summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
summary:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
"
|
||||
);
|
||||
let channel_children = css!(
|
||||
"
|
||||
border-left: solid var(--line-color) var(--line-width);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-left: 5px;
|
||||
padding-left: 11px;
|
||||
padding-top: 4px; "
|
||||
);
|
||||
|
||||
rsx!(
|
||||
details {
|
||||
class: "{channel_details}",
|
||||
class: "channel_details",
|
||||
open: true,
|
||||
summary {
|
||||
span {
|
||||
@@ -244,7 +197,7 @@ pub fn Channel(id: ChannelId) -> Element {
|
||||
}
|
||||
if state.users.len() + state.children.len() > 0 {
|
||||
div {
|
||||
class: "{channel_children}",
|
||||
class: "channel_children",
|
||||
for id in state.users.iter() {
|
||||
User { id: *id }
|
||||
}
|
||||
@@ -285,71 +238,6 @@ pub fn ChatView() -> Element {
|
||||
let server = STATE.server.read();
|
||||
let mut draft = use_signal(|| "".to_string());
|
||||
|
||||
let chat_panel = css!(
|
||||
"
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
"
|
||||
);
|
||||
|
||||
let chat_history = css!(
|
||||
"
|
||||
overflow-y: auto;
|
||||
flex: 1 0 0;
|
||||
"
|
||||
);
|
||||
|
||||
let chat_message = css!(
|
||||
"
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 16px;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
"
|
||||
);
|
||||
|
||||
let chat_box_wrapper = css!(
|
||||
"
|
||||
padding: 16px;
|
||||
border-top: solid var(--line-color) var(--line-width);
|
||||
"
|
||||
);
|
||||
|
||||
let chat_box = css!(
|
||||
"
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 16px;
|
||||
|
||||
background-color: var(--light-bg-color);
|
||||
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
|
||||
padding-left: 8px;
|
||||
padding-right: 16px;
|
||||
|
||||
border-radius: 8px;
|
||||
|
||||
input {
|
||||
color: white;
|
||||
background-color: var(--light-bg-color);
|
||||
|
||||
font-size: larger;
|
||||
|
||||
flex-grow: 1;
|
||||
|
||||
border: none;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
"
|
||||
);
|
||||
|
||||
let mut do_send = move || {
|
||||
if let Some(user) = STATE.server.read().this_user() {
|
||||
net.send(SendChat {
|
||||
@@ -361,12 +249,12 @@ pub fn ChatView() -> Element {
|
||||
|
||||
rsx!(
|
||||
div {
|
||||
class: "{chat_panel}",
|
||||
class: "chat_panel",
|
||||
div {
|
||||
class: "{chat_history}",
|
||||
class: "chat_history",
|
||||
for chat in server.chat.iter() {
|
||||
div {
|
||||
class: "{chat_message}",
|
||||
class: "chat_message",
|
||||
if let Some(sender) = chat.sender.and_then(|u| server.users.get(&u)) {
|
||||
UserPill {
|
||||
name: sender.name.clone(),
|
||||
@@ -381,9 +269,9 @@ pub fn ChatView() -> Element {
|
||||
}
|
||||
}
|
||||
div {
|
||||
class: "{chat_box_wrapper}",
|
||||
class: "chat_box_wrapper",
|
||||
div {
|
||||
class: "{chat_box}",
|
||||
class: "chat_box",
|
||||
input {
|
||||
placeholder: "say something",
|
||||
value: "{draft.read()}",
|
||||
@@ -420,25 +308,6 @@ pub fn ChatView() -> Element {
|
||||
)
|
||||
}
|
||||
|
||||
// true => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "mic_off"}),
|
||||
//Connecting => rsx! {
|
||||
// div {
|
||||
// class: "{connecting_status}",
|
||||
// span {
|
||||
// class: "material-symbols-outlined",
|
||||
// style: "vertical-align: middle; font-size: 30px;",
|
||||
// "signal_cellular_alt_2_bar"
|
||||
// }
|
||||
// span {
|
||||
// style: "width: 5px; display: inline-block;"
|
||||
// }
|
||||
// span {
|
||||
// style: "vertical-align: middle; font-size: 30px;",
|
||||
// "Connecting"
|
||||
// }
|
||||
// }
|
||||
//},
|
||||
|
||||
#[component]
|
||||
pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
let net: Coroutine<Command> = use_coroutine_handle();
|
||||
@@ -459,107 +328,20 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
|
||||
let current_channel_name = server.channels[&channel].name.clone();
|
||||
|
||||
let Some(proxy_url) = config
|
||||
let proxy_url = config
|
||||
.read_unchecked()
|
||||
.as_ref()
|
||||
.and_then(|gui_config| gui_config.proxy_url.clone())
|
||||
else {
|
||||
return rsx!();
|
||||
};
|
||||
.and_then(|gui_config| gui_config.proxy_url.clone());
|
||||
|
||||
let button_row = css!(
|
||||
r#"
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
"#
|
||||
);
|
||||
|
||||
let spacer = css!(
|
||||
r#"
|
||||
flex-grow: 1;
|
||||
"#
|
||||
);
|
||||
|
||||
let toggle_button = css!(
|
||||
r#"
|
||||
padding: 8px;
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
|
||||
background-color: unset;
|
||||
|
||||
border: solid rgb(255 255 255 / 0.1) 3px;
|
||||
border-radius: 10px;
|
||||
color: rgb(255 255 255 / 50%);
|
||||
|
||||
transition: all 0.5s ease-in-out;
|
||||
"#
|
||||
);
|
||||
|
||||
let toggle_button_on = css!(
|
||||
r#"
|
||||
padding: 8px;
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
|
||||
background-color: oklch(0.5 0.1381 21.71 / 20.12%);
|
||||
|
||||
border: solid rgb(255 255 255 / 0) 3px;
|
||||
border-radius: 10px;
|
||||
color: oklch(0.53 0.1505 21.71 / 89.38%);
|
||||
|
||||
transition: all 0.25s ease-in-out;
|
||||
"#
|
||||
);
|
||||
|
||||
let button_style = r#"
|
||||
font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48;
|
||||
vertical-align: middle;
|
||||
font-size: 35px;
|
||||
"#;
|
||||
|
||||
let connecting_status = css!(
|
||||
r#"
|
||||
color: yellow;
|
||||
"#
|
||||
);
|
||||
|
||||
let connected_status = css!(
|
||||
r#"
|
||||
color: oklch(0.55 0.1184 141.35);
|
||||
"#
|
||||
);
|
||||
|
||||
let disconnected_status = css!(
|
||||
r#"
|
||||
color: gray;
|
||||
"#
|
||||
);
|
||||
|
||||
let failed_status = css!(
|
||||
r#"
|
||||
color: red;
|
||||
"#
|
||||
);
|
||||
|
||||
let connection_info = css!(
|
||||
r#"
|
||||
color: gray;
|
||||
"#
|
||||
);
|
||||
|
||||
let user_edit_button = css!(
|
||||
r#"
|
||||
background-color: oklch(0.53 0.1431 264.18);
|
||||
border-radius: 50%;
|
||||
aspect-ratio: 1 / 1;
|
||||
"#
|
||||
);
|
||||
let connecting_color = "yellow";
|
||||
let connected_color = "oklch(0.55 0.1184 141.35)";
|
||||
let disconnected_color = "gray";
|
||||
let failed_color = "red";
|
||||
|
||||
let connection_status = match &*status.read() {
|
||||
Connecting => rsx! {
|
||||
div {
|
||||
class: "{connecting_status}",
|
||||
style: "color: \"{connecting_color}\";",
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "vertical-align: middle; font-size: 30px;",
|
||||
@@ -577,7 +359,7 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
Connected => rsx! {
|
||||
div {
|
||||
div {
|
||||
class: "{connected_status}",
|
||||
style: "color: \"{connected_color}\";",
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "vertical-align: middle; font-size: 30px;",
|
||||
@@ -592,17 +374,18 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
}
|
||||
}
|
||||
div {
|
||||
class: "{connection_info}",
|
||||
span { style: "width: 3px; display: inline-block;"}
|
||||
span { "{current_channel_name}" }
|
||||
span { " — " }
|
||||
span { "{proxy_url}" }
|
||||
if let Some(proxy_url) = proxy_url {
|
||||
span { " — " }
|
||||
span { "{proxy_url}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Disconnected => rsx! {
|
||||
div {
|
||||
class: "{disconnected_status}",
|
||||
style: "color: \"{disconnected_color}\";",
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "vertical-align: middle;",
|
||||
@@ -619,7 +402,7 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
},
|
||||
Failed(_) => rsx! {
|
||||
div {
|
||||
class: "{failed_status}",
|
||||
style: "color: \"{failed_color}\";",
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "vertical-align: middle;",
|
||||
@@ -640,17 +423,16 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
rsx!(
|
||||
// Server control
|
||||
div {
|
||||
class: "{button_row}",
|
||||
class: "button_row",
|
||||
div {
|
||||
{connection_status}
|
||||
}
|
||||
span { class: "{spacer}" }
|
||||
span { class: "spacer" }
|
||||
button {
|
||||
class: "{toggle_button}",
|
||||
class: "toggle_button",
|
||||
onclick: move |_| net.send(Disconnect),
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "{button_style}",
|
||||
"signal_disconnected"
|
||||
}
|
||||
}
|
||||
@@ -658,9 +440,9 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
hr { style: "width: 100%;" }
|
||||
// User control
|
||||
div {
|
||||
class: "{button_row}",
|
||||
class: "button_row",
|
||||
button {
|
||||
class: "{user_edit_button}",
|
||||
class: "user_edit_button",
|
||||
span {
|
||||
class: "material-symbols-outlined",
|
||||
style: "color: oklch(0.65 0.2245 28.06); font-size: 45px; font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 48;",
|
||||
@@ -675,11 +457,11 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
span { style: "font-size: 20px; color: gray;", "some data" }
|
||||
}
|
||||
}
|
||||
span { class: "{spacer}" }
|
||||
span { class: "spacer" }
|
||||
button {
|
||||
class: match denoise() {
|
||||
true => toggle_button_on,
|
||||
false => toggle_button,
|
||||
true => "toggle_button is_on",
|
||||
false => "toggle_button",
|
||||
},
|
||||
role: "switch",
|
||||
aria_checked: denoise(),
|
||||
@@ -689,36 +471,36 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
net.send(UpdateMicEffects { denoise: new_denoise })
|
||||
},
|
||||
match denoise() {
|
||||
true => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "cadence"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "graphic_eq"}),
|
||||
true => rsx!(span { class: "material-symbols-outlined", "cadence"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", "graphic_eq"}),
|
||||
}
|
||||
}
|
||||
button {
|
||||
class: match mute || self_mute {
|
||||
true => toggle_button_on,
|
||||
false => toggle_button,
|
||||
true => "toggle_button is_on",
|
||||
false => "toggle_button",
|
||||
},
|
||||
role: "switch",
|
||||
aria_checked: mute || self_mute,
|
||||
disabled: mute,
|
||||
onclick: move |_| net.send(SetMute { mute: !self_mute }),
|
||||
match mute || self_mute {
|
||||
true => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "mic_off"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "mic"}),
|
||||
true => rsx!(span { class: "material-symbols-outlined", "mic_off"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", "mic"}),
|
||||
}
|
||||
}
|
||||
button {
|
||||
class: match deaf || self_deaf {
|
||||
true => toggle_button_on,
|
||||
false => toggle_button,
|
||||
true => "toggle_button in_on",
|
||||
false => "toggle_button",
|
||||
},
|
||||
role: "switch",
|
||||
aria_checked: deaf || self_deaf,
|
||||
disabled: deaf,
|
||||
onclick: move |_| net.send(SetDeaf { deaf: !self_deaf }),
|
||||
match deaf || self_deaf {
|
||||
true => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "volume_off"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", style: "{button_style}", "volume_up"}),
|
||||
true => rsx!(span { class: "material-symbols-outlined", "volume_off"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", "volume_up"}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -740,71 +522,11 @@ pub fn ServerView(config: Resource<ClientConfig>) -> Element {
|
||||
return rsx!();
|
||||
};
|
||||
|
||||
let grid = css!(
|
||||
r#"
|
||||
display: grid;
|
||||
height: 100%;
|
||||
background-color: var(--bg-color);
|
||||
|
||||
grid-template-rows: 1fr auto;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
grid-template-areas:
|
||||
"tree chat"
|
||||
"control chat";
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
grid-template-rows: auto 1fr 1fr;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-areas:
|
||||
"tree"
|
||||
"control"
|
||||
"chat";
|
||||
}
|
||||
"#
|
||||
);
|
||||
|
||||
let channel_box = css!(
|
||||
"
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
grid-area: tree;
|
||||
"
|
||||
);
|
||||
|
||||
let chat_box = css!(
|
||||
"
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
grid-area: chat;
|
||||
border-left: solid var(--line-color) var(--line-width);
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
border-left:unset;
|
||||
border-top: solid var(--line-color) var(--line-width);
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
let control_box = css!(
|
||||
"
|
||||
padding: 16px;
|
||||
margin: 16px;
|
||||
background-color: var(--light-bg-color);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
grid-area: control;
|
||||
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-direction: column;
|
||||
"
|
||||
);
|
||||
|
||||
rsx!(
|
||||
div {
|
||||
class: "{grid}",
|
||||
class: "server_grid",
|
||||
div {
|
||||
class: "{channel_box}",
|
||||
class: "server_channel_box",
|
||||
for (id, state) in server.channels.iter() {
|
||||
if state.parent.is_none() {
|
||||
Channel { id: *id }
|
||||
@@ -812,11 +534,11 @@ pub fn ServerView(config: Resource<ClientConfig>) -> Element {
|
||||
}
|
||||
}
|
||||
div {
|
||||
class: "{chat_box}",
|
||||
class: "server_chat_box",
|
||||
ChatView {}
|
||||
}
|
||||
div {
|
||||
class: "{control_box}",
|
||||
class: "server_control_box",
|
||||
ControlView { config }
|
||||
}
|
||||
}
|
||||
@@ -855,7 +577,7 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
});
|
||||
|
||||
let mut address_input = use_signal(|| None::<String>);
|
||||
let mut address = use_memo(move || {
|
||||
let address = use_memo(move || {
|
||||
if let Some(addr) = address_input() {
|
||||
addr.clone()
|
||||
} else {
|
||||
@@ -868,49 +590,6 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
let previous_username = imp::load_username();
|
||||
let mut username = use_signal(|| previous_username.unwrap_or(String::new()));
|
||||
|
||||
let error = css!(
|
||||
"
|
||||
background-color: white;
|
||||
border-radius: 4px;
|
||||
overflow: auto;
|
||||
padding: 4px;
|
||||
color: red;
|
||||
pre {
|
||||
color: black;
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
let login_box = css!(
|
||||
"
|
||||
max-width: 50vw;
|
||||
align-self: center;
|
||||
padding: 32px;
|
||||
border-radius: 16px;
|
||||
background-color: var(--login-bg-color);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
|
||||
input,button {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #b3c6b4;
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
let bttn = css!(
|
||||
"
|
||||
font-weight: bold;
|
||||
font-size: large;
|
||||
"
|
||||
);
|
||||
|
||||
let do_connect = move |_| {
|
||||
//let _ = set_default_username(&username.read());
|
||||
let _ = imp::set_default_username(&username.read());
|
||||
@@ -924,25 +603,25 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
let bottom = match &*status.read() {
|
||||
Disconnected => rsx! {
|
||||
button {
|
||||
class: "{bttn}",
|
||||
class: "login_bttn",
|
||||
onclick: do_connect.clone(),
|
||||
"Connect"
|
||||
}
|
||||
},
|
||||
Connecting => rsx! {
|
||||
div {
|
||||
class: "{bttn}",
|
||||
class: "login_bttn",
|
||||
"Connecting..."
|
||||
}
|
||||
},
|
||||
Failed(msg) => rsx!(
|
||||
button {
|
||||
class: "{bttn}",
|
||||
class: "login_bttn",
|
||||
onclick: do_connect.clone(),
|
||||
"Reconnect"
|
||||
}
|
||||
div {
|
||||
class: "{error}",
|
||||
class: "login_error",
|
||||
"Failed to connect:"
|
||||
pre {
|
||||
"{msg}"
|
||||
@@ -953,10 +632,25 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
};
|
||||
rsx!(
|
||||
div {
|
||||
class: "{login_box}",
|
||||
class: "login",
|
||||
h1 {
|
||||
"Mumble Web"
|
||||
}
|
||||
if config.read().as_ref().is_some_and(|cfg| cfg.any_server) {
|
||||
div {
|
||||
label {
|
||||
for: "address-entry",
|
||||
"Server Address:"
|
||||
}
|
||||
input {
|
||||
id: "address-entry",
|
||||
placeholder: "address",
|
||||
value: "{address.read()}",
|
||||
autofocus: "true",
|
||||
oninput: move |evt| address_input.set(Some(evt.value().clone())),
|
||||
}
|
||||
}
|
||||
}
|
||||
div {
|
||||
label {
|
||||
for: "username-entry",
|
||||
@@ -972,15 +666,37 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
}
|
||||
}
|
||||
div {
|
||||
div {
|
||||
span {}
|
||||
span {"—"}
|
||||
span {}
|
||||
}
|
||||
div {
|
||||
span {"1/100 Online"}
|
||||
span {"—"}
|
||||
span {"Version: 1.4.255"}
|
||||
match &*last_status.read() {
|
||||
None => rsx!(div {
|
||||
class: "login_status",
|
||||
span {"···"}
|
||||
}),
|
||||
Some(Ok(ServerStatus { success: false, .. })) => rsx!(div {
|
||||
class: "login_status is_error",
|
||||
span {
|
||||
"Could not reach server"
|
||||
}
|
||||
}),
|
||||
Some(Ok(status)) => rsx!(div {
|
||||
class: "login_status",
|
||||
if let (Some(users), Some(max_users)) = (status.users, status.max_users) {
|
||||
span {"{users}/{max_users} Online"}
|
||||
} else {
|
||||
span {"Unknown Online"}
|
||||
}
|
||||
span {"-"}
|
||||
if let Some((maj, min, pat)) = status.version {
|
||||
span {"Version: {maj}.{min}.{pat}"}
|
||||
} else {
|
||||
span {"Unknown Version"}
|
||||
}
|
||||
}),
|
||||
Some(Err(_)) => rsx!(div {
|
||||
class: "login_status is_error",
|
||||
span {
|
||||
"Could not reach proxy server"
|
||||
}
|
||||
}),
|
||||
}
|
||||
div {
|
||||
{bottom}
|
||||
@@ -1013,6 +729,8 @@ pub fn LoginView(config: Resource<ClientConfig>) -> Element {
|
||||
}
|
||||
|
||||
pub fn app() -> Element {
|
||||
static STYLE: Asset = asset!("/assets/main.scss");
|
||||
|
||||
use_coroutine(|rx: UnboundedReceiver<Command>| super::network_entrypoint(rx));
|
||||
let config = use_resource(|| async move {
|
||||
match imp::load_config().await {
|
||||
@@ -1021,78 +739,11 @@ pub fn app() -> Element {
|
||||
}
|
||||
});
|
||||
|
||||
global_css!(
|
||||
"
|
||||
:root {
|
||||
--txt-color: oklch(0.9 0 99);
|
||||
--bg-color: oklch(0.15 0.01 338.64);
|
||||
--light-bg-color: oklch(0.25 0.01 338.64);
|
||||
--login-bg-color: #5d7680;
|
||||
--primary-btn-color: #7bad9f;
|
||||
--accent-normal: #7bad9f;
|
||||
--accent-muted: #ff746c;
|
||||
--accent-deafened: #464459;
|
||||
--line-width: 2px;
|
||||
--line-color: white;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#main {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
background-color: var(--bg-color);
|
||||
overflow: auto;
|
||||
color: var(--txt-color);
|
||||
|
||||
font-family: Nunito;
|
||||
font-size: 15pt;
|
||||
font-weight: 600;
|
||||
|
||||
}
|
||||
|
||||
button {
|
||||
font-weight: bold;
|
||||
font-size: medium;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: var(--txt-color);
|
||||
background-color: var(--primary-btn-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input {
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
input:focus,input:focus-visible {
|
||||
border: none;
|
||||
outline: solid var(--line-width) var(--accent-normal);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: var(--accent-normal);
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: var(--accent-muted);
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
rsx!(
|
||||
document::Link{ rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" }
|
||||
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 }
|
||||
|
||||
sir::AppStyle { }
|
||||
match *STATE.status.read() {
|
||||
Connected => rsx!(ServerView { config }),
|
||||
_ => rsx!(LoginView { config }),
|
||||
|
||||
+121
-11
@@ -1,27 +1,137 @@
|
||||
use crossbeam::atomic::AtomicCell;
|
||||
use df::tract::{mut_slice_as_arrayviewmut, slice_as_arrayview};
|
||||
use df::tract::{DfParams, DfTract, RuntimeParams};
|
||||
use dioxus::prelude::{asset, manganis, Asset};
|
||||
use dioxus_asset_resolver::read_asset_bytes;
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::imp;
|
||||
|
||||
static DF_MODEL: Asset = asset!("/assets/DeepFilterNet3_ll_onnx.tar.gz");
|
||||
|
||||
enum DenoisingModelState {
|
||||
Nothing,
|
||||
Downloading(Arc<AtomicCell<Option<DfParams>>>),
|
||||
Availible(Box<DfTract>),
|
||||
}
|
||||
|
||||
fn with_denoising_model<O>(
|
||||
spawn: &imp::SpawnHandle,
|
||||
func: impl FnOnce(&mut DfTract) -> O,
|
||||
) -> Option<O> {
|
||||
// Using a thread local is super gross, but DfTract is not Send (so it can never leave the current
|
||||
// thread) while AudioProcessing itself might change threads whenever.
|
||||
thread_local! {
|
||||
static STATE: RefCell<DenoisingModelState> = const { RefCell::new(DenoisingModelState::Nothing) };
|
||||
}
|
||||
|
||||
STATE.with_borrow_mut(|state| match state {
|
||||
DenoisingModelState::Nothing => {
|
||||
let cell = Arc::new(AtomicCell::new(None));
|
||||
let cell_task = cell.clone();
|
||||
*state = DenoisingModelState::Downloading(cell);
|
||||
spawn.spawn(async move {
|
||||
let model_bytes = match read_asset_bytes(&DF_MODEL).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
error!("could not read denoising model from \"{DF_MODEL}\": {e:?}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let params = match DfParams::from_bytes(&model_bytes) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
error!("could not load denoising model parameters: {e:?}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
cell_task.store(Some(params));
|
||||
});
|
||||
None
|
||||
}
|
||||
DenoisingModelState::Downloading(cell) => {
|
||||
if let Some(params) = cell.take() {
|
||||
let mut tract = match DfTract::new(params, &RuntimeParams::default_with_ch(1)) {
|
||||
Ok(t) => Box::new(t),
|
||||
Err(e) => {
|
||||
error!("could not create denoising engine: {e:?}");
|
||||
return None;
|
||||
}
|
||||
};
|
||||
info!("instantiated denoising engine");
|
||||
let out = func(&mut tract);
|
||||
*state = DenoisingModelState::Availible(tract);
|
||||
Some(out)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
DenoisingModelState::Availible(tract) => Some(func(tract)),
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AudioProcessor {
|
||||
df: Option<::df::DFState>,
|
||||
denoise: bool,
|
||||
spawn: imp::SpawnHandle,
|
||||
buffer: Vec<f32>,
|
||||
}
|
||||
|
||||
impl AudioProcessor {
|
||||
pub fn new_plain() -> Self {
|
||||
AudioProcessor {
|
||||
denoise: false,
|
||||
spawn: imp::SpawnHandle::current(),
|
||||
buffer: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_denoising() -> Self {
|
||||
let df = ::df::DFState::default();
|
||||
AudioProcessor { df: Some(df) }
|
||||
AudioProcessor {
|
||||
denoise: true,
|
||||
spawn: imp::SpawnHandle::current(),
|
||||
buffer: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AudioProcessor {
|
||||
pub fn process(&mut self, audio: &[f32]) -> Box<[f32]> {
|
||||
let mut output: Box<[f32]> = vec![0f32; audio.len()].into();
|
||||
if let Some(df) = &mut self.df {
|
||||
df.process_frame(audio, &mut output);
|
||||
} else {
|
||||
output.copy_from_slice(audio);
|
||||
pub fn process(&mut self, audio: &[f32], 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);
|
||||
output.reserve(audio.len());
|
||||
|
||||
let hop = df.hop_size;
|
||||
let mut i = 0;
|
||||
while self.buffer[i..].len() >= hop {
|
||||
let audio = &self.buffer[i..][..hop];
|
||||
i += audio.len();
|
||||
|
||||
let j = output.len();
|
||||
output.extend(std::iter::repeat_n(0f32, audio.len()));
|
||||
let output = &mut output[j..];
|
||||
|
||||
df.process(
|
||||
slice_as_arrayview(audio, &[audio.len()])
|
||||
.into_shape((1, audio.len()))
|
||||
.unwrap(),
|
||||
mut_slice_as_arrayviewmut(output, &[output.len()])
|
||||
.into_shape((1, output.len()))
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
self.buffer.splice(..i, []);
|
||||
});
|
||||
}
|
||||
|
||||
if include_raw {
|
||||
output.extend_from_slice(audio);
|
||||
}
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+74
-16
@@ -1,15 +1,15 @@
|
||||
use crate::app::Command;
|
||||
use crate::effects::AudioProcessor;
|
||||
use color_eyre::eyre::{eyre, Error};
|
||||
use crate::effects::{AudioProcessor, AudioProcessorSender};
|
||||
use color_eyre::eyre::{eyre, Context, Error};
|
||||
use cpal::traits::{DeviceTrait, HostTrait};
|
||||
use dioxus::hooks::{UnboundedReceiver, UnboundedSender};
|
||||
use dioxus::hooks::UnboundedReceiver;
|
||||
use futures::io::{AsyncRead, AsyncWrite};
|
||||
use mumble_protocol::control::{ClientControlCodec, ControlPacket};
|
||||
use mumble_protocol::Serverbound;
|
||||
use mumble_protocol::control::ClientControlCodec;
|
||||
use mumble_web2_common::ClientConfig;
|
||||
use std::mem::replace;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::{fmt, io, sync::Arc};
|
||||
use tokio::net::TcpStream;
|
||||
use tokio_rustls::rustls;
|
||||
use tokio_rustls::rustls::client::danger::{HandshakeSignatureValid, ServerCertVerifier};
|
||||
@@ -20,6 +20,7 @@ use tokio_rustls::TlsConnector;
|
||||
use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};
|
||||
use tracing::{error, info, instrument, warn};
|
||||
|
||||
pub use tokio::runtime::Handle as SpawnHandle;
|
||||
pub use tokio::task::spawn;
|
||||
pub use tokio::time::sleep;
|
||||
|
||||
@@ -32,8 +33,13 @@ impl<T: AsyncWrite + Unpin + Send + 'static> ImpWrite for T {}
|
||||
pub struct AudioSystem {
|
||||
output: cpal::Device,
|
||||
input: cpal::Device,
|
||||
processors: AudioProcessorSender,
|
||||
recording_stream: Option<cpal::Stream>,
|
||||
}
|
||||
|
||||
const SAMPLE_RATE: u32 = 48_000;
|
||||
const PACKET_SAMPLES: u32 = 960;
|
||||
|
||||
type Buffer = Arc<Mutex<dasp_ring_buffer::Bounded<Vec<i16>>>>;
|
||||
|
||||
impl AudioSystem {
|
||||
@@ -41,6 +47,7 @@ impl AudioSystem {
|
||||
// TODO
|
||||
let host = cpal::default_host();
|
||||
let name = host.id();
|
||||
let processors = AudioProcessorSender::default();
|
||||
Ok(AudioSystem {
|
||||
output: host
|
||||
.default_output_device()
|
||||
@@ -48,16 +55,64 @@ impl AudioSystem {
|
||||
input: host
|
||||
.default_input_device()
|
||||
.ok_or(eyre!("no input devices from {name:?}"))?,
|
||||
processors,
|
||||
recording_stream: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_processor(&self, processor: AudioProcessor) {
|
||||
// TODO
|
||||
self.processors.store(Some(processor))
|
||||
}
|
||||
|
||||
pub fn start_recording(&mut self, each: impl FnMut(Vec<u8>) + 'static) -> Result<(), Error> {
|
||||
// TODO
|
||||
Ok(())
|
||||
pub fn start_recording(
|
||||
&mut self,
|
||||
mut each: impl FnMut(Vec<u8>) + Send + 'static,
|
||||
) -> Result<(), Error> {
|
||||
let mut encoder =
|
||||
opus::Encoder::new(SAMPLE_RATE, opus::Channels::Mono, opus::Application::Voip)?;
|
||||
let mut current_processor = AudioProcessor::new_plain();
|
||||
let mut output_buffer = Vec::new();
|
||||
let processors = self.processors.clone();
|
||||
let error_callback = move |e: cpal::StreamError| error!("error recording: {e:?}");
|
||||
let data_callback = move |frame: &[f32], _: &cpal::InputCallbackInfo| {
|
||||
if let Some(new_processor) = processors.take() {
|
||||
current_processor = new_processor;
|
||||
}
|
||||
current_processor.process(frame, &mut output_buffer);
|
||||
if output_buffer.len() < PACKET_SAMPLES as usize {
|
||||
return;
|
||||
}
|
||||
let remainder = output_buffer.split_off(PACKET_SAMPLES as usize);
|
||||
let frame = replace(&mut output_buffer, remainder);
|
||||
match encoder.encode_vec_float(&frame, frame.len() * 2) {
|
||||
Ok(buf) => {
|
||||
each(buf);
|
||||
}
|
||||
Err(e) => {
|
||||
error!("error encoding {} samples: {e:?}", frame.len());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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,
|
||||
) {
|
||||
Ok(stream) => {
|
||||
self.recording_stream = Some(stream);
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
self.recording_stream = None;
|
||||
Err(err.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_player(&mut self) -> Result<AudioPlayer, Error> {
|
||||
@@ -66,16 +121,16 @@ impl AudioSystem {
|
||||
0,
|
||||
vec![
|
||||
0;
|
||||
2400 // 50ms of buffer
|
||||
SAMPLE_RATE as usize/4 // 250ms of buffer
|
||||
],
|
||||
)));
|
||||
let decoder = opus::Decoder::new(48_000, opus::Channels::Mono)?;
|
||||
let decoder = opus::Decoder::new(SAMPLE_RATE, opus::Channels::Mono)?;
|
||||
let stream = {
|
||||
let buffer = buffer.clone();
|
||||
self.output.build_output_stream(
|
||||
&cpal::StreamConfig {
|
||||
channels: 1,
|
||||
sample_rate: cpal::SampleRate(48_000),
|
||||
sample_rate: cpal::SampleRate(SAMPLE_RATE),
|
||||
buffer_size: cpal::BufferSize::Fixed(480), // 10ms playback delay
|
||||
},
|
||||
move |frame, info| {
|
||||
@@ -234,9 +289,12 @@ pub fn load_username() -> Option<String> {
|
||||
}
|
||||
|
||||
pub async fn load_config() -> color_eyre::Result<ClientConfig> {
|
||||
color_eyre::eyre::bail!(
|
||||
"there is no config on desktop because desktops cannot be configured as they are tables"
|
||||
)
|
||||
Ok(ClientConfig {
|
||||
proxy_url: None,
|
||||
status_url: None,
|
||||
cert_hash: None,
|
||||
any_server: true,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn init_logging() {
|
||||
|
||||
+28
-12
@@ -8,6 +8,7 @@ use js_sys::Float32Array;
|
||||
use mumble_protocol::control::ClientControlCodec;
|
||||
use mumble_web2_common::ClientConfig;
|
||||
use reqwest::Url;
|
||||
use std::future::Future;
|
||||
use std::time::Duration;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing::{debug, error, info, instrument};
|
||||
@@ -82,11 +83,8 @@ impl AudioSystem {
|
||||
// Create MediaStreams to playback decoded audio
|
||||
// The audio context is used to reproduce audio.
|
||||
let webctx = configure_audio_context();
|
||||
let processor = AudioProcessorSender::default();
|
||||
Ok(AudioSystem {
|
||||
webctx,
|
||||
processors: processor,
|
||||
})
|
||||
let processors = AudioProcessorSender::default();
|
||||
Ok(AudioSystem { webctx, processors })
|
||||
}
|
||||
|
||||
pub fn set_processor(&self, processor: AudioProcessor) {
|
||||
@@ -210,7 +208,8 @@ fn process_audio(frame: &JsValue, processor: &mut AudioProcessor) {
|
||||
return;
|
||||
};
|
||||
let input = samples.to_vec();
|
||||
let output = processor.process(&input);
|
||||
let mut output = Vec::with_capacity(input.len());
|
||||
processor.process(&input, &mut output);
|
||||
samples.copy_from(&output);
|
||||
}
|
||||
|
||||
@@ -285,7 +284,7 @@ async fn run_encoder_worklet(
|
||||
audio_encoder.configure(&encoder_config);
|
||||
info!("created audio encoder");
|
||||
|
||||
let mut current_processor = AudioProcessor::default();
|
||||
let mut current_processor = AudioProcessor::new_plain();
|
||||
let onmessage: Closure<dyn FnMut(MessageEvent)> = Closure::new(move |event: MessageEvent| {
|
||||
if let Some(new_processor) = processors.take() {
|
||||
current_processor = new_processor;
|
||||
@@ -406,14 +405,16 @@ pub fn load_username() -> Option<String> {
|
||||
.ok()?
|
||||
}
|
||||
|
||||
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> {
|
||||
let config_url = match option_env!("MUMBLE_WEB2_GUI_CONFIG_URL") {
|
||||
Some(url) => Url::parse(url)?,
|
||||
None => {
|
||||
let window: web_sys::Window = web_sys::window().expect("no global `window` exists");
|
||||
let location = window.location();
|
||||
Url::parse(&location.href().ey()?)?.join("config")?
|
||||
}
|
||||
None => absolute_url("config")?,
|
||||
};
|
||||
info!("loading config from {}", config_url);
|
||||
|
||||
@@ -446,3 +447,18 @@ pub fn init_logging() {
|
||||
|
||||
info!("logging initiated");
|
||||
}
|
||||
|
||||
pub struct SpawnHandle;
|
||||
|
||||
impl SpawnHandle {
|
||||
pub fn current() -> Self {
|
||||
SpawnHandle
|
||||
}
|
||||
|
||||
pub fn spawn<F>(&self, future: F)
|
||||
where
|
||||
F: Future<Output = ()> + 'static,
|
||||
{
|
||||
spawn(future);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ fn accept_command(
|
||||
if denoise {
|
||||
audio.set_processor(AudioProcessor::new_denoising());
|
||||
} else {
|
||||
audio.set_processor(AudioProcessor::default());
|
||||
audio.set_processor(AudioProcessor::new_plain());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -1,12 +1,6 @@
|
||||
use mumble_web2_gui::{app, imp::init_logging};
|
||||
use mumble_web2_gui::{app, imp};
|
||||
|
||||
pub fn main() {
|
||||
#[cfg(feature = "desktop")]
|
||||
let _guard = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
.enter();
|
||||
init_logging();
|
||||
imp::init_logging();
|
||||
dioxus::launch(app::app);
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,13 +7,13 @@ edition = "2021"
|
||||
color-eyre = "^0.6"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tokio = { version = "^1.37", features = ["full"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-rustls = "0.26"
|
||||
toml = "0.8"
|
||||
tracing = { version = "^0.1.40", features = ["async-await"] }
|
||||
tracing-subscriber = { version = "^0.3.18", features = ["env-filter"] }
|
||||
mumble-web2-common = { workspace = true }
|
||||
salvo = { version = "^0.74.2", features = [
|
||||
salvo = { version = "^0.84.2", features = [
|
||||
"quinn",
|
||||
"eyre",
|
||||
"rustls",
|
||||
|
||||
+6
-1
@@ -39,6 +39,7 @@ 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>,
|
||||
cert_path: Option<PathBuf>,
|
||||
@@ -82,9 +83,13 @@ async fn main() -> Result<()> {
|
||||
.map_err(|e| anyhow!("could not install crypto provider {e:?}"))?;
|
||||
|
||||
let mut client_config = ClientConfig {
|
||||
proxy_url: Some(server_config.public_url.join("proxy")?.to_string()),
|
||||
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 (cert, key) = match (&server_config.cert_path, &server_config.key_path) {
|
||||
|
||||
Reference in New Issue
Block a user