From 7f74ddef2e6fdefe9559e46331b78b22ed43c348 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 1 Jun 2024 19:05:54 +0200 Subject: [PATCH] fix --- Authentification.go | 10 ++++------ Chat.go | 1 - MyUtils.go | 1 - Stripe.go | 2 -- main.go | 5 ----- views/partials/message-bot.html | 2 +- views/partials/message-user.html | 2 +- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Authentification.go b/Authentification.go index af36fa6..bcd18bd 100644 --- a/Authentification.go +++ b/Authentification.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "net/http" + "os" "github.com/edgedb/edgedb-go" "github.com/gofiber/fiber/v2" @@ -30,9 +31,6 @@ type TokenResponse struct { ProviderToken string `json:"provider_token"` } -// TODO add to env -const EDGEDB_AUTH_BASE_URL = "https://jade-hackathon--mrbounty.c-40.i.aws.edgedb.cloud/db/main/ext/auth" - func getGoogleUserProfile(providerToken string) (string, string, string) { // Fetch the discovery document resp, err := http.Get("https://accounts.google.com/.well-known/openid-configuration") @@ -158,7 +156,7 @@ func handleUiSignIn(c *fiber.Ctx) error { Secure: true, }) - return c.Redirect(fmt.Sprintf("%s/ui/signup?challenge=%s", EDGEDB_AUTH_BASE_URL, challenge), fiber.StatusTemporaryRedirect) + return c.Redirect(fmt.Sprintf("%s/ui/signup?challenge=%s", os.Getenv("EDGEDB_AUTH_BASE_URL"), challenge), fiber.StatusTemporaryRedirect) } func handleCallbackSignup(c *fiber.Ctx) error { @@ -174,7 +172,7 @@ func handleCallbackSignup(c *fiber.Ctx) error { panic("Could not find 'verifier' in the cookie store. Is this the same user agent/browser that started the authorization flow?") } - codeExchangeURL := fmt.Sprintf("%s/token?code=%s&verifier=%s", EDGEDB_AUTH_BASE_URL, code, verifier) + codeExchangeURL := fmt.Sprintf("%s/token?code=%s&verifier=%s", os.Getenv("EDGEDB_AUTH_BASE_URL"), code, verifier) resp, err := http.Get(codeExchangeURL) if err != nil { fmt.Println("Error exchanging code for access token") @@ -281,7 +279,7 @@ func handleCallback(c *fiber.Ctx) error { panic("Could not find 'verifier' in the cookie store. Is this the same user agent/browser that started the authorization flow?") } - codeExchangeURL := fmt.Sprintf("%s/token?code=%s&verifier=%s", EDGEDB_AUTH_BASE_URL, code, verifier) + codeExchangeURL := fmt.Sprintf("%s/token?code=%s&verifier=%s", os.Getenv("EDGEDB_AUTH_BASE_URL"), code, verifier) resp, err := http.Get(codeExchangeURL) if err != nil { fmt.Println("Error exchanging code for access token") diff --git a/Chat.go b/Chat.go index 2277f79..227b87c 100644 --- a/Chat.go +++ b/Chat.go @@ -443,7 +443,6 @@ func generateLimitReachedChatHTML(c *fiber.Ctx) string { clientSecretSession := CreateClientSecretSession(c) - // TODO Replace by live API call stripeTable := ` -
+
{% if not IsPlaceholder %}
-
+