renamed and created anilist and simkl user functions
renamed anilist userid to user function. Created simkl user functions
This commit is contained in:
@ -27,14 +27,27 @@ var aniCtxShutdown, aniCancel = context.WithCancel(context.Background())
|
||||
|
||||
func (a *App) CheckIfAniListLoggedIn() bool {
|
||||
if (AniListJWT{} == aniListJwt) {
|
||||
return false
|
||||
tokenType, err := aniRing.Get("anilistTokenType")
|
||||
expiresIn, err := aniRing.Get("anilistTokenExpiresIn")
|
||||
accessToken, err := aniRing.Get("anilistAccessToken")
|
||||
refreshToken, err := aniRing.Get("anilistRefreshToken")
|
||||
if err != nil {
|
||||
return false
|
||||
} else {
|
||||
aniListJwt.TokenType = string(tokenType.Data)
|
||||
aniListJwt.AccessToken = string(accessToken.Data)
|
||||
aniListJwt.RefreshToken = string(refreshToken.Data)
|
||||
expiresInString := string(expiresIn.Data)
|
||||
aniListJwt.ExpiresIn, _ = strconv.Atoi(expiresInString)
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) AniListLogin() {
|
||||
if a.CheckIfSimklLoggedIn() == false {
|
||||
if (AniListJWT{} == aniListJwt) {
|
||||
tokenType, err := aniRing.Get("anilistTokenType")
|
||||
expiresIn, err := aniRing.Get("anilistTokenExpiresIn")
|
||||
accessToken, err := aniRing.Get("anilistAccessToken")
|
||||
@ -150,7 +163,7 @@ func getAniListAuthorizationToken(content string) AniListJWT {
|
||||
return post
|
||||
}
|
||||
|
||||
func (a *App) GetAniListLoggedInUserId() AniListUser {
|
||||
func (a *App) GetAniListLoggedInUser() AniListUser {
|
||||
a.AniListLogin()
|
||||
body := struct {
|
||||
Query string `json:"query"`
|
||||
@ -160,6 +173,12 @@ func (a *App) GetAniListLoggedInUserId() AniListUser {
|
||||
Viewer {
|
||||
id
|
||||
name
|
||||
avatar {
|
||||
large
|
||||
medium
|
||||
}
|
||||
bannerImage
|
||||
siteUrl
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
Reference in New Issue
Block a user