Add user hooks in hello world
This commit is contained in:
parent
72c21f0b98
commit
93d7b30cad
@ -4,6 +4,21 @@ function register ({ registerHook, peertubeHelpers }) {
|
||||
handler: () => onApplicationInit(peertubeHelpers)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'action:auth-user.information-loaded',
|
||||
handler: ({ user }) => console.log('User information loaded.', user)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'action:auth-user.logged-in',
|
||||
handler: () => console.log('User logged in.')
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'action:auth-user.logged-out',
|
||||
handler: () => console.log('User logged out.')
|
||||
})
|
||||
|
||||
// Videos list
|
||||
|
||||
registerHook({
|
||||
@ -76,7 +91,6 @@ function register ({ registerHook, peertubeHelpers }) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// Fake hook
|
||||
|
||||
registerHook({
|
||||
@ -102,6 +116,9 @@ function onApplicationInit (peertubeHelpers) {
|
||||
|
||||
peertubeHelpers.translate('User name')
|
||||
.then(translation => console.log('Translated User name by ' + translation))
|
||||
|
||||
peertubeHelpers.getServerConfig()
|
||||
.then(config => console.log('Got server config.', config))
|
||||
}
|
||||
|
||||
function addSymbolToVideoNameResult (result, symbol) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
function register ({ registerVideoField }) {
|
||||
function register ({ registerHook, registerVideoField }) {
|
||||
console.log('loading video edit stuff')
|
||||
|
||||
{
|
||||
@ -13,6 +13,35 @@ function register ({ registerVideoField }) {
|
||||
registerVideoField(commonOptions, { type })
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const hooks = [
|
||||
'action:video-upload.init',
|
||||
'action:video-url-import.init',
|
||||
'action:video-torrent-import.init',
|
||||
'action:go-live.init'
|
||||
]
|
||||
|
||||
for (const h of hooks) {
|
||||
registerHook({
|
||||
target: h,
|
||||
handler: () => {
|
||||
const event = new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
const selects = document.querySelectorAll('label[for=first-step-privacy] + my-select-options')
|
||||
|
||||
console.log(selects)
|
||||
|
||||
selects.forEach(s => {
|
||||
s.value = 2 // Unlisted
|
||||
s.dispatchEvent(event)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
|
Loading…
x
Reference in New Issue
Block a user