From 0ed70d279dcdc19c689978fbf9298184fa541367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir=20=28rar=29?= Date: Thu, 26 Dec 2024 09:05:10 +0100 Subject: [PATCH] [IMP] demo: Allow access to the session/transporservice on local network closes odoo/o-spreadsheet#5383 Task: 0 Signed-off-by: Pierre Rousseau (pro) --- demo/main.js | 4 ++-- demo/transport.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/main.js b/demo/main.js index 06770a18ad..1160963dfb 100644 --- a/demo/main.js +++ b/demo/main.js @@ -38,7 +38,7 @@ topbarMenuRegistry.addChild("clear", ["file"], { name: "Clear & reload", sequence: 10, execute: async (env) => { - await fetch("http://localhost:9090/clear"); + await fetch(`http://${window.location.hostname}:9090/clear`); document.location.reload(); }, icon: "o-spreadsheet-Icon.CLEAR_AND_RELOAD", @@ -308,7 +308,7 @@ class Demo extends Component { * @returns {Promise} */ async fetchHistory() { - const result = await fetch("http://localhost:9090"); + const result = await fetch(`http://${window.location.hostname}:9090`); return result.json(); } } diff --git a/demo/transport.js b/demo/transport.js index 888bc71cf2..dbdaed7171 100644 --- a/demo/transport.js +++ b/demo/transport.js @@ -14,7 +14,7 @@ export class WebsocketTransport { */ connect() { return new Promise((resolve, reject) => { - const socket = new WebSocket(`ws://localhost:9090`); + const socket = new WebSocket(`ws://${window.location.hostname}:9090`); socket.addEventListener("open", () => { this.socket = socket; this.isConnected = true;