From 52e63b5aff794dc84df968e8b12c0ee5ebe46c7b Mon Sep 17 00:00:00 2001 From: David Date: Wed, 18 Sep 2024 12:57:39 +0200 Subject: [PATCH] fix: site name != host --- frontend/index.html | 1 + frontend/src/socket.js | 3 ++- hrms/www/hrms.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 9682e3b7b0..1e1e86823a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -184,6 +184,7 @@ diff --git a/frontend/src/socket.js b/frontend/src/socket.js index ea687e6949..a942ea6fc5 100644 --- a/frontend/src/socket.js +++ b/frontend/src/socket.js @@ -6,9 +6,10 @@ import { getCachedResource } from "frappe-ui/src/resources/resources" export function initSocket() { let host = window.location.hostname + let siteName = window.site_name let port = window.location.port ? `:${socketio_port}` : "" let protocol = port ? "http" : "https" - let url = `${protocol}://${host}${port}/${host}` + let url = `${protocol}://${host}${port}/${siteName}` let socket = io(url, { withCredentials: true, reconnectionAttempts: 5, diff --git a/hrms/www/hrms.py b/hrms/www/hrms.py index 768400facc..50bb5740d1 100644 --- a/hrms/www/hrms.py +++ b/hrms/www/hrms.py @@ -20,4 +20,6 @@ def get_context_for_dev(): def get_boot(): - return frappe._dict({"push_relay_server_url": frappe.conf.get("push_relay_server_url")}) + return frappe._dict( + {"site_name": frappe.local.site, "push_relay_server_url": frappe.conf.get("push_relay_server_url")} + )