feat(api): integrate screenshot commands and link detection

- Add captureUrlScreenshot() API endpoint
- Add cleanupScreenshotTempFiles() for maintenance
- Register screenshot commands in Tauri backend
- Update command module exports
This commit is contained in:
Mufeed VH
2025-06-23 00:30:01 +05:30
parent a44e9a35c3
commit 36744f13f9
3 changed files with 41 additions and 2 deletions

View File

@@ -1760,4 +1760,37 @@ export const api = {
throw error;
}
},
/**
* Captures a screenshot of a specific region in the window
* @param url - The URL to capture
* @param selector - Optional selector to capture
* @param fullPage - Whether to capture the full page
* @returns Promise resolving to the path of the saved screenshot
*/
async captureUrlScreenshot(
url: string,
selector?: string | null,
fullPage: boolean = false
): Promise<string> {
return await invoke<string>("capture_url_screenshot", {
url,
selector,
fullPage,
});
},
/**
* Cleans up old screenshot files from the temporary directory
* @param olderThanMinutes - Remove files older than this many minutes (default: 60)
* @returns Promise resolving to the number of files deleted
*/
async cleanupScreenshotTempFiles(olderThanMinutes?: number): Promise<number> {
try {
return await invoke<number>("cleanup_screenshot_temp_files", { olderThanMinutes });
} catch (error) {
console.error("Failed to cleanup screenshot files:", error);
throw error;
}
},
};