Tidying the repo

This commit is contained in:
2025-10-23 13:50:03 -04:00
parent d55798508d
commit be68a76b8b
13 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
// background.js - Background script for handling downloads
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "downloadSQL") {
const { sqlQuery, filename } = request;
// Create blob with SQL content
const blob = new Blob([sqlQuery], { type: 'text/sql' });
const url = URL.createObjectURL(blob);
// Generate filename if not provided
const finalFilename = filename || `sql_query_${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.sql`;
// Download the file
browser.downloads.download({
url: url,
filename: finalFilename,
saveAs: true
}).then(() => {
URL.revokeObjectURL(url);
sendResponse({ success: true });
}).catch((error) => {
console.error('Download failed:', error);
sendResponse({ success: false, error: error.message });
});
return true; // Keep the message channel open for async response
}
});