Migrate to Bangumi's newer v0 API#1748
Merged
AntsyLich merged 2 commits intomihonapp:mainfrom Feb 24, 2025
Merged
Conversation
AntsyLich
requested changes
Feb 22, 2025
AntsyLich
approved these changes
Feb 24, 2025
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#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.
5b2c879 to
43b83d0
Compare
MajorTanya
added a commit
to MajorTanya/mihon
that referenced
this pull request
Feb 25, 2025
Caused by mihonapp#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#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.
AntsyLich
pushed a commit
that referenced
this pull request
Feb 25, 2025
Caused by #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, #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.
cuong-tran
reviewed
Feb 25, 2025
| // Users can set a 'username' (not nickname) once which effectively | ||
| // replaces the stringified ID in certain queries. | ||
| // If no username is set, the API returns the user ID as a strings | ||
| var username = api.getUsername() |
Member
Author
There was a problem hiding this comment.
Leftover from when I thought I'd have to fiddle with it if the name wasn't set. Never saw that it was var after I figured out they return the stringified ID if no name is set. Thanks for the hint but it's all merged now anyway and I'm not making a third fixup PR for this.
cuong-tran
added a commit
to komikku-app/komikku
that referenced
this pull request
Feb 25, 2025
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 a96fbba)
cuong-tran
pushed a commit
to komikku-app/komikku
that referenced
this pull request
Feb 25, 2025
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, #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 badc229)
cuong-tran
added a commit
to komikku-app/komikku
that referenced
this pull request
Feb 26, 2025
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 a96fbba)
cuong-tran
pushed a commit
to komikku-app/komikku
that referenced
this pull request
Feb 26, 2025
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 badc229)
cuong-tran
added a commit
to komikku-app/komikku
that referenced
this pull request
Feb 26, 2025
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 a96fbba)
cuong-tran
pushed a commit
to komikku-app/komikku
that referenced
this pull request
Feb 26, 2025
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 badc229)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This comes with many benefits:
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.
If the volume data attributes should also be removed, I can do that. 👍