chore: update theme related code
This commit is contained in:
parent
83f95935de
commit
0c022f17cb
@ -14,6 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SetWebRouter(router *gin.Engine, buildFS embed.FS) {
|
func SetWebRouter(router *gin.Engine, buildFS embed.FS) {
|
||||||
|
indexPageData, _ := buildFS.ReadFile(fmt.Sprintf("web/build/%s/index.html", common.Theme))
|
||||||
router.Use(gzip.Gzip(gzip.DefaultCompression))
|
router.Use(gzip.Gzip(gzip.DefaultCompression))
|
||||||
router.Use(middleware.GlobalWebRateLimit())
|
router.Use(middleware.GlobalWebRateLimit())
|
||||||
router.Use(middleware.Cache())
|
router.Use(middleware.Cache())
|
||||||
@ -24,11 +25,6 @@ func SetWebRouter(router *gin.Engine, buildFS embed.FS) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Header("Cache-Control", "no-cache")
|
c.Header("Cache-Control", "no-cache")
|
||||||
indexPage, err := buildFS.ReadFile(fmt.Sprintf("web/build/%s/index.html", common.Theme))
|
c.Data(http.StatusOK, "text/html; charset=utf-8", indexPageData)
|
||||||
if err != nil {
|
|
||||||
controller.RelayNotFound(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.Data(http.StatusOK, "text/html; charset=utf-8", indexPage)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
## 提交新的主题
|
## 提交新的主题
|
||||||
1. 在 `web` 文件夹下新建一个文件夹,文件夹名为主题名。
|
1. 在 `web` 文件夹下新建一个文件夹,文件夹名为主题名。
|
||||||
2. 把你的主题文件放到这个文件夹下。
|
2. 把你的主题文件放到这个文件夹下。
|
||||||
3. 修改 `package.json` 文件,把 `build` 命令改为:`"build": "react-scripts build && mv build ../build/default"`,其中 `default` 为你的主题名。
|
3. 修改 `package.json` 文件,把 `build` 命令改为:`"build": "react-scripts build && mv -f build ../build/default"`,其中 `default` 为你的主题名。
|
||||||
|
|
||||||
## 主题列表
|
## 主题列表
|
||||||
### default
|
### default
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build && mv build ../build/default",
|
"build": "react-scripts build && mv -f build ../build/default",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user