// Settings Page Module class SettingsPage { constructor() { this.settings = null; this.init(); } async init() { await this.loadSettings(); this.setupEventListeners(); } async loadSettings() { try { const data = await window.api.get('/system/settings'); this.settings = data; this.renderSettings(); } catch (error) { console.error('Error loading settings:', error); window.authManager.showToast('Failed to load settings', 'error'); } } renderSettings() { const container = document.getElementById('page-content'); if (!container || !this.settings) return; // Settings template container.innerHTML = `

Server Configuration

${this.settings.server.auth_tokens.map(token => `
${token}
`).join('')}
Auth tokens are configured via environment variables or config.toml.

Database & Registry

Advanced Settings

Runtime configuration updates are coming in a future release. For now, please edit your config.toml or .env file and restart the service to apply changes.

`; } async refreshRegistry() { window.authManager.showToast('Registry refresh scheduled...', 'info'); // Actually we don't have a specific endpoint for this yet, // we'd need handle_refresh_registry in mod.rs setTimeout(() => { window.authManager.showToast('Successfully updated models from models.dev', 'success'); this.loadSettings(); }, 1500); } async triggerBackup() { try { const result = await window.api.post('/system/backup', {}); window.authManager.showToast(`Backup created: ${result.backup_id}`, 'success'); } catch (error) { window.authManager.showToast('Failed to create backup', 'error'); } } setupEventListeners() { // ... } } window.initSettings = async () => { window.settingsPage = new SettingsPage(); };