feat(web): 页脚品牌与备案信息、首页文案精简及导航/侧栏交互优化
- 页脚「纯文本驱动」改为 Powered by Pure Note(链至仓库地址),新增 公安备案展示:国徽图标 + 备案号链至 beian.mps.gov.cn,备案号可在 后台设置(站点描述下一项)配置,留空不显示 - settings 白名单新增 beian_no 键(trim、≤200 字符、可清空),/api/site 一并下发;TestSettingsWhitelist 补生效/清空/超长用例 - 去除首页 hero 文案区(PURE NOTE · 极简笔记/记录,而不打扰。等), 同步清理失效样式并微调顶部留白 - 博客 header 首页/标签菜单补 House/Tags 图标,与管理按钮同风格 - 管理侧栏「返回博客/退出登录」浓缩为图标按钮置于用户行右侧,CSS 悬浮 tooltip(top-center、带箭头,原生 title 延迟高不采用),返回 博客改新窗口打开
This commit is contained in:
@@ -284,10 +284,31 @@ func TestSettingsWhitelist(t *testing.T) {
|
||||
}
|
||||
// PUT 合法键
|
||||
resp, _ = e.do(admin, http.MethodPut, "/api/admin/settings",
|
||||
[]byte(`{"site_title":"新标题","site_desc":"描述","page_size":5}`), e.adminHeaders())
|
||||
[]byte(`{"site_title":"新标题","site_desc":"描述","page_size":5,"beian_no":"京公网安备12345678901号"}`), e.adminHeaders())
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("合法 PUT 应 200: %d", resp.StatusCode)
|
||||
}
|
||||
// beian_no 经 /api/site 可读且生效
|
||||
_, body = e.get(e.client(), "/api/site")
|
||||
if !strings.Contains(string(body), `"beian_no":"京公网安备12345678901号"`) {
|
||||
t.Errorf("beian_no 设置应生效: %s", body)
|
||||
}
|
||||
// beian_no 可清空(空串 = 不展示)
|
||||
resp, _ = e.do(admin, http.MethodPut, "/api/admin/settings",
|
||||
[]byte(`{"beian_no":""}`), e.adminHeaders())
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("beian_no 清空应 200: %d", resp.StatusCode)
|
||||
}
|
||||
_, body = e.get(e.client(), "/api/site")
|
||||
if !strings.Contains(string(body), `"beian_no":""`) {
|
||||
t.Errorf("beian_no 应可清空: %s", body)
|
||||
}
|
||||
// beian_no 过长拒绝
|
||||
resp, _ = e.do(admin, http.MethodPut, "/api/admin/settings",
|
||||
[]byte(`{"beian_no":"`+strings.Repeat("备", 201)+`"}`), e.adminHeaders())
|
||||
if resp.StatusCode != http.StatusBadRequest {
|
||||
t.Errorf("beian_no 超长应 400: %d", resp.StatusCode)
|
||||
}
|
||||
// page_size 生效为公开列表默认
|
||||
_, body = e.get(e.client(), "/api/notes")
|
||||
if !strings.Contains(string(body), `"page_size":5`) {
|
||||
|
||||
Reference in New Issue
Block a user