Merge branch '40-reduce-dependencies-and-their-features' into 'main'
Reduce dependencies and their features Closes #40 See merge request libretunes/libretunes!27
This commit is contained in:
commit
7bcb5f8c04
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -159,15 +159,11 @@ dependencies = [
|
|||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"serde_path_to_error",
|
|
||||||
"serde_urlencoded",
|
|
||||||
"sync_wrapper 1.0.0",
|
"sync_wrapper 1.0.0",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -188,7 +184,6 @@ dependencies = [
|
|||||||
"sync_wrapper 0.1.2",
|
"sync_wrapper 0.1.2",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1588,7 +1583,6 @@ dependencies = [
|
|||||||
"diesel_migrations",
|
"diesel_migrations",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"flexi_logger",
|
"flexi_logger",
|
||||||
"futures",
|
|
||||||
"http",
|
"http",
|
||||||
"icondata",
|
"icondata",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -1609,7 +1603,6 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
"tower-sessions",
|
|
||||||
"tower-sessions-redis-store",
|
"tower-sessions-redis-store",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@ -2337,16 +2330,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_path_to_error"
|
|
||||||
version = "0.1.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6"
|
|
||||||
dependencies = [
|
|
||||||
"itoa",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_qs"
|
name = "serde_qs"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
@ -2376,18 +2359,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_urlencoded"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"itoa",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn"
|
name = "server_fn"
|
||||||
version = "0.6.11"
|
version = "0.6.11"
|
||||||
|
31
Cargo.toml
31
Cargo.toml
@ -8,33 +8,31 @@ build = "src/build.rs"
|
|||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
console_error_panic_hook = "0.1"
|
console_error_panic_hook = { version = "0.1", optional = true }
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
http = "1.0"
|
http = { version = "1.0", default-features = false }
|
||||||
leptos = { version = "0.6", features = ["nightly"] }
|
leptos = { version = "0.6", default-features = false, features = ["nightly"] }
|
||||||
leptos_meta = { version = "0.6", features = ["nightly"] }
|
leptos_meta = { version = "0.6", features = ["nightly"] }
|
||||||
leptos_axum = { version = "0.6", optional = true }
|
leptos_axum = { version = "0.6", optional = true }
|
||||||
leptos_router = { version = "0.6", features = ["nightly"] }
|
leptos_router = { version = "0.6", features = ["nightly"] }
|
||||||
wasm-bindgen = "=0.2.92"
|
wasm-bindgen = { version = "=0.2.92", default-features = false, optional = true }
|
||||||
leptos_icons = { version = "0.3.0" }
|
leptos_icons = { version = "0.3.0" }
|
||||||
icondata = { version = "0.3.0" }
|
icondata = { version = "0.3.0" }
|
||||||
dotenv = { version = "0.15.0", optional = true }
|
dotenv = { version = "0.15.0", optional = true }
|
||||||
diesel = { version = "2.1.4", features = ["postgres", "r2d2", "time"], optional = true }
|
diesel = { version = "2.1.4", features = ["postgres", "r2d2", "time"], default-features = false, optional = true }
|
||||||
lazy_static = { version = "1.4.0", optional = true }
|
lazy_static = { version = "1.4.0", optional = true }
|
||||||
serde = { version = "1.0.195", features = ["derive"] }
|
serde = { version = "1.0.195", features = ["derive"], default-features = false }
|
||||||
openssl = { version = "0.10.63", optional = true }
|
openssl = { version = "0.10.63", optional = true }
|
||||||
time = { version = "0.3.34", features = ["serde"] }
|
time = { version = "0.3.34", features = ["serde"], default-features = false }
|
||||||
diesel_migrations = { version = "2.1.0", optional = true }
|
diesel_migrations = { version = "2.1.0", optional = true }
|
||||||
pbkdf2 = { version = "0.12.2", features = ["simple"], optional = true }
|
pbkdf2 = { version = "0.12.2", features = ["simple"], optional = true }
|
||||||
futures = { version = "0.3.30", default-features = false, optional = true }
|
|
||||||
tokio = { version = "1", optional = true, features = ["rt-multi-thread"] }
|
tokio = { version = "1", optional = true, features = ["rt-multi-thread"] }
|
||||||
axum = { version = "0.7.5", optional = true }
|
axum = { version = "0.7.5", features = ["tokio", "http1"], default-features = false, optional = true }
|
||||||
tower = { version = "0.4.13", optional = true }
|
tower = { version = "0.4.13", optional = true }
|
||||||
tower-http = { version = "0.5", optional = true, features = ["fs"] }
|
tower-http = { version = "0.5", optional = true, features = ["fs"] }
|
||||||
thiserror = "1.0.57"
|
thiserror = "1.0.57"
|
||||||
tower-sessions = { version = "0.11", default-features = false }
|
|
||||||
tower-sessions-redis-store = { version = "0.11", optional = true }
|
tower-sessions-redis-store = { version = "0.11", optional = true }
|
||||||
async-trait = "0.1.79"
|
async-trait = { version = "0.1.79", optional = true }
|
||||||
axum-login = { version = "0.14.0", optional = true }
|
axum-login = { version = "0.14.0", optional = true }
|
||||||
server_fn = { version = "0.6.11", features = ["multipart"] }
|
server_fn = { version = "0.6.11", features = ["multipart"] }
|
||||||
symphonia = { version = "0.5.4", default-features = false, features = ["mp3"], optional = true }
|
symphonia = { version = "0.5.4", default-features = false, features = ["mp3"], optional = true }
|
||||||
@ -47,8 +45,13 @@ web-sys = "0.3.69"
|
|||||||
gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" }
|
gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"]
|
hydrate = [
|
||||||
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
|
"leptos/hydrate",
|
||||||
|
"leptos_meta/hydrate",
|
||||||
|
"leptos_router/hydrate",
|
||||||
|
"console_error_panic_hook",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
ssr = [
|
ssr = [
|
||||||
"dep:leptos_axum",
|
"dep:leptos_axum",
|
||||||
"leptos/ssr",
|
"leptos/ssr",
|
||||||
@ -60,12 +63,12 @@ ssr = [
|
|||||||
"openssl",
|
"openssl",
|
||||||
"diesel_migrations",
|
"diesel_migrations",
|
||||||
"pbkdf2",
|
"pbkdf2",
|
||||||
"futures",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"axum",
|
"axum",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
"tower-sessions-redis-store",
|
"tower-sessions-redis-store",
|
||||||
|
"async-trait",
|
||||||
"axum-login",
|
"axum-login",
|
||||||
"symphonia",
|
"symphonia",
|
||||||
"multer",
|
"multer",
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
use async_trait::async_trait;
|
|
||||||
use axum_login::{AuthnBackend, AuthUser, UserId};
|
use axum_login::{AuthnBackend, AuthUser, UserId};
|
||||||
use crate::users::UserCredentials;
|
use crate::users::UserCredentials;
|
||||||
use leptos::server_fn::error::ServerFnErrorErr;
|
use leptos::server_fn::error::ServerFnErrorErr;
|
||||||
|
|
||||||
use crate::models::User;
|
use crate::models::User;
|
||||||
|
|
||||||
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
|
cfg_if! {
|
||||||
|
if #[cfg(feature = "ssr")] {
|
||||||
|
use async_trait::async_trait;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AuthUser for User {
|
impl AuthUser for User {
|
||||||
type Id = i32;
|
type Id = i32;
|
||||||
|
|
||||||
|
19
src/main.rs
19
src/main.rs
@ -19,7 +19,7 @@ async fn main() {
|
|||||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
use libretunes::app::*;
|
use libretunes::app::*;
|
||||||
use libretunes::fileserv::{file_and_error_handler, get_static_file};
|
use libretunes::fileserv::{file_and_error_handler, get_static_file};
|
||||||
use tower_sessions::SessionManagerLayer;
|
use axum_login::tower_sessions::SessionManagerLayer;
|
||||||
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
|
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
|
||||||
use axum_login::AuthManagerLayerBuilder;
|
use axum_login::AuthManagerLayerBuilder;
|
||||||
use libretunes::auth_backend::AuthBackend;
|
use libretunes::auth_backend::AuthBackend;
|
||||||
@ -72,24 +72,9 @@ async fn main() {
|
|||||||
axum::serve(listener, app.into_make_service()).await.expect("Server failed");
|
axum::serve(listener, app.into_make_service()).await.expect("Server failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "ssr", feature = "csr")))]
|
#[cfg(not(feature = "ssr"))]
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
// no client-side main function
|
// no client-side main function
|
||||||
// unless we want this to work with e.g., Trunk for pure client-side testing
|
// unless we want this to work with e.g., Trunk for pure client-side testing
|
||||||
// see lib.rs for hydration function instead
|
// see lib.rs for hydration function instead
|
||||||
// see optional feature `csr` instead
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(not(feature = "ssr"), feature = "csr"))]
|
|
||||||
pub fn main() {
|
|
||||||
// a client-side main function is required for using `trunk serve`
|
|
||||||
// prefer using `cargo leptos serve` instead
|
|
||||||
// to run: `trunk serve --open --features csr`
|
|
||||||
use leptos::*;
|
|
||||||
use libretunes::app::*;
|
|
||||||
use wasm_bindgen::prelude::wasm_bindgen;
|
|
||||||
|
|
||||||
console_error_panic_hook::set_once();
|
|
||||||
|
|
||||||
leptos::mount_to_body(App);
|
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ pub async fn search(query: String, limit: i64) -> Result<(Vec<Album>, Vec<Artist
|
|||||||
let artists = search_artists(query.clone(), limit);
|
let artists = search_artists(query.clone(), limit);
|
||||||
let songs = search_songs(query.clone(), limit);
|
let songs = search_songs(query.clone(), limit);
|
||||||
|
|
||||||
use futures::join;
|
use tokio::join;
|
||||||
|
|
||||||
let (albums, artists, songs) = join!(albums, artists, songs);
|
let (albums, artists, songs) = join!(albums, artists, songs);
|
||||||
Ok((albums?, artists?, songs?))
|
Ok((albums?, artists?, songs?))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user