Improved auth stability

This commit is contained in:
Ultradesu
2026-06-16 22:34:01 +01:00
parent 2da81ecb89
commit cf82b203a9
4 changed files with 11 additions and 3 deletions
Generated
+1 -1
View File
@@ -1180,7 +1180,7 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]] [[package]]
name = "furumi_tui" name = "furumi_tui"
version = "0.1.3" version = "0.1.4"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"arboard", "arboard",
+7
View File
@@ -58,6 +58,13 @@ pub fn now_epoch_seconds() -> i64 {
.unwrap_or(0) .unwrap_or(0)
} }
pub fn now_epoch_millis() -> i64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|d| d.as_millis() as i64)
.unwrap_or(0)
}
pub fn session_path() -> Option<PathBuf> { pub fn session_path() -> Option<PathBuf> {
crate::config::project_dirs().map(|dirs| dirs.config_dir().join("credentials.json")) crate::config::project_dirs().map(|dirs| dirs.config_dir().join("credentials.json"))
} }
+2 -1
View File
@@ -403,7 +403,7 @@ fn device_playback_state(state: &AppState) -> Option<crate::api::models::DeviceP
shuffle: player.shuffle, shuffle: player.shuffle,
repeat_mode: player.repeat.label().to_string(), repeat_mode: player.repeat.label().to_string(),
volume: f64::from(player.volume) / 100.0, volume: f64::from(player.volume) / 100.0,
updated_at_ms: 0, updated_at_ms: auth::now_epoch_millis(),
}) })
} }
@@ -752,6 +752,7 @@ fn resume_current_audio(state: &mut AppState, runtime: &mut Runtime) {
position_secs, position_secs,
"reopening playback stream after a long pause" "reopening playback stream after a long pause"
); );
runtime.player.stop();
start_current_audio(state, runtime, position_secs, false); start_current_audio(state, runtime, position_secs, false);
} else { } else {
runtime.player.resume(); runtime.player.resume();
+1 -1
View File
@@ -252,7 +252,7 @@ fn handle(
} }
} }
Command::Stop => { Command::Stop => {
if let Some(out) = output { if let Some(out) = output.take() {
out.player.stop(); out.player.stop();
} }
*track_loaded = false; *track_loaded = false;