Add OpenTTD and Terraria support, improve config editors

- Add OpenTTD server integration (config editor, server card, API)
- Add Terraria server integration (config editor, API)
- Add legends to all config editors for syntax highlighting
- Simplify UserManagement: remove edit/delete buttons, add Discord avatars
- Add auto-logout on 401/403 API errors
- Update save button styling with visible borders

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alexander Zielonka
2026-01-08 12:32:38 +01:00
parent 20ba93b26f
commit 1010fe7d11
11 changed files with 600 additions and 176 deletions

View File

@@ -9,6 +9,13 @@ async function fetchAPI(endpoint, options = {}) {
},
})
// Auto-logout on auth errors (invalid/expired token)
if (response.status === 401 || response.status === 403) {
localStorage.removeItem('gsm_token')
window.location.href = '/'
throw new Error('Session expired')
}
if (!response.ok) {
const error = await response.json().catch(() => ({ message: 'Request failed' }))
throw new Error(error.message || `HTTP ${response.status}`)
@@ -243,6 +250,36 @@ export async function savePalworldConfig(token, filename, content) {
})
}
// Terraria Config Management
export async function getTerrariaConfig(token) {
return fetchAPI('/servers/terraria/config', {
headers: { Authorization: `Bearer ${token}` },
})
}
export async function saveTerrariaConfig(token, content) {
return fetchAPI('/servers/terraria/config', {
method: 'PUT',
headers: { Authorization: `Bearer ${token}` },
body: JSON.stringify({ content }),
})
}
// OpenTTD Config Management
export async function getOpenTTDConfig(token) {
return fetchAPI('/servers/openttd/config', {
headers: { Authorization: `Bearer ${token}` },
})
}
export async function saveOpenTTDConfig(token, content) {
return fetchAPI('/servers/openttd/config', {
method: 'PUT',
headers: { Authorization: `Bearer ${token}` },
body: JSON.stringify({ content }),
})
}
// Activity Log
export async function getActivityLog(token, limit = 100) {
return fetchAPI(`/servers/activity-log?limit=${limit}`, {