Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use rustls and webpki-roots for WebSocket TLS

Add rustls and webpki-roots dependencies and switch the WebSocket client
to connect_async_tls_with_config using a rustls ClientConfig and
Connector. Update Cargo.toml and Cargo.lock accordingly. Add
Dockerfile.dev
to provide a reproducible development builder and required build tools.

+144 -6
+71 -2
Cargo.lock
··· 1026 1026 ] 1027 1027 1028 1028 [[package]] 1029 + name = "aws-lc-rs" 1030 + version = "1.13.3" 1031 + source = "registry+https://github.com/rust-lang/crates.io-index" 1032 + checksum = "5c953fe1ba023e6b7730c0d4b031d06f267f23a46167dcbd40316644b10a17ba" 1033 + dependencies = [ 1034 + "aws-lc-sys", 1035 + "zeroize", 1036 + ] 1037 + 1038 + [[package]] 1039 + name = "aws-lc-sys" 1040 + version = "0.30.0" 1041 + source = "registry+https://github.com/rust-lang/crates.io-index" 1042 + checksum = "dbfd150b5dbdb988bcc8fb1fe787eb6b7ee6180ca24da683b61ea5405f3d43ff" 1043 + dependencies = [ 1044 + "bindgen 0.69.5", 1045 + "cc", 1046 + "cmake", 1047 + "dunce", 1048 + "fs_extra", 1049 + ] 1050 + 1051 + [[package]] 1029 1052 name = "axum" 1030 1053 version = "0.7.5" 1031 1054 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1184 1207 1185 1208 [[package]] 1186 1209 name = "bindgen" 1210 + version = "0.69.5" 1211 + source = "registry+https://github.com/rust-lang/crates.io-index" 1212 + checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" 1213 + dependencies = [ 1214 + "bitflags 2.6.0", 1215 + "cexpr", 1216 + "clang-sys", 1217 + "itertools 0.10.5", 1218 + "lazy_static", 1219 + "lazycell", 1220 + "log", 1221 + "prettyplease", 1222 + "proc-macro2", 1223 + "quote", 1224 + "regex", 1225 + "rustc-hash 1.1.0", 1226 + "shlex", 1227 + "syn 2.0.91", 1228 + "which 4.4.2", 1229 + ] 1230 + 1231 + [[package]] 1232 + name = "bindgen" 1187 1233 version = "0.70.1" 1188 1234 source = "registry+https://github.com/rust-lang/crates.io-index" 1189 1235 checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" ··· 3989 4035 ] 3990 4036 3991 4037 [[package]] 4038 + name = "dunce" 4039 + version = "1.0.5" 4040 + source = "registry+https://github.com/rust-lang/crates.io-index" 4041 + checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" 4042 + 4043 + [[package]] 3992 4044 name = "dyn-clone" 3993 4045 version = "1.0.17" 3994 4046 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4650 4702 ] 4651 4703 4652 4704 [[package]] 4705 + name = "fs_extra" 4706 + version = "1.3.0" 4707 + source = "registry+https://github.com/rust-lang/crates.io-index" 4708 + checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" 4709 + 4710 + [[package]] 4653 4711 name = "fsevent-sys" 4654 4712 version = "4.1.0" 4655 4713 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 6390 6448 dependencies = [ 6391 6449 "spin", 6392 6450 ] 6451 + 6452 + [[package]] 6453 + name = "lazycell" 6454 + version = "1.3.0" 6455 + source = "registry+https://github.com/rust-lang/crates.io-index" 6456 + checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 6393 6457 6394 6458 [[package]] 6395 6459 name = "leb128fmt" ··· 6564 6628 source = "registry+https://github.com/rust-lang/crates.io-index" 6565 6629 checksum = "ca8dfd1a173826d193e3b955e07c22765829890f62c677a59c4a410cb4f47c01" 6566 6630 dependencies = [ 6567 - "bindgen", 6631 + "bindgen 0.70.1", 6568 6632 "libloading 0.8.5", 6569 6633 ] 6570 6634 ··· 9146 9210 "prost", 9147 9211 "reqwest", 9148 9212 "rockbox-library", 9213 + "rustls 0.23.13", 9149 9214 "serde", 9150 9215 "serde_json", 9151 9216 "sha256", ··· 9157 9222 "tonic-reflection", 9158 9223 "tonic-web", 9159 9224 "tungstenite 0.26.2", 9225 + "webpki-roots 0.26.3", 9160 9226 ] 9161 9227 9162 9228 [[package]] ··· 9512 9578 source = "registry+https://github.com/rust-lang/crates.io-index" 9513 9579 checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" 9514 9580 dependencies = [ 9581 + "aws-lc-rs", 9515 9582 "log", 9516 9583 "once_cell", 9517 9584 "ring", ··· 9581 9648 source = "registry+https://github.com/rust-lang/crates.io-index" 9582 9649 checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" 9583 9650 dependencies = [ 9651 + "aws-lc-rs", 9584 9652 "ring", 9585 9653 "rustls-pki-types", 9586 9654 "untrusted", ··· 11873 11941 "sha1 0.10.6", 11874 11942 "thiserror 2.0.18", 11875 11943 "utf-8", 11944 + "webpki-roots 0.26.3", 11876 11945 ] 11877 11946 11878 11947 [[package]] ··· 12138 12207 source = "registry+https://github.com/rust-lang/crates.io-index" 12139 12208 checksum = "2ee0be58935708fa4d7efb970c6cf9f2d9511d24ee24246481a65b6ee167348d" 12140 12209 dependencies = [ 12141 - "bindgen", 12210 + "bindgen 0.70.1", 12142 12211 "bitflags 2.6.0", 12143 12212 "fslock", 12144 12213 "gzip-header",
+57
Dockerfile.dev
··· 1 + FROM rust:1.94-bookworm AS builder 2 + 3 + ARG TARGETARCH 4 + 5 + ARG GITHUB_TOKEN 6 + 7 + ARG TAG 8 + 9 + ENV GITHUB_ACCESS_TOKEN=${GITHUB_TOKEN} 10 + 11 + ENV GH_TOKEN=${GITHUB_TOKEN} 12 + 13 + ENV TAG=${TAG} 14 + 15 + RUN apt-get update && apt-get install -y build-essential \ 16 + libsdl2-dev \ 17 + libfreetype6-dev \ 18 + libunwind-dev \ 19 + curl \ 20 + wget \ 21 + zip \ 22 + unzip \ 23 + protobuf-compiler \ 24 + cmake 25 + 26 + RUN case "${TARGETARCH}" in \ 27 + amd64) ZIG_ARCH="x86_64" ;; \ 28 + arm64) ZIG_ARCH="aarch64" ;; \ 29 + *) echo "Unsupported arch: ${TARGETARCH}" && exit 1 ;; \ 30 + esac && \ 31 + export VERSION=0.16.0 && \ 32 + wget "https://ziglang.org/download/${VERSION}/zig-${ZIG_ARCH}-linux-${VERSION}.tar.xz" && \ 33 + tar -xf "zig-${ZIG_ARCH}-linux-${VERSION}.tar.xz" && \ 34 + mv "zig-${ZIG_ARCH}-linux-${VERSION}" /usr/local/zig && \ 35 + ln -s /usr/local/zig/zig /usr/local/bin/zig 36 + 37 + RUN curl -Ssf https://pkgx.sh | sh 38 + 39 + RUN pkgm install buf deno 40 + 41 + COPY . /app 42 + 43 + WORKDIR /app 44 + 45 + RUN mkdir -p build 46 + 47 + WORKDIR /app/webui/rockbox 48 + 49 + RUN deno install 50 + 51 + RUN deno run build 52 + 53 + WORKDIR /app/build-lib 54 + 55 + RUN ../tools/configure --target=sdlapp --type=N --lcdwidth=320 --lcdheight=240 --prefix=/usr/local && cp ../autoconf/autoconf.h . 56 + 57 + RUN make -j$(nproc) lib
+4 -2
crates/rocksky/Cargo.toml
··· 24 24 tonic = "0.12.3" 25 25 tonic-reflection = "0.12.3" 26 26 tonic-web = "0.12.3" 27 - tungstenite = { version = "0.26.2", features = ["rustls"] } 28 - tokio-tungstenite = { version = "0.26.2", features = ["tokio-rustls", "rustls-tls-webpki-roots"] } 27 + tungstenite = { version = "0.26.2", features = ["rustls-tls-webpki-roots"] } 28 + tokio-tungstenite = { version = "0.26.2", features = ["rustls-tls-webpki-roots"] } 29 + rustls = "0.23" 30 + webpki-roots = "0.26" 29 31 futures-util = "0.3.31" 30 32 tokio-stream = "0.1.17" 31 33
+12 -2
crates/rocksky/src/lib.rs
··· 23 23 use std::sync::Arc; 24 24 use std::thread; 25 25 use tokio::sync::Mutex; 26 - use tokio_tungstenite::connect_async; 26 + use tokio_tungstenite::{connect_async_tls_with_config, Connector}; 27 27 28 28 const AUDIO_EXTENSIONS: [&str; 18] = [ 29 29 "mp3", "ogg", "flac", "m4a", "aac", "mp4", "alac", "wav", "wv", "mpc", "aiff", "aif", "ac3", ··· 44 44 pub async fn run_ws_session(token: String) -> Result<(), Error> { 45 45 let rocksky_ws = 46 46 env::var("ROCKSKY_WS").unwrap_or_else(|_| "wss://api.rocksky.app/ws".to_string()); 47 - let (ws_stream, _) = connect_async(&rocksky_ws).await?; 47 + 48 + let root_store = rustls::RootCertStore { 49 + roots: webpki_roots::TLS_SERVER_ROOTS.to_vec(), 50 + }; 51 + let tls_config = rustls::ClientConfig::builder() 52 + .with_root_certificates(root_store) 53 + .with_no_client_auth(); 54 + let connector = Connector::Rustls(Arc::new(tls_config)); 55 + 56 + let (ws_stream, _) = 57 + connect_async_tls_with_config(&rocksky_ws, None, false, Some(connector)).await?; 48 58 println!("Connected to {}", rocksky_ws); 49 59 50 60 let (mut write, mut read) = ws_stream.split();