From bf6c3d5cb09743d25eb5c9ded91ff466e7a353b7 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sun, 13 Jul 2025 20:43:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Apply=20getrandom=20requirements?= =?UTF-8?q?=20to=20support=20wasm-unknown-unknown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://docs.rs/getrandom/latest/getrandom/#webassembly-support --- Cargo.toml | 9 ++++++++- Dockerfile | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cc45fff..502094d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ tokio-stream = "0.1.15" # Utils base64 = "0.22.0" const_format = "0.2.32" -rand = "0.9.0" +rand = "0.9.1" validator = { version = "0.17.0", features = ["derive"] } # Http client reqwest = "0.11.24" @@ -51,6 +51,9 @@ dioxus-free-icons = { version = "0.9", features = ["ionicons", "font-awesome-sol modx = "0.1.4" [target.'cfg(target_family = "wasm")'.dependencies] +# Utils +getrandom = { version = "0.3.2", features = ["wasm_js"] } + # Logging/tracing tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } tracing-web = "0.1.3" @@ -65,6 +68,7 @@ matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", rev = [target.'cfg(not(target_family = "wasm"))'.dependencies] # Utils time = "0.3.36" +getrandom = { version = "0.3.2" } # Logging/tracing tracing-subscriber = { version = "0.3.18", features = ["env-filter", "time"] } @@ -75,6 +79,9 @@ dioxus = { version = "0.6.3", features = ["desktop"] } # Matrix matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", rev = "fa6066b8", default-features = false, features = ["rustls-tls"] } +[target.wasm32-unknown-unknown] +rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] + [build-dependencies] regex = "1.10.3" diff --git a/Dockerfile b/Dockerfile index b45681a..b89aebe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,8 @@ RUN apt update \ COPY . . +# Workaround waiting for the dioxus 0.7 release (cf. https://github.com/DioxusLabs/dioxus/issues/4238) +ENV RUSTFLAGS="--cfg getrandom_backend=\"wasm_js\"" RUN dx build -r --platform web -- -j ${JOBS_NB}