diff --git a/public/customize.js b/public/customize.js index cb95e555..bebfd15b 100644 --- a/public/customize.js +++ b/public/customize.js @@ -597,17 +597,13 @@ (hasUserTheme ? '' : '') + '' + '
' + - '

Admin — Server Theme

' + - '

Save/load the theme on the server. Applies to all users who haven\'t set their own.

' + + '

Admin

' + + '

Download or import a theme file. Admins place it as theme.json next to the server.

' + '
' + - '' + - '' + + '' + '' + '' + - '
' + - '
' + '' + - '' + '
' + '
Raw JSON' + '' + @@ -868,44 +864,7 @@ applyThemePreview(); autoSave(); }); - // Save to server - var saveServerBtn = document.getElementById('custSaveServer'); - if (saveServerBtn) saveServerBtn.addEventListener('click', function () { - var data = buildExport(); - fetch('/api/config/theme', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(data) - }).then(function (r) { - if (!r.ok) throw new Error('Server returned ' + r.status); - return r.json(); - }).then(function () { - saveServerBtn.textContent = '✓ Saved to server!'; - setTimeout(function () { saveServerBtn.textContent = '📡 Save to Server'; }, 2000); - }).catch(function (e) { - saveServerBtn.textContent = '✕ Failed: ' + e.message; - setTimeout(function () { saveServerBtn.textContent = '📡 Save to Server'; }, 3000); - }); - }); - - // Load from server - var loadServerBtn = document.getElementById('custLoadServer'); - if (loadServerBtn) loadServerBtn.addEventListener('click', function () { - fetch('/api/config/theme').then(function (r) { return r.json(); }).then(function (cfg) { - window.SITE_CONFIG = cfg; - resetPreview(); - initState(); - applyThemePreview(); - render(container); - loadServerBtn.textContent = '✓ Loaded!'; - setTimeout(function () { loadServerBtn.textContent = '📥 Load from Server'; }, 2000); - }).catch(function (e) { - loadServerBtn.textContent = '✕ Failed'; - setTimeout(function () { loadServerBtn.textContent = '📥 Load from Server'; }, 3000); - }); - }); - - // Import from file + // Import from file var importBtn = document.getElementById('custImportFile'); var importInput = document.getElementById('custImportInput'); if (importBtn && importInput) { diff --git a/server.js b/server.js index 574ce425..95141efb 100644 --- a/server.js +++ b/server.js @@ -427,16 +427,7 @@ app.get('/api/config/theme', (req, res) => { }); }); -app.post('/api/config/theme', express.json(), (req, res) => { - try { - const data = req.body; - if (!data || typeof data !== 'object') return res.status(400).json({ error: 'Invalid JSON' }); - fs.writeFileSync(THEME_PATH, JSON.stringify(data, null, 2), 'utf8'); - res.json({ ok: true }); - } catch (e) { - res.status(500).json({ error: e.message }); - } -}); + app.get('/api/config/map', (req, res) => { const defaults = config.mapDefaults || {};