2023-07-05 16:33:30 +00:00
|
|
|
import type { RegisterServerOptions, VideoObject, Video } from '@peertube/peertube-types'
|
2023-04-19 17:07:08 +00:00
|
|
|
import { getBaseRouterRoute, getBaseWebSocketRoute } from '../helpers'
|
2023-07-04 16:07:59 +00:00
|
|
|
import { canonicalizePluginUri } from './canonicalize'
|
2023-04-19 17:07:08 +00:00
|
|
|
|
|
|
|
export function getBoshUri (options: RegisterServerOptions): string {
|
|
|
|
return getBaseRouterRoute(options) + 'http-bind'
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getWSUri (options: RegisterServerOptions): string | undefined {
|
|
|
|
const base = getBaseWebSocketRoute(options) // can be undefined if Peertube is too old
|
|
|
|
if (base === undefined) { return undefined }
|
|
|
|
return base + 'xmpp-websocket'
|
|
|
|
}
|
2023-05-19 10:52:52 +00:00
|
|
|
|
|
|
|
export function getWSS2SUri (options: RegisterServerOptions): string | undefined {
|
|
|
|
const base = getBaseWebSocketRoute(options) // can be undefined if Peertube is too old
|
|
|
|
if (base === undefined) { return undefined }
|
|
|
|
return base + 'xmpp-websocket-s2s'
|
|
|
|
}
|
2023-07-04 16:07:59 +00:00
|
|
|
|
2023-07-05 16:33:30 +00:00
|
|
|
export function getPublicChatUri (options: RegisterServerOptions, video: VideoObject | Video): string {
|
2023-07-04 16:07:59 +00:00
|
|
|
const url = getBaseRouterRoute(options) + 'webchat/room/' + encodeURIComponent(video.uuid)
|
|
|
|
return canonicalizePluginUri(options, url, {
|
|
|
|
removePluginVersion: true
|
|
|
|
})
|
|
|
|
}
|