PeerTube plugins and themes should be published on [NPM](https://www.npmjs.com/) so that PeerTube indexes
take into account your plugin (after ~ 1 day). An official PeerTube index is available on https://packages.joinpeertube.org/ (it's just a REST API, so don't expect a beautiful website).
## Write a plugin/theme
Steps:
* Find a name for your plugin or your theme (must not have spaces, it can only contain lowercase letters and `-`)
* Add the appropriate prefix:
* If you develop a plugin, add `peertube-plugin-` prefix to your plugin name (for example: `peertube-plugin-mysupername`)
* If you develop a theme, add `peertube-theme-` prefix to your theme name (for example: `peertube-theme-mysupertheme`)
* Clone the quickstart repository
* Configure your repository
* Update `README.md`
* Update `package.json`
* Register hooks, add CSS and static files
* Test your plugin/theme with a local PeerTube installation
* Publish your plugin/theme on NPM
### Clone the quickstart repository
If you develop a plugin, clone the `peertube-plugin-quickstart` repository:
Unfortunately, we don't have enough resources to provide hook compatibility between minor releases of PeerTube (for example between `1.2.x` and `1.3.x`).
So please:
* Don't make assumptions and check every parameter you want to use. For example:
```js
registerHook({
target: 'filter:api.video.get.result',
handler: video => {
// We check the parameter exists and the name field exists too, to avoid exceptions
if (video && video.name) video.name += ' <3'
return video
}
})
```
* Don't try to require parent PeerTube modules, only use `peertubeHelpers`. If you need another helper or a specific, please [create an issue](https://github.com/Chocobozzz/PeerTube/issues/new)
* Don't use PeerTube dependencies. Use your own :)
If your plugin is broken with a new PeerTube release, update your code and the `peertubeEngine``package.json` field.
This way, older PeerTube versions will still use your old plugin, and new PeerTube versions will use your updated plugin.
### Spam/moderation plugin
If you want to create an antispam/moderation plugin, you could use the following hooks:
*`filter:api.video.upload.accept.result`: to accept or not local uploads
*`filter:api.video-thread.create.accept.result`: to accept or not local thread
*`filter:api.video-comment-reply.create.accept.result`: to accept or not local replies
*`filter:api.video-threads.list.result`: to change/hide the text of threads
*`filter:api.video-thread-comments.list.result`: to change/hide the text of replies
*`filter:video.auto-blacklist.result`: to automatically blacklist local or remote videos