Enable auto-pushing watched info from emby to watcharr and add API keys in watcharr to allow programmatic communication #906
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.
compressed_full_video.mp4
Hello! I'm a software engineer and i stumbled upon your project and loved it. It was missing one core feature for my use-case (that i've seen other users request as well) and that's the ability to "auto-scrobble" (i.e. push info automatically from emby to watcharr when you finish watching something in emby) so i decided to add it! Before i could do that, i had to figure out the authentication since watcharr uses expiring JWTs, so i had to add API key functionality to the app, so this is a large Feature PR! I'll cover what I added and how i tested it and add some screenshots and proposed changes to the documentation so users can make use of this feature.
I've added a lot of inline code comments that can be removed if you want but i figured it'd be useful to explain in line why i did what i did since this is a public collaborative project.
This will likely work with jellyfin too, but i haven't tested it. I do not use plex so it almost certainly won't work with plex, but with minimal tweaking it likely could.
Also, I only explicitly tested this with TV shows, it could work without changes for Movies in emby, but i don't have movies in my emby so i was unable to test it, hence i named the api route
/api/watched/emby/showjust to be safe. If pointing the emby webhook at that route doesn't work with movies out of the box, we could easily have/api/watched/emby/movieswith no or minimal changes just to keep them separate in case they ever need to be separated so we don't have to refactor API routes later on and introduce breaking changes for clientsTotal New Features and Changes Made:
Testing That I Performed To Ensure it Works
Packages added
ScreenShots of UI changes
In the profile section you can see the ability to create API keys and list existing API keys. clicking the create API key in step 2 shows you the pop up with the newly generated API key that is displayed once in plaintext so the user can copy it and then hidden. When stored in the database it is irreversibly hashed. If the user loses this API key it's recommended to just revoke it and create another.
In the server settings page, I have added inputs for the 3 new configurable server settings with descriptions
the API rate-limit and the default emby rating are both numeric inputs that are limited to numbers and have appropriate validation. The user cannot input a number higher than 10 on the Default Emby rating.
Documentation
Attached at the top of the PR is a video walk through of how this feature is used in practice, I can also contribute more picture/text/video guides to the official watcharr documentation on how to configure this feature from scratch without any assumptions but i just wanted to get this PR approved first before doing that!