Improve portable launch, forge persistence, and operator auth UX.
Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
@@ -94,6 +94,9 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Load dashboard auth early so credentials print before slow startup steps.
|
||||
api.LoadUsers(cfg.DataDir)
|
||||
|
||||
// Initialize database
|
||||
database, err := db.New(cfg.DataDir)
|
||||
if err != nil {
|
||||
@@ -182,6 +185,7 @@ func main() {
|
||||
log.Println("Config handler initialized")
|
||||
|
||||
maintenance.StartRetentionJobs(database, cfg.DataDir, cfg.Server.StatsRetentionHours, cfg.Server.BuildRetentionDays)
|
||||
defer maintenance.StopRetentionJobs()
|
||||
|
||||
// Pre-connect default upstream pool from server config (Forge defaults seed from here)
|
||||
go func() {
|
||||
@@ -422,13 +426,23 @@ func resolveDataDir(dataDir, projectRoot string) string {
|
||||
return abs
|
||||
}
|
||||
|
||||
func projectRootMarker(dir string) bool {
|
||||
for _, name := range []string{"devrun.bat", "LAUNCH.bat", "run.bat"} {
|
||||
if _, err := os.Stat(filepath.Join(dir, name)); err == nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func findProjectRoot() string {
|
||||
if cwd, err := os.Getwd(); err == nil {
|
||||
if _, err := os.Stat(filepath.Join(cwd, "run.bat")); err == nil {
|
||||
if projectRootMarker(cwd) {
|
||||
return cwd
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(filepath.Dir(cwd), "run.bat")); err == nil {
|
||||
return filepath.Dir(cwd)
|
||||
parent := filepath.Dir(cwd)
|
||||
if projectRootMarker(parent) {
|
||||
return parent
|
||||
}
|
||||
}
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
@@ -439,7 +453,7 @@ func findProjectRoot() string {
|
||||
filepath.Join(exeDir, "..", ".."),
|
||||
}
|
||||
for _, candidate := range candidates {
|
||||
if _, err := os.Stat(filepath.Join(candidate, "run.bat")); err == nil {
|
||||
if projectRootMarker(candidate) {
|
||||
abs, _ := filepath.Abs(candidate)
|
||||
return abs
|
||||
}
|
||||
@@ -454,7 +468,7 @@ func findProjectRoot() string {
|
||||
// findWebRoot locates the frontend build output directory
|
||||
func findWebRoot() string {
|
||||
candidates := []string{
|
||||
"webroot", // Copied by run.bat
|
||||
"webroot", // Copied by devrun.bat
|
||||
"web/dist", // Vite build output relative to server/
|
||||
filepath.Join("..", "server", "web", "dist"), // Relative to project root
|
||||
filepath.Join("server", "web", "dist"), // From project root
|
||||
|
||||
Reference in New Issue
Block a user