diff --git a/Cargo.lock b/Cargo.lock index 5b2514e..9f4f793 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,6 +71,12 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "async-recursion" version = "1.1.0" @@ -259,6 +265,12 @@ version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +[[package]] +name = "bytemuck" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" + [[package]] name = "byteorder" version = "1.5.0" @@ -1586,9 +1598,12 @@ dependencies = [ "leptos_meta", "leptos_router", "log", + "multer", "openssl", "pbkdf2", "serde", + "server_fn", + "symphonia", "thiserror", "time", "tokio", @@ -1597,6 +1612,7 @@ dependencies = [ "tower-sessions", "tower-sessions-redis-store", "wasm-bindgen", + "web-sys", ] [[package]] @@ -2374,9 +2390,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15a46a2ffdecb81430ecfb995989218a18b6e94c1ead50cb806b5927c986a8ce" +checksum = "536a5b959673643ee01e59ae41bf01425482c8070dee95d7061ee2d45296b59c" dependencies = [ "axum", "bytes", @@ -2390,6 +2406,7 @@ dependencies = [ "hyper", "inventory", "js-sys", + "multer", "once_cell", "send_wrapper", "serde", @@ -2495,6 +2512,55 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "symphonia" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "815c942ae7ee74737bb00f965fa5b5a2ac2ce7b6c01c0cc169bbeaf7abd5f5a9" +dependencies = [ + "lazy_static", + "symphonia-bundle-mp3", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c01c2aae70f0f1fb096b6f0ff112a930b1fb3626178fba3ae68b09dce71706d4" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-core" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "798306779e3dc7d5231bd5691f5a813496dc79d3f56bf82e25789f2094e022c3" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc622b9841a10089c5b18e99eb904f4341615d5aa55bbf4eedde1be721a4023c" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index 52ad1ad..638bbe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,8 +36,12 @@ tower-sessions = { version = "0.11", default-features = false } tower-sessions-redis-store = { version = "0.11", optional = true } async-trait = "0.1.79" axum-login = { version = "0.14.0", optional = true } +server_fn = { version = "0.6.11", features = ["multipart"] } +symphonia = { version = "0.5.4", default-features = false, features = ["mp3"], optional = true } +multer = { version = "3.0.0", optional = true } log = { version = "0.4.21", optional = true } flexi_logger = { version = "0.28.0", optional = true, default-features = false } +web-sys = "0.3.69" [patch.crates-io] gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" } @@ -63,6 +67,8 @@ ssr = [ "tower-http", "tower-sessions-redis-store", "axum-login", + "symphonia", + "multer", "log", "flexi_logger", ] diff --git a/src/app.rs b/src/app.rs index c7b7fe4..67a6c7a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -16,6 +16,7 @@ pub fn App() -> impl IntoView { let play_status = PlayStatus::default(); let play_status = create_rw_signal(play_status); + let upload_open = create_rw_signal(false); view! { // injects a stylesheet into the document @@ -36,7 +37,7 @@ pub fn App() -> impl IntoView { }>
- }> + }> @@ -53,13 +54,15 @@ use crate::components::sidebar::*; use crate::components::dashboard::*; use crate::components::search::*; use crate::components::personal::*; +use crate::components::upload::*; /// Renders the home page of your application. #[component] -fn HomePage(play_status: RwSignal) -> impl IntoView { +fn HomePage(play_status: RwSignal, upload_open: RwSignal) -> impl IntoView { view! {
- + + // This will render the child route components diff --git a/src/components.rs b/src/components.rs index 4d0c8a5..ede9b31 100644 --- a/src/components.rs +++ b/src/components.rs @@ -1,4 +1,5 @@ pub mod sidebar; pub mod dashboard; pub mod search; -pub mod personal; \ No newline at end of file +pub mod personal; +pub mod upload; diff --git a/src/components/sidebar.rs b/src/components/sidebar.rs index 0621704..91c3a44 100644 --- a/src/components/sidebar.rs +++ b/src/components/sidebar.rs @@ -1,9 +1,10 @@ use leptos::leptos_dom::*; use leptos::*; use leptos_icons::*; +use crate::components::upload::*; #[component] -pub fn Sidebar() -> impl IntoView { +pub fn Sidebar(upload_open: RwSignal) -> impl IntoView { use leptos_router::use_location; let location = use_location(); @@ -19,6 +20,7 @@ pub fn Sidebar() -> impl IntoView {