forked from feixuei/chatgpt-mirror-server
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eed4abb
commit d8633a8
Showing
22 changed files
with
212 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
package backendapi | ||
|
||
import ( | ||
"chatgpt-mirror-server/config" | ||
"net/http" | ||
|
||
"github.com/gogf/gf/v2/encoding/gjson" | ||
|
@@ -20,39 +19,40 @@ func Me(r *ghttp.Request) { | |
r.Response.WriteStatus(http.StatusUnauthorized) | ||
return | ||
} | ||
if record.IsEmpty() { | ||
g.Log().Error(ctx, "session is empty") | ||
r.Response.WriteStatus(http.StatusUnauthorized) | ||
return | ||
} | ||
AccessToken := "" | ||
// 如果 record mode ==1 | ||
if record["mode"].Int() == 1 { | ||
AccessToken = record["officialSession"].String() | ||
} else { | ||
officialSession := gjson.New(record["officialSession"].String()) | ||
AccessToken = officialSession.Get("accessToken").String() | ||
// if record.IsEmpty() { | ||
// g.Log().Error(ctx, "session is empty") | ||
// r.Response.WriteStatus(http.StatusUnauthorized) | ||
// return | ||
// } | ||
// AccessToken := "" | ||
// // 如果 record mode ==1 | ||
// if record["mode"].Int() == 1 { | ||
// AccessToken = record["officialSession"].String() | ||
// } else { | ||
// officialSession := gjson.New(record["officialSession"].String()) | ||
// AccessToken = officialSession.Get("accessToken").String() | ||
|
||
} | ||
// } | ||
resStr, err := ProxyRequestGet("/backend-api/me", r) | ||
|
||
UpStream := config.CHATPROXY(ctx) | ||
// 请求后端接口 | ||
res, err := g.Client().SetHeaderMap(map[string]string{ | ||
"Authorization": "Bearer " + AccessToken, | ||
"User-Agent": r.Header.Get("User-Agent"), | ||
"authKey": config.AUTHKEY(ctx), | ||
}).Get(ctx, UpStream+"/backend-api/me") | ||
// UpStream := config.CHATPROXY(ctx) | ||
// // 请求后端接口 | ||
// res, err := g.Client().SetHeaderMap(map[string]string{ | ||
// "Authorization": "Bearer " + AccessToken, | ||
// "User-Agent": r.Header.Get("User-Agent"), | ||
// "authKey": config.AUTHKEY(ctx), | ||
// }).Get(ctx, UpStream+"/backend-api/me") | ||
if err != nil { | ||
r.Response.WriteStatus(http.StatusUnauthorized) | ||
return | ||
} | ||
resStr := res.ReadAllString() | ||
if res.StatusCode != http.StatusOK { | ||
r.Response.Status = res.StatusCode | ||
r.Response.Write(resStr) | ||
// resStr := res.ReadAllString() | ||
// if res.StatusCode != http.StatusOK { | ||
// r.Response.Status = res.StatusCode | ||
// r.Response.Write(resStr) | ||
|
||
return | ||
} | ||
// return | ||
// } | ||
resJson := gjson.New(resStr) | ||
resJson.Set("email", "[email protected]") | ||
resJson.Set("name", record["user_username"].String()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,10 @@ modules: | |
enable: 1 | ||
|
||
# 接入网关地址 | ||
CHATPROXY: "https://demo.xyhelper.cn" | ||
CHATPROXY: "https://38.207.162.134:8443" | ||
#CHATPROXY: "https://chat.openai.com" | ||
#JA3_PROXY: "http://a:[email protected]:9988" | ||
#JA3_PROXY: "http://a:[email protected]:9988" | ||
#CHATPROXY: "http://host.docker.internal:7999" | ||
#CHATPROXY: "https://chatgpt.ggss.club/gateway" | ||
#ARKOSE_URL: "https://chatgpt.ggss.club/arkose/v2/" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html data-build="prod-e3f63e92a6423f531218665f67cc22d6fa99a672"><head>{{.envScript}}<meta charSet="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><link rel="apple-touch-icon" sizes="180x180" href="{{.assetPrefix}}/_next/static/media/apple-touch-icon.59f2e898.png" /><link rel="icon" type="image/png" sizes="32x32" href="{{.assetPrefix}}/_next/static/media/favicon-32x32.be48395e.png" /><link rel="icon" type="image/png" sizes="16x16" href="{{.assetPrefix}}/_next/static/media/favicon-16x16.9b8dbb69.png" /><link rel="preconnect" href="{{.assetPrefix}}" /><title>ChatGPT</title><meta name="title" content="ChatGPT: Get instant answers, find inspiration, learn something new" /><meta name="description" content="ChatGPT is a free-to-use AI system. Use it for engaging conversations, gain insights, automate tasks, and witness the future of AI, all in one place." /><meta name="keywords" content="ai chat,ai,chap gpt,chat gbt,chat gpt 3,chat gpt login,chat gpt website,chat gpt,chat gtp,chat openai,chat,chatai,chatbot gpt,chatg,chatgpt login,chatgpt,gpt chat,open ai,openai chat,openai chatgpt,openai" /><meta property="og:description" content="A conversational AI system that listens, learns, and challenges" /><meta name="robots" content="index, follow" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta property="og:title" content="ChatGPT" /><meta property="og:image" content="{{.assetPrefix}}/_next/static/media/chatgpt-share-og.49cbbffe.png" /><meta property="og:url" content="https://chat.openai.com" /><meta name="apple-itunes-app" content="app-id=6448311069" /><meta name="next-head-count" content="17" /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-buch.13189857.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-halbfett.977f1845.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-kraftig.204b461c.woff2" as="font" crossorigin /><link data-next-font rel="preconnect" href="/" crossorigin="anonymous" /><link rel="preload" href="{{.assetPrefix}}/_next/static/css/69d45a43fffef6f2.css?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" as="style" crossorigin="anonymous" /><link rel="stylesheet" href="{{.assetPrefix}}/_next/static/css/69d45a43fffef6f2.css?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" crossorigin="anonymous" data-n-g /><noscript data-n-css></noscript><script defer crossorigin="anonymous" nomodule src="{{.assetPrefix}}/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672"></script><script src="{{.assetPrefix}}/_next/static/chunks/webpack-428ae3a66ed57c56.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/framework-d69d7cd8328ac368.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/vendor-3adbe9ef4b7dd8f7.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/main-e7f84069c815d1a0.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/_app-8dff4b8fba8c4d5d.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/%5B%5B...default%5D%5D-afdd4e016ec92443.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/4DtybnrborNWeufDD8H-a/_buildManifest.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/4DtybnrborNWeufDD8H-a/_ssgManifest.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script></head><body class="antialiased"><div id="__next"><script>!function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}()</script><div class="relative z-0 flex h-full w-full overflow-hidden"><div class="relative flex h-full max-w-full flex-1 flex-col overflow-hidden"><main class="relative h-full w-full flex-1 overflow-auto transition-width"></main></div></div><div class="absolute left-0 right-0 top-0 z-[2]"></div><audio class="fixed bottom-0 left-0 hidden h-0 w-0" autoplay crossorigin="anonymous"></audio></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{{.props}}</script><script></script></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html data-build="prod-e3f63e92a6423f531218665f67cc22d6fa99a672"><head>{{.envScript}}<meta charSet="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><link rel="apple-touch-icon" sizes="180x180" href="{{.assetPrefix}}/_next/static/media/apple-touch-icon.59f2e898.png" /><link rel="icon" type="image/png" sizes="32x32" href="{{.assetPrefix}}/_next/static/media/favicon-32x32.be48395e.png" /><link rel="icon" type="image/png" sizes="16x16" href="{{.assetPrefix}}/_next/static/media/favicon-16x16.9b8dbb69.png" /><link rel="preconnect" href="{{.assetPrefix}}" /><title>ChatGPT</title><meta name="title" content="ChatGPT: Get instant answers, find inspiration, learn something new" /><meta name="description" content="ChatGPT is a free-to-use AI system. Use it for engaging conversations, gain insights, automate tasks, and witness the future of AI, all in one place." /><meta name="keywords" content="ai chat,ai,chap gpt,chat gbt,chat gpt 3,chat gpt login,chat gpt website,chat gpt,chat gtp,chat openai,chat,chatai,chatbot gpt,chatg,chatgpt login,chatgpt,gpt chat,open ai,openai chat,openai chatgpt,openai" /><meta property="og:description" content="A conversational AI system that listens, learns, and challenges" /><meta name="robots" content="index, follow" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta property="og:title" content="ChatGPT" /><meta property="og:image" content="{{.assetPrefix}}/_next/static/media/chatgpt-share-og.49cbbffe.png" /><meta property="og:url" content="https://chat.openai.com" /><meta name="apple-itunes-app" content="app-id=6448311069" /><meta name="next-head-count" content="17" /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-buch.13189857.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-halbfett.977f1845.woff2" as="font" crossorigin /><link rel="preload" href="{{.assetPrefix}}/_next/static/media/soehne-kraftig.204b461c.woff2" as="font" crossorigin /><link data-next-font rel="preconnect" href="/" crossorigin="anonymous" /><link rel="preload" href="{{.assetPrefix}}/_next/static/css/69d45a43fffef6f2.css?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" as="style" crossorigin="anonymous" /><link rel="stylesheet" href="{{.assetPrefix}}/_next/static/css/69d45a43fffef6f2.css?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" crossorigin="anonymous" data-n-g /><noscript data-n-css></noscript><script defer crossorigin="anonymous" nomodule src="{{.assetPrefix}}/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672"></script><script src="{{.assetPrefix}}/_next/static/chunks/webpack-428ae3a66ed57c56.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/framework-d69d7cd8328ac368.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/vendor-3adbe9ef4b7dd8f7.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/main-e7f84069c815d1a0.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/_app-8dff4b8fba8c4d5d.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/chunks/pages/gpts-2f1723e4bc885593.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/4DtybnrborNWeufDD8H-a/_buildManifest.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script><script src="{{.assetPrefix}}/_next/static/4DtybnrborNWeufDD8H-a/_ssgManifest.js?dpl=e3f63e92a6423f531218665f67cc22d6fa99a672" defer crossorigin="anonymous"></script></head><body class="antialiased"><div id="__next"><script>!function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}()</script><div class="absolute left-0 right-0 top-0 z-[2]"></div><audio class="fixed bottom-0 left-0 hidden h-0 w-0" autoplay crossorigin="anonymous"></audio></div><script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">{{.props}}</script><script></script></body></html> |
Oops, something went wrong.