Skip to content

Commit f5f1600

Browse files
committed
Replaced req.sender w/ fromBG flag in BG msg listener to reduce divergence betwen Chromium/FF code
1 parent 175872b commit f5f1600

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

chatgpt-infinity/chromium/extension/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
modals.alert(...['title', 'msg', 'btns', 'checkbox', 'width'].map(arg => req.options[arg]))
3030
else if (req.action == 'showAbout') chatgpt.isLoaded().then(() => { modals.open('about') })
3131
else if (req.action == 'syncConfigToUI') {
32-
if (req.sender == 'service-worker.js') // disable Infinity mode 1st to not transfer between tabs
32+
if (req.fromBG) // disable Infinity mode 1st to not transfer between tabs
3333
settings.save('infinityMode', false)
3434
syncConfigToUI(req.options)
3535
}

chatgpt-infinity/chromium/extension/service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ chrome.runtime.onInstalled.addListener(details => {
1010
chrome.tabs.onActivated.addListener(activeInfo =>
1111
chrome.tabs.sendMessage(activeInfo.tabId, {
1212
action: 'syncConfigToUI',
13-
sender: 'service-worker.js' // for content.js to reset config.infinityMode
13+
fromBG: true // for content.js to reset config.infinityMode
1414
}))
1515

1616
// Show ABOUT modal on ChatGPT when toolbar button clicked

chatgpt-infinity/firefox/extension/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ chrome.runtime.onInstalled.addListener(details => {
1010
chrome.tabs.onActivated.addListener(activeInfo =>
1111
chrome.tabs.sendMessage(activeInfo.tabId, {
1212
action: 'syncConfigToUI',
13-
sender: 'background.js' // for content.js to reset config.infinityMode
13+
fromBG: true // for content.js to reset config.infinityMode
1414
}))
1515

1616
// Show ABOUT modal on ChatGPT when toolbar button clicked

chatgpt-infinity/firefox/extension/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
const userInput = window.prompt(req.options.msg || 'Please enter your input:', req.options.defaultVal || '')
3333
sendResp({ input: userInput })
3434
} else if (req.action == 'syncConfigToUI') {
35-
if (req.sender == 'background.js') // disable Infinity mode 1st to not transfer between tabs
35+
if (req.fromBG) // disable Infinity mode 1st to not transfer between tabs
3636
settings.save('infinityMode', false)
3737
syncConfigToUI(req.options)
3838
}

0 commit comments

Comments
 (0)