Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyAnimeList Support, Profiles, and List Editor. #527

Open
wants to merge 114 commits into
base: master
Choose a base branch
from

Conversation

RockinChaos
Copy link

@RockinChaos RockinChaos commented Sep 7, 2024

Hi, I apologize in advance as this is kinda lengthy. I absolutely love this app but I ran into a few things that were missing or issues I was having so I created a fork that I have been working on for a few months. I figured since a lot of this is stuff being requested by other users I would attempt to contribute it here.

I have zero expectations of you accepting it as-is as this is quite a large PR and I am sure there are places where my code can be improved. I am open to any advice/criticisms, I would love to contribute these changes if you are interested. I am happy to make any changes to get this closer to something you would consider accepting.

The biggest changes are the MAL support, Profiles, List Editor, Tags to search filtering, Mal-Dubs filtering, and Hide-My-Anime filtering. To clarify on MAL/Profiles support. MAL is completely independent of Anilist, a login for Anilist is NOT required. With profiles users do not need to have multiple profiles for Miru login to function. You do not need to login for Miru to function, and only a single login from either Anilist or MAL is required for list functionality.

Here are some screenshots of the major changes;

image image image image

Changes to relations (and added recommendations) using small cards.

image

Currently, I have the clientId for MAL authentication setup with my dev account, if your able you can create your own clientId and replace mine or do nothing it is up to you.

image

As a final note, helper.js was added to help bridge the gap between authorizations, for the most part being a single location to add support for additional authorizations in the future like Kitsu.

