Skip to content

Commit

Permalink
fix: network settings error
Browse files Browse the repository at this point in the history
  • Loading branch information
dice2o committed Mar 24, 2023
1 parent ea71012 commit 41f5e32
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
productName: 'BingGPT',
description: 'AI-powered copilot',
productDescription: 'AI-powered copilot',
version: '0.3.0',
version: '0.3.1',
categories: ['Utility'],
maintainer: 'dice2o',
homepage: 'https://github.com/dice2o/BingGPT',
Expand All @@ -56,7 +56,7 @@ module.exports = {
productName: 'BingGPT',
description: 'AI-powered copilot',
productDescription: 'AI-powered copilot',
version: '0.3.0',
version: '0.3.1',
categories: ['Utility'],
maintainer: 'dice2o',
homepage: 'https://github.com/dice2o/BingGPT',
Expand Down
20 changes: 12 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const createWindow = () => {
},
},
{
label: 'BingGPT v0.3.0',
label: 'BingGPT v0.3.1',
visible: parameters.selectionText.trim().length === 0,
click: () => {
shell.openExternal('https://github.com/dice2o/BingGPT/releases')
Expand All @@ -235,10 +235,8 @@ const createWindow = () => {
isDarkMode ? 'dark' : 'light'
}schemeovr=1&FORM=SHORUN&udscs=1&udsnav=1&setlang=${locale}&features=udssydinternal&clientscopes=windowheader,coauthor,chat,&udsframed=1`
const userAgent =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1660.12'
mainWindow.loadURL(bingUrl, {
userAgent: userAgent,
})
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.0.0'
mainWindow.loadURL(bingUrl)
// Open links in default browser
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url)
Expand All @@ -250,9 +248,7 @@ const createWindow = () => {
url.indexOf('https://edgeservices.bing.com/edgesvc/urlredirect') !== -1
) {
event.preventDefault()
mainWindow.loadURL(bingUrl, {
userAgent: userAgent,
})
mainWindow.loadURL(bingUrl)
}
})
// Modify Content Security Policy
Expand All @@ -273,6 +269,14 @@ const createWindow = () => {
}
}
)
// Modify headers
mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
(details, callback) => {
details.requestHeaders['user-agent'] = userAgent
details.requestHeaders['x-forwarded-for'] = '1.1.1.1'
callback({ requestHeaders: details.requestHeaders, cancel: false })
}
)
// Theme
const themeHandler = (newTheme) => {
config.set('theme', newTheme)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "binggpt",
"productName": "BingGPT",
"version": "0.3.0",
"version": "0.3.1",
"description": "AI-powered copilot",
"author": "dice2o",
"license": "Apache-2.0",
Expand Down

0 comments on commit 41f5e32

Please sign in to comment.