Add registerClientRoute
This commit is contained in:
		| @ -1,4 +1,4 @@ | |||||||
| function register ({ registerHook, registerSettingsScript, peertubeHelpers }) { | function register ({ registerHook, registerSettingsScript, registerClientRoute, peertubeHelpers }) { | ||||||
|   registerHook({ |   registerHook({ | ||||||
|     target: 'action:application.init', |     target: 'action:application.init', | ||||||
|     handler: () => onApplicationInit(peertubeHelpers) |     handler: () => onApplicationInit(peertubeHelpers) | ||||||
| @ -88,11 +88,18 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }) { | |||||||
|           key: 'in-my-stuff', |           key: 'in-my-stuff', | ||||||
|           title: 'In my stuff', |           title: 'In my stuff', | ||||||
|           links: [ |           links: [ | ||||||
|               { |             { | ||||||
|               path: '/about', |               path: '/about', | ||||||
|               icon: 'alert', |               icon: 'alert', | ||||||
|               shortLabel: 'About', |               shortLabel: 'About', | ||||||
|               label: 'About' |               label: 'About' | ||||||
|  |             }, | ||||||
|  |  | ||||||
|  |             { | ||||||
|  |               path: peertubeHelpers.getBasePluginClientPath() + '/my-super/route', | ||||||
|  |               icon: '', | ||||||
|  |               shortLabel: 'super route', | ||||||
|  |               label: 'Super route' | ||||||
|             } |             } | ||||||
|           ] |           ] | ||||||
|         } |         } | ||||||
| @ -138,6 +145,15 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }) { | |||||||
|       return false |       return false | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   // Routes | ||||||
|  |  | ||||||
|  |   registerClientRoute({ | ||||||
|  |     route: 'my-super/route', | ||||||
|  |     onMount: ({ rootEl }) => { | ||||||
|  |       rootEl.innerHTML = 'hello' | ||||||
|  |     } | ||||||
|  |   }) | ||||||
| } | } | ||||||
|  |  | ||||||
| export { | export { | ||||||
|  | |||||||
| @ -71,6 +71,19 @@ function register ({ registerHook, peertubeHelpers }) { | |||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   for (const hook of [ | ||||||
|  |     'filter:api.video-watch.video-playlist-elements.get.result' | ||||||
|  |   ]) { | ||||||
|  |     registerHook({ | ||||||
|  |       target: hook, | ||||||
|  |       handler: (result) => { | ||||||
|  |         console.log('Running hook %s', hook, result) | ||||||
|  |  | ||||||
|  |         return result | ||||||
|  |       } | ||||||
|  |     }) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   peertubeHelpers.notifier.info('you are on the watch page', 'useless', 1000) |   peertubeHelpers.notifier.info('you are on the watch page', 'useless', 1000) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user