From 063c5016f33b26ae8b6479daed163ce163f4a72c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 21 Dec 2025 00:24:25 -0500 Subject: [PATCH] fixed MAL not auto logging in when app starts --- MALUserFunctions.go | 10 ++++++++++ frontend/src/App.svelte | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/MALUserFunctions.go b/MALUserFunctions.go index d2ddcb3..284d9b1 100644 --- a/MALUserFunctions.go +++ b/MALUserFunctions.go @@ -308,7 +308,16 @@ func refreshMyAnimeListAuthorizationToken() { func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser { a.MyAnimeListLogin() + user := createUser() + if user.Name == "" { + refreshMyAnimeListAuthorizationToken() + user = createUser() + } + return user +} + +func createUser() MyAnimeListUser { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.myanimelist.net/v2/users/@me?fields=anime_statistics", nil) @@ -335,6 +344,7 @@ func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser { } return user + } func (a *App) LogoutMyAnimeList() string { diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 3a9c096..3a43a5e 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,7 +1,10 @@