Caused by mihonapp/mihon#1748.
Two different issues actually.
Firstly, the getUsername API call uses the authClient, which uses the
BangumiInterceptor to get the current OAuth data and attach the
Authorization header. However, on login, mihonapp/mihon#1748 did not try to set the
new auth details until after attempting to call getUsername.
This would cause Mihon to think the user was not authenticated with
Bangumi and cancel the process.
This is fixed by having Mihon store the OAuth credentials in the
interceptor first before attempting to call getUsername.
The second issue is a simple trailing dollar sign in the API URL for
the getUsername method. This was removed.
(cherry picked from commit badc229a2312c0c750c34631f303ac4ca970dc71)
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.
This change will allow mihonapp/mihon#1736 to proceed, hopefully.
(cherry picked from commit 277d8bad8e8d21cd74dc1681da09a4b980f455e0)
This comes with many benefits:
- Starting dates are now available and shown to users
- Lays groundwork to add private tracking for Bangumi, e.g. in mihonapp/mihon#1736
- Mihon makes approximately 2-4 times fewer calls to Bangumi's API
- Simplified interceptor for the access token addition
- v0 does not allow access tokens in the query string
- There is actively maintained documentation for it
Also shrunk the DTOs for Bangumi by removing attributes we have no
use for either now or in the foreseeable future. Volume data remains
in case Mihon wants to ever support volumes. But attributes such as
user avatars, nicknames, data relating to Bangumi's tag & meta-tag
systems, etc. have been removed or just not added to the DTOs.
Co-authored-by: cuong-tran <cuongtran.tm@gmail.com>
(cherry picked from commit a96fbba3dc354e363b85923c52feceb88dc34447)
* Add missing @EncodeDefault annotation to MALOAuth
Similar to the situation with Bangumi, the missing annotation means
kotlinx.serialization would _provide_ the default value upon
instantiation but not serialise it to disk. This means the isExpired()
calculation would effectively rarely/never do its job correctly,
leading to Mihon sending expired tokens to MAL and causing problems
for everyone involved.
Overall, this change _could_ (should) lead to a drastic reduction in
MAL requests failing, leading to users having to relink their MAL
accounts.
Also switched createdAt to be in seconds instead of milliseconds as
all other trackers use seconds for timestamps (except for AniList,
which uses milliseconds but doesn't use a createdAt timestamp anyway).
* Add CHANGELOG.md entry
(cherry picked from commit 29ec7c125a3f1a1f39a90f8eba2d3e39b5af9797)
* Fix Bangumi tracking losing track of login state
kotlinx.serialization does NOT serialize default values (like
createdAt in BGMOAuth.kt), so every time the Bangumi tracker
deserialized the tracker OAuth, createdAt was set to the time of the
read, not the time of issuance.
Separately, BangumiInterceptor did correctly fetch new OAuth
credentials upon detected expiry of the stored credentials and saved
them, but did not use them for the current request (the new
credentials were used for all subsequent requests only). This led to
401 errors from Bangumi because the expired access_token was provided.
A subsequent request using the newly acquired access_token would end
up being successful.
* Add CHANGELOG.md entry
(cherry picked from commit dce6aacf02d07f3f123b19b1b74cbbe18c28852b)
* Add zoned date & time to debug info & logs
This should help distinguish log entries that happened recently and
may be related to crashes from older entries that occurred before now.
* Change logcat date and time output format
After some discussion, it was decided to adjust the logcat date and
time display to include the year and the timezone in the logcat
output. This results in a line start like this:
`2025-01-27 18:37:46.662 +0100`
which follows the following DateTimeFormatter pattern:
`yyyy-MM-dd HH:mm:ss.SSS Z`
* Add CHANGELOG.md entry
(cherry picked from commit 503d0be66772c37e08e69e5d022475245b706fd1)
* switch off integrated H to show E-H source & extension
* More languages for E-H/ExH, also more popular with rate 5
* Don't hide Multi source when toggle Integrated H
* Avoid crash trying to load ehentaiBrowseDisplayMode
* change source ID to matching general extension
* migration old source ID to new source ID
* Allow importing of EHentai extension backups
* limit library update & metadata source to only Multi lang
* update app version
* fix spotless
* also migrate saved search/feed & pinned EH/EXH source ID when restore from backup or update app