import { getServerSettings } from "./server-settings" ; import basePath from "@cocalc/backend/base-path" ; export default async function siteURL ( dns ? ) { if ( ! dns ) { dns = ( await getServerSettings ( ) ) . dns ?. toLowerCase ( ) ; } if ( ! dns ) { dns = "localhost" ; } if ( ! dns . startsWith ( "http" ) ) { dns = "https://" + dns ; } return `${ dns }${ basePath == "/" ? "" : basePath }` ; }