Skip to content

Commit

Permalink
Updated apis[api].expectedOrigin.headers, abstracted majority ones …
Browse files Browse the repository at this point in the history
…to `createHeaders()` ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/googlegpt]
  • Loading branch information
kudo-sync-bot committed Jan 14, 2025
1 parent 26f6d6d commit f4c9bb8
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions chatgpt/googlegpt/googlegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.14
// @version 2025.1.14.1
// @license MIT
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
Expand Down Expand Up @@ -767,10 +767,7 @@
endpoint: 'https://am.aifree.site/api/generate',
expectedOrigin: {
url: 'https://am.aifree.site',
headers: {
'Accept': '*/*', 'Alt-Used': 'am.aifree.site', 'Content-Type': 'text/plain;charset=UTF-8',
'Priority': 'u=4', 'Sec-Fetch-Site': 'same-origin'
}
headers: { 'Alt-Used': 'am.aifree.site', 'Content-Type': 'text/plain;charset=UTF-8', 'Priority': 'u=4' }
},
method: 'POST', streamable: true
},
Expand All @@ -779,7 +776,8 @@
expectedOrigin: {
url: 'https://ai28.gptforlove.com',
headers: {
'Accept': 'application/json, text/plain, */*', 'Priority': 'u=0', 'Sec-Fetch-Site': 'same-site'
'Accept': 'application/json, text/plain, */*',
'Priority': 'u=0', 'Sec-Fetch-Site': 'same-site', 'TE': 'trailers'
}
},
method: 'POST', streamable: true, accumulatesText: true,
Expand All @@ -788,9 +786,7 @@
'MixerBox AI': {
endpoint: 'https://chatai.mixerbox.com/api/chat/stream',
expectedOrigin: {
url: 'https://chatai.mixerbox.com',
headers: { 'Accept': '*/*', 'Alt-Used': 'chatai.mixerbox.com', 'Sec-Fetch-Site': 'same-origin' }
},
url: 'https://chatai.mixerbox.com', headers: { 'Alt-Used': 'chatai.mixerbox.com', 'TE': 'trailers' }},
method: 'POST', streamable: true, accumulatesText: false
},
'OpenAI': {
Expand All @@ -799,10 +795,7 @@
completions: 'https://api.openai.com/v1/chat/completions',
session: 'https://chatgpt.com/api/auth/session'
},
expectedOrigin: {
url: 'https://chatgpt.com',
headers: { 'Accept': '*/*', 'Priority': 'u=4', 'Sec-Fetch-Site': 'same-site' }
},
expectedOrigin: { url: 'https://chatgpt.com', headers: { 'Priority': 'u=4' }},
method: 'POST', streamable: true
}
}
Expand Down Expand Up @@ -3384,12 +3377,11 @@
createHeaders(api) {
const ip = ipv4.generate({ verbose: false })
const headers = {
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Connection': 'keep-alive', 'Content-Type': 'application/json', 'DNT': '1',
'Host': new URL(apis[api].endpoints?.completions || apis[api].endpoint).hostname,
'Origin': apis[api].expectedOrigin.url,
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors',
'TE': 'trailers', 'X-Forwarded-For': ip, 'X-Real-IP': ip
'Origin': apis[api].expectedOrigin.url, 'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'X-Forwarded-For': ip, 'X-Real-IP': ip
}
headers.Referer = headers.Origin + '/'
if (api == 'OpenAI') headers.Authorization = 'Bearer ' + config.openAIkey
Expand Down

0 comments on commit f4c9bb8

Please sign in to comment.