This commit is contained in:
Daniel 2024-10-27 22:22:47 +08:00
parent c1a7995862
commit ed4661c4ad
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 11 additions and 10 deletions

View file

@ -55,6 +55,8 @@ func getColorScheme(color string) ColorScheme {
} }
func getDynamicIcon(c *gin.Context) { func getDynamicIcon(c *gin.Context) {
// Add internal kernel API `/api/icon/getDynamicIcon` https://github.com/siyuan-note/siyuan/pull/12939
iconType := c.DefaultQuery("type", "1") iconType := c.DefaultQuery("type", "1")
color := c.Query("color") // 不要预设默认值不然type6返回星期就没法自动设置周末颜色了 color := c.Query("color") // 不要预设默认值不然type6返回星期就没法自动设置周末颜色了
date := c.Query("date") date := c.Query("date")
@ -151,7 +153,6 @@ func getDateInfo(dateStr string, lang string, weekdayType string) map[string]int
} }
weekdayStr = weekdays[date.Weekday()] weekdayStr = weekdays[date.Weekday()]
default: default:
// 其他语言 // 其他语言
switch weekdayType { switch weekdayType {
@ -314,7 +315,7 @@ func generateTypeSixSVG(color string, lang string, weekdayType string, dateInfo
} }
// 动态变化字体大小 // 动态变化字体大小
var fontSize float64 var fontSize float64
switch lang{ switch lang {
case "zh_CN", "zh_CHT": case "zh_CN", "zh_CHT":
fontSize = 460 / float64(len([]rune(weekday))) fontSize = 460 / float64(len([]rune(weekday)))
default: default:

View file

@ -33,7 +33,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/system/loginAuth", model.LoginAuth) ginServer.Handle("POST", "/api/system/loginAuth", model.LoginAuth)
ginServer.Handle("POST", "/api/system/logoutAuth", model.LogoutAuth) ginServer.Handle("POST", "/api/system/logoutAuth", model.LogoutAuth)
ginServer.Handle("GET", "/api/system/getCaptcha", model.GetCaptcha) ginServer.Handle("GET", "/api/system/getCaptcha", model.GetCaptcha)
ginServer.Handle("GET", "/api/icon/getDynamicIcon", getDynamicIcon) // 添加动态图标路由 ginServer.Handle("GET", "/api/icon/getDynamicIcon", getDynamicIcon)
// 需要鉴权 // 需要鉴权