feat: 更新背景脚本和内容脚本,添加录制控制消息处理,优化录制状态检查逻辑,新增消息常量

This commit is contained in:
雨霖铃
2026-01-30 23:08:49 +08:00
parent 0ff33cbeb3
commit 88a612f9cf
7 changed files with 201 additions and 105 deletions
+23 -2
View File
@@ -1,6 +1,27 @@
// import { useRecorder } from '../hooks/useRecorder';
export default defineContentScript({
matches: ['*://*.google.com/*'],
// matches: ['*://*.google.com/*'],
matches: ['<all_urls>'],
runAt: 'document_start',
main() {
console.log('Hello content.');
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' });
} else {
console.log('Unknown command received in content script');
sendResponse({ status: 'Unknown command' });
}
return true;
});
},
});