From 73a0294104aad0a87570e382ee3721bc3ac57f13 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Jul 2019 09:42:52 +0200 Subject: [PATCH] Add route hook action --- .../client/common-client-plugin.js | 7 +++++++ peertube-plugin-hello-world/main.js | 8 ++++++++ peertube-plugin-hello-world/package.json | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/peertube-plugin-hello-world/client/common-client-plugin.js b/peertube-plugin-hello-world/client/common-client-plugin.js index 4f6e4d4..c838c38 100644 --- a/peertube-plugin-hello-world/client/common-client-plugin.js +++ b/peertube-plugin-hello-world/client/common-client-plugin.js @@ -46,6 +46,13 @@ function register ({ registerHook, peertubeHelpers }) { handler: result => addSymbolToVideoNameResult(result, ':D') }) + // Router hooks + + registerHook({ + target: 'action:router.navigation-end', + handler: params => console.log('New URL! %s.', params.path) + }) + // Fake hook registerHook({ diff --git a/peertube-plugin-hello-world/main.js b/peertube-plugin-hello-world/main.js index a6263a2..06ac973 100644 --- a/peertube-plugin-hello-world/main.js +++ b/peertube-plugin-hello-world/main.js @@ -15,9 +15,17 @@ async function register ({ registerHook, registerSetting, settingsManager, stora name: 'admin-name', label: 'Admin name', type: 'input', + private: true, default: defaultAdmin }) + registerSetting({ + name: 'user-name', + label: 'User name', + type: 'input', + private: false + }) + const value = await storageManager.getData('toto') console.log(value) diff --git a/peertube-plugin-hello-world/package.json b/peertube-plugin-hello-world/package.json index 4a422ff..3ff4760 100644 --- a/peertube-plugin-hello-world/package.json +++ b/peertube-plugin-hello-world/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-hello-world", - "version": "0.0.11", + "version": "0.0.12", "description": "Hello world PeerTube plugin example", "engine": { "peertube": ">=1.3.0"