Merge pull request #164 from WJQSERVER-STUDIO/dev

4.3.2
This commit is contained in:
WJQSERVER
2025-08-20 15:56:39 +08:00
committed by GitHub
3 changed files with 17 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
# 更新日志
4.3.2 - 2025-08-20
---
- FIX: 修正`cfg.Pages.StaticDir`为空时的处置
4.3.1 - 2025-08-13
---
- CHANGE: 更新至[Go 1.25](https://tip.golang.org/doc/go1.25)

View File

@@ -1 +1 @@
4.3.1
4.3.2

14
main.go
View File

@@ -234,8 +234,18 @@ func setupPages(cfg *config.Config, r *touka.Engine) {
}
case "external":
r.SetUnMatchFS(http.Dir(cfg.Pages.StaticDir))
if cfg.Pages.StaticDir == "" {
logger.Errorf("Pages Mode is 'external' but StaticDir is empty. Using embedded pages instead.")
err := setInternalRoute(cfg, r)
if err != nil {
logger.Errorf("Failed to load embedded pages: %s", err)
fmt.Printf("Failed to load embedded pages: %s", err)
os.Exit(1)
}
} else {
extPageFS := os.DirFS(cfg.Pages.StaticDir)
r.SetUnMatchFS(http.FS(extPageFS))
}
default:
// 处理无效的Pages Mode
logger.Warnf("Invalid Pages Mode: %s, using default embedded theme", cfg.Pages.Mode)