Skip to content

Commit 41f5e32

Browse files
committed
fix: network settings error
1 parent ea71012 commit 41f5e32

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

forge.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
productName: 'BingGPT',
4040
description: 'AI-powered copilot',
4141
productDescription: 'AI-powered copilot',
42-
version: '0.3.0',
42+
version: '0.3.1',
4343
categories: ['Utility'],
4444
maintainer: 'dice2o',
4545
homepage: 'https://github.com/dice2o/BingGPT',
@@ -56,7 +56,7 @@ module.exports = {
5656
productName: 'BingGPT',
5757
description: 'AI-powered copilot',
5858
productDescription: 'AI-powered copilot',
59-
version: '0.3.0',
59+
version: '0.3.1',
6060
categories: ['Utility'],
6161
maintainer: 'dice2o',
6262
homepage: 'https://github.com/dice2o/BingGPT',

main.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const createWindow = () => {
222222
},
223223
},
224224
{
225-
label: 'BingGPT v0.3.0',
225+
label: 'BingGPT v0.3.1',
226226
visible: parameters.selectionText.trim().length === 0,
227227
click: () => {
228228
shell.openExternal('https://github.com/dice2o/BingGPT/releases')
@@ -235,10 +235,8 @@ const createWindow = () => {
235235
isDarkMode ? 'dark' : 'light'
236236
}schemeovr=1&FORM=SHORUN&udscs=1&udsnav=1&setlang=${locale}&features=udssydinternal&clientscopes=windowheader,coauthor,chat,&udsframed=1`
237237
const userAgent =
238-
'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'
239-
mainWindow.loadURL(bingUrl, {
240-
userAgent: userAgent,
241-
})
238+
'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'
239+
mainWindow.loadURL(bingUrl)
242240
// Open links in default browser
243241
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
244242
shell.openExternal(url)
@@ -250,9 +248,7 @@ const createWindow = () => {
250248
url.indexOf('https://edgeservices.bing.com/edgesvc/urlredirect') !== -1
251249
) {
252250
event.preventDefault()
253-
mainWindow.loadURL(bingUrl, {
254-
userAgent: userAgent,
255-
})
251+
mainWindow.loadURL(bingUrl)
256252
}
257253
})
258254
// Modify Content Security Policy
@@ -273,6 +269,14 @@ const createWindow = () => {
273269
}
274270
}
275271
)
272+
// Modify headers
273+
mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
274+
(details, callback) => {
275+
details.requestHeaders['user-agent'] = userAgent
276+
details.requestHeaders['x-forwarded-for'] = '1.1.1.1'
277+
callback({ requestHeaders: details.requestHeaders, cancel: false })
278+
}
279+
)
276280
// Theme
277281
const themeHandler = (newTheme) => {
278282
config.set('theme', newTheme)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "binggpt",
33
"productName": "BingGPT",
4-
"version": "0.3.0",
4+
"version": "0.3.1",
55
"description": "AI-powered copilot",
66
"author": "dice2o",
77
"license": "Apache-2.0",

0 commit comments

Comments
 (0)