Added:

  • MyAnimeList Login Support!
    • Favorites button is disabled as favorites are not accessible at the API endpoint.
    • Following is hidden as there is no such functionality on the API endpoint.
    • Some (very few) MAL IDs do not translate to Anilist resulting in them not appearing. This is primarily due to them being recap episodes that are already bundled into the main anime series on Anilist.
    • There is no started on, finished on, or episode progress sorting options in the API endpoint, instead this logic is handled internally and identified via "_nan".
    • Continue watching anime isn't filtered out. Rather the opacity is dropped for those who do not have a next airing episode available. (This is a limitation of MAL it doesn't return the current airing episode).
    • Sorting limitations, when sorting by a user-specific sorting option then genre and tag search are disabled as these can't be fetched through MyAnimeList media.
    • notifications cannot be added as v2 and v3 of the api do not expose the user notifications.
    • no feasible way of closing the authentication tab after authorizing.
    • Sequels You Missed user section is disabled when authenticated with MAL. There is a bug where user lists do not return relations so you cannot get them without querying AniList which isn't feasible for large user lists.
  • Profiles for login
    • limited to 6 total logins (5 other profiles).
    • sync toggle for profiles, if you are logged in a sync-enabled profile you can sync your list with other sync-enabled profiles.
    • torrents are automagically swapped when switching profiles, so you can resume where the last profile left off.
    • all settings are specific to each profile, so for example, each profile can have different interface settings (custom home layouts).
  • List Editor
    • Replaces the bookmark for anime preview, anime banner, and view anime.
    • A Bookmark is shown when it's not on your list and pencil-edit when it is on your list.
  • Audio Labels (Mal-Dubs)
    • dub/partial dub/sub-labels to full anime views or large previews next to episode count.
    • RSS feed episodes, which list what audio each episode is for that specific torrent (based on keywords in file_name or listed language.
    • A badge to anime that shows if it has a Dub or if it's Sub Only on PreviewCards and FullCards, this is disabled by default and can be toggled in the interface settings.
  • New sorting options for user-specific list types.
    • UPDATED_TIME_DESC, STARTED_ON_DESC, FINISHED_ON_DESC (only completed lists), USER_SCORE_DESC (only completed lists), PROGRESS_DESC (Excluding completed lists).
  • The ability to select MULTIPLE genres (this applies to tags as well)
  • X buttons to search badges (filters) to quickly delete certain ones without entirely clearing the search filters.
  • Category icons to search badges (filters) such as when typing Title or Genre the tag (filter) inputted shows title Helck and theater_comedy Adventure.
  • Tags to Anime View with rank percentages
  • Tags to search page.
  • Not In My Lists "Hide My Anime" filter to search
    • Filter is disabled when viewing home page categories that are user-specific such as "Continue Watching"
  • Global Setting to hide Not In My Lists "Hide My Anime" for Completed and Dropped lists from default sections on the home page like Romance and Comedy.
    • Basically made default categories on the home page like Romance and Comedy AUTOMATICALLY filter out already watched anime (hide from my watch list).
  • Preferred Title Language
    • If the user is not AniList authorized, (logged out or logged in with MyAnimeList) a setting will appear under the interface settings called "Preferred Title Language" which allows the user to select either English or Japanese as their display language.
    • If the selected language does not exist for a specific media title, it will default to userPreferred (typically Japanese).
    • Added additional Anilist language fetching in relations so it properly returns the selected language title.
  • Completed Episodes in RSS feeds are now "dimmed" to better identify watched episodes.
  • 18+ Label
    • Adult Content is listed on anime view.
    • Rated 18+ is listed on preview and full cards.
    • 18+ Label is displayed on small cards and full cards (only shown if enabled in the interface settings).
  • Toast to be sent when an episode is completed, stating the change made to your user list.
  • Country of Origin to anime view (ViewAnime) details
  • Dubbed Audio (filter) button to anime search page.
    • This will allow users to ONLY search for anime that have dubs.
  • Hover text to icon-only anime search buttons so you can know what they do.
  • Recommendations to anime view (ViewAnime) page.
  • Rating and number of reviewers to preview card, full card, and view anime
  • RSS Episode prompt for when an episode is clicked that is not the next episode in the users watch list
    • The prompt asks for confirmation before playing, listing the users current progress
  • A back button for clicking through relations and recommendations in the view anime overlay page.
  • Custom search genre and tag option.
    • Idenfitifer key is *
    • You can now type Romance* and hit enter to force search that genre.
    • Works well for something that wasn't manually added to Miru (missing genres and tags).
  • Enable RPC interface option, toggle on/off to disable discord RPC entirely (default is enabled for advertising).
  • Drop-shadow to volume icon on trailers.
  • Toast when pasting torrents.
  • "Stories You Missed" user section.
    • This shows all relations excluding Sequel, Character, and "Other".
    • Primarily for showing missed Prequel and Side Stories.

Fixed:

  • RSS feed returning the incorrect season.
    • Occurs when the result was an array (if an array is returned it would default to the first season), primarily an issue with Yameii RSS.
  • Progress Bar on EpisodeCard and EpisodePreviewCard being difficult to see.
    • Bumped the z index to 10.
    • Additionally the bar will now be shown if the episode is completed.
  • Toast
    • z-index was set too low, resulting in toasts not being visible in view anime.
    • \n was not being respected, added white-space: pre-line to container-wrapper.
  • Sidebar when the torrent menu is open.
    • Sidebar animation is now visible.
    • Clicking any of the sidebar buttons automatically closes the torrent window.
  • Active sidebar buttons
    • Stroke width is now slightly smaller, text is bold, and font is slightly larger when page is active.
  • MiniPlayer from not being visible in ViewAnime.
  • Episodecard and episodepreviewcard not showing if the rss is a movie or a batch (season).
  • Banner on FullCard and PreviewCard showing broken trailer image if the trailer id is undefined, now it properly checks and tries the coverImage?.extraLarge if no trailer is defined.
  • Occasional duplicates in following list.
    • seems to be a bug with the AniList query on some anime.
  • Studios details in viewanime
    • This never worked because the query and the custom property code were incorrect.
  • Broken debugs referencing null/dead (non-existent) data.
    • Example; subsplease rss feed would randomly break due to animeresolve.js
    • MediaHandler failed to play videos when media failed to resolve...

Changed:

  • UserList (section) is now shown on the search page.
  • Cached user lists to be handled locally for all variables excluding sorting. They are dynamic pages (50 per) and filter for the title, status, genres, tags, season, seasonYear, etc.
    • Uses Fuse.js dependency to allow for spelling mistakes in the search query for user list searches (similar to AniList).
    • This reduces load times and reduces the number of queries.
  • (search page) Genre to use a Typable search box (+dropdown) instead of just a dropdown menu.
  • (search page) Filter button from delete (trash bin) to Filter_ALT when nothing is selected but FILTER_ALT_OFF when a filter is active, also changed color from blue to red when active.
  • Relations to import SmallCards as it is better...
    • you can now know what type it is (ova/tv/movie)
    • an audio label is now shown.
    • fixes the blurry image as it was pixelated/distorted.
    • relations are now sorted alphabetically and by seasonYear for better navigation.
  • startedAt and completedAt dates to be passed to the entry, which also ensures it is set when using MyAnimeList.
    • Yes, AniList does automagically set these dates for you, but MyAnimeList does not.
  • Torrent raw file_name to be visible when hovering over the RSS feed episodepreview episode number/post date/audio label.
  • ViewAnime to show sidebar.
    • Clicking the "now playing" button while viewing an anime dismisses the overlay.
    • If the overlay is not the "now playing" media, it swaps to the current media.
    • Allowed sidebar clicks without dismissing overlays (viewanime/torrentmodal) are login/logout & favorites.
  • ViewAnime EpisodeList now properly dims/shows progress on paused and dropped anime.
  • Final checks to animeresolver, fixes issues with episode resolving for Misfit of a Demon King.
  • Reduced AniList query complexity, slightly improved load times.
    • Splitting things up into separate queries sometimes improves things, such as recommendations make userlists load SLOW so we do it separately.
    • Some niche series failed to load at all because the queries were being rejected because they were too complex.
  • Update (check for updates) nagging.
    • I don't need a Windows notification every 20 minutes.
    • One notification + the Update is Ready icon is plenty, I'll update when I feel like it.
  • Sequels You Missed to include your planning list.
    • You haven't seen them yet so might as well include them.
  • Player (video) error toasts are now infinite.
    • The toasts would expire causing the video to no longer have an option to be reloaded by dismissing the toast.
  • User lists will no longer be updated when watching or scoring if the entry is identical.
    • No need to update an entry if the progress, status, and score are identical.
  • Major Discord-RPC improvements.
    • Recent discord updates broke the RPC.
    • Now shows duration/progress in a currently watching anime such as 11:30/23:00.
    • Now shows when you "paused" an anime (not currently watching).
    • Now shows when you are specifically browsing for anime (not actively watching).

idk why an array is returned for some seasons resulting in '3,03' so instead of it failing and returning the default season we can now return the first entry in the array.
@RockinChaos
Copy link
Author

jheezus christ, this is a massive PR, I'm currently on vacation, so this will need to sit for a month, forgiv

Hahaha no problem, hope you have a great vacation.

@jubiman
Copy link

jubiman commented Sep 9, 2024

Quick heads up: the pasting on linux if the protocol handler doesn't work, doesn't actually work. This means that if your linux protocol handler doesn't work, you cannot log in (probably on both anilist and mal, not tested)

@jubiman
Copy link

jubiman commented Sep 9, 2024

Update: that seems to be an issue with an undefined variable in settings.js#63 and settings.js#64 where line should be text. I am, however, getting a code_verifier being null in the token exchange, this has something to do with the session storage/state not being the same, but I have no idea how to work with session storage, so it might take a while for me to figure out

Fix line feed at the end of state returned from MAL and undefined symbol 'line' in linux's clipboard paste handler
@RockinChaos
Copy link
Author

Update: that seems to be an issue with an undefined variable in settings.js#63 and settings.js#64 where line should be text. I am, however, getting a code_verifier being null in the token exchange, this has something to do with the session storage/state not being the same, but I have no idea how to work with session storage, so it might take a while for me to figure out

Confirmed, thanks for catching that.

@ThaUnknown
Copy link
Owner

so the TLDR is no. this PR is simply too massive for me to review and merge all at once and it touches a lot of things it really shouldn't, it also builds on top of my shitty code which caused a lot of problems for you, and many od these things can be done cleaner

HOWEVER

there's a lot of good shit, please don't remove this PR as I'll likely use it as reference for many Mal things for miru v6

@RockinChaos
Copy link
Author

yeah I figured as much. The MAL implementation should be a good reference, and the auth tokens have been properly refreshing after they expire without the need for any user input so the implementation has been working well.

I plan to keep maintaining my fork of Miru since it's finally at a stage where it does everything I need it to in order for me to move away from using streaming sites and addons. So I'll keep this PR open and create a separate detached fork so I don't further clutter things here. You can feel free to delete this whenever you no longer have need of it.

Thanks for all the time you have put into Miru. It's been an absolute life changer and has been working perfectly. I have tried many other "similar" apps but nothing can compare to it.

@DudeDude2
Copy link

it touches a lot of things it really shouldn't

Just curious, could you elaborate more on this? I'm interested in using this fork and tinkering with it myself.

@Meff1u
Copy link

Meff1u commented Nov 13, 2024

I can't wait for an implementation that supports MAL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants