From a179edede7dae3e4053c5caf20cd9c82822c7540 Mon Sep 17 00:00:00 2001 From: "nehashivankar@gofynd.com" Date: Wed, 29 Apr 2026 05:52:37 +0000 Subject: [PATCH] chnages --- .gitignore | 0 boltic.yaml | 0 package.json | 0 public/app.js | 50 +++++--------------------------- public/index.html | 74 ++--------------------------------------------- public/style.css | 0 server.js | 0 7 files changed, 10 insertions(+), 114 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 boltic.yaml mode change 100644 => 100755 package.json mode change 100644 => 100755 public/app.js mode change 100644 => 100755 public/index.html mode change 100644 => 100755 public/style.css mode change 100644 => 100755 server.js diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/boltic.yaml b/boltic.yaml old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/public/app.js b/public/app.js old mode 100644 new mode 100755 index 4c545a4..aaeeadb --- a/public/app.js +++ b/public/app.js @@ -1,5 +1,7 @@ /* ── Socket ──────────────────────────────────────────────────────────────── */ -const socket = io(); +const socket = io({ + path: window.location.pathname.replace(/\/$/, '') + '/socket.io' +}); /* ── State ───────────────────────────────────────────────────────────────── */ let state = { @@ -14,13 +16,6 @@ let state = { /* ── DOM Refs ─────────────────────────────────────────────────────────────── */ const $ = id => document.getElementById(id); -const loadingScreen = $('loading-screen'); -const qrScreen = $('qr-screen'); -const degradedScreen = $('degraded-screen'); -const dashboard = $('dashboard'); -const qrImg = $('qr-img'); -const qrOverlay = $('qr-overlay'); -const qrConnecting = $('qr-connecting'); const inboxList = $('inbox-list'); const convPlaceholder= $('conv-placeholder'); const convView = $('conv-view'); @@ -78,36 +73,7 @@ function setBadge(el, sessionStr) { } /* ── Screen Router ────────────────────────────────────────────────────────── */ -function route(sessionStr, qrDataUrl) { - loadingScreen.classList.add('hidden'); - qrScreen.classList.add('hidden'); - degradedScreen.classList.add('hidden'); - dashboard.classList.add('hidden'); - qrConnecting.classList.add('hidden'); - - if (sessionStr === 'awaiting_scan' || sessionStr === 'connecting') { - qrScreen.classList.remove('hidden'); - if (qrDataUrl) { - qrImg.src = qrDataUrl; - qrOverlay.classList.add('hidden'); - } else { - qrOverlay.classList.remove('hidden'); - } - if (sessionStr === 'connecting') { - qrConnecting.classList.remove('hidden'); - } - setBadge($('qr-status-badge'), sessionStr); - } else if (sessionStr === 'degraded') { - degradedScreen.classList.remove('hidden'); - } else if (sessionStr === 'connected') { - dashboard.classList.remove('hidden'); - } else { - // disconnected / reconnecting — show QR screen with no QR - qrScreen.classList.remove('hidden'); - qrOverlay.classList.remove('hidden'); - setBadge($('qr-status-badge'), sessionStr); - } -} +function route() {} /* ── Stats Update ─────────────────────────────────────────────────────────── */ function updateStats(stats) { @@ -259,7 +225,7 @@ async function doSend() { const idempotencyKey = `${state.selectedChatId}-${Date.now()}-${Math.random().toString(36).slice(2)}`; try { - const res = await fetch('/api/send', { + const res = await fetch(window.location.pathname + 'api/send', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ chatId: state.selectedChatId, body, idempotencyKey }) @@ -309,7 +275,7 @@ async function doAiDraft() { $('ops-ai-badge').innerHTML = 'Generating'; try { - const res = await fetch('/api/ai-draft', { + const res = await fetch(window.location.pathname + 'api/ai-draft', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ chatId: state.selectedChatId }) @@ -418,8 +384,8 @@ window.addEventListener('resize', () => { (async () => { try { const [sessionRes, inboxRes] = await Promise.all([ - fetch('/api/session'), - fetch('/api/inbox') + fetch(window.location.pathname + 'api/session'), + fetch(window.location.pathname + 'api/inbox') ]); const sessionData = await sessionRes.json(); const inbox = await inboxRes.json(); diff --git a/public/index.html b/public/index.html old mode 100644 new mode 100755 index 31b8115..6f198de --- a/public/index.html +++ b/public/index.html @@ -10,78 +10,8 @@ - -
- -
-
- - - - - - - -