blob: fae0ef9488c91aba916765201db6ac7ed731bec5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
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)
console.log(value.coucou)
await storageManager.storeData('toto', { coucou: '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)
}
|