diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/doc/plugins/guide.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index d3b9db0ed..db1f1863c 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md | |||
@@ -21,6 +21,7 @@ | |||
21 | - [Notifier](#notifier) | 21 | - [Notifier](#notifier) |
22 | - [Markdown Renderer](#markdown-renderer) | 22 | - [Markdown Renderer](#markdown-renderer) |
23 | - [Auth header](#auth-header) | 23 | - [Auth header](#auth-header) |
24 | - [Plugin router route](#plugin-router-route) | ||
24 | - [Custom Modal](#custom-modal) | 25 | - [Custom Modal](#custom-modal) |
25 | - [Translate](#translate) | 26 | - [Translate](#translate) |
26 | - [Get public settings](#get-public-settings) | 27 | - [Get public settings](#get-public-settings) |
@@ -561,6 +562,27 @@ function register (...) { | |||
561 | } | 562 | } |
562 | ``` | 563 | ``` |
563 | 564 | ||
565 | #### Plugin router route | ||
566 | |||
567 | **PeerTube >= 3.3** | ||
568 | |||
569 | To get your plugin router route, you can use `peertubeHelpers.getBaseRouterRoute()`: | ||
570 | |||
571 | ```js | ||
572 | function register (...) { | ||
573 | registerHook({ | ||
574 | target: 'action:video-watch.video.loaded', | ||
575 | handler: ({ video }) => { | ||
576 | fetch(peertubeHelpers.getBaseRouterRoute() + '/my/plugin/api', { | ||
577 | method: 'GET', | ||
578 | headers: peertubeHelpers.getAuthHeader() | ||
579 | }).then(res => res.json()) | ||
580 | .then(data => console.log('Hi %s.', data)) | ||
581 | } | ||
582 | }) | ||
583 | } | ||
584 | ``` | ||
585 | |||
564 | #### Custom Modal | 586 | #### Custom Modal |
565 | 587 | ||
566 | To show a custom modal: | 588 | To show a custom modal: |