You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
782 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package internal
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/imdotdev/im.dev/server/pkg/common"
"github.com/imdotdev/im.dev/server/pkg/config"
)
type UIConfig struct {
Posts *PostsConfig `json:"posts"`
}
type PostsConfig struct {
TitleMaxLen int `json:"titleMaxLen"`
BriefMaxLen int `json:"briefMaxLen"`
WritingEnabled bool `json:"writingEnabled"`
MaxTags int `json:"maxTags"`
}
// 在后台页面配置存储到mysql中
func GetUIConfig(c *gin.Context) {
conf := &UIConfig{
Posts: &PostsConfig{
TitleMaxLen: config.Data.Posts.TitleMaxLen,
BriefMaxLen: config.Data.Posts.BriefMaxLen,
WritingEnabled: config.Data.Posts.WritingEnabled,
MaxTags: 2,
},
}
c.JSON(http.StatusOK, common.RespSuccess(conf))
}