Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor: remove in-app auto-update mechanism and notify users to download updates from GitHub
Samir Hossains7a733d4a6b61
diff --git a/Cargo.lock b/Cargo.lockindex a435b26..6ca0b5c 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -61,9 +61,6 @@ name = "arbitrary"version = "1.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"-dependencies = [- "derive_arbitrary",-][[package]]name = "arg_enum_proc_macro"@@ -194,12 +191,6 @@ dependencies = ["vsimd",]-[[package]]-name = "base64ct"-version = "1.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"-[[package]]name = "bit-set"version = "0.5.3"@@ -417,24 +408,6 @@ dependencies = ["static_assertions",]-[[package]]-name = "console"-version = "0.16.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c"-dependencies = [- "encode_unicode",- "libc",- "unicode-width",- "windows-sys 0.61.2",-]--[[package]]-name = "const-oid"-version = "0.9.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"-[[package]]name = "const-oid"version = "0.10.2"@@ -450,35 +423,6 @@ dependencies = ["unicode-segmentation",]-[[package]]-name = "cookie"-version = "0.18.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"-dependencies = [- "percent-encoding",- "time",- "version_check",-]--[[package]]-name = "cookie_store"-version = "0.22.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3fc4bff745c9b4c7fb1e97b25d13153da2bc7796260141df62378998d070207f"-dependencies = [- "cookie",- "document-features",- "idna",- "indexmap",- "log",- "serde",- "serde_derive",- "serde_json",- "time",- "url",-]-[[package]]name = "core-foundation"version = "0.10.1"@@ -648,33 +592,6 @@ dependencies = ["cmov",]-[[package]]-name = "curve25519-dalek"-version = "4.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"-dependencies = [- "cfg-if",- "cpufeatures 0.2.17",- "curve25519-dalek-derive",- "digest 0.10.7",- "fiat-crypto",- "rustc_version",- "subtle",- "zeroize",-]--[[package]]-name = "curve25519-dalek-derive"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]-[[package]]name = "darling"version = "0.20.11"@@ -716,33 +633,12 @@ version = "0.3.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4"-[[package]]-name = "der"-version = "0.7.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"-dependencies = [- "const-oid 0.9.6",- "zeroize",-]-[[package]]name = "deranged"version = "0.5.8"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"-[[package]]-name = "derive_arbitrary"-version = "1.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]-[[package]]name = "derive_more"version = "2.1.1"@@ -782,7 +678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"dependencies = ["block-buffer 0.12.1",- "const-oid 0.10.2",+ "const-oid","crypto-common 0.2.2","ctutils",]@@ -849,31 +745,6 @@ version = "1.0.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"-[[package]]-name = "ed25519"-version = "2.2.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"-dependencies = [- "pkcs8",- "signature",-]--[[package]]-name = "ed25519-dalek"-version = "2.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"-dependencies = [- "curve25519-dalek",- "ed25519",- "serde",- "sha2",- "signature",- "subtle",- "zeroize",-]-[[package]]name = "ego-tree"version = "0.10.0"@@ -886,21 +757,6 @@ version = "1.17.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"-[[package]]-name = "encode_unicode"-version = "1.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"--[[package]]-name = "encoding_rs"-version = "0.8.35"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"-dependencies = [- "cfg-if",-]-[[package]]name = "equator"version = "0.4.2"@@ -979,12 +835,6 @@ version = "1.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1"-[[package]]-name = "fastrand"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"-[[package]]name = "fax"version = "0.2.7"@@ -1000,12 +850,6 @@ dependencies = ["simd-adler32",]-[[package]]-name = "fiat-crypto"-version = "0.2.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"-[[package]]name = "filedescriptor"version = "0.8.3"@@ -1017,16 +861,6 @@ dependencies = ["winapi",]-[[package]]-name = "filetime"-version = "0.2.29"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"-dependencies = [- "cfg-if",- "libc",-]-[[package]]name = "find-msvc-tools"version = "0.1.9"@@ -1263,25 +1097,6 @@ dependencies = ["weezl",]-[[package]]-name = "h2"-version = "0.4.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"-dependencies = [- "atomic-waker",- "bytes",- "fnv",- "futures-core",- "futures-sink",- "http",- "indexmap",- "slab",- "tokio",- "tokio-util",- "tracing",-]-[[package]]name = "half"version = "2.7.1"@@ -1405,7 +1220,6 @@ dependencies = ["bytes","futures-channel","futures-core",- "h2","http","http-body","httparse",@@ -1612,29 +1426,6 @@ version = "1.12.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"-[[package]]-name = "indexmap"-version = "2.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"-dependencies = [- "equivalent",- "hashbrown 0.17.1",-]--[[package]]-name = "indicatif"-version = "0.18.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c"-dependencies = [- "console",- "portable-atomic",- "unicode-width",- "unit-prefix",- "web-time",-]-[[package]]name = "indoc"version = "2.0.7"@@ -2015,7 +1806,7 @@ dependencies = ["ratatui-image","reqwest","scraper",- "self_update",+ "semver","serde","serde_json","thiserror 2.0.19",@@ -2372,16 +2163,6 @@ version = "0.2.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"-[[package]]-name = "pkcs8"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"-dependencies = [- "der",- "spki",-]-[[package]]name = "pkg-config"version = "0.3.33"@@ -2529,15 +2310,6 @@ version = "2.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"-[[package]]-name = "quick-xml"-version = "0.38.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c"-dependencies = [- "memchr",-]-[[package]]name = "quinn"version = "0.11.11"@@ -2999,7 +2771,6 @@ dependencies = ["futures-channel","futures-core","futures-util",- "h2","http","http-body","http-body-util",@@ -3096,9 +2867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"dependencies = ["aws-lc-rs",- "log","once_cell",- "ring","rustls-pki-types","rustls-webpki","subtle",@@ -3268,47 +3037,12 @@ dependencies = ["smallvec",]-[[package]]-name = "self-replace"-version = "1.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "03ec815b5eab420ab893f63393878d89c90fdd94c0bcc44c07abb8ad95552fb7"-dependencies = [- "fastrand",- "tempfile",- "windows-sys 0.52.0",-]-[[package]]name = "self_cell"version = "1.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813"-[[package]]-name = "self_update"-version = "0.44.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2e79722b5a505d4ddc77527455a97244e9e8c4c07533ff44cf4421cce7bb6d17"-dependencies = [- "http",- "indicatif",- "log",- "quick-xml",- "regex",- "reqwest",- "self-replace",- "semver",- "serde",- "serde_json",- "tar",- "tempfile",- "ureq",- "urlencoding",- "zip",- "zipsign-api",-]-[[package]]name = "semver"version = "1.0.28"@@ -3415,16 +3149,6 @@ dependencies = ["libc",]-[[package]]-name = "signature"-version = "2.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"-dependencies = [- "digest 0.10.7",- "rand_core 0.6.4",-]-[[package]]name = "simd-adler32"version = "0.3.10"@@ -3484,27 +3208,6 @@ dependencies = ["windows-sys 0.61.2",]-[[package]]-name = "socks"-version = "0.3.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b"-dependencies = [- "byteorder",- "libc",- "winapi",-]--[[package]]-name = "spki"-version = "0.7.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"-dependencies = [- "base64ct",- "der",-]-[[package]]name = "stable_deref_trait"version = "1.2.1"@@ -3634,30 +3337,6 @@ version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"-[[package]]-name = "tar"-version = "0.4.46"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"-dependencies = [- "filetime",- "libc",- "xattr",-]--[[package]]-name = "tempfile"-version = "3.27.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"-dependencies = [- "fastrand",- "getrandom 0.4.3",- "once_cell",- "rustix 1.1.4",- "windows-sys 0.61.2",-]-[[package]]name = "tendril"version = "0.4.3"@@ -3812,7 +3491,6 @@ dependencies = ["powerfmt","serde_core","time-core",- "time-macros",][[package]]@@ -3821,16 +3499,6 @@ version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"-[[package]]-name = "time-macros"-version = "0.2.32"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85"-dependencies = [- "num-conv",- "time-core",-]-[[package]]name = "tinystr"version = "0.8.3"@@ -3873,13 +3541,13 @@ dependencies = [[[package]]name = "tokio-macros"-version = "2.7.1"+version = "2.7.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba"+checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"dependencies = ["proc-macro2","quote",- "syn 2.0.119",+ "syn 3.0.3",][[package]]@@ -3892,20 +3560,6 @@ dependencies = ["tokio",]-[[package]]-name = "tokio-util"-version = "0.7.19"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"-dependencies = [- "bytes",- "futures-core",- "futures-sink",- "libc",- "pin-project-lite",- "tokio",-]-[[package]]name = "tower"version = "0.5.3"@@ -4017,52 +3671,12 @@ version = "0.2.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"-[[package]]-name = "unit-prefix"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3"-[[package]]name = "untrusted"version = "0.9.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"-[[package]]-name = "ureq"-version = "3.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0"-dependencies = [- "base64",- "cookie_store",- "encoding_rs",- "flate2",- "log",- "percent-encoding",- "rustls",- "rustls-pki-types",- "serde",- "serde_json",- "socks",- "ureq-proto",- "utf8-zero",- "webpki-roots",-]--[[package]]-name = "ureq-proto"-version = "0.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c"-dependencies = [- "base64",- "http",- "httparse",- "log",-]-[[package]]name = "url"version = "2.5.8"@@ -4075,24 +3689,12 @@ dependencies = ["serde",]-[[package]]-name = "urlencoding"-version = "2.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"-[[package]]name = "utf-8"version = "0.7.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"-[[package]]-name = "utf8-zero"-version = "0.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e"-[[package]]name = "utf8_iter"version = "1.0.4"@@ -4279,15 +3881,6 @@ dependencies = ["rustls-pki-types",]-[[package]]-name = "webpki-roots"-version = "1.0.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"-dependencies = [- "rustls-pki-types",-]-[[package]]name = "weezl"version = "0.1.12"@@ -4589,16 +4182,6 @@ dependencies = ["tap",]-[[package]]-name = "xattr"-version = "1.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"-dependencies = [- "libc",- "rustix 1.1.4",-]-[[package]]name = "y4m"version = "0.8.0"@@ -4708,30 +4291,6 @@ dependencies = ["syn 2.0.119",]-[[package]]-name = "zip"-version = "6.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b"-dependencies = [- "arbitrary",- "crc32fast",- "indexmap",- "memchr",- "time",-]--[[package]]-name = "zipsign-api"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dba6063ff82cdbd9a765add16d369abe81e520f836054e997c2db217ceca40c0"-dependencies = [- "base64",- "ed25519-dalek",- "thiserror 2.0.19",-]-[[package]]name = "zmij"version = "1.0.23"diff --git a/Cargo.toml b/Cargo.tomlindex 66f276c..5d3da39 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -24,9 +24,9 @@ md-5 = "0.11.0"rand = "0.10.2"ratatui = "0.30.2"ratatui-image = { version = "11.0.6", default-features = false, features = ["crossterm", "image-defaults"] }-reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls"] }+reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls", "blocking"] }scraper = "0.24.0"-self_update = { version = "0.44.0", default-features = false, features = ["archive-tar", "archive-zip", "rustls", "reqwest"] }+semver = "1.0.28"serde = { version = "1.0.228", features = ["derive"] }serde_json = "1.0.150"thiserror = "2.0.18"diff --git a/src/tui/action.rs b/src/tui/action.rsindex f5a3f6a..2e4d6ae 100644--- a/src/tui/action.rs+++ b/src/tui/action.rs@@ -102,10 +102,6 @@ pub enum Action {SearchPosterLoaded(String, Option<std::sync::Arc<image::DynamicImage>>),UpdateAvailable(String),CheckForUpdates,- StartUpdate,- UpdateProgress(f64, String),- UpdateSuccess,- UpdateFailure(String),SetStatus(String),Refresh,ClearCache,diff --git a/src/tui/app.rs b/src/tui/app.rsindex 3af218e..6439222 100644--- a/src/tui/app.rs+++ b/src/tui/app.rs@@ -1567,9 +1567,6 @@ impl App {self.state.input_mode = InputMode::Normal;self.state.active_screen = Screen::Startup;self.state.update_available = None;- self.state.updater_progress = None;- self.state.updater_status = None;- self.state.updater_done = false;self.state.manual_update_check = true;self.action_sender.send(Action::CheckForUpdates).ok();return None;@@ -4162,16 +4159,19 @@ impl App {.ok();}Err(error) => {- update_sender.send(Action::UpdateFailure(error)).ok();+ update_sender+ .send(Action::UpdateAvailable(format!("error:{}", error)))+ .ok();}}});}Action::UpdateAvailable(version) => {+ if self.state.active_screen == Screen::Startup {+ self.state.active_screen = Screen::Home;+ }+if version == "none" {- if self.state.active_screen == Screen::Startup {- self.state.active_screen = Screen::Home;- }if self.state.manual_update_check {self.state.notify(NotificationKind::Success,@@ -4180,69 +4180,25 @@ impl App {);}self.state.manual_update_check = false;+ } else if version.starts_with("error:") {+ let err = version.trim_start_matches("error:");+ if self.state.manual_update_check {+ self.state.notify(+ NotificationKind::Error,+ "Update check failed",+ err.to_string(),+ );+ }+ self.state.manual_update_check = false;} else {self.state.manual_update_check = false;- self.state.update_available = Some(version);- if self.state.active_screen == Screen::Startup {- match crate::tui::updater::replacement_access() {- Ok(()) => {- self.action_sender.send(Action::StartUpdate).ok();- }- Err(error) => {- self.state.active_screen = Screen::Home;- self.state.notify(- NotificationKind::Warning,- "Update needs permission",- error,- );- }- }- }- }- }- Action::StartUpdate => {- let version = self.state.update_available.clone().unwrap_or_default();- self.state.updater_progress = Some(0.0);- self.state.updater_status = Some("Starting update...".to_string());- let update_sender = self.action_sender.clone();-- tokio::task::spawn_blocking(move || {- let result = crate::tui::updater::install(&version, |progress, status| {- update_sender- .send(Action::UpdateProgress(progress, status.into()))- .ok();- });- match result {- Ok(()) => {- update_sender.send(Action::UpdateSuccess).ok();- }- Err(error) => {- update_sender.send(Action::UpdateFailure(error)).ok();- }- }- });- }- Action::UpdateProgress(p, status) => {- if !self.state.updater_done {- self.state.updater_progress = Some(p);- self.state.updater_status = Some(status);- }- }- Action::UpdateSuccess => {- self.state.updater_done = true;- self.state.updater_progress = Some(1.0);-- if let Ok(exe) = std::env::current_exe() {- let _ = std::process::Command::new(exe).spawn();+ self.state.update_available = Some(version.clone());+ self.state.notify(+ NotificationKind::Info,+ "Update Available",+ format!("Version v{} is available! Download at github.com/mesamirh/MovieBox-Tui", version),+ );}- return Some(());- }- Action::UpdateFailure(error) => {- self.state.updater_progress = None;- self.state.updater_status = None;- self.state.active_screen = Screen::Home;- self.state- .notify(NotificationKind::Error, "Update failed", error);}}Nonediff --git a/src/tui/screens/startup.rs b/src/tui/screens/startup.rsindex d2e0514..8ac5673 100644--- a/src/tui/screens/startup.rs+++ b/src/tui/screens/startup.rs@@ -4,19 +4,11 @@ use ratatui::{layout::{Alignment, Constraint, Direction, Layout, Rect},style::Modifier,text::{Line, Span},- widgets::{Block, BorderType, Borders, Gauge, Padding, Paragraph},+ widgets::{Block, BorderType, Borders, Padding, Paragraph},};-const QUOTES: &[&str] = &[- "\"Talk is cheap. Show me the code.\" — Linus Torvalds",- "\"First, solve the problem. Then, write the code.\" — John Johnson",- "\"Fix the cause, not the symptom.\" — Steve Maguire",- "\"Simplicity is the soul of efficiency.\" — Austin Freeman",- "\"Make it work, make it right, make it fast.\" — Kent Beck",-];-pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme) {- let panel = centered_rect(68.min(area.width.saturating_sub(4)), 15, area);+ let panel = centered_rect(68.min(area.width.saturating_sub(4)), 10, area);let block = Block::default().title(Line::from(vec![Span::styled(" MOVIEBOX ", theme.title),@@ -33,8 +25,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let rows = Layout::default().direction(Direction::Vertical).constraints([- Constraint::Length(1),- Constraint::Length(2),Constraint::Length(1),Constraint::Length(1),Constraint::Length(1),@@ -43,85 +33,24 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)]).split(inner);- let (active_step, status_text) = if state.updater_done {- (2, "Update installed. Restarting MovieBox…".to_string())- } else if state.updater_progress.is_some() {- (- 1,- state- .updater_status- .clone()- .unwrap_or_else(|| "Downloading the latest release…".to_string()),- )- } else {- (0, "Checking GitHub for a newer release…".to_string())- };-- frame.render_widget(- Paragraph::new(Line::from(vec![- Span::styled("01 CHECK", step_style(active_step, 0, theme)),- Span::styled(" ───── ", theme.muted),- Span::styled("02 INSTALL", step_style(active_step, 1, theme)),- Span::styled(" ───── ", theme.muted),- Span::styled("03 LAUNCH", step_style(active_step, 2, theme)),- ]))- .alignment(Alignment::Center),- rows[0],- );+ let status_text = "Checking GitHub for a newer release…";let spinner_frames = ['◐', '◓', '◑', '◒'];let spinner = spinner_frames[(state.tick_count as usize / 3) % spinner_frames.len()];- let status_style = if state.updater_done {- theme.success.add_modifier(Modifier::BOLD)- } else {- theme.text- };+frame.render_widget(Paragraph::new(Line::from(vec![Span::styled(format!("{spinner} "), theme.accent),- Span::styled(status_text, status_style),+ Span::styled(status_text, theme.text),])).alignment(Alignment::Center),- rows[2],+ rows[1],);- if let Some(progress) = state.updater_progress {- let progress = progress.clamp(0.0, 1.0);- let label = if state.updater_done {- "READY".to_string()- } else {- format!("{:>3}%", (progress * 100.0).round() as u16)- };- frame.render_widget(- Gauge::default()- .gauge_style(if state.updater_done {- theme.success- } else {- theme.accent- })- .label(Span::styled(label, theme.text.add_modifier(Modifier::BOLD)))- .ratio(progress),- rows[4],- );- } else {- let pulse =- ["● · ·", "· ● ·", "· · ●", "· ● ·"][(state.tick_count as usize / 4) % 4];- frame.render_widget(- Paragraph::new(Span::styled(pulse, theme.accent)).alignment(Alignment::Center),- rows[4],- );- }-- let detail = if state.updater_progress.is_some() && !state.updater_done {- QUOTES[(state.tick_count as usize / 300) % QUOTES.len()]- } else if state.updater_done {- "Your new version is ready."- } else {- "This only takes a moment. Your library stays untouched."- };+ let pulse = ["● · ·", "· ● ·", "· · ●", "· ● ·"][(state.tick_count as usize / 4) % 4];frame.render_widget(- Paragraph::new(Span::styled(detail, theme.text_dim)).alignment(Alignment::Center),- rows[6],+ Paragraph::new(Span::styled(pulse, theme.accent)).alignment(Alignment::Center),+ rows[3],);let footer = Rect {@@ -144,16 +73,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme));}-fn step_style(active: usize, step: usize, theme: &Theme) -> ratatui::style::Style {- if step < active {- theme.success.add_modifier(Modifier::BOLD)- } else if step == active {- theme.accent.add_modifier(Modifier::BOLD)- } else {- theme.muted- }-}-fn centered_rect(width: u16, height: u16, area: Rect) -> Rect {Rect {x: area.x + area.width.saturating_sub(width) / 2,diff --git a/src/tui/state.rs b/src/tui/state.rsindex 1d924aa..eb176ac 100644--- a/src/tui/state.rs+++ b/src/tui/state.rs@@ -122,9 +122,6 @@ pub struct AppState {pub status_timer: usize,pub notifications: std::collections::VecDeque<crate::tui::overlay::Notification>,pub update_available: Option<String>,- pub updater_progress: Option<f64>,- pub updater_status: Option<String>,- pub updater_done: bool,pub auto_update: bool,pub last_update_check: u64,pub manual_update_check: bool,@@ -229,9 +226,6 @@ impl Default for AppState {status_timer: 0,notifications: std::collections::VecDeque::new(),update_available: None,- updater_progress: None,- updater_status: None,- updater_done: false,auto_update: true,last_update_check: 0,manual_update_check: false,diff --git a/src/tui/updater.rs b/src/tui/updater.rsindex e24f321..c55c7f3 100644--- a/src/tui/updater.rs+++ b/src/tui/updater.rs@@ -1,159 +1,63 @@-use self_update::backends::github::ReleaseList;-use std::{- fs,- path::{Path, PathBuf},-};-const OWNER: &str = "mesamirh";const REPOSITORY: &str = "MovieBox-Tui";pub fn check(current: &str) -> Result<Option<String>, String> {- let releases = releases()?;- let Some(release) = releases.first() else {- return Err("GitHub returned no published releases".into());- };+ let releases = fetch_releases()?;+ let release = releases.first().ok_or_else(|| "No published releases".to_string())?;- if !self_update::version::bump_is_greater(current, &release.version)- .map_err(|error| format!("invalid release version {}: {error}", release.version))?- {+ if !is_newer(current, &release.version) {return Ok(None);}- let asset_name = asset_name()?;- if !release.assets.iter().any(|asset| asset.name == asset_name) {- return Err(format!(- "release v{} has no compatible asset named {asset_name}",- release.version- ));- }-Ok(Some(release.version.clone()))}-pub fn replacement_access() -> Result<(), String> {- let executable =- std::env::current_exe().map_err(|error| format!("cannot locate executable: {error}"))?;- let directory = executable- .parent()- .ok_or_else(|| "executable has no parent directory".to_string())?;- let probe = directory.join(format!(".moviebox-update-access-{}", std::process::id()));- fs::OpenOptions::new()- .write(true)- .create_new(true)- .open(&probe)- .map_err(|error| format!("{} is not writable: {error}", directory.display()))?;- fs::remove_file(probe).map_err(|error| format!("cannot clean update access check: {error}"))+fn is_newer(current: &str, other: &str) -> bool {+ let parse = |v: &str| semver::Version::parse(v.trim_start_matches('v'));+ match (parse(current), parse(other)) {+ (Ok(cur), Ok(o)) => o > cur,+ _ => other != current,+ }}-pub fn install(version: &str, mut progress: impl FnMut(f64, &str)) -> Result<(), String> {- let asset_name = asset_name()?;- let release = releases()?- .into_iter()- .find(|release| release.version == version)- .ok_or_else(|| format!("release v{version} was not found"))?;- let asset = release- .assets- .into_iter()- .find(|asset| asset.name == asset_name)- .ok_or_else(|| format!("release v{version} has no {asset_name} asset"))?;-- let temp_dir = update_temp_dir();- fs::create_dir_all(&temp_dir)- .map_err(|error| format!("cannot create update directory: {error}"))?;-- let result = (|| {- progress(0.1, "Downloading release...");- let archive_path = temp_dir.join(&asset_name);- let mut archive = fs::File::create(&archive_path)- .map_err(|error| format!("cannot create update archive: {error}"))?;- self_update::Download::from_url(&asset.download_url)- .show_progress(false)- .download_to(&mut archive)- .map_err(|error| format!("release download failed: {error}"))?;-- progress(0.7, "Verifying package...");- if archive- .metadata()- .map_err(|error| format!("cannot verify update archive: {error}"))?- .len()- == 0- {- return Err("downloaded update archive is empty".into());- }+fn fetch_releases() -> Result<Vec<Release>, String> {+ let url = format!("https://api.github.com/repos/{OWNER}/{REPOSITORY}/releases?per_page=20");+ let client = http_client()?;- let binary_name = if cfg!(target_os = "windows") {- "MovieBox.exe"- } else {- "moviebox"- };- let archive_kind = if cfg!(target_os = "windows") {- self_update::ArchiveKind::Zip- } else {- self_update::ArchiveKind::Tar(Some(self_update::Compression::Gz))- };-- progress(0.82, "Extracting binary...");- self_update::Extract::from_source(&archive_path)- .archive(archive_kind)- .extract_file(&temp_dir, Path::new(binary_name))- .map_err(|error| format!("release extraction failed: {error}"))?;-- let new_binary = temp_dir.join(binary_name);- if new_binary- .metadata()- .map_err(|error| format!("extracted binary is missing: {error}"))?- .len()- == 0- {- return Err("extracted binary is empty".into());- }+ let mut request = client.get(&url);+ if let Some(token) = std::env::var("GITHUB_TOKEN").ok().filter(|t| !t.is_empty()) {+ request = request.header("Authorization", format!("Bearer {token}"));+ }- progress(0.94, "Replacing executable...");- let current = std::env::current_exe()- .map_err(|error| format!("cannot locate current executable: {error}"))?;- self_update::self_replace::self_replace(&new_binary).map_err(|error| {- let permission_hint = if cfg!(unix) {- " If installed in /usr/local/bin, run the installer once with sudo."- } else {- ""- };- format!(- "cannot replace {}: {error}.{permission_hint}",- current.display()- )- })?;+ let resp = request.send().map_err(|e| format!("GitHub request failed: {e}"))?;+ let status = resp.status();+ if !status.is_success() {+ let body = resp.text().unwrap_or_default();+ return Err(format!("GitHub API {status}: {body}"));+ }- progress(1.0, "Update installed.");- Ok(())- })();+ let items: Vec<serde_json::Value> = resp.json().map_err(|e| format!("bad JSON: {e}"))?;- let _ = fs::remove_dir_all(temp_dir);- result+ items+ .into_iter()+ .map(|r| {+ let tag = r["tag_name"].as_str().ok_or("missing tag_name")?.to_string();+ Ok(Release {+ version: tag.trim_start_matches('v').to_string(),+ })+ })+ .collect()}-fn releases() -> Result<Vec<self_update::update::Release>, String> {- ReleaseList::configure()- .repo_owner(OWNER)- .repo_name(REPOSITORY)+fn http_client() -> Result<reqwest::blocking::Client, String> {+ reqwest::blocking::Client::builder()+ .user_agent("MovieBox-Tui")+ .timeout(std::time::Duration::from_secs(30))+ .connect_timeout(std::time::Duration::from_secs(10)).build()- .and_then(ReleaseList::fetch)- .map_err(|error| format!("GitHub release check failed: {error}"))-}--fn asset_name() -> Result<String, String> {- match (std::env::consts::OS, std::env::consts::ARCH) {- ("macos", "aarch64" | "x86_64") => Ok("MovieBox_macOS_Universal.tar.gz".into()),- ("windows", "x86_64") => Ok("MovieBox_Windows_x64.zip".into()),- ("linux", "x86_64") => Ok("MovieBox_Linux_x64.tar.gz".into()),- ("linux", "aarch64") => Ok("MovieBox_Linux_arm64.tar.gz".into()),- (os, arch) => Err(format!("automatic updates do not support {os}/{arch}")),- }+ .map_err(|e| format!("HTTP client: {e}"))}-fn update_temp_dir() -> PathBuf {- let stamp = std::time::SystemTime::now()- .duration_since(std::time::UNIX_EPOCH)- .unwrap_or_default()- .as_nanos();- std::env::temp_dir().join(format!("moviebox-update-{}-{stamp}", std::process::id()))+struct Release {+ version: String,}