First commit
This commit is contained in:
3
peertube-plugin-hello-world/assets/style1.css
Normal file
3
peertube-plugin-hello-world/assets/style1.css
Normal file
@ -0,0 +1,3 @@
|
||||
body {
|
||||
--mainBackgroundColor: black !important;
|
||||
}
|
3
peertube-plugin-hello-world/assets/style2.css
Normal file
3
peertube-plugin-hello-world/assets/style2.css
Normal file
@ -0,0 +1,3 @@
|
||||
body {
|
||||
color: white !important;
|
||||
}
|
10
peertube-plugin-hello-world/client/common-client-plugin.js
Normal file
10
peertube-plugin-hello-world/client/common-client-plugin.js
Normal file
@ -0,0 +1,10 @@
|
||||
function register ({ registerHook, peertubeHelpers }) {
|
||||
registerHook({
|
||||
target: 'action:application.loaded',
|
||||
handler: () => console.log('Hello application world')
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
register
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
function register ({ registerHook, peertubeHelpers }) {
|
||||
registerHook({
|
||||
target: 'action:video-watch.loaded',
|
||||
handler: () => console.log('Hello video watch world')
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
register
|
||||
}
|
38
peertube-plugin-hello-world/main.js
Normal file
38
peertube-plugin-hello-world/main.js
Normal file
@ -0,0 +1,38 @@
|
||||
async function register ({ registerHook, registerSetting, settingsManager, storageManager }) {
|
||||
const defaultAdmin = 'PeerTube admin'
|
||||
|
||||
registerHook({
|
||||
target: 'action:application.listening',
|
||||
handler: () => displayHelloWorld(settingsManager, defaultAdmin)
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
name: 'admin-name',
|
||||
label: 'Admin name',
|
||||
type: 'input',
|
||||
default: defaultAdmin
|
||||
})
|
||||
|
||||
const value = await storageManager.getData('toto')
|
||||
console.log(value)
|
||||
|
||||
await storageManager.storeData('toto', 'hello' + new Date())
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ############################################################################
|
||||
|
||||
async function displayHelloWorld (settingsManager, defaultAdmin) {
|
||||
let value = await settingsManager.getSetting('admin-name')
|
||||
if (!value) value = defaultAdmin
|
||||
|
||||
console.log('hello world ' + value)
|
||||
}
|
33
peertube-plugin-hello-world/package.json
Normal file
33
peertube-plugin-hello-world/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "peertube-plugin-hello-world",
|
||||
"version": "0.0.7",
|
||||
"description": "Hello world PeerTube plugin example",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {
|
||||
"images": "public/images"
|
||||
},
|
||||
"css": [
|
||||
"assets/style1.css",
|
||||
"assets/style2.css"
|
||||
],
|
||||
"clientScripts": [
|
||||
{
|
||||
"script": "client/common-client-plugin.js",
|
||||
"scopes": [ "common" ]
|
||||
},
|
||||
{
|
||||
"script": "client/video-watch-client-plugin.js",
|
||||
"scopes": [ "video-watch" ]
|
||||
}
|
||||
]
|
||||
}
|
BIN
peertube-plugin-hello-world/public/images/chocobo.png
Normal file
BIN
peertube-plugin-hello-world/public/images/chocobo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
Reference in New Issue
Block a user