From 9fa6ca160a9dda057c3980c6ee19f0ee426fd0a0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Jul 2019 15:46:51 +0200 Subject: Some plugins fixes and doc enhancements --- support/doc/plugins/quickstart.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'support') diff --git a/support/doc/plugins/quickstart.md b/support/doc/plugins/quickstart.md index a018aa50a..0e125e707 100644 --- a/support/doc/plugins/quickstart.md +++ b/support/doc/plugins/quickstart.md @@ -18,10 +18,13 @@ A plugin registers functions in JavaScript to execute when PeerTube (server and Example: ```js -registerHook({ - target: 'action:application.listening', - handler: () => displayHelloWorld() -}) +// This register function is called by PeerTube, and **must** return a promise +async function register ({ registerHook }) { + registerHook({ + target: 'action:application.listening', + handler: () => displayHelloWorld() + }) +} ``` On server side, these hooks are registered by the `library` file defined in `package.json`. @@ -65,9 +68,7 @@ or `/themes/{theme-name}/{theme-version}/static/` routes. Plugins can declare CSS files that PeerTube will automatically inject in the client. -### Server helpers - -**Only for plugins** +### Server helpers (only for plugins) #### Settings @@ -94,7 +95,7 @@ Example: ```js const value = await storageManager.getData('mykey') -await storageManager.storeData('mykey', 'myvalue') +await storageManager.storeData('mykey', { subkey: 'value' }) ``` ### Publishing @@ -169,12 +170,13 @@ If you don't need static directories, use an empty `object`: } ``` -And if you don't need CSS files, use an empty `array`: +And if you don't need CSS or client script files, use an empty `array`: ```json { ..., "css": [], + "clientScripts": [], ... } ``` @@ -196,9 +198,15 @@ You'll need to have a local PeerTube instance: ``` $ npm run build -- --light +``` + + * Build the CLI: + +``` +$ npm run setup:cli ``` - * Run it (you can access to your instance on http://localhost:9000): + * Run PeerTube (you can access to your instance on http://localhost:9000): ``` $ NODE_ENV=test npm start -- cgit v1.2.3