Skip to content

Commit cffb623

Browse files
committed
Replaced persistent sessionStorage for env.extensionActive init w/ msg passing ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-auto-continue]
1 parent d733a08 commit cffb623

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

chatgpt/chatgpt-auto-continue/chatgpt-auto-continue.user.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
// @description:zu ⚡ Terus menghasilkan imibuzo eminingi ye-ChatGPT ngokwesizulu
220220
// @author Adam Lui
221221
// @namespace https://github.com/adamlui
222-
// @version 2025.2.27
222+
// @version 2025.2.28
223223
// @license MIT
224224
// @icon https://assets.chatgptautocontinue.com/images/icons/continue-symbol/circled/with-robot/icon48.png?v=8b39fb4
225225
// @icon64 https://assets.chatgptautocontinue.com/images/icons/continue-symbol/circled/with-robot/icon64.png?v=8b39fb4
@@ -497,8 +497,18 @@
497497

498498
// Run MAIN routine
499499

500+
// Init EXTENSION ACTIVE state
501+
env.extensionActive = false
502+
postMessage({ action: 'getExtensionInfo', source: `${app.slug}.user.js` })
503+
addEventListener('message', handleMsgResp)
504+
function handleMsgResp(resp) {
505+
const sender = resp.data.source.toLowerCase()
506+
env.extensionActive = sender.includes(app.slug.toLowerCase()) && sender.includes('extension')
507+
}
508+
await new Promise(resolve => setTimeout(resolve, 100)) // wait for extension response
509+
removeEventListener('message', handleMsgResp)
510+
500511
// Create browser TOOLBAR MENU + DISABLE SCRIPT if extension active
501-
env.extensionActive = sessionStorage.chatgptAutoContisdnueExtensionActive == 'true'
502512
toolbarMenu.register() ; if (env.extensionActive) return
503513

504514
// Add RISING PARTICLES styles

0 commit comments

Comments
 (0)