diff --git a/Dockerfile b/Dockerfile index 3f5f0cc..50905ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,11 @@ COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo # 从 builder 镜像中复制应用到当前镜像中 COPY --from=builder /app/main /app/main +# 从 builder 镜像中复制应用到当前镜像中 +COPY --from=builder /app/resource /app/resource + # 指定环境变量 TZ,你可以在运行 Docker 容器时通过 -e 参数来覆盖这个值 ENV TZ=Asia/Shanghai # 指定容器启动时运行的命令 -ENTRYPOINT ["/app/main"] \ No newline at end of file +ENTRYPOINT ["/app/main"] diff --git a/api/api.go b/api/api.go index dcf5ea3..857ed36 100644 --- a/api/api.go +++ b/api/api.go @@ -1,6 +1,10 @@ package api -import "github.com/gogf/gf/v2/frame/g" +import ( + "net/http" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/net/ghttp" +) func init() { s := g.Server() @@ -24,9 +28,17 @@ func init() { group.GET("/login", Login) group.POST("/login", LoginPost) group.GET("/auth/logout", AuthLogout) + group.ALL("/public-api/referral/invites/*any", NotFound) //禁用邀请 + group.POST("/backend-api/accounts/data_export", NotFound) // 禁用导出 + group.POST("/backend-api/payments/checkout", NotFound) // 禁用支付 } +// NotFound 404 +func NotFound(r *ghttp.Request) { + r.Response.WriteStatus(http.StatusNotFound) +} + // Init initializes the api module. func Init(ctx g.Ctx) { g.Log().Info(ctx, "Api module initialized") diff --git a/api/proxyapi.go b/api/proxyapi.go index f3910f2..d090f1a 100644 --- a/api/proxyapi.go +++ b/api/proxyapi.go @@ -40,6 +40,10 @@ func ProxyApi(r *ghttp.Request) { header := r.Request.Header header.Set("Origin", "https://chat.openai.com") header.Set("Referer", "https://chat.openai.com/") + accessToken := config.GetAccessToken(ctx) + if accessToken != "" { + header.Set("Authorization", "Bearer "+ accessToken) + } utils.HeaderModify(&r.Request.Header) proxy.ServeHTTP(r.Response.RawWriter(), r.Request) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ed5f033 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' +services: + cockroachai-v2: + image: lyy0709/cockroachai-v2:latest + ports: + - "9000:9315" #左侧为暴露的端口 + volumes: + - ./config.yaml:/config.yaml + - ./resource:/app/resource \ No newline at end of file diff --git a/resource/template/setup.html b/resource/template/setup.html index 6532d87..8ee58e0 100644 --- a/resource/template/setup.html +++ b/resource/template/setup.html @@ -3,40 +3,110 @@
+