Add support for client app ID routing when serving on a LAN ip address

This commit is contained in:
Andrew Kingston 2020-10-14 20:33:09 +01:00
parent 9f9cc46988
commit 59b12af15c
1 changed files with 13 additions and 10 deletions

View File

@ -4,10 +4,12 @@ import { parseAppIdFromCookie } from "./getAppId"
export const screenRouter = ({ screens, onScreenSelected, window }) => { export const screenRouter = ({ screens, onScreenSelected, window }) => {
const makeRootedPath = url => { const makeRootedPath = url => {
const hostname = window.location && window.location.hostname
if (hostname) {
if ( if (
window.location && hostname === "localhost" ||
(window.location.hostname === "localhost" || hostname === "127.0.0.1" ||
window.location.hostname === "127.0.0.1") hostname.startsWith("192.168")
) { ) {
const appId = parseAppIdFromCookie(window.document.cookie) const appId = parseAppIdFromCookie(window.document.cookie)
if (url) { if (url) {
@ -16,6 +18,7 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => {
} }
return appId return appId
} }
}
return url return url
} }