feat: add plugin interface #7
Open
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.
Hey,
I tinkered a bit with your javascript injector and would like to propose this plugin interface, to make it possible to interact with your plugin programmatically, similar to how your plugin uses the
FileTransformationplugin.Other plugins can use this new
IJavaScriptRegistrationService, to add and remove javascripts. If a script already exists, it will be automatically updated to the newest version, which ensures that the plugin always uses an up-to-date script. Injecting javascript otherwise is rather tedious and your injector makes it super convenient.The scripts are stored in the plugin configuration, just like the user provided ones, and there's an updated config page which shows all the scripts added by plugins. The config page also allows you to disable or remove scripts added by plugins. This is more of a cleanup feature, tho. For example if a plugin doesn't properly unregister its scripts, you can remove them manually.
Other manual changes will probably be overwritten if the server gets restarted.
As for the security...
The plugin interface can only be called by other plugins and doesn't expose anything via the jellyfin API. So I think this isn't really a security issue. Let's be honest, if it comes to plugins, there isn't much of security at all. And everything your injector plugin does, can a plugin with malicious intent also implement directly.
Screenshot:
Example of how to use this plugin interface:
closes #5