gamevault-backend
gamevault-backend copied to clipboard
Server-Side Plugin System
Is your feature request related to a problem? Please describe. There are many things that some may want to have happen on the server, that are separate from the intent of the app. Be it serving the downloads from a different server completely, serving games directly from a third party site (such as proxying from ichio) or many other situations.
Describe the solution you'd like A plugin system would allow for these kinds of situations to be independently developed and supported.
Technology i consider using: https://docs.nestjs.com/fundamentals/dynamic-modules preparatory project restructuration: https://github.com/Phalcode/gamevault-backend/commit/2651afd2f5949ffaba403db134a50cbe1efeb20f
I want the Plugin System to be able to extend and override the basic logic of the application, but I'm struggling to find a way to do it.
The main method I know of to override basic logic is to literally load in libraries that hook into the code and run code before/after or even replace it. That said, I am not certain how to implement such a method into an application, as most methods I have dealt with were implemented by third parties to mod games and such (Harmony patching for instance.)
Hey, guess what?! I've got some exciting news to share. I've discovered a fantastic method. Basically, we're allowing the server to execute any specified JavaScript code from defined sources, providing all the necessary javascript context a plugin might need. And just for testing, I've created this amazing plugin:
Chuck Norris Joke Fetcher Plugin
This plugin for example will run immediately upon loading.
Then, in the server configuration:
PLUGIN_ENABLED=true
PLUGIN_SOURCES="https://raw.githubusercontent.com/Phalcode/gamevault-backend-example-plugins/master/plugins/gamevault-chuck-norris-joke-fetcher-plugin.js"
Currently, the only context accessible to a plugin is the gamevault logger and the node fetch api to make HTTP requests. I still need to specify what other information a plugin should be able to access, such as the BoxArtService to retrieve box arts from your paid APIs.
I also need to establish a proper plugin schema so that machines can interpret them. Perhaps, we might even feature them on a self-updating marketplace in the store.
Lastly im thinking of some kind of event system to react to specific events aswell.
For example:
- User joined -> Plugin that calls a Discord Webhook.
- Game added -> RSS-Feed Plugin.
I'm really excited to see where this leads us as a community, as it could be a major fucking deal!
I'll get this to some kind of usable state and publish it with 10.2.0. Stay tuned!
Implemented in v13