Skip to content

Commit 2b8d8a3

Browse files
committed
Updated apis[api].expectedOrigin.headers, abstracted majority ones to createHeaders() ↞ [auto-sync from https://github.com/adamlui/ai-web-extensionss/tree/main/bravegpt]
1 parent 2f5546b commit 2b8d8a3

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

chatgpt/bravegpt/bravegpt.user.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.1.14
151+
// @version 2025.1.14.1
152152
// @license MIT
153153
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
154154
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
@@ -577,10 +577,7 @@
577577
endpoint: 'https://am.aifree.site/api/generate',
578578
expectedOrigin: {
579579
url: 'https://am.aifree.site',
580-
headers: {
581-
'Accept': '*/*', 'Alt-Used': 'am.aifree.site', 'Content-Type': 'text/plain;charset=UTF-8',
582-
'Priority': 'u=4', 'Sec-Fetch-Site': 'same-origin'
583-
}
580+
headers: { 'Alt-Used': 'am.aifree.site', 'Content-Type': 'text/plain;charset=UTF-8', 'Priority': 'u=4' }
584581
},
585582
method: 'POST', streamable: true
586583
},
@@ -589,7 +586,8 @@
589586
expectedOrigin: {
590587
url: 'https://ai28.gptforlove.com',
591588
headers: {
592-
'Accept': 'application/json, text/plain, */*', 'Priority': 'u=0', 'Sec-Fetch-Site': 'same-site'
589+
'Accept': 'application/json, text/plain, */*',
590+
'Priority': 'u=0', 'Sec-Fetch-Site': 'same-site', 'TE': 'trailers'
593591
}
594592
},
595593
method: 'POST', streamable: true, accumulatesText: true,
@@ -598,9 +596,7 @@
598596
'MixerBox AI': {
599597
endpoint: 'https://chatai.mixerbox.com/api/chat/stream',
600598
expectedOrigin: {
601-
url: 'https://chatai.mixerbox.com',
602-
headers: { 'Accept': '*/*', 'Alt-Used': 'chatai.mixerbox.com', 'Sec-Fetch-Site': 'same-origin' }
603-
},
599+
url: 'https://chatai.mixerbox.com', headers: { 'Alt-Used': 'chatai.mixerbox.com', 'TE': 'trailers' }},
604600
method: 'POST', streamable: true, accumulatesText: false
605601
},
606602
'OpenAI': {
@@ -609,10 +605,7 @@
609605
completions: 'https://api.openai.com/v1/chat/completions',
610606
session: 'https://chatgpt.com/api/auth/session'
611607
},
612-
expectedOrigin: {
613-
url: 'https://chatgpt.com',
614-
headers: { 'Accept': '*/*', 'Priority': 'u=4', 'Sec-Fetch-Site': 'same-site' }
615-
},
608+
expectedOrigin: { url: 'https://chatgpt.com', headers: { 'Priority': 'u=4' }},
616609
method: 'POST', streamable: true
617610
}
618611
}
@@ -3151,6 +3144,7 @@
31513144
} catch (err) { return false }
31523145
}
31533146
}
3147+
31543148
// Define API functions
31553149

31563150
const api = {
@@ -3163,12 +3157,11 @@
31633157
createHeaders(api) {
31643158
const ip = ipv4.generate({ verbose: false })
31653159
const headers = {
3166-
'Accept-Encoding': 'gzip, deflate, br, zstd',
3160+
'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br, zstd',
31673161
'Connection': 'keep-alive', 'Content-Type': 'application/json', 'DNT': '1',
31683162
'Host': new URL(apis[api].endpoints?.completions || apis[api].endpoint).hostname,
3169-
'Origin': apis[api].expectedOrigin.url,
3170-
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors',
3171-
'TE': 'trailers', 'X-Forwarded-For': ip, 'X-Real-IP': ip
3163+
'Origin': apis[api].expectedOrigin.url, 'Sec-Fetch-Site': 'same-origin',
3164+
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'X-Forwarded-For': ip, 'X-Real-IP': ip
31723165
}
31733166
headers.Referer = headers.Origin + '/'
31743167
if (api == 'OpenAI') headers.Authorization = 'Bearer ' + config.openAIkey

0 commit comments

Comments
 (0)