Chat Federation, connection to remote chat:
Front-end connect using BOSH or WS directly on the remote server. If use is logged-in, his nickname is use as default nickname.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { parseConfigUUIDs } from './config'
|
||||
|
||||
interface SharedSettings {
|
||||
interface VideoHasWebchatSettings {
|
||||
'chat-per-live-video': boolean
|
||||
'chat-all-lives': boolean
|
||||
'chat-all-non-lives': boolean
|
||||
@ -12,6 +12,7 @@ interface SharedVideoBase {
|
||||
isLive: boolean
|
||||
pluginData?: {
|
||||
'livechat-active'?: boolean
|
||||
'livechat-remote'?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +26,13 @@ interface SharedVideoBackend extends SharedVideoBase {
|
||||
|
||||
type SharedVideo = SharedVideoBackend | SharedVideoFrontend
|
||||
|
||||
function videoHasWebchat (settings: SharedSettings, video: SharedVideo): boolean {
|
||||
/**
|
||||
* Indicate if the video has a local chat.
|
||||
* @param settings plugin settings
|
||||
* @param video the video
|
||||
* @returns true if the video has a local chat
|
||||
*/
|
||||
function videoHasWebchat (settings: VideoHasWebchatSettings, video: SharedVideo): boolean {
|
||||
// Never use webchat on remote videos.
|
||||
if ('isLocal' in video) {
|
||||
if (!video.isLocal) return false
|
||||
@ -53,6 +60,29 @@ function videoHasWebchat (settings: SharedSettings, video: SharedVideo): boolean
|
||||
return false
|
||||
}
|
||||
|
||||
export {
|
||||
videoHasWebchat
|
||||
interface VideoHasRemoteWebchatSettings {
|
||||
'federation-no-remote-chat': boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the video has a remote chat.
|
||||
* @param settings plugin settings
|
||||
* @param video the video
|
||||
* @returns true if the video has a remote chat
|
||||
*/
|
||||
function videoHasRemoteWebchat (settings: VideoHasRemoteWebchatSettings, video: SharedVideo): boolean {
|
||||
if (settings['federation-no-remote-chat']) { return false }
|
||||
if ('isLocal' in video) {
|
||||
if (video.isLocal) return false
|
||||
} else {
|
||||
if (!video.remote) return false
|
||||
}
|
||||
if (!video.pluginData) { return false }
|
||||
if (!video.pluginData['livechat-remote']) { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
export {
|
||||
videoHasWebchat,
|
||||
videoHasRemoteWebchat
|
||||
}
|
||||
|
Reference in New Issue
Block a user