(headers?: {
host?: string;
origin?: string;
})
| 14 | } |
| 15 | |
| 16 | export function getHostFromHeaders(headers?: { |
| 17 | host?: string; |
| 18 | origin?: string; |
| 19 | }) { |
| 20 | if (process.env.NODE_ENV === 'development') { |
| 21 | return `localhost:${process.env.PORT || 3000}`; |
| 22 | } |
| 23 | if ( |
| 24 | headers?.origin?.startsWith('tauri://') || |
| 25 | headers?.origin?.startsWith('linenapp://') |
| 26 | ) { |
| 27 | return process.env.NEXTAUTH_URL || 'www.linen.dev'; |
| 28 | } |
| 29 | return ( |
| 30 | headers?.origin || |
| 31 | headers?.host || |
| 32 | process.env.NEXTAUTH_URL || |
| 33 | 'www.linen.dev' |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | // Checks if the routing is subdomain or based on paths |
| 38 | export const isSubdomainbasedRouting = (host: string): boolean => { |
no outgoing calls
no test coverage detected