diff --git a/src-tauri/src/capture.rs b/src-tauri/src/capture.rs index 0b5d83f..1006e1b 100644 --- a/src-tauri/src/capture.rs +++ b/src-tauri/src/capture.rs @@ -105,7 +105,7 @@ impl GraphicsCaptureApiHandler for CaptureHandler { use std::io::{BufRead, BufReader}; let reader = BufReader::new(serr); for line in reader.lines().map_while(Result::ok) { - tracing::error!("ffmpeg: {line}"); + tracing::debug!("ffmpeg: {line}"); } }); } diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index 7a9ad53..972eba0 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -148,9 +148,8 @@ impl Config { match toml::from_str::(&raw) { Ok(cfg) => Ok(cfg), Err(e) => { - // Config is corrupt - back it up and return defaults - tracing::warn!("config.toml is corrupt ({e}), backing up and using defaults"); let backup = path.with_extension("toml.bak"); + tracing::warn!("config.toml is corrupt ({}), backing up to {:?} and using defaults", e, backup); let _ = std::fs::copy(path, &backup); let cfg = Self::default(); cfg.save(path)?; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 360a84f..f929789 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -200,11 +200,7 @@ struct DownloadProgress { total: Option, } -#[derive(Clone, Serialize)] -struct UpdateDownloadProgress { - downloaded: u64, - total: Option, -} +type UpdateDownloadProgress = DownloadProgress; #[tauri::command] async fn download_update( @@ -646,8 +642,7 @@ pub struct ExportRequest { #[tauri::command] fn default_output_path(state: State<'_, AppState>, format: Format) -> String { - let cfg = lock(&state.config).clone(); - let dir = output_dir(&state.app_dir, &cfg); + let dir = output_dir(&state.app_dir, &lock(&state.config)); dir.join(format!( "bytesize-{}.{}", timestamp_slug(), diff --git a/src-tauri/src/updates.rs b/src-tauri/src/updates.rs index 2afbf7f..553b801 100644 --- a/src-tauri/src/updates.rs +++ b/src-tauri/src/updates.rs @@ -128,6 +128,8 @@ pub fn write_apply_script(app_dir: &Path) -> Result { } fn is_newer(latest: &str, current: &str) -> bool { + // Note: pre-release suffixes (e.g., "-beta") are filtered out by parse().ok(), + // so "1.0.0-beta" compares equal to "1.0.0". Acceptable for v1. let mut l: Vec = latest.split('.').filter_map(|s| s.parse().ok()).collect(); let mut c: Vec = current.split('.').filter_map(|s| s.parse().ok()).collect(); let max = l.len().max(c.len()); diff --git a/src/lib/Main.svelte b/src/lib/Main.svelte index a3741c7..f1b8a7b 100644 --- a/src/lib/Main.svelte +++ b/src/lib/Main.svelte @@ -117,11 +117,15 @@ unlistenOverlayClosed = await listen("overlay-closed", () => { useFrame = false }) - config = await api.getConfig() - format = config.export.default_format - fps = config.capture.default_fps - keepAudio = config.capture.capture_audio - gifDither = config.export.gif_dither + try { + config = await api.getConfig() + format = config.export.default_format + fps = config.capture.default_fps + keepAudio = config.capture.capture_audio + gifDither = config.export.gif_dither + } catch (e) { + console.warn("failed to load config:", e) + } unlistenHotkey = await api.onHotkey((kind) => { if (kind === "start" && phase === "idle") void startRec() @@ -277,8 +281,16 @@ clip = null; exportResult = null; errMsg = null; encodeProgress = null thumbnails = []; deletedFrames = new Set() thumbCache = new Map() + previewPath = null; trimPreviewPath = null if (previewTimer !== null) { clearTimeout(previewTimer); previewTimer = null } elapsed = 0; phase = "idle" + if (config) { + format = config.export.default_format + fps = config.capture.default_fps + gifDither = config.export.gif_dither + gifBudgetMode = "balanced" + gifColors = 256 + } } async function cancelExport() { diff --git a/src/lib/Picker.svelte b/src/lib/Picker.svelte index b16a651..94de16f 100644 --- a/src/lib/Picker.svelte +++ b/src/lib/Picker.svelte @@ -22,12 +22,17 @@ void (async () => { await refresh() win.onMoved(refresh).then(fn => { if (mounted) unlisten.push(fn) }) - listen("picker-hover", (e) => { hover = e.payload }).then(fn => { if (mounted) unlisten.push(fn) }) + let hoverDebounce = 0 + listen("picker-hover", (e) => { + clearTimeout(hoverDebounce) + hoverDebounce = window.setTimeout(() => { hover = e.payload }, 30) + }).then(fn => { if (mounted) unlisten.push(fn) }) })() return () => { mounted = false unlisten.forEach(fn => fn()) + emit("picker-cancel", {}).catch(() => {}) } })