generated from coulomb/repo-seed
Implement document proxy concept with archive/live views
- Add content hash (MD5) for document deduplication - Separate local state (archived) from server state (binectStatus) - Add archive toggle button to switch between live/archived views - Add archive/restore/delete actions for documents - Refactor pdf-queue.ts with DocumentProxy interface - Add hash.ts utility for content hashing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,12 @@ import {
|
||||
addPDF,
|
||||
getActionableCount,
|
||||
getAllPDFs,
|
||||
getLiveProxies,
|
||||
getArchivedProxies,
|
||||
getPendingPDFs,
|
||||
updatePDFStatus,
|
||||
archiveProxy,
|
||||
restoreProxy,
|
||||
dismissPDF,
|
||||
removePDF,
|
||||
cleanupOldEntries,
|
||||
@@ -130,6 +134,24 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get live proxy documents (not archived)
|
||||
if (request.action === 'getLiveProxies') {
|
||||
getLiveProxies().then(entries => {
|
||||
console.log('[Service Worker] Returning live proxies:', entries.length, 'entries');
|
||||
sendResponse({ entries });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get archived proxy documents
|
||||
if (request.action === 'getArchivedProxies') {
|
||||
getArchivedProxies().then(entries => {
|
||||
console.log('[Service Worker] Returning archived proxies:', entries.length, 'entries');
|
||||
sendResponse({ entries });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Add a PDF to the queue (from popup discovery)
|
||||
if (request.action === 'addPDF') {
|
||||
addPDF(request.pdf).then(entry => {
|
||||
@@ -171,6 +193,26 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Archive a proxy document (move to archive view)
|
||||
if (request.action === 'archiveProxy') {
|
||||
archiveProxy(request.id).then(() => {
|
||||
return updateBadge();
|
||||
}).then(() => {
|
||||
sendResponse({ success: true });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Restore a proxy document (move back to live view)
|
||||
if (request.action === 'restoreProxy') {
|
||||
restoreProxy(request.id).then(() => {
|
||||
return updateBadge();
|
||||
}).then(() => {
|
||||
sendResponse({ success: true });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
if (request.action === 'removePDF') {
|
||||
removePDF(request.id).then(() => {
|
||||
return updateBadge();
|
||||
|
||||
Reference in New Issue
Block a user