Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
GetForm
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed Jun 29, 2023
1 parent f012bfd commit b819e68
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion funcaptcha
Submodule funcaptcha updated from 084e7d to 43552f
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/acheong08/OpenAIAuth v0.0.0-20230530050836-f2a06cd52911
github.com/acheong08/endless v0.0.0-20230529075213-74050cf641c8
github.com/acheong08/funcaptcha v0.2.1-0.20230629044031-084e7dfaffef
github.com/acheong08/funcaptcha v0.2.1-0.20230629084009-43552f77d69a
github.com/bogdanfinn/fhttp v0.5.23
github.com/bogdanfinn/tls-client v1.4.0
github.com/gin-gonic/gin v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/acheong08/endless v0.0.0-20230529075213-74050cf641c8 h1:mHtMoGlGNUfMR
github.com/acheong08/endless v0.0.0-20230529075213-74050cf641c8/go.mod h1:0yO7neMeJLvKk/B/fq5votDY8rByrOPDubpvU+6saKo=
github.com/acheong08/funcaptcha v0.2.1-0.20230629044031-084e7dfaffef h1:B5fq4j+Qiu/6vay/70BG9mBuBgF28CnA4MTx1+J2V+o=
github.com/acheong08/funcaptcha v0.2.1-0.20230629044031-084e7dfaffef/go.mod h1:VupbjtVAODvgyAB3Zo86fOA53G+UAmaV/Rk9jUCGuTU=
github.com/acheong08/funcaptcha v0.2.1-0.20230629084009-43552f77d69a h1:fmOHjUNCWC0iYzn0giYkDYIppIaCfmdn4UqFXZRbL4E=
github.com/acheong08/funcaptcha v0.2.1-0.20230629084009-43552f77d69a/go.mod h1:VupbjtVAODvgyAB3Zo86fOA53G+UAmaV/Rk9jUCGuTU=
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/bogdanfinn/fhttp v0.5.23 h1:4Xb5OjYArB8GpnUw4A4r5jmt8UW0/Cvey3R9nS2dC9U=
Expand Down
23 changes: 15 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (
http_proxy = os.Getenv("http_proxy")
authorizations auth_struct
OpenAI_HOST = os.Getenv("OPENAI_HOST")
arkose_token string
)

func admin(c *gin.Context) {
Expand Down Expand Up @@ -133,6 +132,11 @@ func main() {
os.Setenv("OPENAI_PASSWORD", authorizations.OpenAI_Password)
})

handler.GET("/api/arkose", func(ctx *gin.Context) {
arkose_form := arkose.GetForm()
ctx.JSON(200, gin.H{"form": arkose_form})
})

handler.Any("/api/*path", proxy)

gin.SetMode(gin.ReleaseMode)
Expand Down Expand Up @@ -171,14 +175,17 @@ func proxy(c *gin.Context) {
return
}
if strings.HasPrefix(request_body["model"].(string), "gpt-4") {
token, err := arkose.GetOpenAIToken()
if err == nil {
arkose_token = token
} else {
fmt.Println(err)
if _, ok := request_body["arkose_token"]; !ok {
token, err := arkose.GetOpenAIToken()
var arkose_token string
if err == nil {
arkose_token = token
} else {
fmt.Println(err)
}
request_body["arkose_token"] = arkose_token
println(arkose_token)
}
request_body["arkose_token"] = arkose_token
println(arkose_token)
}
body_json, err := json.Marshal(request_body)
if err != nil {
Expand Down

0 comments on commit b819e68

Please sign in to comment.