Skip to content

Commit

Permalink
fix: site name != host (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Sep 19, 2024
1 parent 8cb698b commit 7eb2b5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@

<script>
window.csrf_token = "{{ csrf_token }}"
window.site_name = '{{ site_name }}'
if (!window.frappe) window.frappe = {}
frappe.boot = {{ boot }}
</script>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion hrms/www/hrms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
)

0 comments on commit 7eb2b5b

Please sign in to comment.