feat: merge PVE VM management + local features

- Merge PVE (Proxmox VE) virtual machine management from remote
  - PVE host CRUD API
  - VM status query / start / stop operations
  - PVE database tables and models
  - Frontend VM status display and control buttons
  - SPA routing fix for nested asset paths

- Keep local features:
  - Change password functionality
  - Log cleanup service
  - Docker containerization (Dockerfile + docker-compose)
  - Empty machine ping log spam fix
  - settings table for admin password storage

- Update machines handlers to support PVE fields
- Update frontend API client with PVE endpoints
This commit is contained in:
shirainbown
2026-06-18 22:33:45 +08:00
parent af306c183c
commit 6f507b319e
18 changed files with 1619 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
package config
import (
"database/sql"
"log"
"os"
"strconv"
@@ -47,6 +48,14 @@ func Load() *Config {
return cfg
}
func LoadPasswordFromDB(cfg *Config, db *sql.DB) {
var stored string
err := db.QueryRow(`SELECT value FROM settings WHERE key = 'admin_password'`).Scan(&stored)
if err == nil && stored != "" {
cfg.AdminPass = stored
}
}
func getEnv(key, defaultValue string) string {
if v := os.Getenv(key); v != "" {
return v