Fix turbo nav for settings and stats pages.

Extract settings.js, preserve inline scripts from raw HTML (DOMParser strips them), and load trade config via JSON script tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 21:26:15 +08:00
parent 6d55a54946
commit 9613fb0737
7 changed files with 229 additions and 163 deletions
+6 -2
View File
@@ -138,8 +138,11 @@
}
function loadStats() {
fetch('/api/stats')
.then(function (r) { return r.json(); })
fetch('/api/stats', { credentials: 'same-origin' })
.then(function (r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
return r.json();
})
.then(applyData)
.catch(function () {
var updated = document.getElementById('stats-updated');
@@ -148,6 +151,7 @@
}
function bootStatsPage() {
if (!document.getElementById('stats-summary')) return;
var viewSel = document.getElementById('stats-view-select');
if (viewSel && !viewSel.dataset.statsBound) {
viewSel.dataset.statsBound = '1';