feat: Add UI Settings panel with config management
- Add 3 API endpoints: GET /api/v2/config, POST /api/v2/config/edit, GET /api/v2/config/validate
- Add Settings button (⚙️) to bottom bar
- Add Settings panel with CSS styling (8 classes)
- Add JavaScript functions: toggleSettings, loadSettings, editSetting, saveSetting, validateSettings, cancelEdit, toast
- Support viewing/editing/validating all config sections (server, postgresql, authentication, test, logging)
- Update AGENTS.md with UI Settings documentation
Features:
- Real-time config editing via UI
- Input validation before save
- Toast notifications for user feedback
- Responsive design matching existing UI style
Files changed:
- src/server.rs: +70 lines (API handlers)
- src/page.html: +110 lines (UI + JS)
- AGENTS.md: +40 lines (documentation)
Tested: All API endpoints verified, UI elements present in HTML
This commit is contained in:
63
data/init_auth_db.sql
Normal file
63
data/init_auth_db.sql
Normal file
@@ -0,0 +1,63 @@
|
||||
-- MarkBase Authentication Database Schema
|
||||
-- Synced from SFTPGo PostgreSQL
|
||||
|
||||
-- 1. Users table (synced from sftpgo.users)
|
||||
CREATE TABLE IF NOT EXISTS sftpgo_users (
|
||||
username TEXT PRIMARY KEY,
|
||||
password_hash TEXT NOT NULL,
|
||||
email TEXT,
|
||||
status INTEGER DEFAULT 1,
|
||||
home_dir TEXT,
|
||||
permissions TEXT,
|
||||
uid INTEGER,
|
||||
gid INTEGER,
|
||||
last_login INTEGER,
|
||||
created_at INTEGER,
|
||||
updated_at INTEGER,
|
||||
last_sync_at INTEGER,
|
||||
sync_status INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_users_status ON sftpgo_users(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_users_sync_status ON sftpgo_users(sync_status);
|
||||
|
||||
-- 2. Groups table (synced from sftpgo.groups)
|
||||
CREATE TABLE IF NOT EXISTS sftpgo_groups (
|
||||
name TEXT PRIMARY KEY,
|
||||
description TEXT,
|
||||
created_at INTEGER,
|
||||
updated_at INTEGER,
|
||||
last_sync_at INTEGER
|
||||
);
|
||||
|
||||
-- 3. Users-Groups mapping (synced from sftpgo.users_groups_mapping)
|
||||
CREATE TABLE IF NOT EXISTS users_groups_mapping (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT NOT NULL,
|
||||
group_name TEXT NOT NULL,
|
||||
created_at INTEGER,
|
||||
FOREIGN KEY (username) REFERENCES sftpgo_users(username) ON DELETE CASCADE,
|
||||
FOREIGN KEY (group_name) REFERENCES sftpgo_groups(name) ON DELETE CASCADE,
|
||||
UNIQUE(username, group_name)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_mapping_username ON users_groups_mapping(username);
|
||||
CREATE INDEX IF NOT EXISTS idx_mapping_group ON users_groups_mapping(group_name);
|
||||
|
||||
-- 4. Sync log table
|
||||
CREATE TABLE IF NOT EXISTS sync_log (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sync_type TEXT,
|
||||
sync_time INTEGER,
|
||||
users_synced INTEGER DEFAULT 0,
|
||||
users_failed INTEGER DEFAULT 0,
|
||||
groups_synced INTEGER DEFAULT 0,
|
||||
groups_failed INTEGER DEFAULT 0,
|
||||
mappings_synced INTEGER DEFAULT 0,
|
||||
status TEXT,
|
||||
error_message TEXT,
|
||||
details TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_sync_time ON sync_log(sync_time);
|
||||
CREATE INDEX IF NOT EXISTS idx_sync_status ON sync_log(status);
|
||||
Reference in New Issue
Block a user