1、移动popup的page、components
2、更新wxt的host权限
3、验证message传递逻辑
This commit is contained in:
雨霖铃
2026-02-01 00:21:36 +08:00
parent 4213e70697
commit 0b70c0c0c1
12 changed files with 83 additions and 85 deletions
+6 -14
View File
@@ -1,25 +1,17 @@
import '../.wxt/types/imports.d.ts';
import { browser } from 'wxt/browser';
export default defineContentScript({
// matches: ['*://*.google.com/*'],
matches: ['<all_urls>'],
runAt: 'document_start',
main() {
console.log('Content script loaded successfully', { id: browser.runtime.id });
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
if (message.type === 'START_RECORD') {
// startRecord();
console.log('Start recording command received in content script');
sendResponse({ status: 'Recording started' });
} else if (message.type === 'STOP_RECORD') {
// stopRecord();
console.log('Stop recording command received in content script');
sendResponse({ status: 'Recording stopped' });
// 监听来自 background script 的消息
chrome.runtime.onMessage.addListener((msg: { type: string }, _sender, sendResponse) => {
if (msg.type === messages.content.checkStatus) {
console.log('[content] checkStatus received');
sendResponse({ ok: true });
} else {
console.log('Unknown command received in content script');
sendResponse({ status: 'Unknown command' });
console.log('[content] unknown message type:', msg.type);
}
return true;