feat: 增加获取图片源地址功能

This commit is contained in:
meishibiezb
2026-05-01 21:54:20 +08:00
parent a6b86934af
commit dd97df9ede
3 changed files with 18 additions and 13 deletions

View File

@@ -9,15 +9,12 @@ export default defineContentScript({
const collector = new PinCollector();
// 首次加载自动收集并存储
const pins = collector.collect();
if (pins.length > 0) {
collector.saveToStorage();
}
// 允许 popup 主动触发重新收集
browser.runtime.onMessage.addListener((msg, sender, sendResponse) => {
if (msg.type === 'COLLECT_PINS') {
const updatedPins = collector.collect();
sendResponse({ success: true, count: updatedPins.length });
const pins = collector.collect();
sendResponse({ success: true, count: pins.length, pins });
return true; // 异步响应
}
});