trustbase-seller-backend 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/routes/sp-applyment.js +2 -2
- package/test-sp-applyment.js +7 -1
package/package.json
CHANGED
package/routes/sp-applyment.js
CHANGED
|
@@ -595,8 +595,8 @@ function renderSlots(){
|
|
|
595
595
|
return '<div class="slot"><div class="t">'+kk[1]+'</div>'
|
|
596
596
|
+(mid?'<div class="mid">✓ '+esc(maskMid(mid))+'</div>':'')
|
|
597
597
|
+'<img id="img-'+kk[0]+'" style="display:none">'
|
|
598
|
-
+'<label class="upbtn">'+(mid?'替换':'点击上传')+'<input type="file" accept="image/*" style="display:none" onchange="upFormAsset(event
|
|
599
|
-
+(mid?'<button class="upbtn del" onclick="formAssets[
|
|
598
|
+
+'<label class="upbtn">'+(mid?'替换':'点击上传')+'<input type="file" accept="image/*" style="display:none" onchange="upFormAsset(event,\\x27'+kk[0]+'\\x27)"></label>'
|
|
599
|
+
+(mid?'<button class="upbtn del" onclick="formAssets[\\x27'+kk[0]+'\\x27]=\\x27\\x27;renderSlots()">删除</button>':'')
|
|
600
600
|
+'</div>';
|
|
601
601
|
}).join('');
|
|
602
602
|
}
|
package/test-sp-applyment.js
CHANGED
|
@@ -435,7 +435,13 @@ test("SP 配置页后端: config 读写 (表优先 env) + 配齐度 + info 立
|
|
|
435
435
|
// 页面: Accept text/html 无 key 也 200 (admin key 页面内输入)
|
|
436
436
|
r = await fetch(base + "/sp/config", { headers: { Accept: "text/html" } });
|
|
437
437
|
assert.strictEqual(r.status, 200);
|
|
438
|
-
|
|
438
|
+
const pageHtml = await r.text();
|
|
439
|
+
assert.ok(pageHtml.includes("服务商配置"));
|
|
440
|
+
// 回归 (0.4.2): 页面内联脚本必须可编译 — 模板里 \x27 会被服务端提前求值成双引号导致整页 JS 死掉 (保存按钮无反应),
|
|
441
|
+
// 必须用 \\x27 让浏览器拿到字面 \x27 再自行求值
|
|
442
|
+
const scriptMatch = pageHtml.match(/<script>([\s\S]*?)<\/script>/);
|
|
443
|
+
assert.ok(scriptMatch, "配置页应有内联脚本");
|
|
444
|
+
new Function(scriptMatch[1]); // 语法错误会抛
|
|
439
445
|
// 读默认 (env 兜底)
|
|
440
446
|
let j = await (await fetch(base + "/api/sp/config", { headers: { ...H, Accept: "application/json" } })).json();
|
|
441
447
|
assert.strictEqual(j.ok, true);
|