feat: enhance template configuration and update README for translation status

This commit is contained in:
naiba
2024-12-10 22:27:06 +08:00
parent 8f8a30c02c
commit 06738d5d16
6 changed files with 28 additions and 10 deletions

View File

@@ -240,11 +240,11 @@ func fallbackToFrontend(frontendDist fs.FS) func(*gin.Context) {
}
if strings.HasPrefix(c.Request.URL.Path, "/dashboard") {
stripPath := strings.TrimPrefix(c.Request.URL.Path, "/dashboard")
localFilePath := path.Join("admin-dist", stripPath)
localFilePath := path.Join(singleton.Conf.AdminTemplate, stripPath)
if checkLocalFileOrFs(c, frontendDist, localFilePath) {
return
}
if !checkLocalFileOrFs(c, frontendDist, "admin-dist/index.html") {
if !checkLocalFileOrFs(c, frontendDist, singleton.Conf.AdminTemplate+"/index.html") {
c.JSON(http.StatusOK, newErrorResponse(errors.New("404 Not Found")))
}
return

View File

@@ -60,8 +60,10 @@ func updateConfig(c *gin.Context) (any, error) {
}
var userTemplateValid bool
for _, v := range singleton.FrontendTemplates {
if v.Path == sf.UserTemplate && sf.UserTemplate != "admin-dist" {
if !userTemplateValid && v.Path == sf.UserTemplate && !v.IsAdmin {
userTemplateValid = true
}
if userTemplateValid {
break
}
}