14 Commits
Author SHA1 Message Date
john-okeefe d08756c36f fix(mal): distinguish silent token refresh from a fresh re-login
Two MAL login issues were caused by the refresh path being conflated
with the full browser OAuth flow:

1. A spurious 'It is now safe to close your browser tab' dialog was
   shown after a *silent* background token refresh, even though the
   browser was never opened. The dialog now belongs only to the
   browser-callback handler (handleMyAnimeListCallback); the refresh
   raises no dialog.

2. When both the access token and the refresh token were invalid, the
   app reported MAL as logged in without a username. Now, if a refresh
   fails (HttpClient error, non-2xx, or an empty access token), the
   stale tokens are cleared and a fresh browser OAuth login is
   automatically initiated instead of silently returning an empty user.

refreshMyAnimeListAuthorizationToken now returns a bool indicating
whether a fresh access token was actually obtained, letting
GetMyAnimeListLoggedInUser decide between retrying with the refreshed
token or falling back to a full re-login.
2026-08-29 13:13:37 -04:00
john-okeefe 48a6005725 feat(mal): add comprehensive error handling
MALFunctions.go:
- Update MALHelper to return (json.RawMessage, string, error)
- Add network error handling and proper request error checking
- Update GetMyAnimeList to return (MALWatchlist, error)
- Update MyAnimeListUpdate to return (MalListStatus, error)
- Update GetMyAnimeListAnime to return (MALAnime, error)
- Update DeleteMyAnimeListEntry to return (bool, error)

MALUserFunctions.go:
- Replace log.Fatalf with log.Printf in server error handling
- Prevent server shutdown on OAuth callback errors

All MAL API calls now properly propagate errors to frontend.
2026-03-30 20:08:16 -04:00
john-okeefe 063c5016f3 fixed MAL not auto logging in when app starts 2025-12-21 00:24:25 -05:00
john-okeefe 73d349ee1a cleaned up some print lines 2025-01-25 22:50:54 -05:00
john-okeefe 72dfbf4a03 spelling correct 2025-01-17 20:39:18 -05:00
john-okeefe 5ee9c42352 cleaned up errors in go code 2024-12-15 00:19:48 -05:00
john-okeefe 064a2c7f7d added info for mac keychain 2024-10-18 22:06:33 -04:00
john-okeefe 00930f611e added ability to delete entries. Added MAL RefreshToken Function 2024-09-18 14:05:41 -04:00
john-okeefe 45b11fa8f4 app now only allows a single instance 2024-09-07 22:35:51 -04:00
john-okeefe 55cb0e2bd5 switched from .env to built-in envrionment file 2024-08-16 23:32:16 -04:00
john-okeefe 90b68b717a added logout functions 2024-08-15 16:16:40 -04:00
john-okeefe 0f647e85cb added dialog informing browser tab closing 2024-08-13 20:05:25 -04:00
john-okeefe 03413cd11a changed to mux so I can run sequentially. 2024-08-13 19:13:26 -04:00
john-okeefe fa3304db92 added MAL Login 2024-08-13 18:54:27 -04:00