switched from .env to built-in envrionment file

This commit is contained in:
2024-08-16 23:32:16 -04:00
parent f37622010f
commit 55cb0e2bd5
9 changed files with 37 additions and 33 deletions

View File

@ -8,7 +8,6 @@ import (
"log"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"sync"
@ -52,7 +51,7 @@ func (a *App) AniListLogin() {
accessToken, err := aniRing.Get("anilistAccessToken")
refreshToken, err := aniRing.Get("anilistRefreshToken")
if err != nil || len(accessToken.Data) == 0 {
getAniListCodeUrl := "https://anilist.co/api/v2/oauth/authorize?client_id=" + os.Getenv("ANILIST_APP_ID") + "&redirect_uri=" + os.Getenv("ANILIST_CALLBACK_URI") + "&response_type=code"
getAniListCodeUrl := "https://anilist.co/api/v2/oauth/authorize?client_id=" + Environment.ANILIST_APP_ID + "&redirect_uri=" + Environment.ANILIST_CALLBACK_URI + "&response_type=code"
runtime.BrowserOpenURL(a.ctx, getAniListCodeUrl)
serverDone := &sync.WaitGroup{}
@ -133,9 +132,9 @@ func getAniListAuthorizationToken(content string) AniListJWT {
resource := "/api/v2/oauth/token"
data := url.Values{}
data.Set("grant_type", "authorization_code")
data.Set("client_id", os.Getenv("ANILIST_APP_ID"))
data.Set("client_secret", os.Getenv("ANILIST_SECRET_TOKEN"))
data.Set("redirect_uri", os.Getenv("ANILIST_CALLBACK_URI"))
data.Set("client_id", Environment.ANILIST_APP_ID)
data.Set("client_secret", Environment.ANILIST_SECRET_TOKEN)
data.Set("redirect_uri", Environment.ANILIST_CALLBACK_URI)
data.Set("code", content)
u, _ := url.ParseRequestURI(apiUrl)
@ -211,6 +210,7 @@ func (a *App) LogoutAniList() string {
if err != nil {
fmt.Println("AniList Logout Failed", err)
}
aniListJwt = AniListJWT{}
}
return "AniList Logged Out Successfully"