spelling correct
This commit is contained in:
		@@ -17,14 +17,14 @@ func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
 | 
			
		||||
	if login && (AniListJWT{}) != aniListJwt {
 | 
			
		||||
		response.Header.Add("Authorization", "Bearer "+aniListJwt.AccessToken)
 | 
			
		||||
	} else if login {
 | 
			
		||||
		return nil, "Please login to anilist to make this request"
 | 
			
		||||
		return nil, "Please login to AniList to make this request"
 | 
			
		||||
	}
 | 
			
		||||
	response.Header.Add("Content-Type", "application/json")
 | 
			
		||||
	response.Header.Add("Accept", "application/json")
 | 
			
		||||
 | 
			
		||||
	client := &http.Client{}
 | 
			
		||||
	res, reserr := client.Do(response)
 | 
			
		||||
	if reserr != nil {
 | 
			
		||||
	res, resErr := client.Do(response)
 | 
			
		||||
	if resErr != nil {
 | 
			
		||||
		log.Printf("Failed at res, %s\n", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -148,7 +148,7 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
 | 
			
		||||
		return post
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if status == "404 Not Found" && login {
 | 
			
		||||
	if status == "404 Not Found" {
 | 
			
		||||
		post = a.GetAniListItem(aniId, false)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package main
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
@@ -123,7 +124,7 @@ func (a *App) handleAniListCallback(wg *sync.WaitGroup) {
 | 
			
		||||
 | 
			
		||||
	go func() {
 | 
			
		||||
		defer wg.Done()
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
 | 
			
		||||
			log.Fatalf("listen: %s\n", err)
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("Shutting down...")
 | 
			
		||||
@@ -152,8 +153,8 @@ func getAniListAuthorizationToken(content string) AniListJWT {
 | 
			
		||||
	response.Header.Add("Accept", "application/json")
 | 
			
		||||
 | 
			
		||||
	client := &http.Client{}
 | 
			
		||||
	res, reserr := client.Do(response)
 | 
			
		||||
	if reserr != nil {
 | 
			
		||||
	res, resErr := client.Do(response)
 | 
			
		||||
	if resErr != nil {
 | 
			
		||||
		log.Printf("Failed at res, %s\n", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ import (
 | 
			
		||||
	"crypto/sha256"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
@@ -79,10 +80,10 @@ func (a *App) CheckIfMyAnimeListLoggedIn() bool {
 | 
			
		||||
		if (tokenErr != nil || expiresInErr != nil || refreshTokenErr != nil || accessTokenErr != nil) || len(accessToken.Data) == 0 {
 | 
			
		||||
			return false
 | 
			
		||||
		} else {
 | 
			
		||||
			var expresInConvertErr error
 | 
			
		||||
			var expiresInConvertErr error
 | 
			
		||||
			myAnimeListJwt.TokenType = string(tokenType.Data)
 | 
			
		||||
			myAnimeListJwt.ExpiresIn, expresInConvertErr = strconv.Atoi(string(expiresIn.Data))
 | 
			
		||||
			if expresInConvertErr != nil {
 | 
			
		||||
			myAnimeListJwt.ExpiresIn, expiresInConvertErr = strconv.Atoi(string(expiresIn.Data))
 | 
			
		||||
			if expiresInConvertErr != nil {
 | 
			
		||||
				fmt.Println("unable to convert string to int")
 | 
			
		||||
			}
 | 
			
		||||
			myAnimeListJwt.AccessToken = string(accessToken.Data)
 | 
			
		||||
@@ -111,10 +112,10 @@ func (a *App) MyAnimeListLogin() {
 | 
			
		||||
			a.handleMyAnimeListCallback(serverDone, verifier)
 | 
			
		||||
			serverDone.Wait()
 | 
			
		||||
		} else {
 | 
			
		||||
			var expresInConvertErr error
 | 
			
		||||
			var expiresInConvertErr error
 | 
			
		||||
			myAnimeListJwt.TokenType = string(tokenType.Data)
 | 
			
		||||
			myAnimeListJwt.ExpiresIn, expresInConvertErr = strconv.Atoi(string(expiresIn.Data))
 | 
			
		||||
			if expresInConvertErr != nil {
 | 
			
		||||
			myAnimeListJwt.ExpiresIn, expiresInConvertErr = strconv.Atoi(string(expiresIn.Data))
 | 
			
		||||
			if expiresInConvertErr != nil {
 | 
			
		||||
				fmt.Println("unable to convert string to int in Login function")
 | 
			
		||||
			}
 | 
			
		||||
			myAnimeListJwt.AccessToken = string(accessToken.Data)
 | 
			
		||||
@@ -176,7 +177,7 @@ func (a *App) handleMyAnimeListCallback(wg *sync.WaitGroup, verifier *CodeVerifi
 | 
			
		||||
 | 
			
		||||
	go func() {
 | 
			
		||||
		defer wg.Done()
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
 | 
			
		||||
			log.Fatalf("listen: %s\n", err)
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("Shutting down...")
 | 
			
		||||
@@ -215,8 +216,8 @@ func getMyAnimeListAuthorizationToken(content string, verifier *CodeVerifier) My
 | 
			
		||||
	response.Header.Add("Content-Type", "application/x-www-form-urlencoded")
 | 
			
		||||
 | 
			
		||||
	client := &http.Client{}
 | 
			
		||||
	res, reserr := client.Do(response)
 | 
			
		||||
	if reserr != nil {
 | 
			
		||||
	res, resErr := client.Do(response)
 | 
			
		||||
	if resErr != nil {
 | 
			
		||||
		log.Printf("Failed at res, %s\n", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -265,8 +266,8 @@ func refreshMyAnimeListAuthorizationToken() {
 | 
			
		||||
	response.Header.Add("Content-Type", "application/x-www-form-urlencoded")
 | 
			
		||||
 | 
			
		||||
	client := &http.Client{}
 | 
			
		||||
	res, reserr := client.Do(response)
 | 
			
		||||
	if reserr != nil {
 | 
			
		||||
	res, resErr := client.Do(response)
 | 
			
		||||
	if resErr != nil {
 | 
			
		||||
		log.Printf("Failed at res, %s\n", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
@@ -114,7 +115,7 @@ func (a *App) handleSimklCallback(wg *sync.WaitGroup) {
 | 
			
		||||
 | 
			
		||||
	go func() {
 | 
			
		||||
		defer wg.Done()
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
 | 
			
		||||
		if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
 | 
			
		||||
			log.Fatalf("listen: %s\n", err)
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("Shutting down...")
 | 
			
		||||
@@ -147,8 +148,8 @@ func getSimklAuthorizationToken(content string) SimklJWT {
 | 
			
		||||
	response.Header.Add("Content-Type", "application/json")
 | 
			
		||||
 | 
			
		||||
	client := &http.Client{}
 | 
			
		||||
	res, reserr := client.Do(response)
 | 
			
		||||
	if reserr != nil {
 | 
			
		||||
	res, resErr := client.Do(response)
 | 
			
		||||
	if resErr != nil {
 | 
			
		||||
		log.Printf("Failed at res, %s\n", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user