import { getServerSettings } from "./server-settings" ; import siteURL from "./site-url" ; import { KucalcValues } from "@cocalc/util/db-schema/site-defaults" ; import { KUCALC_COCALC_COM } from "@cocalc/util/db-schema/site-defaults" ; export interface Customize { siteName ? : string ; siteDescription ? : string ; organizationName ? : string ; organizationEmail ? : string ; organizationURL ? : string ; termsOfServiceURL ? : string ; helpEmail ? : string ; contactEmail ? : string ; isCommercial ? : boolean ; kucalc ? : KucalcValues ; sshGateway ? : boolean ; logoSquareURL ? : string ; logoRectangularURL ? : string ; splashImage ? : string ; indexInfo ? : string ; shareServer ? : boolean ; landingPages ? : boolean ; dns ? : string ; siteURL ? : string ; googleAnalytics ? : string ; anonymousSignup ? : boolean ; emailSignup ? : boolean ; accountCreationInstructions ? : string ; zendesk ? : boolean ; index_info_html ? : string ; imprint_html ? : string ; policies_html ? : string ; } const fallback = ( a ? , b ? ) : string => typeof a == "string" && a . length > 0 ? a : `${ b }` ; export default async function getCustomize ( ) { const settings = await getServerSettings ( ) ; return { siteName : fallback ( settings . site_name , "On Premises CoCalc" ) , siteDescription : fallback ( settings . site_description , "Collaborative Calculation using Python, Sage, R, Julia, and more." ) , organizationName : settings . organization_name , organizationEmail : settings . organization_email , organizationURL : settings . organization_url , termsOfServiceURL : settings . terms_of_service_url , helpEmail : settings . help_email , contactEmail : fallback ( settings . organization_email , settings . help_email ) , isCommercial : settings . commercial , kucalc : settings . kucalc , sshGateway : settings . ssh_gateway , anonymousSignup : settings . anonymous_signup , emailSignup : settings . email_signup , accountCreationInstructions : settings . account_creation_email_instructions , logoSquareURL : settings . logo_square , logoRectangularURL : settings . logo_rectangular , splashImage : settings . splash_image , shareServer : ! ! settings . share_server , landingPages : ! ! settings . landing_pages && settings . kucalc === KUCALC_COCALC_COM , googleAnalytics : settings . google_analytics , indexInfo : settings . index_info_html , imprint : settings . imprint , policies : settings . policies , dns : settings . dns , siteURL : await siteURL ( settings . dns ) , zendesk : settings . zendesk_token && settings . zendesk_username && settings . zendesk_uri , } as Customize ; }