feat: CSP Violation ( 感叹号图标被拦截 )
All checks were successful
Extension Build & Release / build (push) Successful in 48s

This commit is contained in:
zs
2026-03-03 00:19:24 +08:00
parent dc808628d3
commit 50bd2925c1
3 changed files with 52 additions and 9 deletions

View File

@@ -9,7 +9,19 @@ const API_BASE = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080/api
chrome.runtime.onMessage.addListener((message: { type: string; payload?: any }, _sender: chrome.runtime.MessageSender, sendResponse: (response?: any) => void) => {
if (message.type === 'SHOW_INSIGHT') {
console.log('Received tweet data in background:', message.payload);
console.log('[InsightReply Background] Received SHOW_INSIGHT data:', message.payload);
if (_sender.tab?.id) {
console.log(`[InsightReply Background] Forwarding SHOW_INSIGHT to tab ${_sender.tab.id}`);
chrome.tabs.sendMessage(_sender.tab.id, message, (response) => {
if (chrome.runtime.lastError) {
console.error('[InsightReply Background] Error forwarding message to tab:', chrome.runtime.lastError);
} else {
console.log('[InsightReply Background] Successfully forwarded to tab, response:', response);
}
});
}
sendResponse({ success: true, forwarded: !!_sender.tab?.id });
return true;
}
if (message.type === 'FETCH_CUSTOM_STRATEGIES') {