]> git.seodisparate.com - mpd_info_screen/commitdiff
Fix prev commit: no passwd close on disconnect
authorStephen Seo <seo.disparate@gmail.com>
Mon, 17 Mar 2025 08:23:52 +0000 (17:23 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 17 Mar 2025 08:23:52 +0000 (17:23 +0900)
src/display.rs
src/main.rs

index e3d8607903681e1614b7012c52a6905cac8eab7a..85a9e052712399b3de1a04734970735816bdb7f2 100644 (file)
@@ -759,7 +759,7 @@ impl MPDDisplay {
     }
 
     pub fn is_authenticated(&self) -> bool {
-        self.password_entered && self.is_authenticated
+        self.is_authenticated
     }
 
     pub fn get_is_mpd_handler_stopped(&self) -> Result<bool, String> {
index c94251256105660c55af41ed96bc4657e8d13a06..c4dba0561b8d6d02ccc673078a0c6559585fe2cd 100644 (file)
@@ -75,6 +75,8 @@ fn main() -> Result<(), String> {
     }
     println!("Got host addr == {}, port == {}", opt.host, opt.port);
 
+    let password_opted = opt.password_file.is_some() || opt.enable_prompt_password;
+
     // Read password from file if exists, error otherwise.
     if let Some(psswd_file_path) = opt.password_file.as_ref() {
         let mut file = File::open(psswd_file_path).expect("pfile/password_file should exist");
@@ -115,7 +117,8 @@ fn main() -> Result<(), String> {
     event_loop.run(move |mut event, _window_target, control_flow| {
         if !ctx.continuing
             || ctx.quit_requested
-            || (display.is_authenticated() && display.get_is_mpd_handler_stopped().unwrap_or(false))
+            || ((!password_opted || display.is_authenticated())
+                && display.get_is_mpd_handler_stopped().unwrap_or(false))
         {
             *control_flow = ControlFlow::Exit;
             return;