|
EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
|
!!!note Plugins as such receive no support by the main developers of MeshCentral. If you experience problems with MeshCentral please make sure to disable all plugins before further troubleshooting!
Certain feature requests may not be suitable for all MeshCentral users and thus are available as a plugin. Furthermore users can develop their own plugins - as described further below - to extend functionality or benefit from integrating MeshCentral into their existing application environment.
https://github.com/topics/meshcentral-plugin
"enabled": true >},
!!!note Plugins as such receive no support by the main developers of MeshCentral. If you experience problems with MeshCentral please make sure to disable all plugins before further troubleshooting!
Not all feature requests may be suitable for all MeshCentral users and thus can't be integrated into MeshCentral directly. Hwoever, Instead of maintaining a complete fork of MeshCentral it is much easier to extend MeshCentral's functionality using hooks and writing plugins for it.
- plugin_name/ -- config.json -- plugin_name.js -- modules_meshcore/ // optional --- plugin_name.js // optional
A valid JSON object within a file named config.json in the root folder of your project. An example:
{
"name": "Plugin Name",
"shortName": "plugin_name",
"version": "0.0.0",
"author": "Author Name",
"description": "Short Description of the plugin",
"hasAdminPanel": false,
"homepage": "https://www.example.com",
"changelogUrl": "https://raw.githubusercontent.com/User/Project/master/changelog.md",
"configUrl": "https://raw.githubusercontent.com/User/Project/master/config.json",
"downloadUrl": "https://github.com/User/Project/archive/master.zip",
"repository": {
"type": "git",
"url": "https://github.com/User/Project.git"
},
"versionHistoryUrl": "https://api.github.com/repos/User/Project/tags",
"meshCentralCompat": ">0.4.3"
}
| Field | Required | Type | Description |
|---|---|---|---|
| name | Yes | string | a human-readable name for the plugin |
| shortName | Yes | string | an alphanumeric, unique short identifier for the plugin (will be used to access your functions throughout the project |
| version | Yes | string | the current version of the plugin |
| author | No | string | the author's name |
| description | Yes | string | a short, human-readable description of what the plugin does |
| hasAdminPanel | Yes | boolean | true or false, indicates whether or not the plugin will offer its own administrative interface |
| homepage | Yes | string | the URL of the projects homepage |
| changelogUrl | Yes | string | the URL to the changelog of the project |
| configUrl | Yes | string | the URL to the config.json of the project |
| downloadUrl | Yes | string | the URL to a ZIP of the project (used for installation/upgrades) |
| repository | Yes | JSON object | contains the following attributes |
| repository.type | Yes | string | valid values are git and in the future, npm will also be supported. |
| repository.url | Yes | string | the URL to the project's repository |
| versionHistoryUrl | No | string | the URL to the project's versions/tags |
| meshCentralCompat | Yes | string | the minimum version string of required compatibility with the MeshCentral server, can be formatted as "0.1.2-c" or ">=0.1.2-c". Currently only supports minimum version, not full semantic checking. |
In essence, hooks are locations in the code which enable developers to tap into a module to either provide alternative behavior or to respond to an event.
These are separated into the following categories depending on the type of functionality the plugin should offer.
Any function can be exported to the Web UI layer by adding the name of the function to an exports array in the plugin object.
Use of the optional file plugin_name.js in the optional folder modules_meshcore will include the file in the default meshcore file sent to each endpoint. This is useful to add functionality on each of the endpoints.
Much of MeshCentral revolves around returning objects for your structures, and plugins are no different. Within your plugin you can traverse all the way up to the web server and MeshCentral Server classes to access all the functionality those layers provide. This is done by passing the current object to newly created objects, and assigning that reference to a parent variable within that object.
If you build a plugin which makes use of meshrelay.ashx, keep in mind to either handle ping-pong messages (serverPing, serverPong) on the control channel or to request MeshCentral to not send such messages through sending the noping=1 parameter in the connection URL. For a deeper sight search for "PING/PONG" in meshrelay.js.
Versioning your plugin correctly and consistently is essential to ensure users of your plugin are prompted to upgrade when it is available. Semantic versioning is recommended.
A changelog is highly recommended so that your users know what's changed since their last version.
MeshCentral-Sample is a simple plugin that, upon disconnecting from remote desktop, prompts the user to enter a manual event (note), pre-filled in with the date and timestamp.