import { Request , Response } from "express" ; import { getJiraAppUrl , getJiraMarketplaceUrl , jiraSiteExists } from "../util/jira-utils" ; import { Installation } from "../models" ; export default async ( req , res ) : Promise < void > => { req . log . info ( "Received get github setup page request" ) ; const { jiraHost } = res . locals ; let redirectUrl = getJiraMarketplaceUrl ( jiraHost ) ; if ( jiraHost && await jiraSiteExists ( jiraHost ) && await Installation . getForHost ( jiraHost ) ) { redirectUrl = getJiraAppUrl ( jiraHost ) ; } res . render ( "github-setup.hbs" , { csrfToken : req . csrfToken ( ) , nonce : res . locals . nonce , jiraHost , redirectUrl } ) ; } ;