switched from .env to built-in envrionment file
This commit is contained in:
@ -11,7 +11,6 @@ import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -97,7 +96,7 @@ func (a *App) MyAnimeListLogin() {
|
||||
refreshToken, err := myAnimeListRing.Get("MyAnimeListRefreshToken")
|
||||
if err != nil || len(accessToken.Data) == 0 {
|
||||
verifier, _ := verifier()
|
||||
getMyAnimeListCodeUrl := "https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=" + os.Getenv("MAL_CLIENT_ID") + "&redirect_uri=" + os.Getenv("MAL_CALLBACK_URI") + "&code_challenge=" + verifier.Value + "&code_challenge_method=plain"
|
||||
getMyAnimeListCodeUrl := "https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=" + Environment.MAL_CLIENT_ID + "&redirect_uri=" + Environment.MAL_CALLBACK_URI + "&code_challenge=" + verifier.Value + "&code_challenge_method=plain"
|
||||
runtime.BrowserOpenURL(a.ctx, getMyAnimeListCodeUrl)
|
||||
serverDone := &sync.WaitGroup{}
|
||||
serverDone.Add(1)
|
||||
@ -185,9 +184,9 @@ func getMyAnimeListAuthorizationToken(content string, verifier *CodeVerifier) My
|
||||
CodeVerifier *CodeVerifier `json:"code_verifier"`
|
||||
}{
|
||||
GrantType: "authorization_code",
|
||||
ClientID: os.Getenv("MAL_CLIENT_ID"),
|
||||
ClientSecret: os.Getenv("MAL_CLIENT_SECRET"),
|
||||
RedirectURI: os.Getenv("MAL_CALLBACK_URI"),
|
||||
ClientID: Environment.MAL_CLIENT_ID,
|
||||
ClientSecret: Environment.MAL_CLIENT_SECRET,
|
||||
RedirectURI: Environment.MAL_CALLBACK_URI,
|
||||
Code: content,
|
||||
CodeVerifier: verifier,
|
||||
}
|
||||
@ -234,7 +233,7 @@ func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("Authorization", "Bearer "+myAnimeListJwt.AccessToken)
|
||||
req.Header.Add("myAnimeList-api-key", os.Getenv("MAL_CLIENT_ID"))
|
||||
req.Header.Add("myAnimeList-api-key", Environment.MAL_CLIENT_ID)
|
||||
|
||||
response, err := client.Do(req)
|
||||
|
||||
@ -267,6 +266,7 @@ func (a *App) LogoutMyAnimeList() string {
|
||||
if err != nil {
|
||||
fmt.Println("MAL Logout Failed", err)
|
||||
}
|
||||
myAnimeListJwt = MyAnimeListJWT{}
|
||||
}
|
||||
|
||||
return "MAL Logged Out Successfully"
|
||||
|
Reference in New Issue
Block a user