v0.4.1: Chrome cookie import, config.json, session persistence
- Add Chrome cookie importer (macOS Keychain AES-128-CBC decryption) - Add ~/.config/browse/config.json (headless, fullscreen, stealth, preview defaults) - Add ~/.config/browse/session.json (auto-save/restore cookies + localStorage) - Auto-import from all browsers (Safari + Firefox + Chrome) on first launch - Deduplicate cookies across browsers (domain+name+path key) - Defaults: headed, fullscreen, stealth, preview all enabled - Fix BigInt overflow for Chrome timestamps (CAST to TEXT in SQL)
This commit is contained in:
Vendored
+96
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Browse configuration and session persistence
|
||||
*
|
||||
* Config: ~/.config/browse/config.json — user defaults for launch options
|
||||
* Session: ~/.config/browse/session.json — persistent cookies, storage, last URL
|
||||
*
|
||||
* Config is loaded once at startup and merged under explicit tool args.
|
||||
* Session is auto-saved on close and auto-restored on launch (if present).
|
||||
*/
|
||||
export interface BrowseConfig {
|
||||
/** Launch headless (default: true) */
|
||||
headless?: boolean;
|
||||
/** Default viewport width (default: 1280) */
|
||||
width?: number;
|
||||
/** Default viewport height (default: 800) */
|
||||
height?: number;
|
||||
/** Launch in macOS native fullscreen (default: false) */
|
||||
fullscreen?: boolean;
|
||||
/** Enable preview mode — highlight elements before actions (default: false) */
|
||||
preview?: boolean;
|
||||
/** Preview highlight duration in ms (default: 2000) */
|
||||
previewDelay?: number;
|
||||
/** Enable stealth mode to reduce bot detection (default: false) */
|
||||
stealth?: boolean;
|
||||
/** Auto-restore session on launch (default: true) */
|
||||
autoRestore?: boolean;
|
||||
/** Auto-save session on close (default: true) */
|
||||
autoSave?: boolean;
|
||||
/** Default browser to import cookies from on first launch */
|
||||
importFrom?: 'safari' | 'firefox' | 'chrome';
|
||||
/** Default domain filter for cookie import */
|
||||
importDomain?: string;
|
||||
}
|
||||
/**
|
||||
* Load config from ~/.config/browse/config.json
|
||||
* Returns defaults merged with user config. Missing file = all defaults.
|
||||
*/
|
||||
export declare function loadConfig(): Required<BrowseConfig>;
|
||||
/**
|
||||
* Save config to ~/.config/browse/config.json
|
||||
*/
|
||||
export declare function saveConfig(config: Partial<BrowseConfig>): void;
|
||||
/**
|
||||
* Get the config file path (for display/debugging)
|
||||
*/
|
||||
export declare function getConfigPath(): string;
|
||||
export interface BrowseSession {
|
||||
/** Last visited URL */
|
||||
url?: string;
|
||||
/** Page title at save time */
|
||||
title?: string;
|
||||
/** All cookies from the browser context */
|
||||
cookies?: Array<{
|
||||
name: string;
|
||||
value: string;
|
||||
domain: string;
|
||||
path: string;
|
||||
expires: number;
|
||||
secure: boolean;
|
||||
httpOnly: boolean;
|
||||
sameSite: 'Strict' | 'Lax' | 'None';
|
||||
}>;
|
||||
/** localStorage key-value pairs (per origin) */
|
||||
localStorage?: Record<string, string>;
|
||||
/** sessionStorage key-value pairs (per origin) */
|
||||
sessionStorage?: Record<string, string>;
|
||||
/** ISO timestamp of last save */
|
||||
savedAt?: string;
|
||||
}
|
||||
/**
|
||||
* Load session from ~/.config/browse/session.json
|
||||
* Returns null if no session file exists.
|
||||
*/
|
||||
export declare function loadSession(): BrowseSession | null;
|
||||
/**
|
||||
* Save session to ~/.config/browse/session.json
|
||||
*/
|
||||
export declare function saveSession(session: BrowseSession): void;
|
||||
/**
|
||||
* Delete the session file
|
||||
*/
|
||||
export declare function clearSession(): void;
|
||||
/**
|
||||
* Get the session file path (for display/debugging)
|
||||
*/
|
||||
export declare function getSessionPath(): string;
|
||||
/**
|
||||
* Import cookies from all available browsers, deduplicate, and save to session.json.
|
||||
* Dedup key: domain + name + path. Last-write wins (Chrome > Firefox > Safari priority).
|
||||
* Returns the merged cookie count.
|
||||
*/
|
||||
export declare function importAllToSession(): Promise<{
|
||||
total: number;
|
||||
sources: Record<string, number>;
|
||||
}>;
|
||||
//# sourceMappingURL=config.d.ts.map
|
||||
Reference in New Issue
Block a user