Fix dashboard WebSocket and API URLs for /cv prefix routing
The dashboard lives at ftdt.io/cv but WebSocket and API calls used root-relative paths (/ws, /api/backtests) which Caddy routed to the wrong backend. Fixed to /cv/ws and /cv/api/* so Caddy's handle_path properly strips the prefix.
This commit is contained in:
@@ -222,7 +222,7 @@ function switchTab(tab) {
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
let ws;
|
||||
function connectWS() {
|
||||
ws = new WebSocket((location.protocol==='https:'?'wss:':'ws:')+'//'+location.host+'/ws');
|
||||
ws = new WebSocket((location.protocol==='https:'?'wss:':'ws:')+'//'+location.host+'/cv/ws');
|
||||
ws.onopen = function() {
|
||||
document.getElementById('connection-status').innerHTML = '<span style="color:#22c55e">live</span>';
|
||||
document.getElementById('status-dot').className = 'status-dot live';
|
||||
@@ -313,7 +313,7 @@ function renderLive() {
|
||||
// Backtests
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
function loadBacktests() {
|
||||
fetch('/api/backtests').then(function(r){return r.json();}).then(function(data){
|
||||
fetch('/cv/api/backtests').then(function(r){return r.json();}).then(function(data){
|
||||
backtests = data;
|
||||
var list = document.getElementById('bt-list');
|
||||
var html = '';
|
||||
@@ -334,7 +334,7 @@ function loadBacktests() {
|
||||
}
|
||||
|
||||
function viewBacktest(name) {
|
||||
fetch('/api/backtest/'+name).then(function(r){return r.json();}).then(function(bt){
|
||||
fetch('/cv/api/backtest/'+name).then(function(r){return r.json();}).then(function(bt){
|
||||
selectedBacktest = bt;
|
||||
document.getElementById('bt-detail-card').style.display = 'block';
|
||||
document.getElementById('bt-title').textContent = bt.strategy + ' — ' + bt.description;
|
||||
|
||||
Reference in New Issue
Block a user