From d28b19c053f4e3ecae12498cb1aa7524a1cb57ab Mon Sep 17 00:00:00 2001 From: AG Date: Sat, 20 Dec 2025 20:54:12 +0200 Subject: [PATCH] No Subfolder in the URL --- server/index.ts | 8 +++----- src/hooks/useWebSocket.ts | 2 +- vite.config.ts | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/server/index.ts b/server/index.ts index 04ec6b5..fe6af76 100644 --- a/server/index.ts +++ b/server/index.ts @@ -14,18 +14,16 @@ const __dirname = dirname(__filename); const app = express(); const port = process.env.PORT || 3001; -const subfolder = '/ag-beats'; const distPath = path.join(__dirname, '../dist'); const COLORS = ['#F94144', '#F3722C', '#F8961E', '#F9C74F', '#90BE6D', '#43AA8B', '#4D908E', '#577590', '#277DA1']; const getRandomColor = () => COLORS[Math.floor(Math.random() * COLORS.length)]; -app.use(subfolder, express.static(distPath)); -app.get(subfolder + '/*', (req, res) => res.sendFile(path.join(distPath, 'index.html'))); -app.get('/', (req, res) => res.redirect(subfolder)); +app.use(express.static(distPath)); +app.get('*', (req, res) => res.sendFile(path.join(distPath, 'index.html'))); const httpServer = http.createServer(app); -const wss = new WebSocketServer({ path: '/ag-beats', server: httpServer }); +const wss = new WebSocketServer({ path: '/', server: httpServer }); interface ClientInfo { ws: WebSocket; diff --git a/src/hooks/useWebSocket.ts b/src/hooks/useWebSocket.ts index 6345e36..0035f85 100644 --- a/src/hooks/useWebSocket.ts +++ b/src/hooks/useWebSocket.ts @@ -15,7 +15,7 @@ export function useWebSocket(sessionId: string | null) { if (!sessionId || ws.current) return; const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const wsUrl = `${protocol}//${window.location.host}/ag-beats?sessionId=${sessionId}`; + const wsUrl = `${protocol}//${window.location.host}/?sessionId=${sessionId}`; const socket = new WebSocket(wsUrl); socket.onopen = () => { diff --git a/vite.config.ts b/vite.config.ts index 9c42dba..601abe0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -15,7 +15,7 @@ export default defineConfig(({ mode }) => { react(), tailwindcss(), ], - base: '/ag-beats/', + base: '/', build: { outDir: '../dist', emptyOutDir: true,