From 2b8d8a3aed3843049ed4cb82aa18325b246cefb9 Mon Sep 17 00:00:00 2001 From: kudo-sync-bot Date: Tue, 14 Jan 2025 04:32:30 -0800 Subject: [PATCH] =?UTF-8?q?Updated=20`apis[api].expectedOrigin.headers`,?= =?UTF-8?q?=20abstracted=20majority=20ones=20to=20`createHeaders()`=20?= =?UTF-8?q?=E2=86=9E=20[auto-sync=20from=20https://github.com/adamlui/ai-w?= =?UTF-8?q?eb-extensionss/tree/main/bravegpt]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chatgpt/bravegpt/bravegpt.user.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/chatgpt/bravegpt/bravegpt.user.js b/chatgpt/bravegpt/bravegpt.user.js index 63afc630d..59542254f 100644 --- a/chatgpt/bravegpt/bravegpt.user.js +++ b/chatgpt/bravegpt/bravegpt.user.js @@ -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 @@ -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 }, @@ -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, @@ -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': { @@ -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 } } @@ -3151,6 +3144,7 @@ } catch (err) { return false } } } + // Define API functions const api = { @@ -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