Merge remote-tracking branch 'origin/main' into 19-implement-file-uploads

This commit is contained in:
Ethan Girouard 2024-05-10 12:49:58 -04:00
commit 695f404ba8
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
6 changed files with 116 additions and 4 deletions

View File

@ -8,3 +8,4 @@
!/style !/style
!/Cargo.lock !/Cargo.lock
!/Cargo.toml !/Cargo.toml
!/ascii_art.txt

85
Cargo.lock generated
View File

@ -44,6 +44,21 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.81" version = "1.0.81"
@ -328,6 +343,18 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
dependencies = [
"android-tzdata",
"iana-time-zone",
"num-traits",
"windows-targets 0.52.4",
]
[[package]] [[package]]
name = "ciborium" name = "ciborium"
version = "0.2.2" version = "0.2.2"
@ -434,6 +461,12 @@ dependencies = [
"futures", "futures",
] ]
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.2.12" version = "0.2.12"
@ -625,6 +658,18 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "flexi_logger"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f248c29a6d4bc5d065c9e9068d858761a0dcd796759f7801cc14db35db23abd8"
dependencies = [
"chrono",
"glob",
"log",
"thiserror",
]
[[package]] [[package]]
name = "float-cmp" name = "float-cmp"
version = "0.9.0" version = "0.9.0"
@ -808,6 +853,12 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]] [[package]]
name = "gloo-net" name = "gloo-net"
version = "0.5.0" version = "0.5.0"
@ -977,6 +1028,29 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "iana-time-zone"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "icondata" name = "icondata"
version = "0.3.0" version = "0.3.0"
@ -1513,6 +1587,7 @@ dependencies = [
"diesel", "diesel",
"diesel_migrations", "diesel_migrations",
"dotenv", "dotenv",
"flexi_logger",
"futures", "futures",
"http", "http",
"icondata", "icondata",
@ -1522,6 +1597,7 @@ dependencies = [
"leptos_icons", "leptos_icons",
"leptos_meta", "leptos_meta",
"leptos_router", "leptos_router",
"log",
"multer", "multer",
"openssl", "openssl",
"pbkdf2", "pbkdf2",
@ -3131,6 +3207,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.4",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"

View File

@ -21,7 +21,7 @@ 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"], optional = true }
lazy_static = { version = "1.4.0", optional = true } lazy_static = { version = "1.4.0", optional = true }
serde = { versions = "1.0.195", features = ["derive"] } serde = { version = "1.0.195", features = ["derive"] }
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"] }
diesel_migrations = { version = "2.1.0", optional = true } diesel_migrations = { version = "2.1.0", optional = true }
@ -29,7 +29,7 @@ pbkdf2 = { version = "0.12.2", features = ["simple"], optional = true }
futures = { version = "0.3.30", default-features = false, 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", optional = true }
tower = { veresion = "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 = { version = "0.11", default-features = false }
@ -39,6 +39,8 @@ 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 }
multer = { version = "3.0.0", 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 }
[patch.crates-io] [patch.crates-io]
gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" } gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" }
@ -66,6 +68,8 @@ ssr = [
"axum-login", "axum-login",
"symphonia", "symphonia",
"multer", "multer",
"log",
"flexi_logger",
] ]
# Defines a size-optimized profile for the WASM bundle in release mode # Defines a size-optimized profile for the WASM bundle in release mode

View File

@ -32,6 +32,7 @@ COPY style /app/style
# Minify CSS # Minify CSS
RUN npx tailwindcss -i /app/style/main.scss -o /app/style/main.scss --minify RUN npx tailwindcss -i /app/style/main.scss -o /app/style/main.scss --minify
COPY ascii_art.txt /app/ascii_art.txt
COPY assets /app/assets COPY assets /app/assets
COPY src /app/src COPY src /app/src
COPY migrations /app/migrations COPY migrations /app/migrations

10
ascii_art.txt Normal file
View File

@ -0,0 +1,10 @@
.-=. =+==-.
.=++++. =+++++=.
_ _ _ _______ =++++++= :*++++++=
| | (_) | |__ __| -++++**+. -+**++++-
| | _| |__ _ __ ___| |_ _ _ __ ___ ___ *+++**+ +**+++*
| | | | '_ \| '__/ _ \ | | | | '_ \ / _ \/ __| *+++**+ +**+++*
| |____| | |_) | | | __/ | |_| | | | | __/\__ \ -++++**+-: +**++++-
|______|_|_.__/|_| \___|_|\__,_|_| |_|\___||___/ =++++++**+ -+++++=
.=+++++++=.+++=.
.-==++++---.

View File

@ -23,13 +23,23 @@ async fn main() {
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;
use log::*;
flexi_logger::Logger::try_with_env_or_str("debug").unwrap().format(flexi_logger::opt_format).start().unwrap();
info!("\n{}", include_str!("../ascii_art.txt"));
info!("Starting Leptos server...");
use dotenv::dotenv; use dotenv::dotenv;
dotenv().ok(); dotenv().ok();
debug!("Running database migrations...");
// Bring the database up to date // Bring the database up to date
libretunes::database::migrate(); libretunes::database::migrate();
debug!("Connecting to Redis...");
let redis_url = std::env::var("REDIS_URL").expect("REDIS_URL must be set"); let redis_url = std::env::var("REDIS_URL").expect("REDIS_URL must be set");
let redis_config = RedisConfig::from_url(&redis_url).expect(&format!("Unable to parse Redis URL: {}", redis_url)); let redis_config = RedisConfig::from_url(&redis_url).expect(&format!("Unable to parse Redis URL: {}", redis_url));
let redis_pool = RedisPool::new(redis_config, None, None, None, 1).expect("Unable to create Redis pool"); let redis_pool = RedisPool::new(redis_config, None, None, None, 1).expect("Unable to create Redis pool");
@ -55,9 +65,10 @@ async fn main() {
.fallback(file_and_error_handler) .fallback(file_and_error_handler)
.with_state(leptos_options); .with_state(leptos_options);
println!("listening on http://{}", &addr);
let listener = tokio::net::TcpListener::bind(&addr).await.expect(&format!("Could not bind to {}", &addr)); let listener = tokio::net::TcpListener::bind(&addr).await.expect(&format!("Could not bind to {}", &addr));
info!("Listening on http://{}", &addr);
axum::serve(listener, app.into_make_service()).await.expect("Server failed"); axum::serve(listener, app.into_make_service()).await.expect("Server failed");
} }