aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
authorJohn Livingston <38844060+JohnXLivingston@users.noreply.github.com>2021-06-03 12:28:26 +0200
committerGitHub <noreply@github.com>2021-06-03 12:28:26 +0200
commit9777fe9eebe53debdf45091cab98f72a5987e05a (patch)
tree0f85ae9dc3ef89e0ca111d21e4a48d942ff3f991 /support/doc
parent63da15eb18065ef6c419f073c95fec6ef5541652 (diff)
downloadPeerTube-9777fe9eebe53debdf45091cab98f72a5987e05a.tar.gz
PeerTube-9777fe9eebe53debdf45091cab98f72a5987e05a.tar.zst
PeerTube-9777fe9eebe53debdf45091cab98f72a5987e05a.zip
Adding frontend peertubeHelpers.getBaseRouterRoute. (#4153)
* Adding frontend peertubeHelpers.getBaseRouterRoute. * Fix doctoc.
Diffstat (limited to 'support/doc')
-rw-r--r--support/doc/plugins/guide.md22
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
569To get your plugin router route, you can use `peertubeHelpers.getBaseRouterRoute()`:
570
571```js
572function 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
566To show a custom modal: 588To show a custom modal: