14 lines
326 B
TypeScript
14 lines
326 B
TypeScript
export function isMobileHost(hostname = window.location.hostname) {
|
|
return hostname === 'm.localhost' || hostname.startsWith('m.')
|
|
}
|
|
|
|
export function toMobilePath(path: string) {
|
|
if (path === '/') {
|
|
return '/m'
|
|
}
|
|
if (path.startsWith('/m') || path.startsWith('/admin')) {
|
|
return path
|
|
}
|
|
return `/m${path}`
|
|
}
|