From fe672fce1d0a740dce3d2b34b5aebe63d2a7ee1f Mon Sep 17 00:00:00 2001 From: Omar Oughriss Date: Thu, 10 Oct 2024 16:04:19 +0200 Subject: [PATCH] url sp_adress + wsurl + server config --- src/index.ts | 3 ++- src/services/service.ts | 3 ++- vite.config.ts | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 62f23c6..6bc33b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,8 @@ import Services from './services/service'; // import { WebSocketClient } from './websockets'; -const wsurl = `ws://74.234.68.175:8091`; +// const wsurl = `ws://74.234.68.175:8091`; +const wsurl = `wss://localhost/ws/`; document.addEventListener('DOMContentLoaded', async () => { try { diff --git a/src/services/service.ts b/src/services/service.ts index b64a681..2a52254 100644 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -76,7 +76,8 @@ export default class Services { console.log("🚀 ~ Services ~ generateQRCode= ~ text:", text) try { const container = document.getElementById('containerId'); - const url = await QRCode.toDataURL(text); + const currentUrl = window.location.href; + const url = await QRCode.toDataURL(currentUrl + "?sp_address=" + text); const qrCode = container?.querySelector('.qr-code img'); qrCode?.setAttribute('src', url) } catch (err) { diff --git a/vite.config.ts b/vite.config.ts index 71672c7..7a4c68a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -34,7 +34,13 @@ export default defineConfig({ extensions: ['.ts', '.tsx', '.js'], }, server: { + host: 'localhost', open: false, port: 3001, + strictPort: true, // EmpĂȘche de changer de port si le 3001 est occupĂ© + hmr: { + port: 9050, // Assure que le WebSocket HMR utilise bien le mĂȘme port + protocol: 'wss', + } }, }); \ No newline at end of file