完成扩展

This commit is contained in:
dela
2026-01-10 16:53:02 +08:00
parent 9eba656dbd
commit 97b162939e
31 changed files with 8436 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/**
* Extension Compatibility Wrapper
* Add this to the end of each module file to make it work with the extension
*/
// Listen for initialization messages from content script
window.addEventListener('message', (event) => {
if (event.source !== window) return;
const message = event.data;
// Handle module initialization
if (message && message.type === 'INIT_MODULE' && message.moduleName === 'hcaptchaBypass') {
console.log('[HCaptcha Bypass] Initializing from extension...');
if (window[message.instanceKey]) {
console.log('[HCaptcha Bypass] Instance already exists');
return;
}
try {
const instance = new HCaptchaBypassModule(message.config);
instance.init();
window[message.instanceKey] = instance;
console.log('[HCaptcha Bypass] Initialized successfully');
} catch (error) {
console.error('[HCaptcha Bypass] Initialization failed:', error);
}
}
// Handle module destruction
if (message && message.type === 'DESTROY_MODULE' && message.instanceKey === '__hcaptchaBypassInstance') {
console.log('[HCaptcha Bypass] Destroying instance...');
const instance = window[message.instanceKey];
if (instance && typeof instance.destroy === 'function') {
instance.destroy();
delete window[message.instanceKey];
console.log('[HCaptcha Bypass] Destroyed successfully');
}
}
});