mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
[backport] add multi theme support
This commit is contained in:
parent
3c247665fc
commit
c1ba935ca4
1 changed files with 10 additions and 5 deletions
15
main.go
15
main.go
|
|
@ -35,10 +35,8 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
//go:embed pages/bootstrap/*
|
||||
//go:embed pages/*
|
||||
pagesFS embed.FS
|
||||
//go:embed pages/nebula/*
|
||||
NebulaPagesFS embed.FS
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -110,12 +108,19 @@ func InitReq(cfg *config.Config) {
|
|||
func loadEmbeddedPages(cfg *config.Config) (fs.FS, error) {
|
||||
var pages fs.FS
|
||||
var err error
|
||||
|
||||
switch cfg.Pages.Theme {
|
||||
case "bootstrap":
|
||||
pages, err = fs.Sub(pagesFS, "pages/bootstrap")
|
||||
case "nebula":
|
||||
pages, err = fs.Sub(NebulaPagesFS, "pages/nebula")
|
||||
pages, err = fs.Sub(pagesFS, "pages/nebula")
|
||||
case "design":
|
||||
pages, err = fs.Sub(pagesFS, "pages/design")
|
||||
case "metro":
|
||||
pages, err = fs.Sub(pagesFS, "pages/metro")
|
||||
case "classic":
|
||||
pages, err = fs.Sub(pagesFS, "pages/classic")
|
||||
case "mino":
|
||||
pages, err = fs.Sub(pagesFS, "pages/mino")
|
||||
default:
|
||||
pages, err = fs.Sub(pagesFS, "pages/bootstrap") // 默认主题
|
||||
logWarning("Invalid Pages Theme: %s, using default theme 'bootstrap'", cfg.Pages.Theme)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue