fix: dual id/name matching for installed + console.error on all catches
This commit is contained in:
@@ -21,7 +21,7 @@ const Topbar = {
|
|||||||
this._statusEl.className = `status-indicator ${wsStatus}`;
|
this._statusEl.className = `status-indicator ${wsStatus}`;
|
||||||
this._statusEl.querySelector('.status-text').textContent =
|
this._statusEl.querySelector('.status-text').textContent =
|
||||||
wsStatus === 'connected' ? `已连接 (${status.ws_clients})` : '未连接';
|
wsStatus === 'connected' ? `已连接 (${status.ws_clients})` : '未连接';
|
||||||
} catch (e) {}
|
} catch (e) { console.error(e); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const PageDebug = {
|
|||||||
if (el) el.innerHTML = data.lines.map(l =>
|
if (el) el.innerHTML = data.lines.map(l =>
|
||||||
`<span style="color:${l.includes('ERROR')?'red':l.includes('WARNING')?'#f90':l.includes('INFO')?'#888':'#555'}">${l}</span>`
|
`<span style="color:${l.includes('ERROR')?'red':l.includes('WARNING')?'#f90':l.includes('INFO')?'#888':'#555'}">${l}</span>`
|
||||||
).join('\n');
|
).join('\n');
|
||||||
} catch (e) {}
|
} catch (e) { console.error(e); }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -35,17 +35,17 @@ const PageMarket = {
|
|||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const items = data.items || [];
|
const items = data.items || [];
|
||||||
|
|
||||||
let localIds = [];
|
let localIds = [], localNames = [];
|
||||||
try {
|
try {
|
||||||
const lr = await fetch('/api/dashboards?category=all');
|
const lr = await fetch('/api/dashboards?category=all');
|
||||||
const ld = await lr.json();
|
const ld = await lr.json();
|
||||||
if (Array.isArray(ld)) localIds = ld.map(d => d.id);
|
if (Array.isArray(ld)) { localIds = ld.map(d => d.id); localNames = ld.map(d => d.name); }
|
||||||
if (isScene) {
|
if (isScene) {
|
||||||
const sr = await fetch('/api/scenes');
|
const sr = await fetch('/api/scenes');
|
||||||
const sl = await sr.json();
|
const sl = await sr.json();
|
||||||
if (Array.isArray(sl)) localIds = localIds.concat(sl.map(s => s.id));
|
if (Array.isArray(sl)) { localIds = localIds.concat(sl.map(s => s.id)); localNames = localNames.concat(sl.map(s => s.name)); }
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} catch(e) { console.error('load local:', e); }
|
||||||
|
|
||||||
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
||||||
grid.innerHTML = items.map(d => {
|
grid.innerHTML = items.map(d => {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const PageRecord = {
|
|||||||
const size = f.size > 1048576 ? (f.size/1048576).toFixed(1)+'MB' : (f.size/1024).toFixed(1)+'KB';
|
const size = f.size > 1048576 ? (f.size/1048576).toFixed(1)+'MB' : (f.size/1024).toFixed(1)+'KB';
|
||||||
return '<div class="glass-card" style="padding:10px 14px;margin-bottom:6px;display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap"><span style="font-size:12px;flex:1;min-width:150px">' + f.name + '</span><span style="font-size:11px;color:var(--text-tertiary)">' + size + '</span><button class="btn btn-sm btn-primary btn-play-rec" data-file="' + f.name + '">播放</button><a class="btn btn-sm btn-secondary" href="/api/recording/' + f.name + '/export" download>导出</a><button class="btn btn-sm btn-danger btn-del-rec" data-file="' + f.name + '">删除</button></div>';
|
return '<div class="glass-card" style="padding:10px 14px;margin-bottom:6px;display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap"><span style="font-size:12px;flex:1;min-width:150px">' + f.name + '</span><span style="font-size:11px;color:var(--text-tertiary)">' + size + '</span><button class="btn btn-sm btn-primary btn-play-rec" data-file="' + f.name + '">播放</button><a class="btn btn-sm btn-secondary" href="/api/recording/' + f.name + '/export" download>导出</a><button class="btn btn-sm btn-danger btn-del-rec" data-file="' + f.name + '">删除</button></div>';
|
||||||
}).join('');
|
}).join('');
|
||||||
} catch (e) {}
|
} catch (e) { console.error(e); }
|
||||||
},
|
},
|
||||||
|
|
||||||
_bindEvents() {
|
_bindEvents() {
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ const PageSettings = {
|
|||||||
Toast.show('回放已开始', 'success');
|
Toast.show('回放已开始', 'success');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e) {}
|
} catch (e) { console.error(e); }
|
||||||
},
|
},
|
||||||
|
|
||||||
_gamePortListHtml(games, cfg) {
|
_gamePortListHtml(games, cfg) {
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ const WS = {
|
|||||||
if (msg.type === 'telemetry') {
|
if (msg.type === 'telemetry') {
|
||||||
this._emit('telemetry', msg.data);
|
this._emit('telemetry', msg.data);
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) { console.error(e); }
|
||||||
};
|
};
|
||||||
|
|
||||||
this._ws.onclose = () => {
|
this._ws.onclose = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user