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
|
|
|
|
|
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
|
|
|
|
}
|