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()`
  • Loading branch information
adamlui committed Jan 14, 2025
1 parent 214c88c commit 7187d00
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 68 deletions.
26 changes: 9 additions & 17 deletions amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.14.1
// @version 2025.1.14.2
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -403,10 +403,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 @@ -415,7 +412,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 @@ -424,9 +422,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 @@ -435,10 +431,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 @@ -2513,12 +2506,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
27 changes: 10 additions & 17 deletions bravegpt/greasemonkey/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.14
// @version 2025.1.14.1
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -577,10 +577,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 @@ -589,7 +586,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 @@ -598,9 +596,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 @@ -609,10 +605,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 @@ -3151,6 +3144,7 @@
} catch (err) { return false }
}
}

// Define API functions

const api = {
Expand All @@ -3163,12 +3157,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
26 changes: 9 additions & 17 deletions duckduckgpt/greasemonkey/duckduckgpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.14
// @version 2025.1.14.1
// @license MIT
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
Expand Down Expand Up @@ -585,10 +585,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 @@ -597,7 +594,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 @@ -606,9 +604,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 @@ -617,10 +613,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 @@ -3049,12 +3042,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
26 changes: 9 additions & 17 deletions googlegpt/greasemonkey/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 7187d00

Please sign in to comment.