voltraco / beta

Bugs, suggestions and ideas
11 stars 2 forks source link

Plugin manager (as a plugin) #46

Closed monocursive closed 5 years ago

monocursive commented 7 years ago

The idea is to create a plugin providing install hooks, a settings api and a UI.

UI :

2 views A pane listing installed plugins and another view exposing selected plugin settings (a form).

Questions: In order to match with Voltra's ecosystem, is there a way to work with Mineral templates within the plugin system? Should this pluginception get its own webpack setup?

Install Hooks : I see two obvious way to handle this, either enforce a config file containing metadata (name, icon etc..) or just use the package.json file in the plugin's folder to install. The pluginception should listen to some events like plugins:postinstall if the plugin needs some user info or actions.

Settings API : Namespacing plugins by their package name would allow us to store their config in localstorage, indexedDB, whatever.. without having the plugin creator worry about name clashes. I don't think there is a way to prevent other plugins to access navigator's dbs, so there might be a risk of a rogue plugin stealing all of your API keys. Use at your own risk ®.

Install Method : Installing Pluginception : Either git clone or a bash script as a dreaded curl *** | sh, the curlpipe won't work for windows users though. So a regular installer might be needed if we are aiming for non technical users.

Installing plugins : For a start, allowing users to paste a git url in a form at the top of the list view should do the trick. Pluginception would then git clone the repo, npm install it and then store the folder name + metadata, in order to require() it dynamically during the startup process. Next logical step would be to have a plugins list json file in the public Git repo, allowing plugins creators to submit a pull request to add their plugins to the list. With this we could add a view listing plugins and allowing users to install plugins without leaving Voltra. Ultimate step will be a plugin system integrated to Voltra, without relying on a plugin.

Not resolved : Plugins updates. As this plugin manager will rely on git we could either :

I will probably start hacking on this at the end of this week. If you have inputs, advice or anything to add please reply here or contact me directly.

heapwolf commented 7 years ago

One of the big blockers to having this become real is sandboxing, we dont want plugins to destroy the player or have access to things they shouldn't. One idea i had for this was using the vm module's runincontext.