nonworking keybinds

This commit is contained in:
2026-02-13 17:25:32 -05:00
parent 91fcaa9b9e
commit 8e0f90f449
9 changed files with 381 additions and 66 deletions

View File

@@ -16,6 +16,7 @@ import { DEFAULT_THEME } from "../constants/themes";
const APP_STATE_FILE = "app-state.json";
const PROGRESS_FILE = "progress.json";
const AUDIO_NAV_FILE = "audio-nav.json";
// --- Defaults ---
@@ -119,3 +120,39 @@ export async function saveProgressToFile(
// Silently ignore write errors
}
}
interface AudioNavEntry {
source: string;
currentIndex: number;
podcastId?: string;
lastUpdated: string;
}
/** Load audio navigation state from JSON file */
export async function loadAudioNavFromFile<T>(): Promise<T | null> {
try {
const filePath = getConfigFilePath(AUDIO_NAV_FILE);
const file = Bun.file(filePath);
if (!(await file.exists())) return null;
const raw = await file.json();
if (!raw || typeof raw !== "object") return null;
return raw as T;
} catch {
return null;
}
}
/** Save audio navigation state to JSON file */
export async function saveAudioNavToFile<T>(
data: T,
): Promise<void> {
try {
await ensureConfigDir();
const filePath = getConfigFilePath(AUDIO_NAV_FILE);
await Bun.write(filePath, JSON.stringify(data, null, 2));
} catch {
// Silently ignore write errors
}
}