From 7ff74303060e188e707556ff5736726f2f849c28 Mon Sep 17 00:00:00 2001 From: Yanis Rigaudeau Date: Sun, 8 Mar 2026 19:41:52 +0100 Subject: [PATCH] playing works --- Cargo.lock | 1012 ++++++++++++++++++++++++-- Dockerfile | 2 +- apps/master/Cargo.toml | 4 +- apps/master/src/commands/testnats.rs | 62 +- apps/master/src/main.rs | 4 +- apps/worker/Cargo.toml | 8 +- apps/worker/src/main.rs | 17 +- apps/worker/src/workers/download.rs | 2 +- apps/worker/src/workers/play.rs | 14 +- 9 files changed, 1034 insertions(+), 91 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1a49a0..59afcba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -225,6 +225,12 @@ dependencies = [ "fs_extra", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.22.1" @@ -424,17 +430,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "command_attr" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8208103c5e25a091226dfa8d61d08d0561cc14f31b25691811ba37d4ec9b157b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "compression-codecs" version = "0.4.37" @@ -509,6 +504,17 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core-models" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94950e87ea550d6d68f1993f3e7bebc8cb7235157bff84337d46195c3aa0b3f0" +dependencies = [ + "hax-lib", + "pastey", + "rand 0.9.2", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -551,6 +557,16 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + [[package]] name = "crossbeam-epoch" version = "0.9.18" @@ -566,6 +582,18 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -599,6 +627,7 @@ dependencies = [ "fiat-crypto", "rustc_version", "subtle", + "zeroize", ] [[package]] @@ -682,6 +711,20 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core 0.9.12", + "serde", +] + [[package]] name = "dashmap" version = "6.1.0" @@ -693,7 +736,7 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.12", ] [[package]] @@ -702,6 +745,33 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" +[[package]] +name = "davey" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e05bae3e741c249912d39c6cec28d2ef3c1a196e9acac025582182a8f9fbb7" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "hex-literal", + "hmac", + "num-derive", + "num-traits", + "openmls", + "openmls_basic_credential", + "openmls_rust_crypto", + "p256", + "rand 0.8.5", + "scrypt", + "sha2", + "subtle", + "thiserror 2.0.18", + "tracing", +] + [[package]] name = "der" version = "0.7.10" @@ -802,7 +872,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -844,12 +916,27 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "ed25519" version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ + "pkcs8", "signature", ] @@ -861,9 +948,12 @@ checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" dependencies = [ "curve25519-dalek", "ed25519", + "rand_core 0.6.4", + "serde", "sha2", "signature", "subtle", + "zeroize", ] [[package]] @@ -872,6 +962,27 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "embedded-io" version = "0.4.0" @@ -936,12 +1047,28 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "fiat-crypto" version = "0.2.9" @@ -988,6 +1115,21 @@ dependencies = [ "spin", ] +[[package]] +name = "fluvio-wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b768c170dc045fa587a8f948c91f9bcfb87f774930477c6215addf54317f137f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1133,6 +1275,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1186,6 +1329,17 @@ dependencies = [ "polyval", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.4.13" @@ -1252,6 +1406,43 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "hax-lib" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543f93241d32b3f00569201bfce9d7a93c92c6421b23c77864ac929dc947b9fc" +dependencies = [ + "hax-lib-macros", + "num-bigint", + "num-traits", +] + +[[package]] +name = "hax-lib-macros" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8755751e760b11021765bb04cb4a6c4e24742688d9f3aa14c2079638f537b0f" +dependencies = [ + "hax-lib-macros-types", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "hax-lib-macros-types" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f177c9ae8ea456e2f71ff3c1ea47bf4464f772a05133fcbba56cd5ba169035a2" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "heapless" version = "0.7.17" @@ -1293,6 +1484,21 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hls_m3u8" version = "0.4.2" @@ -1308,6 +1514,77 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "hpke-rs" +version = "0.3.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b245758dea58531acbdd0e9a20d73a93561a78f78531a2bed0ef9b5a39cc0ff2" +dependencies = [ + "hpke-rs-crypto", + "hpke-rs-libcrux", + "hpke-rs-rust-crypto", + "libcrux-sha3", + "log", + "rand_core 0.9.5", + "serde", + "tls_codec", + "zeroize", +] + +[[package]] +name = "hpke-rs-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51ffd304e06803f90f2e56a24a6910f19b8516f842d7b72a436c51026279876" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "hpke-rs-libcrux" +version = "0.3.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fa708a147e2068a04ec209f5d94f2446f89a754e2556a4c14b88101aa26ff8" +dependencies = [ + "hpke-rs-crypto", + "libcrux-chacha20poly1305", + "libcrux-ecdh", + "libcrux-hkdf", + "libcrux-kem", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "hpke-rs-rust-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7dc0df494528a0b90005bb511c117453c6a89cd8819f6cf311d0f4446dcf45" +dependencies = [ + "aes-gcm", + "chacha20poly1305", + "hkdf", + "hpke-rs-crypto", + "k256", + "p256", + "p384", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "sha2", + "x25519-dalek", +] + [[package]] name = "http" version = "1.4.0" @@ -1378,7 +1655,7 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "tokio", "tokio-rustls 0.26.4", @@ -1592,6 +1869,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1656,6 +1945,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "elliptic-curve", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1668,18 +1967,191 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" -[[package]] -name = "levenshtein" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" - [[package]] name = "libc" version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" +[[package]] +name = "libcrux-chacha20poly1305" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0683aedd9048bead90863fa83f56fc224ea545762fdd108c845d5c15391413" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", + "libcrux-poly1305", +] + +[[package]] +name = "libcrux-curve25519" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a39960483f24efea15b1aa111bb8668dc671f808598793104ccc4fec9f5e28b" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", +] + +[[package]] +name = "libcrux-ecdh" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5ecef729c99bb2f751133b89186a636cd8b3e8320d094131d21ea8c82348ca" +dependencies = [ + "libcrux-curve25519", + "libcrux-p256", + "rand 0.9.2", +] + +[[package]] +name = "libcrux-hacl-rs" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a141e79dcefa1a91b68831783114232ed6a69b8c8c853c6e6b1cf2af231c3c" +dependencies = [ + "libcrux-macros", +] + +[[package]] +name = "libcrux-hkdf" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2663b258d1a4a023a03e946bb949cf30f862d2da1e68fe9a1d3e6103c1d4a6a5" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-hmac", +] + +[[package]] +name = "libcrux-hmac" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c8d021153affaad2aba7c6dd4c23e7304e77198080ce9b949c725682912154" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", + "libcrux-sha2", +] + +[[package]] +name = "libcrux-intrinsics" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d3b41dcbc21a5fb7efbbb5af7405b2e79c4bfe443924e90b13afc0080318d31" +dependencies = [ + "core-models", + "hax-lib", +] + +[[package]] +name = "libcrux-kem" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc932402ccd803c064e228ff2a4d2aef5b5a0b03b461518d29046e01ebc2cf98" +dependencies = [ + "libcrux-ecdh", + "libcrux-ml-kem", + "libcrux-sha3", + "libcrux-traits", + "rand 0.9.2", +] + +[[package]] +name = "libcrux-macros" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc8e38ec9c49ba83cb7e72d278c3537552afbc67728f22e567c21725cdd8b3ba" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "libcrux-ml-kem" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6206bb81fc3e51bd94d4b847760039d44a9a8e77bac841df8ed9320f79a6f3be" +dependencies = [ + "hax-lib", + "libcrux-intrinsics", + "libcrux-platform", + "libcrux-secrets", + "libcrux-sha3", + "rand 0.9.2", +] + +[[package]] +name = "libcrux-p256" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb56de31fa136bdaa838401547c3644f3e11c7929818dfb45d934a2db7ab521" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", + "libcrux-sha2", +] + +[[package]] +name = "libcrux-platform" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db82d058aa76ea315a3b2092f69dfbd67ddb0e462038a206e1dcd73f058c0778" +dependencies = [ + "libc", +] + +[[package]] +name = "libcrux-poly1305" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8907194cd2d35dd763519189036c6062f5464ac9b63fb968b10abcb09feef3" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", +] + +[[package]] +name = "libcrux-secrets" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332737e629fe6ba7547f5c0f90559eac865d5dbecf98138ffae8f16ab8cbe33f" +dependencies = [ + "hax-lib", +] + +[[package]] +name = "libcrux-sha2" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0c0266cc2b0920f3b1540bb1268ea5dae2cfff9aa0e92b316d2c73e618fb64" +dependencies = [ + "libcrux-hacl-rs", + "libcrux-macros", + "libcrux-traits", +] + +[[package]] +name = "libcrux-sha3" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c076a07a2df2cc8f6603042823e752c0057bce51beb4e0b2cbf0b3dfb7f73d" +dependencies = [ + "hax-lib", + "libcrux-intrinsics", + "libcrux-platform", +] + +[[package]] +name = "libcrux-traits" +version = "0.0.3-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "477d39395a82293e079313c288f313bcbb62501ae4c31588e471344eea1a77da" +dependencies = [ + "rand 0.9.2", +] + [[package]] name = "libredox" version = "0.1.12" @@ -1864,7 +2336,7 @@ dependencies = [ "equivalent", "event-listener", "futures-util", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "smallvec", "tagptr", @@ -1937,6 +2409,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-complex" version = "0.4.6" @@ -1952,6 +2434,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -2001,6 +2494,86 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "openmls" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692e9c6b7d725e53cc42d1fa870066770fd67df35cf1cfbbd047dc0355e06b67" +dependencies = [ + "fluvio-wasm-timer", + "getrandom 0.2.17", + "log", + "openmls_traits", + "rayon", + "serde", + "serde_bytes", + "thiserror 2.0.18", + "tls_codec", + "zeroize", +] + +[[package]] +name = "openmls_basic_credential" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e6454b2b1b6749fc2f142d7f74eb387f7793be88187ed372e9f5f4cf10c34c" +dependencies = [ + "ed25519-dalek", + "openmls_traits", + "p256", + "rand 0.8.5", + "serde", + "tls_codec", +] + +[[package]] +name = "openmls_memory_storage" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e7b071ea5573a97efaa72b7c53e81cebc644b62ef0fe992bad685cc0f7dd4ea" +dependencies = [ + "log", + "openmls_traits", + "serde", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "openmls_rust_crypto" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3faef09e17a15c8065b9ec6b1e150c19dcb0c4cb810a636b6f010a94a189678e" +dependencies = [ + "aes-gcm", + "chacha20poly1305", + "ed25519-dalek", + "hkdf", + "hmac", + "hpke-rs", + "hpke-rs-crypto", + "hpke-rs-rust-crypto", + "openmls_memory_storage", + "openmls_traits", + "p256", + "rand 0.8.5", + "rand_chacha 0.3.1", + "serde", + "sha2", + "thiserror 2.0.18", + "tls_codec", +] + +[[package]] +name = "openmls_traits" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e21d8877bacdbc407060df29bf59b145bb886a8fa0099b87ae8067a34b902a13" +dependencies = [ + "serde", + "tls_codec", +] + [[package]] name = "openssl-probe" version = "0.1.6" @@ -2033,12 +2606,45 @@ dependencies = [ "serde", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "elliptic-curve", + "primeorder", +] + [[package]] name = "parking" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2046,7 +2652,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -2068,6 +2688,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + [[package]] name = "patricia_tree" version = "0.8.0" @@ -2077,6 +2703,16 @@ dependencies = [ "bitflags 2.11.0", ] +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2264,6 +2900,37 @@ dependencies = [ "num-integer", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "proc-macro2" version = "1.0.106" @@ -2285,7 +2952,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.36", + "rustls 0.23.37", "socket2 0.6.2", "thiserror 2.0.18", "tokio", @@ -2306,7 +2973,7 @@ dependencies = [ "rand 0.9.2", "ring", "rustc-hash", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "slab", "thiserror 2.0.18", @@ -2422,6 +3089,26 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "realfft" version = "3.5.0" @@ -2431,6 +3118,15 @@ dependencies = [ "rustfft", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -2520,7 +3216,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "serde", "serde_json", @@ -2564,7 +3260,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "rustls-platform-verifier", "serde", @@ -2583,6 +3279,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.14" @@ -2678,9 +3384,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.36" +version = "0.23.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "aws-lc-rs", "once_cell", @@ -2746,7 +3452,7 @@ dependencies = [ "jni", "log", "once_cell", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-native-certs 0.8.3", "rustls-platform-verifier-android", "rustls-webpki 0.103.9", @@ -2810,6 +3516,15 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2864,6 +3579,31 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "secrecy" version = "0.8.0" @@ -2948,6 +3688,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "serde_core" version = "1.0.228" @@ -3064,33 +3814,30 @@ dependencies = [ "base64", "bitflags 2.11.0", "bytes", - "command_attr", + "dashmap 5.5.3", "flate2", "futures", - "levenshtein", "mime_guess", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", "reqwest 0.12.28", + "rustc-hash", "secrecy", "serde", "serde_cow", "serde_json", - "static_assertions", "time", "tokio", "tokio-tungstenite 0.21.0", "tracing", "typemap_rev", "url", - "uwl", ] [[package]] name = "serenity-voice-model" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790de0c27162611d3adbb98eb83abc295ecd0d608ad9c36653b3e5f2bd06dc22" +source = "git+https://github.com/serenity-rs/voice-model.git?branch=next#b1400a1272da4ed259314133b2536006de1850ab" dependencies = [ "bitflags 2.11.0", "num-traits", @@ -3233,8 +3980,7 @@ dependencies = [ [[package]] name = "songbird" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0f2c269821881c25c6daa6863a611a10c9b40ed9f56e2955793bf06fb0fdfd" +source = "git+https://github.com/beerpsi-forks/songbird.git?branch=davey#25195877c715e08df25eda668df6b3a6bb3d3cdf" dependencies = [ "aead", "aes-gcm", @@ -3244,14 +3990,15 @@ dependencies = [ "bytes", "chacha20poly1305", "crypto-common", - "dashmap", + "dashmap 6.1.0", + "davey", "derivative", "discortp", "either", "flume", "futures", "nohash-hasher", - "parking_lot", + "parking_lot 0.12.5", "pin-project", "rand 0.9.2", "reqwest 0.12.28", @@ -3314,12 +4061,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "stream_lib" version = "0.5.2" @@ -3400,8 +4141,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" dependencies = [ "lazy_static", + "symphonia-bundle-flac", + "symphonia-codec-adpcm", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-mkv", + "symphonia-format-ogg", + "symphonia-format-riff", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" +dependencies = [ + "log", "symphonia-core", "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-codec-adpcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dddc50e2bbea4cfe027441eece77c46b9f319748605ab8f3443350129ddd07f" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" +dependencies = [ + "log", + "symphonia-core", + "symphonia-utils-xiph", ] [[package]] @@ -3417,6 +4208,43 @@ dependencies = [ "log", ] +[[package]] +name = "symphonia-format-mkv" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122d786d2c43a49beb6f397551b4a050d8229eaa54c7ddf9ee4b98899b8742d0" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] + [[package]] name = "symphonia-metadata" version = "0.5.5" @@ -3429,6 +4257,16 @@ dependencies = [ "symphonia-core", ] +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + [[package]] name = "syn" version = "1.0.109" @@ -3627,6 +4465,28 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tls_codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de2e01245e2bb89d6f05801c564fa27624dbd7b1846859876c7dad82e90bf6b" +dependencies = [ + "serde", + "tls_codec_derive", + "zeroize", +] + +[[package]] +name = "tls_codec_derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "tokio" version = "1.49.0" @@ -3671,7 +4531,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.36", + "rustls 0.23.37", "tokio", ] @@ -3711,7 +4571,7 @@ checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "tokio", "tokio-rustls 0.26.4", @@ -3957,7 +4817,7 @@ dependencies = [ "httparse", "log", "rand 0.9.2", - "rustls 0.23.36", + "rustls 0.23.37", "rustls-pki-types", "sha1", "thiserror 2.0.18", @@ -4130,12 +4990,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "uwl" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0" - [[package]] name = "valuable" version = "0.1.1" @@ -4368,6 +5222,22 @@ dependencies = [ "winsafe", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" @@ -4377,6 +5247,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows" version = "0.48.0" @@ -4837,8 +5713,10 @@ dependencies = [ "futures", "futures-executor", "postcard", + "rustls 0.23.37", "serenity", "songbird", + "symphonia", "tokio", "types", "which", @@ -4851,6 +5729,18 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "serde", + "zeroize", +] + [[package]] name = "xattr" version = "1.6.1" @@ -4980,6 +5870,20 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] [[package]] name = "zerotrie" diff --git a/Dockerfile b/Dockerfile index b469510..39b5157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ CMD ["/app/master"] FROM alpine:3.23 AS worker RUN \ - apk add --no-cache python3 ffmpeg deno + apk add --no-cache python3 ffmpeg deno opus RUN \ wget https://github.com/yt-dlp/yt-dlp/releases/download/2026.02.21/yt-dlp -O /usr/local/bin/yt-dlp && \ diff --git a/apps/master/Cargo.toml b/apps/master/Cargo.toml index c9eb24f..b89eb3a 100644 --- a/apps/master/Cargo.toml +++ b/apps/master/Cargo.toml @@ -7,11 +7,11 @@ edition = "2024" async-nats = { version = "0.46.0" } postcard = { version = "1.1.3", features = ["use-std"] } serenity = { version = "0.12.5", default-features = false, features = [ + "cache", "client", + "collector", "gateway", "rustls_backend", - "model", - "collector", ] } tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] } types = { path = "../../libs/types" } diff --git a/apps/master/src/commands/testnats.rs b/apps/master/src/commands/testnats.rs index 9fe3364..4d5f5e5 100644 --- a/apps/master/src/commands/testnats.rs +++ b/apps/master/src/commands/testnats.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + use postcard::{from_bytes, to_stdvec}; use serenity::{ all::{ @@ -12,7 +14,7 @@ use serenity::{ model::application::{CommandOptionType, ResolvedOption, ResolvedValue}, }; use types::{ - jobs::{DownloadJob, DownloadResponse, JobResponse}, + jobs::{DownloadJob, JobResponse, Jobs, PlayJob}, misc::new_uuid_v4, }; @@ -38,37 +40,69 @@ pub async fn run( ) .await?; - let job = DownloadJob { + let download_job = DownloadJob { uuid: new_uuid_v4(), url: value.to_string(), }; - println!("job {:?}", job); + println!("job {:?}", download_job); let response = match nats_client - .request("corro-dj.play", to_stdvec(&job).unwrap().into()) + .request( + "corro-dj.download", + to_stdvec(&download_job).unwrap().into(), + ) .await { Ok(resp) => resp, Err(_why) => return Err(serenity::Error::Other("send error")), }; - let job_response: JobResponse = from_bytes(&response.payload).unwrap(); + let job_response: JobResponse = from_bytes(&response.payload).unwrap(); println!("response: {:?}", job_response); let text_response: String; - if let Some(error) = job_response.error { text_response = error; - } else if let Some(content) = job_response.content { + } else if let Some(Jobs::Download(content)) = job_response.content { text_response = content.path.display().to_string(); } else { text_response = "unkown".to_string(); } interaction - .edit_response(ctx, EditInteractionResponse::new().content(text_response)) + .edit_response(ctx, EditInteractionResponse::new().content(&text_response)) + .await?; + + let guild_id = interaction.guild_id.unwrap(); + + let channel_id = guild_id + .get_user_voice_state(&ctx.http, interaction.user.id) + .await + .unwrap() + .channel_id + .unwrap(); + + let play_job = PlayJob { + uuid: new_uuid_v4(), + path: PathBuf::from(&text_response), + guild_id: guild_id.into(), + channel_id: channel_id.into(), + }; + + println!("job {:?}", play_job); + + let _ = match nats_client + .request("corro-dj.play", to_stdvec(&play_job).unwrap().into()) + .await + { + Ok(resp) => resp, + Err(_why) => return Err(serenity::Error::Other("send error")), + }; + + interaction + .edit_response(ctx, EditInteractionResponse::new().content("playing...")) .await?; } else { interaction @@ -85,10 +119,14 @@ pub async fn run( } pub fn register() -> CreateCommand { - CreateCommand::new("testnats") - .description("test nats") + CreateCommand::new("play") + .description("Play a song") .add_option( - CreateCommandOption::new(CommandOptionType::String, "str", "random string") - .required(false), + CreateCommandOption::new( + CommandOptionType::String, + "song", + "Name or url of the song to play", + ) + .required(false), ) } diff --git a/apps/master/src/main.rs b/apps/master/src/main.rs index fb2c68a..bc2975f 100644 --- a/apps/master/src/main.rs +++ b/apps/master/src/main.rs @@ -24,7 +24,7 @@ impl EventHandler for Handler { println!("Received command interaction: {command:#?}"); let content = match command.data.name.as_str() { - "testnats" => { + "play" => { commands::testnats::run(&ctx, &command, &self.nats_client) .await .unwrap(); @@ -78,7 +78,7 @@ async fn main() { let handler = Handler { nats_client }; // Build our client. - let mut discord_client = Client::builder(discord_token, GatewayIntents::empty()) + let mut discord_client = Client::builder(discord_token, GatewayIntents::non_privileged()) .event_handler(handler) .await .expect("Error creating discord client"); diff --git a/apps/worker/Cargo.toml b/apps/worker/Cargo.toml index 6456958..b77d606 100644 --- a/apps/worker/Cargo.toml +++ b/apps/worker/Cargo.toml @@ -9,12 +9,14 @@ futures = { version = "0.3.32" } futures-executor = { version = "0.3.32" } postcard = { version = "1.1.3", features = ["use-std"] } serenity = { version = "0.12.5", default-features = false, features = [ - "client", - "standard_framework", + "cache", + "rustls_backend", "voice", ] } -songbird = { version = "0.5.0" } +songbird = { git = "https://github.com/beerpsi-forks/songbird.git", branch = "davey" } +symphonia = { version = "0.5.5" } tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] } types = { path = "../../libs/types" } which = { version = "8.0.0" } yt-dlp = { version = "2.4.0" } +rustls = { version = "0.23.37", default-features = false, features = ["ring"] } diff --git a/apps/worker/src/main.rs b/apps/worker/src/main.rs index 96812ec..1b25879 100644 --- a/apps/worker/src/main.rs +++ b/apps/worker/src/main.rs @@ -1,6 +1,6 @@ mod workers; -use std::{env, num::NonZeroU64, path::PathBuf, str::FromStr}; +use std::env; use futures::StreamExt; use postcard::{from_bytes, to_stdvec}; @@ -10,7 +10,7 @@ use serenity::{ async_trait, }; use songbird::SerenityInit; -use types::{jobs::{JobResponse, Jobs, PlayJob}, misc::new_uuid_v4}; +use types::jobs::{JobResponse, Jobs}; use which::which; use yt_dlp::{Downloader, client::Libraries}; @@ -49,12 +49,7 @@ impl EventHandler for Handler { error: res.error, }), "play" => { - workers::play::play(&voice_manager, PlayJob { - uuid: new_uuid_v4(), - path: PathBuf::new(), - guild_id: NonZeroU64::from_str("302837320250294283").unwrap(), - channel_id: NonZeroU64::from_str("863014198703423499").unwrap() - }) + workers::play::play(&voice_manager, from_bytes(&message.payload).unwrap()) .await .map(|res| JobResponse { content: res.content.map(Jobs::Play), @@ -86,6 +81,10 @@ impl EventHandler for Handler { #[tokio::main] async fn main() { + rustls::crypto::ring::default_provider() + .install_default() + .expect("Failed to install rustls crypto provider"); + let discord_token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment"); let nats_client = async_nats::connect("nats://localhost:4222") @@ -105,7 +104,7 @@ async fn main() { yt_downloader, }; - let mut discord_client = Client::builder(&discord_token, GatewayIntents::empty()) + let mut discord_client = Client::builder(&discord_token, GatewayIntents::non_privileged()) .event_handler(handler) .register_songbird() .await diff --git a/apps/worker/src/workers/download.rs b/apps/worker/src/workers/download.rs index db10568..ebf172e 100644 --- a/apps/worker/src/workers/download.rs +++ b/apps/worker/src/workers/download.rs @@ -15,7 +15,7 @@ pub async fn download( let audio_path = match downloader .download_audio_stream_with_quality( &video, - format!("{}.opus", video.id), + format!("{}.ogg", video.id), yt_dlp::model::AudioQuality::Best, yt_dlp::model::AudioCodecPreference::Opus, ) diff --git a/apps/worker/src/workers/play.rs b/apps/worker/src/workers/play.rs index 9a0b56c..5940287 100644 --- a/apps/worker/src/workers/play.rs +++ b/apps/worker/src/workers/play.rs @@ -1,9 +1,11 @@ use std::sync::Arc; use serenity::async_trait; -use songbird::Songbird; -use songbird::events::{Event, EventContext, EventHandler as VoiceEventHandler, TrackEvent}; -use songbird::input::File; +use songbird::{ + Songbird, + events::{Event, EventContext, EventHandler as VoiceEventHandler, TrackEvent}, + input::File, +}; use types::jobs::{JobResponse, PlayJob, PlayResponse}; pub async fn play( @@ -31,18 +33,16 @@ pub async fn play( let mut handler = handler_lock.lock().await; - let src = File::new("output/sQaKWttol58.opus").clone(); + let src = File::new(job.path).clone(); let track_handle = handler.play_input(src.into()); - println!("before info"); + println!("before info {:?}", track_handle); println!("{:?}", track_handle.get_info().await); println!("after info"); - let _ = track_handle.play(); - Ok(JobResponse { content: Some(PlayResponse {}), error: None,