Compare commits
4 Commits
release-20
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e36c28c0d | ||
|
|
6530e20af2 | ||
|
|
32f4946530 | ||
|
|
619951fa1c |
@@ -21,6 +21,21 @@ impl Db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run_migrations(&self) -> Result<()> {
|
async fn run_migrations(&self) -> Result<()> {
|
||||||
|
// WAL mode - enables concurrent reads while writing
|
||||||
|
sqlx::query("PRAGMA journal_mode=WAL")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// NORMAL synchronous - faster than FULL, still safe enough
|
||||||
|
sqlx::query("PRAGMA synchronous=NORMAL")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// 5 second busy timeout - reduces "database locked" errors
|
||||||
|
sqlx::query("PRAGMA busy_timeout=5000")
|
||||||
|
.execute(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
sqlx::migrate!("./migrations").run(&self.pool).await?;
|
sqlx::migrate!("./migrations").run(&self.pool).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,13 +118,8 @@ pub async fn send_push_notification(
|
|||||||
|
|
||||||
let client = HyperWebPushClient::new();
|
let client = HyperWebPushClient::new();
|
||||||
|
|
||||||
// Get VAPID keys from environment or use defaults
|
let vapid_private_key = std::env::var("VAPID_PRIVATE_KEY").expect("VAPID_PRIVATE_KEY must be set in .env");
|
||||||
let _vapid_public_key = std::env::var("VAPID_PUBLIC_KEY")
|
let vapid_email = std::env::var("VAPID_EMAIL").expect("VAPID_EMAIL must be set in .env");
|
||||||
.unwrap_or_else(|_| "BEdPj6XQR7MGzM28Nev9wokF5upHoydNDahouJbQ9ZdBJpEFAN1iNfANSEvY0ItasNY5zcvvqN_tjUt64Rfd0gU".to_string());
|
|
||||||
let vapid_private_key = std::env::var("VAPID_PRIVATE_KEY")
|
|
||||||
.unwrap_or_else(|_| "aUcCYJ7kUd9UClCaWwad0IVgbYJ6svwl19MjSX7GH10".to_string());
|
|
||||||
let vapid_email = std::env::var("VAPID_EMAIL")
|
|
||||||
.unwrap_or_else(|_| "mailto:admin@vibetorrent.app".to_string());
|
|
||||||
|
|
||||||
for subscription in subscriptions {
|
for subscription in subscriptions {
|
||||||
let subscription_info = SubscriptionInfo {
|
let subscription_info = SubscriptionInfo {
|
||||||
@@ -166,6 +161,5 @@ pub async fn send_push_notification(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_vapid_public_key() -> String {
|
pub fn get_vapid_public_key() -> String {
|
||||||
std::env::var("VAPID_PUBLIC_KEY")
|
std::env::var("VAPID_PUBLIC_KEY").expect("VAPID_PUBLIC_KEY must be set in .env")
|
||||||
.unwrap_or_else(|_| "BEdPj6XQR7MGzM28Nev9wokF5upHoydNDahouJbQ9ZdBJpEFAN1iNfANSEvY0ItasNY5zcvvqN_tjUt64Rfd0gU".to_string())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ fn format_duration(seconds: i64) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn format_date(timestamp: i64) -> String {
|
fn format_date(timestamp: i64) -> String {
|
||||||
|
if timestamp <= 0 {
|
||||||
|
return "N/A".to_string();
|
||||||
|
}
|
||||||
let dt = chrono::DateTime::from_timestamp(timestamp, 0);
|
let dt = chrono::DateTime::from_timestamp(timestamp, 0);
|
||||||
match dt {
|
match dt {
|
||||||
Some(dt) => dt.format("%d/%m/%Y %H:%M").to_string(),
|
Some(dt) => dt.format("%d/%m/%Y %H:%M").to_string(),
|
||||||
|
|||||||
@@ -11,11 +11,15 @@ use app::App;
|
|||||||
#[wasm_bindgen(start)]
|
#[wasm_bindgen(start)]
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
console_log::init_with_level(log::Level::Debug).unwrap();
|
console_log::init_with_level(log::Level::Debug)
|
||||||
|
.expect("Failed to initialize logging");
|
||||||
|
|
||||||
let window = web_sys::window().unwrap();
|
let window = web_sys::window()
|
||||||
let document = window.document().unwrap();
|
.expect("Failed to access window - browser may not be fully loaded");
|
||||||
let body = document.body().unwrap();
|
let document = window.document()
|
||||||
|
.expect("Failed to access document");
|
||||||
|
let body = document.body()
|
||||||
|
.expect("Failed to access document body");
|
||||||
|
|
||||||
// Add app-loaded class to body to hide spinner via CSS
|
// Add app-loaded class to body to hide spinner via CSS
|
||||||
let _ = body.class_list().add_1("app-loaded");
|
let _ = body.class_list().add_1("app-loaded");
|
||||||
|
|||||||
Reference in New Issue
Block a user