diff --git a/src/utils.ts b/src/utils.ts index 92860ce2361..10cefcca9c3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -216,9 +216,11 @@ export function executeIf(condition: boolean, promiseFunc: () => Promise): export const sessionIdKey = 'pokerogue_sessionId'; // Check if the current hostname is 'localhost' or an IP address, and ensure a port is specified -export const isLocal = (window.location.hostname === 'localhost' || +export const isLocal = ( + (window.location.hostname === 'localhost' || /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(window.location.hostname)) && - window.location.port !== ''; + window.location.port !== '' +) || window.location.hostname === ''; // Set the server URL based on whether it's local or not export const serverUrl = isLocal ? `${window.location.hostname}:${window.location.port}` : '';