Feature Request: Host Functions for Knowing if a Plugin is Enabled and What Version the Plugin is
Share your bug report, feature request, or comment.
Plugins should be able to know if another plugin is installed and enabled, that way a plugin that offers custom events and features can be known to be available before another plugin attempts to use them. It should also be able to know the version number of the plugin.
For example, say there's a plugin that gives your Owncast server email functionality. Another plugin that adds social media crossposting might use this plugin to send out emails when a stream goes live, however, it would only want to offer this feature if said email plugin was installed and enabled. Otherwise it would waste time and resources on emitting events that don't exist, and it might even show the admin UI that doesn't do anything.
I imagine this would probably be done through a new host function, owncast_plugin_enabled or something. It would accept a string for a plugin slug, and it would return a boolean for whether or not the plugin is installed and enabled.
Expanding on our example, say that a new version of the email plugin, 0.2.0, changes the payload for the send email custom event. Our plugin that interacts with the email plugin would want to know what version the email plugin is, that way it can either send the old payload shape, or the updated one.
This could be done through an owncast_plugin_version host function. It takes the plugin slug string as an argument, and if the plugin exists it returns the version number string, and if it doesn't exist then it returns nothing.
Source: owncast/owncast