feat: 小程序阅读记录与资料链路、管理端用户规则、API/VIP/推荐与运营脚本
- miniprogram: reading-records、imageUrl/mpNavigate、多页资料与 VIP 展示调整 - soul-admin: Users/Settings/UserDetailModal、dist 构建产物更新 - soul-api: user/vip/referral/ckb/db、MBTI 头像管理、user_rule_completion、迁移 SQL - .cursor: karuo-party 与飞书文档;.gitignore 忽略 .tmp_skill_bundle Made-with: Cursor
This commit is contained in:
14
miniprogram/utils/imageUrl.js
Normal file
14
miniprogram/utils/imageUrl.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 小程序 <image src> 合法判断:避免 undefined 字符串、相对脏值触发「illegal src」
|
||||
*/
|
||||
function isSafeImageSrc(u) {
|
||||
if (u == null) return false
|
||||
const s = String(u).trim()
|
||||
if (!s || s === 'undefined' || s === 'null') return false
|
||||
if (/^https?:\/\//i.test(s)) return true
|
||||
if (s.startsWith('wxfile://') || s.startsWith('cloud://')) return true
|
||||
if (s.startsWith('/')) return true
|
||||
return false
|
||||
}
|
||||
|
||||
module.exports = { isSafeImageSrc }
|
||||
Reference in New Issue
Block a user