diff options
Diffstat (limited to 'support/doc')
-rw-r--r-- | support/doc/plugins/quickstart.md | 28 |
1 files changed, 18 insertions, 10 deletions
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 | |||
18 | Example: | 18 | Example: |
19 | 19 | ||
20 | ```js | 20 | ```js |
21 | registerHook({ | 21 | // This register function is called by PeerTube, and **must** return a promise |
22 | target: 'action:application.listening', | 22 | async function register ({ registerHook }) { |
23 | handler: () => displayHelloWorld() | 23 | registerHook({ |
24 | }) | 24 | target: 'action:application.listening', |
25 | handler: () => displayHelloWorld() | ||
26 | }) | ||
27 | } | ||
25 | ``` | 28 | ``` |
26 | 29 | ||
27 | On server side, these hooks are registered by the `library` file defined in `package.json`. | 30 | 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. | |||
65 | 68 | ||
66 | Plugins can declare CSS files that PeerTube will automatically inject in the client. | 69 | Plugins can declare CSS files that PeerTube will automatically inject in the client. |
67 | 70 | ||
68 | ### Server helpers | 71 | ### Server helpers (only for plugins) |
69 | |||
70 | **Only for plugins** | ||
71 | 72 | ||
72 | #### Settings | 73 | #### Settings |
73 | 74 | ||
@@ -94,7 +95,7 @@ Example: | |||
94 | 95 | ||
95 | ```js | 96 | ```js |
96 | const value = await storageManager.getData('mykey') | 97 | const value = await storageManager.getData('mykey') |
97 | await storageManager.storeData('mykey', 'myvalue') | 98 | await storageManager.storeData('mykey', { subkey: 'value' }) |
98 | ``` | 99 | ``` |
99 | 100 | ||
100 | ### Publishing | 101 | ### Publishing |
@@ -169,12 +170,13 @@ If you don't need static directories, use an empty `object`: | |||
169 | } | 170 | } |
170 | ``` | 171 | ``` |
171 | 172 | ||
172 | And if you don't need CSS files, use an empty `array`: | 173 | And if you don't need CSS or client script files, use an empty `array`: |
173 | 174 | ||
174 | ```json | 175 | ```json |
175 | { | 176 | { |
176 | ..., | 177 | ..., |
177 | "css": [], | 178 | "css": [], |
179 | "clientScripts": [], | ||
178 | ... | 180 | ... |
179 | } | 181 | } |
180 | ``` | 182 | ``` |
@@ -197,8 +199,14 @@ You'll need to have a local PeerTube instance: | |||
197 | ``` | 199 | ``` |
198 | $ npm run build -- --light | 200 | $ npm run build -- --light |
199 | ``` | 201 | ``` |
202 | |||
203 | * Build the CLI: | ||
204 | |||
205 | ``` | ||
206 | $ npm run setup:cli | ||
207 | ``` | ||
200 | 208 | ||
201 | * Run it (you can access to your instance on http://localhost:9000): | 209 | * Run PeerTube (you can access to your instance on http://localhost:9000): |
202 | 210 | ||
203 | ``` | 211 | ``` |
204 | $ NODE_ENV=test npm start | 212 | $ NODE_ENV=test npm start |