Skip to content

Commit

Permalink
v1.1.0 / Links to Bing AI
Browse files Browse the repository at this point in the history
  • Loading branch information
patrik-martinko committed Jan 13, 2024
1 parent a3ce295 commit 368a850
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
12 changes: 10 additions & 2 deletions package-brave/background.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
chrome.webRequest.onBeforeSendHeaders.addListener(data => {
for (let header of data.requestHeaders) {
if (header.name.toLowerCase() === 'user-agent') {
header.value = navigator.userAgent.split('Gecko')[0] + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.58';
header.value = navigator.userAgent.split('Gecko')[0] + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0';
}
}
return { requestHeaders: data.requestHeaders };
}, { urls: ['https://*.bing.com/*'] }, ['blocking', 'requestHeaders']);
}, { urls: ['https://*.bing.com/*'] }, ['blocking', 'requestHeaders']);
chrome.browserAction.onClicked.addListener(() => {
chrome.tabs.create({ url: 'https://chat.bing.com' });
});
chrome.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'install') {
chrome.tabs.create({ url: 'https://chat.bing.com' });
}
});
5 changes: 4 additions & 1 deletion package-brave/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Bing AI for Brave",
"description": "Allows using Bing AI chatbot with Brave.",
"version": "1.0.1",
"version": "1.1.0",
"permissions": [
"webRequest",
"webRequestBlocking",
Expand All @@ -28,5 +28,8 @@
"16": "icon-16.png",
"48": "icon-48.png",
"128": "icon-128.png"
},
"browser_action": {
"default_icon": "icon-48.png"
}
}
15 changes: 9 additions & 6 deletions package/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ chrome.declarativeNetRequest.updateDynamicRules({
{
operation: 'set',
header: 'user-agent',
value: navigator.userAgent.split('AppleWebKit')[0] + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1700.00'
},
{
operation: 'set',
header: 'sec-ch-ua',
value: '"Chromium";v="112", "Microsoft Edge";v="112", "Not:A-Brand";v="99"'
value: navigator.userAgent.split('AppleWebKit')[0] + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0'
}
]
},
Expand All @@ -24,4 +19,12 @@ chrome.declarativeNetRequest.updateDynamicRules({
}
}
],
});
chrome.action.onClicked.addListener(() => {
chrome.tabs.create({ url: 'https://chat.bing.com' });
});
chrome.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'install') {
chrome.tabs.create({ url: 'https://chat.bing.com' });
}
});
5 changes: 4 additions & 1 deletion package/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Bing AI for Chrome",
"description": "Allows using Bing AI chatbot with Google Chrome and other Chromium browsers.",
"version": "1.0.1",
"version": "1.1.0",
"permissions": [
"declarativeNetRequest"
],
Expand All @@ -26,5 +26,8 @@
"16": "icon-16.png",
"48": "icon-48.png",
"128": "icon-128.png"
},
"action": {
"default_icon": "icon-48.png"
}
}

0 comments on commit 368a850

Please sign in to comment.