2022-01-11 00:29:33 +00:00
|
|
|
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
|
|
|
|
2021-05-06 11:31:55 +00:00
|
|
|
async function getProsodyDomain (options: RegisterServerOptions): Promise<string> {
|
2021-05-06 19:00:42 +00:00
|
|
|
const url = options.peertubeHelpers.config.getWebserverUrl()
|
|
|
|
const matches = url.match(/^https?:\/\/([^:/]*)(:\d+)?(\/|$)/)
|
|
|
|
if (!matches) {
|
|
|
|
throw new Error(`Cant get a domain name from url '${url}'`)
|
|
|
|
}
|
|
|
|
return matches[1]
|
2021-05-06 11:31:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getProsodyDomain
|
|
|
|
}
|