peertube-plugin-livechat/conversejs/lib/plugins/livechat-specific.ts

49 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-05-23 09:42:14 +00:00
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
//
// SPDX-License-Identifier: AGPL-3.0-only
import { customizeHeading } from './livechat-specific/heading'
import { customizeToolbar } from './livechat-specific/toolbar'
import { initReconnectionStuff } from './livechat-specific/reconnection'
import { chatRoomOverrides } from './livechat-specific/chatroom'
import { chatRoomMessageOverrides } from './livechat-specific/chatroom-message'
import { customizeMessageAction } from './livechat-specific/message-action'
import { customizeProfileModal } from './livechat-specific/profile'
2024-09-05 16:28:54 +00:00
import { customizeMUCBottomPanel } from './livechat-specific/muc-bottom-panel'
export const livechatSpecificsPlugin = {
dependencies: ['converse-muc', 'converse-muc-views'],
initialize: function (this: any) {
const _converse = this._converse
_converse.api.settings.extend({
// if user is authenticated with an external account (to add a logout button)
livechat_specific_external_authent: false,
// if user is anonymous
livechat_specific_is_anonymous: false
})
customizeHeading(this)
customizeToolbar(this)
customizeMessageAction(this)
customizeProfileModal(this)
2024-09-05 16:28:54 +00:00
customizeMUCBottomPanel(this)
_converse.api.listen.on('chatRoomViewInitialized', function (this: any, _model: any): void {
// Remove the spinner if present...
document.getElementById('livechat-loading-spinner')?.remove()
})
initReconnectionStuff(this)
2024-03-28 11:22:30 +00:00
2024-03-28 10:16:33 +00:00
if (window.location.protocol === 'http:') {
// We are probably on a dev instance, so we will add _converse in window:
(window as any)._livechatConverse = _converse
}
},
overrides: {
ChatRoom: chatRoomOverrides(),
ChatRoomMessage: chatRoomMessageOverrides()
}
}