- Replace Electron IPC with native fetch + AbortController (VITE_VALHALLA_URL) - Add vite.web.config.ts for standalone SPA build (npm run build:web) - Per-mode color palettes (green/cyan/amber), RDP polygon simplification - Interactive legend, hover popup, right-click context menu, map labels - Toast notifications, history (last 5), auto-recalculate toggle - Status dot, error card with retry, timing feedback, copy coordinates - Zustand: toasts, history, hiddenLayers, autoRecalculate - Add README.md and AGENT.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const http = require('http')
|
|
|
|
const WSL_HOST = '172.30.239.252'
|
|
const WSL_PORT = 8002
|
|
const LOCAL_PORT = 9002
|
|
|
|
const server = http.createServer((req, res) => {
|
|
res.setHeader('Access-Control-Allow-Origin', '*')
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
|
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
res.writeHead(204)
|
|
res.end()
|
|
return
|
|
}
|
|
|
|
const chunks = []
|
|
req.on('data', (c) => chunks.push(c))
|
|
req.on('end', () => {
|
|
const proxyReq = http.request(
|
|
{ hostname: WSL_HOST, port: WSL_PORT, path: req.url, method: req.method, headers: { 'Content-Type': 'application/json' } },
|
|
(proxyRes) => {
|
|
res.writeHead(proxyRes.statusCode, proxyRes.headers)
|
|
proxyRes.pipe(res)
|
|
}
|
|
)
|
|
proxyReq.on('error', (e) => {
|
|
console.error('Proxy error:', e.message)
|
|
res.writeHead(502)
|
|
res.end(JSON.stringify({ error: e.message }))
|
|
})
|
|
if (chunks.length) proxyReq.write(Buffer.concat(chunks))
|
|
proxyReq.end()
|
|
})
|
|
})
|
|
|
|
server.listen(LOCAL_PORT, '127.0.0.1', () => {
|
|
console.log(`Proxy listening on http://127.0.0.1:${LOCAL_PORT} -> ${WSL_HOST}:${WSL_PORT}`)
|
|
})
|