diff --git a/pages/search.vue b/pages/search.vue index a8b3674..02ff23c 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -29,15 +29,12 @@ const { $music, $settings } = useNuxtApp(); const searchTerm = ref(""); const searchResults = ref([]); -const isLoading = ref(false); let searchTimeout: ReturnType; async function searchSongs() { - isLoading.value = true; if (searchTerm.value === "") { searchResults.value = []; - isLoading.value = false; return; } @@ -61,8 +58,6 @@ async function searchSongs() { console.error("Failed to fetch songs:", error, apiURL, searchTerm.value); searchResults.value = []; } - - isLoading.value = false; } function handleInput() { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index fccc2ac..6dedc27 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1272,7 +1272,7 @@ dependencies = [ "rustc_version", "toml 0.8.12", "vswhom", - "winreg 0.52.0", + "winreg", ] [[package]] @@ -1994,25 +1994,6 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.2.6", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.4" @@ -2024,7 +2005,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 1.1.0", + "http", "indexmap 2.2.6", "slab", "tokio", @@ -2134,17 +2115,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa 1.0.11", -] - [[package]] name = "http" version = "1.1.0" @@ -2156,17 +2126,6 @@ dependencies = [ "itoa 1.0.11", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.0" @@ -2174,7 +2133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http 1.1.0", + "http", ] [[package]] @@ -2185,8 +2144,8 @@ checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", "futures-core", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "pin-project-lite", ] @@ -2196,36 +2155,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa 1.0.11", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.3.1" @@ -2235,9 +2164,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.4", - "http 1.1.0", - "http-body 1.0.0", + "h2", + "http", + "http-body", "httparse", "itoa 1.0.11", "pin-project-lite", @@ -2253,8 +2182,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.3.1", + "http", + "hyper", "hyper-util", "rustls", "rustls-pki-types", @@ -2263,19 +2192,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.28", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -2284,7 +2200,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.3.1", + "hyper", "hyper-util", "native-tls", "tokio", @@ -2301,9 +2217,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "hyper 1.3.1", + "http", + "http-body", + "hyper", "pin-project-lite", "socket2", "tokio", @@ -2895,16 +2811,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -3993,67 +3899,25 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "async-compression", - "base64 0.21.7", + "base64 0.22.0", "bytes", "cookie", "cookie_store", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", - "hyper-tls 0.5.0", - "ipnet", - "js-sys", - "log", - "mime", - "mime_guess", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile 1.0.4", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg 0.50.0", -] - -[[package]] -name = "reqwest" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e6cc1e89e689536eb5aeede61520e874df5a4707df811cd5da4aa5fbb2aae19" -dependencies = [ - "base64 0.22.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.4.4", - "http 1.1.0", - "http-body 1.0.0", + "h2", + "http", + "http-body", "http-body-util", - "hyper 1.3.1", + "hyper", "hyper-rustls", - "hyper-tls 0.6.0", + "hyper-tls", "hyper-util", "ipnet", "js-sys", @@ -4064,7 +3928,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls", - "rustls-pemfile 2.1.2", + "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", @@ -4082,42 +3946,41 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg 0.52.0", + "winreg", ] [[package]] name = "reqwest-middleware" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" +checksum = "a45d100244a467870f6cb763c4484d010a6bed6bd610b3676e3825d93fb4cfbd" dependencies = [ "anyhow", "async-trait", - "http 0.2.12", - "reqwest 0.11.27", + "http", + "reqwest", "serde", - "task-local-extensions", "thiserror", + "tower-service", ] [[package]] name = "reqwest-retry" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadced6a67c5c2d1c819cc2d7e6ddf066f32b9b6a04f8866203ceeb44b79c37f" +checksum = "40f342894422862af74c50e1e9601cf0931accc9c6981e5eb413c46603b616b5" dependencies = [ "anyhow", "async-trait", "chrono", "futures", "getrandom 0.2.14", - "http 0.2.12", - "hyper 0.14.28", + "http", + "hyper", "parking_lot 0.11.2", - "reqwest 0.11.27", + "reqwest", "reqwest-middleware", "retry-policies", - "task-local-extensions", "tokio", "tracing", "wasm-timer", @@ -4241,15 +4104,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -4285,9 +4139,9 @@ checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "rusty_ytdl" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fbc9dd1bcc9a127dc0d85b0c289c3624e30dd10fb46cfc8adea7950798ede6" +checksum = "ad6999f80c14e0325c3e19178ecfe70cc3834e96fbea8f4581fd356ab7752c62" dependencies = [ "aes", "async-trait", @@ -4302,7 +4156,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "regex", - "reqwest 0.11.27", + "reqwest", "reqwest-middleware", "reqwest-retry", "scraper", @@ -4311,7 +4165,6 @@ dependencies = [ "serde_qs", "thiserror", "tokio", - "unicode-segmentation", "url", "urlencoding", ] @@ -4473,18 +4326,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.201" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -4504,9 +4357,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa 1.0.11", "ryu", @@ -4515,9 +4368,9 @@ dependencies = [ [[package]] name = "serde_qs" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0431a35568651e363364210c91983c1da5eb29404d9f0928b67d4ebcfa7d330c" +checksum = "cd34f36fe4c5ba9654417139a9b3a20d2e1de6012ee678ad14d240c22c78d8d6" dependencies = [ "percent-encoding", "serde", @@ -5259,15 +5112,6 @@ version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" -[[package]] -name = "task-local-extensions" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" -dependencies = [ - "pin-utils", -] - [[package]] name = "tauri" version = "2.0.0-beta.17" @@ -5285,7 +5129,7 @@ dependencies = [ "glob", "gtk", "heck 0.5.0", - "http 1.1.0", + "http", "jni", "libc", "log", @@ -5294,7 +5138,7 @@ dependencies = [ "objc", "percent-encoding", "raw-window-handle 0.6.0", - "reqwest 0.12.3", + "reqwest", "serde", "serde_json", "serde_repr", @@ -5451,9 +5295,9 @@ dependencies = [ [[package]] name = "tauri-plugin-os" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dc0a2037ef113d9d9db85edceab6f95f83ae111e4d989d6bc1df79c8ab4cf" +checksum = "653c0dbf5f954c7614a5e93f5b548bbe4417b3e1aa553b31ed0b6a2656949459" dependencies = [ "gethostname", "log", @@ -5495,10 +5339,10 @@ dependencies = [ "dirs-next", "flate2", "futures-util", - "http 1.1.0", + "http", "infer", "minisign-verify", - "reqwest 0.12.3", + "reqwest", "semver", "serde", "serde_json", @@ -5537,7 +5381,7 @@ checksum = "148b6e6aff8e63fe5d4ae1d50159d50cfc0b4309abdeca64833c887c6b5631ef" dependencies = [ "dpi", "gtk", - "http 1.1.0", + "http", "jni", "raw-window-handle 0.6.0", "serde", @@ -5556,7 +5400,7 @@ checksum = "398d065c6e0fbf3c4304583759b6e153bc1e0daeb033bede6834ebe4df371fc3" dependencies = [ "cocoa", "gtk", - "http 1.1.0", + "http", "jni", "log", "percent-encoding", @@ -5654,18 +5498,18 @@ checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b" [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -6080,15 +5924,6 @@ dependencies = [ "unic-common", ] -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -6218,14 +6053,14 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vleer" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "discord-ipc-rp", "dotenv", "lazy_static", "regex", - "reqwest 0.12.3", + "reqwest", "rusty_ytdl", "serde_json", "tauri", @@ -6902,16 +6737,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "winreg" version = "0.52.0" @@ -6950,7 +6775,7 @@ dependencies = [ "gdkx11", "gtk", "html5ever", - "http 1.1.0", + "http", "javascriptcore-rs", "jni", "kuchikiki", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0178c95..bd57aa6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vleer" -version = "0.1.0" +version = "0.1.1" description = "Vleer" authors = ["pandadev", "waradu"] edition = "2021" @@ -26,7 +26,7 @@ anyhow = "1.0" discord-ipc-rp = "0.1.1" dotenv = "0.15.0" reqwest = "0.12.3" -rusty_ytdl = "0.7.1" +rusty_ytdl = "0.7.2" regex = "1.10.4" [features] diff --git a/src-tauri/src/discord_rpc.rs b/src-tauri/src/discord_rpc.rs index 866ab0e..6734058 100644 --- a/src-tauri/src/discord_rpc.rs +++ b/src-tauri/src/discord_rpc.rs @@ -65,7 +65,7 @@ pub fn update_activity( } thread::spawn(move || { - let mut drpc = DRPC_CLIENT.lock().map_err(|e| e.to_string()); + let drpc = DRPC_CLIENT.lock().map_err(|e| e.to_string()); if let Ok(mut drpc) = drpc { if let Some(ref mut client) = *drpc { let mut activity_builder = activity::Activity::new() diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index cb4f8c2..c97946b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -14,9 +14,8 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags, WindowExt}; fn main() { let _ = discord_rpc::connect_rpc(); - let migration_v1 = format!( - r#" - CREATE TABLE songs ( + let migration_v1 = r#" + CREATE TABLE IF NOT EXISTS songs ( id TEXT PRIMARY KEY, title TEXT, artist TEXT, @@ -25,45 +24,41 @@ fn main() { date_added TEXT, last_played TEXT ); - CREATE TABLE playlists ( + CREATE TABLE IF NOT EXISTS playlists ( id TEXT PRIMARY KEY, name TEXT, date TEXT, cover TEXT, songs TEXT ); - {} - {} - "#, - migration::generate_songs_insert_sql(), - migration::generate_playlists_insert_sql(), - ); + "#; - let migration_v2 = format!( - r#" - CREATE TABLE settings ( + let migration_v2 = r#" + CREATE TABLE IF NOT EXISTS settings ( key TEXT PRIMARY KEY, value TEXT ); - {} - "#, - migration::generate_settings_insert_sql(), + "#; + + let migration_v1_data = format!( + "{}\n{}", + migration::generate_songs_insert_sql(), + migration::generate_playlists_insert_sql() ); - let sql_commands_v1 = Box::leak(Box::new(migration_v1)); - let sql_commands_v2 = Box::leak(Box::new(migration_v2)); + let migration_v2_data = migration::generate_settings_insert_sql(); let migrations = vec![ Migration { version: 1, description: "create_songs_and_playlists_tables", - sql: sql_commands_v1, + sql: Box::leak(format!("{}\n{}", migration_v1, migration_v1_data).into_boxed_str()), kind: MigrationKind::Up, }, Migration { version: 2, description: "create_settings_table", - sql: sql_commands_v2, + sql: Box::leak(format!("{}\n{}", migration_v2, migration_v2_data).into_boxed_str()), kind: MigrationKind::Up, }, ]; diff --git a/src-tauri/src/migration.rs b/src-tauri/src/migration.rs index 0fee355..52131a6 100644 --- a/src-tauri/src/migration.rs +++ b/src-tauri/src/migration.rs @@ -59,6 +59,7 @@ pub fn generate_playlists_insert_sql() -> String { inserts.join("\n") } + fn load_settings_json() -> Option { let path = commands::get_config_path().join("settings.json"); if !path.exists() { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 54f4000..4639578 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "Vleer", - "version": "0.1.0", + "version": "0.1.1", "identifier": "app.vleer", "build": { "beforeDevCommand": "pnpm nuxt dev",