New chat integration:

* refactoring
* cleaning
* using peertubeHelpers to get authent info when available
This commit is contained in:
John Livingston
2024-03-26 15:38:22 +01:00
parent 4cf2cd3ac8
commit b6478f0f9e
5 changed files with 82 additions and 37 deletions

View File

@ -46,7 +46,9 @@ async function registerConfiguration (clientOptions: RegisterClientOptions): Pro
converseRoot.classList.add('theme-peertube')
container.append(converseRoot)
window.initConverse(converseJSParams, 'embedded')
const authHeader = peertubeHelpers.getAuthHeader()
window.initConverse(converseJSParams, 'peertube-fullpage', authHeader ?? null)
} catch (err) {
console.error('[peertube-plugin-livechat] ' + (err as string))
rootEl.innerText = await peertubeHelpers.translate(LOC_NOT_FOUND)

View File

@ -1,6 +1,7 @@
import type { InitConverseJSParams } from 'shared/lib/types'
import { computeAutoColors } from './colors'
// FIXME
// declare global {
// interface Window {
// converse?: {
@ -12,6 +13,7 @@ import { computeAutoColors } from './colors'
// }
// }
// FIXME: better declaration
declare global {
interface Window {
converse?: any