2022-01-11 01:29:33 +01:00
|
|
|
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
|
|
|
|
2021-05-06 13:31:55 +02:00
|
|
|
async function getProsodyDomain (options: RegisterServerOptions): Promise<string> {
|
2021-05-06 21:00:42 +02: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 13:31:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getProsodyDomain
|
|
|
|
}
|