Files
halo-theme-WarmIsland/package.json
T
nxxy335 28b1f90b26 fix: 修复 /links 页面 500(th:attr 受限求值)并校正友链申请回执 (v1.1.11)
问题:GET /links 抛 TemplateProcessingException ——
"Instantiation of new objects and access to static classes or parameters is forbidden"
定位到 links.html 第 126 行第 978 列:
  th:attr="value=${param.value != null and !#lists.isEmpty(param.value) ? param.value[0] : ''}"
Thymeleaf 对 th:attr 走受限表达式求值,禁止表达式对象的方法调用(#lists.isEmpty 等),
且校验发生在解析阶段,运行时短路(param.value 为 null)也救不了。同样的表达式
放在 th:with 里是合法的 —— 这正是本主题其他页面的既有写法。

修复:
- 全部取值逻辑移入 th:with(采用主题已验证写法 param?.x + x.length > 0 ? x[0] : null),
  输出改用单值属性 th:value,彻底不在 th:attr 里放复杂表达式
- 校正申请回执语义:插件实际回跳参数是 applied=success|error|disabled,
  另有 message / field / value(旧版误判为 applied=true)
  - 统一单条提示:有 message 显示 message,否则成功文案
  - applied=success 用强调色,error 用红色
  - applied=disabled 时隐藏表单,保留「未开放」提示
  - field/value 回填到对应输入框(displayName / url)
- 新增 .wi-links__apply-result--ok 样式
- 版本升至 1.1.11

同时沉淀校验:新增扫描脚本检查构建产物中 th:attr 是否含 #xxx. 方法调用 / new / T() / @bean,
全主题扫描结果为 0。
2026-09-26 20:33:54 +08:00

38 lines
881 B
JSON

{
"version": "1.1.11",
"type": "module",
"engines": {
"node": ">=22.12.0"
},
"scripts": {
"dev": "nodemon --config nodemon.json --exec 'astro build'",
"build": "astro build && node -e \"const fs=require('fs');const src='templates/logo.png';const dst='templates/assets/logo.png';if(fs.existsSync(src)){fs.copyFileSync(src,dst)}\"",
"astro": "astro",
"format": "prettier --write ."
},
"prettier": {
"plugins": [
"prettier-plugin-astro"
],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
},
"dependencies": {
"astro": "^6.1.4",
"lightgallery": "^2.9.0"
},
"devDependencies": {
"@halo-dev/theme-package-cli": "^1.1.1",
"nodemon": "^3.1.14",
"prettier": "3.8.1",
"prettier-plugin-astro": "0.14.1",
"sass": "^1.87.0"
}
}