This repo is a example plugin for Manyfold. It shows a number of things you can do with plugins.
To install a Manyfold plugin, place it (unzipped) inside the plugins folder of the Manyfold app. If you're running in a Docker container, you will probably want to create a new volume for plugins and mount it at /usr/src/app/plugins.
NOTE: restart Manyfold after installing a plugin so that it gets picked up.
Currently there is no way to add new Ruby dependencies from plugins. This may be possible in the future, but for now, you will need to use gems that are available in the main application.
See the Manyfold Gemfile for direct dependencies, or the Gemfile.lock file for a complete list. Similarly, see package.json and yarn.lock for preinstalled npm packages.
Plugin metadata (version, name, homepage, etc) should be specified in the plugin_name.gemspec file; see example_plugin.gemspec in this repository for an example. Currently this is just used for metadata, so only the following fields are used:
- name
- version
- summary
- description
- authors
- homepage
Proper gemspecs must include a files attribute; this is not necessary for Manyfold plugins. Also, note that adding dependencies won't work at the moment (see above).
You can add your own pages to the application - see app/controllers/example_plugin for a skeleton controller, with associated views in app/views/example_plugin.
The main application has various "hooks", locations within the app UI that will render Phlex components that are registered by plugins. For an example, see components/example_plugin/nav_link.rb, and the hook registration in config/initializers/register_hooks.rb.
You can add new print services, which are responsible for communicating with printer APIs. See app/services/print.
You can register your own media types - see config/initializers/media_types.rb for details. All registered media types will be indexed by Manyfold when scanning for files on disk.
Relatedly, file handlers are used for many things across Manyfold; the simplest example is "open in" links for files. You can add a new file handler for a slicer with just a few lines. See app/lib/file_handlers for an example.
Locale-specific strings can be included in config/locales/en.yml, and whatever other languages you have translated them into. See the Manyfold source for a list of supported languages. Use the standard Rails t() method to use the translation in your views, or use translate() to get a version with less markup for use in HTML attribute values (e.g. button labels).
Not currently available, but hopefully soon.