feat: upload history/retry UI and low-disk recording guardrails
This commit is contained in:
1 parent
a2800c3664
commit
9c221cb101
7 files changed
+333
-9
No files matched your search
@@ -36,6 +36,9 @@
|
|||||||
- The UI Upload button uses the selected upload provider and saved provider configuration, including Catbox userhash, Litterbox expiry, custom endpoint, response path, and custom headers.
|
- The UI Upload button uses the selected upload provider and saved provider configuration, including Catbox userhash, Litterbox expiry, custom endpoint, response path, and custom headers.
|
||||||
- Auto-upload is persisted and, when enabled, attempts upload after manual and event clips while preserving local clips on failure.
|
- Auto-upload is persisted and, when enabled, attempts upload after manual and event clips while preserving local clips on failure.
|
||||||
- Upload attempts are recorded in SQLite upload history.
|
- Upload attempts are recorded in SQLite upload history.
|
||||||
|
- The Uploads screen shows recent upload history with retry buttons for failed uploads, refreshed from the backend on load and after uploads.
|
||||||
|
- Screenshot capture is implemented: F9 takes a PNG screenshot via bundled FFmpeg into `~/Pictures/ClipForge`, the recording bar has a Screenshot button, and the Library shows recent screenshots with an Open-in-Explorer action.
|
||||||
|
- Storage guardrails are wired: recording refuses to start below 2 GB free and a backend worker stops an active recording and flags `StorageLow` when available disk drops to critical; the recording bar shows free disk space and a low-disk warning.
|
||||||
- Vite TypeScript UI builds and has interactive Library, Recording, Auto Clip, Uploads, and Settings views.
|
- Vite TypeScript UI builds and has interactive Library, Recording, Auto Clip, Uploads, and Settings views.
|
||||||
- Library search, event/upload filters, and grid/list switching are functional in the UI.
|
- Library search, event/upload filters, and grid/list switching are functional in the UI.
|
||||||
- User-visible notices are shown for major actions and failures instead of relying only on console output.
|
- User-visible notices are shown for major actions and failures instead of relying only on console output.
|
||||||
@@ -45,14 +48,10 @@
|
|||||||
- Native Windows Graphics Capture is wired for rolling replay capture with native audio; resolution downscaling still needs more work.
|
- Native Windows Graphics Capture is wired for rolling replay capture with native audio; resolution downscaling still needs more work.
|
||||||
- Native WASAPI audio is mixed into a single AAC track for MVP clips; separate audio tracks and per-process audio capture are still future work.
|
- Native WASAPI audio is mixed into a single AAC track for MVP clips; separate audio tracks and per-process audio capture are still future work.
|
||||||
- Capture has not yet been manually QA-tested on real NVIDIA/AMD/Intel gaming systems.
|
- Capture has not yet been manually QA-tested on real NVIDIA/AMD/Intel gaming systems.
|
||||||
- Upload retry controls and a visible upload-history screen are not complete yet.
|
|
||||||
- Valve GSI receiver is a lightweight MVP receiver; config templates can be generated from the Auto Clip screen, but richer event mapping per game is still needed.
|
- Valve GSI receiver is a lightweight MVP receiver; config templates can be generated from the Auto Clip screen, but richer event mapping per game is still needed.
|
||||||
- Auto start/stop is conservative but live: when auto-record is enabled, supported detected games can start recording and stop when the game disappears.
|
- Auto start/stop is conservative but live: when auto-record is enabled, supported detected games can start recording and stop when the game disappears.
|
||||||
- Trim still uses timestamp text inputs instead of draggable timeline handles.
|
|
||||||
- Hotkeys are still hardcoded; editable hotkey registration is future work.
|
- Hotkeys are still hardcoded; editable hotkey registration is future work.
|
||||||
- Screenshot capture is still not implemented.
|
|
||||||
- Capture source, quality, storage cap, excluded windows, and per-game override UI are still incomplete.
|
- Capture source, quality, storage cap, excluded windows, and per-game override UI are still incomplete.
|
||||||
- Storage critical-low-disk guardrails are not fully wired into recording start/stop behavior.
|
|
||||||
- Recorder service still runs inside the Tauri process instead of a separate background service process.
|
- Recorder service still runs inside the Tauri process instead of a separate background service process.
|
||||||
- Installer onboarding, auto-update, and crash logging are still not implemented.
|
- Installer onboarding, auto-update, and crash logging are still not implemented.
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ struct DesktopStatus {
|
|||||||
hotkey_clip_last_30s: String,
|
hotkey_clip_last_30s: String,
|
||||||
hotkey_toggle_session_recording: String,
|
hotkey_toggle_session_recording: String,
|
||||||
hotkey_screenshot: String,
|
hotkey_screenshot: String,
|
||||||
|
free_disk_gb: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@@ -139,6 +140,17 @@ struct ClipDto {
|
|||||||
color_class: String,
|
color_class: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
struct UploadHistoryDto {
|
||||||
|
id: i64,
|
||||||
|
clip_id: String,
|
||||||
|
provider: String,
|
||||||
|
status: String,
|
||||||
|
url: Option<String>,
|
||||||
|
error: Option<String>,
|
||||||
|
attempted_at: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
struct GsiConfigDto {
|
struct GsiConfigDto {
|
||||||
game_id: String,
|
game_id: String,
|
||||||
@@ -589,6 +601,14 @@ fn start_capture_inner(runtime: &AppRuntime) -> Result<DesktopStatus, String> {
|
|||||||
return Ok(status_from_recorder(&recorder, capture.as_ref()));
|
return Ok(status_from_recorder(&recorder, capture.as_ref()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let storage = clipforge::storage::check_storage_space(&recorder.paths.buffer_root);
|
||||||
|
if let clipforge::storage::StorageLevel::Critical = storage.level {
|
||||||
|
return Err(format!(
|
||||||
|
"Recording blocked: only {:.1} GB of disk space remains. Free at least 2 GB before recording.",
|
||||||
|
storage.free_gb()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
let ffmpeg = find_ffmpeg_executable()
|
let ffmpeg = find_ffmpeg_executable()
|
||||||
.ok_or_else(|| "FFmpeg was not found on PATH or in the bundled sidecar.".to_string())?;
|
.ok_or_else(|| "FFmpeg was not found on PATH or in the bundled sidecar.".to_string())?;
|
||||||
let now = SystemTime::now();
|
let now = SystemTime::now();
|
||||||
@@ -902,6 +922,29 @@ fn upload_clip(
|
|||||||
Ok(clip_to_dto(&clip))
|
Ok(clip_to_dto(&clip))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn list_upload_history(runtime: State<'_, AppRuntime>) -> Result<Vec<UploadHistoryDto>, String> {
|
||||||
|
let database = runtime.database.lock().map_err(|error| error.to_string())?;
|
||||||
|
Ok(database
|
||||||
|
.load_upload_history()
|
||||||
|
.map_err(|error| error.to_string())?
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| UploadHistoryDto {
|
||||||
|
id: entry.id,
|
||||||
|
clip_id: entry.clip_id,
|
||||||
|
provider: entry.provider,
|
||||||
|
status: entry.status,
|
||||||
|
url: entry.url,
|
||||||
|
error: entry.error,
|
||||||
|
attempted_at: format_upload_time(entry.attempted_at),
|
||||||
|
})
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_upload_time(time: SystemTime) -> String {
|
||||||
|
format_system_time(time)
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn update_clip_metadata(
|
fn update_clip_metadata(
|
||||||
clip_id: String,
|
clip_id: String,
|
||||||
@@ -1385,6 +1428,7 @@ fn main() {
|
|||||||
upload_clip,
|
upload_clip,
|
||||||
update_clip_metadata,
|
update_clip_metadata,
|
||||||
export_clip_copy,
|
export_clip_copy,
|
||||||
|
list_upload_history,
|
||||||
take_screenshot,
|
take_screenshot,
|
||||||
list_screenshots,
|
list_screenshots,
|
||||||
reveal_screenshot,
|
reveal_screenshot,
|
||||||
@@ -1535,11 +1579,38 @@ fn start_backend_workers(app: tauri::AppHandle) {
|
|||||||
let runtime = app.state::<AppRuntime>();
|
let runtime = app.state::<AppRuntime>();
|
||||||
let _ = refresh_detected_game_inner(runtime.inner());
|
let _ = refresh_detected_game_inner(runtime.inner());
|
||||||
let _ = poll_auto_clip_events_inner(runtime.inner());
|
let _ = poll_auto_clip_events_inner(runtime.inner());
|
||||||
|
let _ = stop_capture_on_critical_storage(runtime.inner());
|
||||||
thread::sleep(Duration::from_secs(2));
|
thread::sleep(Duration::from_secs(2));
|
||||||
})
|
})
|
||||||
.expect("could not start ClipForge backend workers");
|
.expect("could not start ClipForge backend workers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn stop_capture_on_critical_storage(runtime: &AppRuntime) -> Result<(), String> {
|
||||||
|
let buffer_root = {
|
||||||
|
let recorder = runtime.recorder.lock().map_err(|error| error.to_string())?;
|
||||||
|
recorder.paths.buffer_root.clone()
|
||||||
|
};
|
||||||
|
if runtime
|
||||||
|
.capture
|
||||||
|
.lock()
|
||||||
|
.map_err(|error| error.to_string())?
|
||||||
|
.is_none()
|
||||||
|
{
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let storage = clipforge::storage::check_storage_space(&buffer_root);
|
||||||
|
if let clipforge::storage::StorageLevel::Critical = storage.level {
|
||||||
|
let _ = stop_capture_inner(runtime);
|
||||||
|
let mut recorder = runtime.recorder.lock().map_err(|error| error.to_string())?;
|
||||||
|
recorder.state.status = RecordingStatus::StorageLow;
|
||||||
|
eprintln!(
|
||||||
|
"ClipForge stopped recording: critical low disk ({:.1} GB free).",
|
||||||
|
storage.free_gb()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCapture>) -> DesktopStatus {
|
fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCapture>) -> DesktopStatus {
|
||||||
DesktopStatus {
|
DesktopStatus {
|
||||||
recording_state: recording_status_name(&recorder.state.status).to_string(),
|
recording_state: recording_status_name(&recorder.state.status).to_string(),
|
||||||
@@ -1582,6 +1653,7 @@ fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCaptu
|
|||||||
hotkey_clip_last_30s: recorder.settings.hotkeys.clip_last_30s.clone(),
|
hotkey_clip_last_30s: recorder.settings.hotkeys.clip_last_30s.clone(),
|
||||||
hotkey_toggle_session_recording: recorder.settings.hotkeys.toggle_session_recording.clone(),
|
hotkey_toggle_session_recording: recorder.settings.hotkeys.toggle_session_recording.clone(),
|
||||||
hotkey_screenshot: recorder.settings.hotkeys.screenshot.clone(),
|
hotkey_screenshot: recorder.settings.hotkeys.screenshot.clone(),
|
||||||
|
free_disk_gb: clipforge::storage::check_storage_space(&recorder.paths.buffer_root).free_gb(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+29
-1
@@ -1,4 +1,4 @@
|
|||||||
use crate::models::{Clip, ClipSource, GameEventType, UploadProvider};
|
use crate::models::{Clip, ClipSource, GameEventType, UploadHistoryEntry, UploadProvider};
|
||||||
use rusqlite::{params, Connection};
|
use rusqlite::{params, Connection};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||||
@@ -176,6 +176,31 @@ impl ClipDatabase {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn load_upload_history(&self) -> rusqlite::Result<Vec<UploadHistoryEntry>> {
|
||||||
|
let mut statement = self.connection.prepare(
|
||||||
|
"
|
||||||
|
SELECT id, clip_id, provider, status, url, error, attempted_at_ms
|
||||||
|
FROM upload_history
|
||||||
|
ORDER BY attempted_at_ms DESC
|
||||||
|
LIMIT 200
|
||||||
|
",
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let rows = statement.query_map([], |row| {
|
||||||
|
Ok(UploadHistoryEntry {
|
||||||
|
id: row.get(0)?,
|
||||||
|
clip_id: row.get(1)?,
|
||||||
|
provider: row.get(2)?,
|
||||||
|
status: row.get(3)?,
|
||||||
|
url: row.get(4)?,
|
||||||
|
error: row.get(5)?,
|
||||||
|
attempted_at: millis_to_system_time(row.get(6)?),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
rows.collect()
|
||||||
|
}
|
||||||
|
|
||||||
fn column_exists(&self, table: &str, column: &str) -> rusqlite::Result<bool> {
|
fn column_exists(&self, table: &str, column: &str) -> rusqlite::Result<bool> {
|
||||||
let mut statement = self
|
let mut statement = self
|
||||||
.connection
|
.connection
|
||||||
@@ -293,6 +318,9 @@ mod tests {
|
|||||||
SystemTime::now(),
|
SystemTime::now(),
|
||||||
)
|
)
|
||||||
.expect("upload history");
|
.expect("upload history");
|
||||||
|
let history = database.load_upload_history().expect("load upload history");
|
||||||
|
assert_eq!(history.len(), 1);
|
||||||
|
assert_eq!(history[0].clip_id, "clip-1");
|
||||||
database.delete_clip("clip-1").expect("delete");
|
database.delete_clip("clip-1").expect("delete");
|
||||||
assert!(database.load_clips().expect("load empty").is_empty());
|
assert!(database.load_clips().expect("load empty").is_empty());
|
||||||
let _ = std::fs::remove_file(db_path);
|
let _ = std::fs::remove_file(db_path);
|
||||||
|
|||||||
@@ -111,6 +111,17 @@ pub struct Clip {
|
|||||||
pub upload_provider: Option<UploadProvider>,
|
pub upload_provider: Option<UploadProvider>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct UploadHistoryEntry {
|
||||||
|
pub id: i64,
|
||||||
|
pub clip_id: String,
|
||||||
|
pub provider: String,
|
||||||
|
pub status: String,
|
||||||
|
pub url: Option<String>,
|
||||||
|
pub error: Option<String>,
|
||||||
|
pub attempted_at: SystemTime,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum RecordingStatus {
|
pub enum RecordingStatus {
|
||||||
WaitingForGame,
|
WaitingForGame,
|
||||||
|
|||||||
@@ -114,6 +114,69 @@ pub struct StorageCleanupReport {
|
|||||||
pub remaining_bytes: u64,
|
pub remaining_bytes: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum StorageLevel {
|
||||||
|
Ok,
|
||||||
|
Warning,
|
||||||
|
Critical,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct StorageSpace {
|
||||||
|
pub total_bytes: u64,
|
||||||
|
pub available_bytes: u64,
|
||||||
|
pub level: StorageLevel,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StorageSpace {
|
||||||
|
pub fn free_gb(&self) -> f64 {
|
||||||
|
self.available_bytes as f64 / (1024.0 * 1024.0 * 1024.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn check_storage_space(root: &Path) -> StorageSpace {
|
||||||
|
let disks = sysinfo::Disks::new_with_refreshed_list();
|
||||||
|
let mount = disks
|
||||||
|
.list()
|
||||||
|
.iter()
|
||||||
|
.find(|disk| path_is_on_mount(root, disk.mount_point()))
|
||||||
|
.or_else(|| disks.list().first());
|
||||||
|
let valid = |disk: Option<&sysinfo::Disk>| -> Option<(u64, u64)> {
|
||||||
|
disk.map(|disk| (disk.total_space(), disk.available_space()))
|
||||||
|
};
|
||||||
|
let (total, available) = valid(mount).unwrap_or((0, 0));
|
||||||
|
let warning_at = bytes_for_gb(5);
|
||||||
|
let critical_at = bytes_for_gb(2);
|
||||||
|
let level = if available < critical_at {
|
||||||
|
StorageLevel::Critical
|
||||||
|
} else if available < warning_at {
|
||||||
|
StorageLevel::Warning
|
||||||
|
} else {
|
||||||
|
StorageLevel::Ok
|
||||||
|
};
|
||||||
|
StorageSpace {
|
||||||
|
total_bytes: total,
|
||||||
|
available_bytes: available,
|
||||||
|
level,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bytes_for_gb(gb: u64) -> u64 {
|
||||||
|
gb * 1024 * 1024 * 1024
|
||||||
|
}
|
||||||
|
|
||||||
|
fn path_is_on_mount(path: &Path, mount: &Path) -> bool {
|
||||||
|
let path = path
|
||||||
|
.to_str()
|
||||||
|
.map(|value| value.to_ascii_lowercase())
|
||||||
|
.unwrap_or_default();
|
||||||
|
let mount = mount
|
||||||
|
.to_str()
|
||||||
|
.map(|value| value.to_ascii_lowercase())
|
||||||
|
.unwrap_or_default();
|
||||||
|
path == mount || path.starts_with(&mount)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn cleanup_oldest_files_until_under_limit(
|
pub fn cleanup_oldest_files_until_under_limit(
|
||||||
root: &Path,
|
root: &Path,
|
||||||
max_bytes: u64,
|
max_bytes: u64,
|
||||||
@@ -206,4 +269,27 @@ mod tests {
|
|||||||
assert_eq!(report.remaining_bytes, 10);
|
assert_eq!(report.remaining_bytes, 10);
|
||||||
let _ = fs::remove_dir_all(root);
|
let _ = fs::remove_dir_all(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn storage_space_reports_metrics_for_root() {
|
||||||
|
let root = env::temp_dir();
|
||||||
|
let space = check_storage_space(&root);
|
||||||
|
assert!(space.total_bytes > 0);
|
||||||
|
assert!(space.available_bytes <= space.total_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn path_is_on_mount_matches_drive_prefix() {
|
||||||
|
let root = if cfg!(windows) {
|
||||||
|
Path::new("C:/Users/ClipForge/Clips")
|
||||||
|
} else {
|
||||||
|
Path::new("/home/clipforge/clips")
|
||||||
|
};
|
||||||
|
let mount = if cfg!(windows) {
|
||||||
|
Path::new("C:")
|
||||||
|
} else {
|
||||||
|
Path::new("/home")
|
||||||
|
};
|
||||||
|
assert!(path_is_on_mount(root, mount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+94
-4
@@ -74,6 +74,7 @@ type DesktopStatus = {
|
|||||||
hotkey_clip_last_30s: string;
|
hotkey_clip_last_30s: string;
|
||||||
hotkey_toggle_session_recording: string;
|
hotkey_toggle_session_recording: string;
|
||||||
hotkey_screenshot: string;
|
hotkey_screenshot: string;
|
||||||
|
free_disk_gb: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ClipDto = {
|
type ClipDto = {
|
||||||
@@ -91,6 +92,16 @@ type ClipDto = {
|
|||||||
color_class: string;
|
color_class: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type UploadHistoryEntry = {
|
||||||
|
id: number;
|
||||||
|
clip_id: string;
|
||||||
|
provider: string;
|
||||||
|
status: string;
|
||||||
|
url: string | null;
|
||||||
|
error: string | null;
|
||||||
|
attempted_at: string;
|
||||||
|
};
|
||||||
|
|
||||||
type GsiConfigDto = {
|
type GsiConfigDto = {
|
||||||
game_id: string;
|
game_id: string;
|
||||||
path: string;
|
path: string;
|
||||||
@@ -134,11 +145,13 @@ type AppState = {
|
|||||||
selectedClipId: string;
|
selectedClipId: string;
|
||||||
clips: Clip[];
|
clips: Clip[];
|
||||||
screenshots: string[];
|
screenshots: string[];
|
||||||
|
uploadHistory: UploadHistoryEntry[];
|
||||||
autoEvents: AutoEvent[];
|
autoEvents: AutoEvent[];
|
||||||
hotkeyClipLast60s: string;
|
hotkeyClipLast60s: string;
|
||||||
hotkeyClipLast30s: string;
|
hotkeyClipLast30s: string;
|
||||||
hotkeyToggleRecording: string;
|
hotkeyToggleRecording: string;
|
||||||
hotkeyScreenshot: string;
|
hotkeyScreenshot: string;
|
||||||
|
freeDiskGb: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type TauriGlobal = {
|
type TauriGlobal = {
|
||||||
@@ -189,6 +202,7 @@ const state: AppState = {
|
|||||||
selectedClipId: "",
|
selectedClipId: "",
|
||||||
clips: [],
|
clips: [],
|
||||||
screenshots: [],
|
screenshots: [],
|
||||||
|
uploadHistory: [],
|
||||||
autoEvents: [
|
autoEvents: [
|
||||||
{ id: "cs2-kill", gameId: "counter-strike-2", eventType: "kill", game: "Counter-Strike 2", event: "Kill", enabled: true },
|
{ id: "cs2-kill", gameId: "counter-strike-2", eventType: "kill", game: "Counter-Strike 2", event: "Kill", enabled: true },
|
||||||
{ id: "cs2-death", gameId: "counter-strike-2", eventType: "death", game: "Counter-Strike 2", event: "Death", enabled: true },
|
{ id: "cs2-death", gameId: "counter-strike-2", eventType: "death", game: "Counter-Strike 2", event: "Death", enabled: true },
|
||||||
@@ -213,6 +227,7 @@ const state: AppState = {
|
|||||||
hotkeyClipLast30s: "Shift+F8",
|
hotkeyClipLast30s: "Shift+F8",
|
||||||
hotkeyToggleRecording: "Alt+F7",
|
hotkeyToggleRecording: "Alt+F7",
|
||||||
hotkeyScreenshot: "F9",
|
hotkeyScreenshot: "F9",
|
||||||
|
freeDiskGb: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const root = document.querySelector<HTMLDivElement>("#app");
|
const root = document.querySelector<HTMLDivElement>("#app");
|
||||||
@@ -254,7 +269,10 @@ function render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderRecordingBar() {
|
function renderRecordingBar() {
|
||||||
const statusText = state.captureActive
|
const lowDisk = state.freeDiskGb < 2 && state.freeDiskGb > 0;
|
||||||
|
const statusText = lowDisk
|
||||||
|
? `Low disk (${state.freeDiskGb.toFixed(1)} GB free)`
|
||||||
|
: state.captureActive
|
||||||
? "Recording to disk"
|
? "Recording to disk"
|
||||||
: state.sessionRecording
|
: state.sessionRecording
|
||||||
? "Recording session"
|
? "Recording session"
|
||||||
@@ -269,9 +287,9 @@ function renderRecordingBar() {
|
|||||||
<span class="meter"><i style="width: 72%"></i></span>
|
<span class="meter"><i style="width: 72%"></i></span>
|
||||||
<span class="meter"><i style="width: ${state.micEnabled ? 34 : 0}%"></i></span>
|
<span class="meter"><i style="width: ${state.micEnabled ? 34 : 0}%"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-pill">${statusText}</div>
|
<div class="status-pill ${lowDisk ? "warn" : ""}">${statusText}</div>
|
||||||
<button class="icon-button" data-action="clip">Clip</button>
|
${lowDisk ? "" : `<button class="icon-button" data-action="clip">Clip</button>`}
|
||||||
<button class="icon-button" data-action="screenshot">Screenshot</button>
|
${lowDisk ? "" : `<button class="icon-button" data-action="screenshot">Screenshot</button>`}
|
||||||
<button class="record-button" data-action="toggle-record">${state.captureActive || state.sessionRecording ? "Stop" : "Record"}</button>
|
<button class="record-button" data-action="toggle-record">${state.captureActive || state.sessionRecording ? "Stop" : "Record"}</button>
|
||||||
</header>
|
</header>
|
||||||
`;
|
`;
|
||||||
@@ -476,6 +494,7 @@ function renderRecordingView() {
|
|||||||
<p class="muted">${state.captureBackend ? `Active backend: ${state.captureBackend}` : "Active backend: idle"}</p>
|
<p class="muted">${state.captureBackend ? `Active backend: ${state.captureBackend}` : "Active backend: idle"}</p>
|
||||||
<p class="muted">${state.ffmpegAvailable ? "FFmpeg ready" : "FFmpeg missing"}${state.ffmpegPath ? ` · ${state.ffmpegPath}` : ""}</p>
|
<p class="muted">${state.ffmpegAvailable ? "FFmpeg ready" : "FFmpeg missing"}${state.ffmpegPath ? ` · ${state.ffmpegPath}` : ""}</p>
|
||||||
<p class="muted">${state.capturePath ? `Writing ${state.capturePath}` : "No active capture file"}</p>
|
<p class="muted">${state.capturePath ? `Writing ${state.capturePath}` : "No active capture file"}</p>
|
||||||
|
<p class="muted">${state.freeDiskGb > 0 ? `${state.freeDiskGb.toFixed(1)} GB free on recording drive` : "Disk space unknown"}</p>
|
||||||
</article>
|
</article>
|
||||||
<article class="settings-panel">
|
<article class="settings-panel">
|
||||||
<p class="eyebrow">Audio</p>
|
<p class="eyebrow">Audio</p>
|
||||||
@@ -574,6 +593,36 @@ function renderUploadsView() {
|
|||||||
<label>Headers <textarea data-action="custom-upload-headers">${escapeHtml(state.customUploadHeaders)}</textarea></label>
|
<label>Headers <textarea data-action="custom-upload-headers">${escapeHtml(state.customUploadHeaders)}</textarea></label>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="table-panel">
|
||||||
|
<div class="section-heading">
|
||||||
|
<div>
|
||||||
|
<p class="eyebrow">Upload history</p>
|
||||||
|
<h2>Recent Uploads</h2>
|
||||||
|
</div>
|
||||||
|
<button data-action="refresh-upload-history">Refresh</button>
|
||||||
|
</div>
|
||||||
|
${state.uploadHistory.length > 0
|
||||||
|
? `<div class="upload-history">${state.uploadHistory.map(renderUploadHistoryRow).join("")}</div>`
|
||||||
|
: `<p class="muted">No upload attempts recorded yet.</p>`}
|
||||||
|
</section>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUploadHistoryRow(entry: UploadHistoryEntry) {
|
||||||
|
const failed = entry.status === "failed";
|
||||||
|
const uploaded = entry.status === "uploaded";
|
||||||
|
return `
|
||||||
|
<div class="upload-row ${failed ? "failed" : uploaded ? "uploaded" : ""}">
|
||||||
|
<div class="upload-row-main">
|
||||||
|
<strong>${escapeHtml(entry.provider)}</strong>
|
||||||
|
<span class="muted">${escapeHtml(entry.clip_id)}</span>
|
||||||
|
<span class="status-pill">${escapeHtml(entry.status)}</span>
|
||||||
|
${entry.url ? `<a class="muted" href="${escapeHtml(entry.url)}" target="_blank" rel="noreferrer">${escapeHtml(entry.url)}</a>` : ""}
|
||||||
|
${entry.error ? `<p class="muted">${escapeHtml(entry.error)}</p>` : ""}
|
||||||
|
<p class="muted">${escapeHtml(entry.attempted_at)}</p>
|
||||||
|
</div>
|
||||||
|
${failed ? `<button data-action="retry-upload" data-clip-id="${escapeHtml(entry.clip_id)}">Retry</button>` : ""}
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,6 +839,22 @@ function bindEvents() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
appRoot.querySelector<HTMLButtonElement>("[data-action='refresh-upload-history']")?.addEventListener("click", () => {
|
||||||
|
void refreshUploadHistory().then(() => render());
|
||||||
|
});
|
||||||
|
|
||||||
|
appRoot.querySelectorAll<HTMLButtonElement>("[data-action='retry-upload']").forEach((button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
const clipId = button.dataset.clipId;
|
||||||
|
if (clipId) {
|
||||||
|
const entry = state.uploadHistory.find((e) => e.clip_id === clipId);
|
||||||
|
if (entry) {
|
||||||
|
void retryUpload(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Timeline drag handlers
|
// Timeline drag handlers
|
||||||
const timelineTrack = appRoot.querySelector<HTMLElement>("[data-action='timeline-track']");
|
const timelineTrack = appRoot.querySelector<HTMLElement>("[data-action='timeline-track']");
|
||||||
const handleStart = appRoot.querySelector<HTMLElement>("#timeline-handle-start");
|
const handleStart = appRoot.querySelector<HTMLElement>("#timeline-handle-start");
|
||||||
@@ -1042,6 +1107,7 @@ function applyDesktopStatus(status: DesktopStatus) {
|
|||||||
state.hotkeyClipLast30s = status.hotkey_clip_last_30s;
|
state.hotkeyClipLast30s = status.hotkey_clip_last_30s;
|
||||||
state.hotkeyToggleRecording = status.hotkey_toggle_session_recording;
|
state.hotkeyToggleRecording = status.hotkey_toggle_session_recording;
|
||||||
state.hotkeyScreenshot = status.hotkey_screenshot;
|
state.hotkeyScreenshot = status.hotkey_screenshot;
|
||||||
|
state.freeDiskGb = status.free_disk_gb;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function trimSelectedClip() {
|
async function trimSelectedClip() {
|
||||||
@@ -1140,6 +1206,7 @@ async function uploadSelectedClip() {
|
|||||||
});
|
});
|
||||||
const updated = clipFromDto(dto);
|
const updated = clipFromDto(dto);
|
||||||
state.clips = state.clips.map((clip) => (clip.id === updated.id ? updated : clip));
|
state.clips = state.clips.map((clip) => (clip.id === updated.id ? updated : clip));
|
||||||
|
await refreshUploadHistory();
|
||||||
showNotice("Clip uploaded");
|
showNotice("Clip uploaded");
|
||||||
render();
|
render();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -1431,6 +1498,28 @@ async function refreshScreenshots() {
|
|||||||
state.screenshots = screenshots;
|
state.screenshots = screenshots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function refreshUploadHistory() {
|
||||||
|
if (!tauriInvoke) return;
|
||||||
|
try {
|
||||||
|
state.uploadHistory = await tauriInvoke<UploadHistoryEntry[]>("list_upload_history");
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Could not load upload history", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retryUpload(entry: UploadHistoryEntry) {
|
||||||
|
if (!tauriInvoke) return;
|
||||||
|
const clip = state.clips.find((c) => c.id === entry.clip_id);
|
||||||
|
if (!clip) {
|
||||||
|
showNotice(`Clip ${entry.clip_id} not found in library`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.selectedClipId = clip.id;
|
||||||
|
state.activeView = "Library";
|
||||||
|
render();
|
||||||
|
await uploadSelectedClip();
|
||||||
|
}
|
||||||
|
|
||||||
function filteredClips() {
|
function filteredClips() {
|
||||||
const query = state.libraryQuery.trim().toLowerCase();
|
const query = state.libraryQuery.trim().toLowerCase();
|
||||||
return state.clips.filter((clip) => {
|
return state.clips.filter((clip) => {
|
||||||
@@ -1517,6 +1606,7 @@ async function loadDesktopBridge() {
|
|||||||
state.clips = clips.map(clipFromDto);
|
state.clips = clips.map(clipFromDto);
|
||||||
state.selectedClipId = state.clips[0]?.id ?? "";
|
state.selectedClipId = state.clips[0]?.id ?? "";
|
||||||
await refreshScreenshots();
|
await refreshScreenshots();
|
||||||
|
await refreshUploadHistory();
|
||||||
render();
|
render();
|
||||||
await refreshAudioDevices();
|
await refreshAudioDevices();
|
||||||
window.setInterval(() => {
|
window.setInterval(() => {
|
||||||
|
|||||||
@@ -164,6 +164,11 @@ h3 {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-pill.warn {
|
||||||
|
background: #7f1d1d;
|
||||||
|
color: #fecaca;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-button,
|
.icon-button,
|
||||||
.record-button,
|
.record-button,
|
||||||
.actions button {
|
.actions button {
|
||||||
@@ -470,6 +475,39 @@ textarea {
|
|||||||
color: #9ba7b8;
|
color: #9ba7b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.upload-history {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #2c3140;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #12161d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row-main {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row.failed {
|
||||||
|
border-color: #7f1d1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row.uploaded {
|
||||||
|
border-color: #14532d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-row .status-pill {
|
||||||
|
justify-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.app-shell,
|
.app-shell,
|
||||||
.content-grid,
|
.content-grid,
|
||||||
|
|||||||
Reference in new issue
Block a user