diff --git a/guoba.support.js b/guoba.support.js index 112fda6..c1e8206 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -601,16 +601,22 @@ export function supportGuoba () { bottomHelpMessage: 'claude.ai Cookie中的SessionKey', component: 'Input' }, + { + field: 'claudeAIReverseProxy', + label: 'claude2 反代', + bottomHelpMessage: 'claude.ai 的反代。或许可以参考https://github.com/ikechan8370/sydney-ws-proxy/tree/claude.ai搭建', + component: 'Input' + }, { field: 'claudeAIJA3', label: 'claude2浏览器指纹', - bottomHelpMessage: 'claude.ai使用的浏览器TLS指纹,去https://scrapfly.io/web-scraping-tools/ja3-fingerprint或https://ja3.zone/check查看', + bottomHelpMessage: 'claude.ai使用的浏览器TLS指纹,去https://scrapfly.io/web-scraping-tools/ja3-fingerprint或https://ja3.zone/check查看。如果用了反代就不用管', component: 'Input' }, { field: 'claudeAIUA', label: 'claude2浏览器UA', - bottomHelpMessage: 'claude.ai使用的浏览器UA,去https://scrapfly.io/web-scraping-tools/ja3-fingerprint或https://ja3.zone/check查看', + bottomHelpMessage: 'claude.ai使用的浏览器UA,https://scrapfly.io/web-scraping-tools/http2-fingerprint或https://ja3.zone/check查看。如果用了反代就不用管', component: 'Input' }, { diff --git a/utils/claude.ai/index.js b/utils/claude.ai/index.js index e79e0ef..68ce116 100644 --- a/utils/claude.ai/index.js +++ b/utils/claude.ai/index.js @@ -103,8 +103,9 @@ export class ClaudeAIClient { // redirect: 'manual' // // referrer: 'https://claude.ai/chat/bba5a67d-ee59-4196-a371-ece8a35db1f2' // }) + let host = Config.claudeAIReverseProxy || 'https://claude.ai' const cycleTLS = await initCycleTLS() - let result = await cycleTLS(`https://claude.ai/api/organizations/${this.organizationId}/chat_conversations`, { + let result = await cycleTLS(`${host}/api/organizations/${this.organizationId}/chat_conversations`, { ja3: this.JA3, userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36', proxy: this.proxy, @@ -140,7 +141,8 @@ export class ClaudeAIClient { timezone: 'Asia/Hong_Kong' } } - let url = 'https://claude.ai/api/append_message' + let host = Config.claudeAIReverseProxy || 'https://claude.ai' + let url = host + '/api/append_message' const cycleTLS = await initCycleTLS() let streamDataRes = await cycleTLS(url, { ja3: this.JA3, diff --git a/utils/config.js b/utils/config.js index 341d097..78351a1 100644 --- a/utils/config.js +++ b/utils/config.js @@ -147,6 +147,7 @@ const defaultConfig = { // claude2 claudeAIOrganizationId: '', claudeAISessionKey: '', + claudeAIReverseProxy: '', claudeAIJA3: '772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,27-5-65281-13-35-0-51-18-16-43-10-45-11-17513-23,29-23-24,0', claudeAIUA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36', version: 'v2.7.4'