feat: add resetpwd cmd

This commit is contained in:
engigu
2026-02-27 23:08:44 +08:00
parent 8775bec155
commit d9e73a9d18
10 changed files with 206 additions and 16 deletions
+19
View File
@@ -3,6 +3,8 @@ package bootstrap
import (
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
@@ -42,6 +44,23 @@ func (a *App) initConfig() {
if err != nil {
return
}
a.setupBaihuBin()
}
func (a *App) setupBaihuBin() {
binDir := filepath.Join(constant.DataDir, "bin")
_ = os.MkdirAll(binDir, 0755)
exe, err := os.Executable()
if err == nil {
linkPath := filepath.Join(binDir, "baihu")
if runtime.GOOS == "windows" {
linkPath += ".exe"
}
os.Remove(linkPath)
_ = os.Symlink(exe, linkPath)
}
}
func (a *App) initDatabase() {