Merge pull request #164 from WJQSERVER-STUDIO/dev
Some checks failed
Build / prepare (push) Has been cancelled
Build / build (amd64, darwin) (push) Has been cancelled
Build / build (amd64, freebsd) (push) Has been cancelled
Build / build (amd64, linux) (push) Has been cancelled
Build / build (arm64, darwin) (push) Has been cancelled
Build / build (arm64, freebsd) (push) Has been cancelled
Build / build (arm64, linux) (push) Has been cancelled
Build / docker (push) Has been cancelled

4.3.2
This commit is contained in:
WJQSERVER 2025-08-20 15:56:39 +08:00 committed by GitHub
commit efb63927e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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)