修复认证与基础安全链路
This commit is contained in:
@@ -34,6 +34,25 @@
|
||||
* 用于展示任命公告、好友通知、红包选择等需要居中展示的大卡片。
|
||||
*/
|
||||
window.chatBanner = (function() {
|
||||
/**
|
||||
* 将任意文本转为 HTML 安全文本。
|
||||
*/
|
||||
function escapeBannerText(text) {
|
||||
return String(text ?? '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
/**
|
||||
* 将多行纯文本转为带 <br> 的安全 HTML。
|
||||
*/
|
||||
function renderMultilineText(text) {
|
||||
return escapeBannerText(text).replace(/\n/g, '<br>');
|
||||
}
|
||||
|
||||
/** 注入入场/退场动画(全局只注入一次) */
|
||||
function ensureKeyframes() {
|
||||
if (document.getElementById('appoint-keyframes')) {
|
||||
@@ -89,7 +108,7 @@
|
||||
style="background:${btn.color || '#10b981'}; color:#fff; border:none; border-radius:8px;
|
||||
padding:8px 20px; font-size:13px; font-weight:bold; cursor:pointer;
|
||||
box-shadow:0 4px 12px rgba(0,0,0,0.25);">
|
||||
${btn.label || '确定'}
|
||||
${escapeBannerText(btn.label || '确定')}
|
||||
</button>`;
|
||||
});
|
||||
buttonsHtml += '</div>';
|
||||
@@ -110,15 +129,15 @@
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.4);
|
||||
border: 2px solid rgba(255,255,255,0.25); backdrop-filter: blur(8px);
|
||||
min-width: 260px;">
|
||||
${opts.icon ? `<div style="font-size:40px; margin-bottom:8px;">${opts.icon}</div>` : ''}
|
||||
${opts.icon ? `<div style="font-size:40px; margin-bottom:8px;">${escapeBannerText(opts.icon)}</div>` : ''}
|
||||
${opts.title ? `<div style="color:${titleColor}; font-size:13px; font-weight:bold; letter-spacing:3px; margin-bottom:12px;">
|
||||
══ ${opts.title} ══
|
||||
══ ${escapeBannerText(opts.title)} ══
|
||||
</div>` : ''}
|
||||
${opts.name ? `<div style="color:white; font-size:22px; font-weight:900; text-shadow:0 2px 8px rgba(0,0,0,0.3);">
|
||||
${escapeHtml(opts.name)}
|
||||
${escapeBannerText(opts.name)}
|
||||
</div>` : ''}
|
||||
${opts.body ? `<div style="color:rgba(255,255,255,0.9); font-size:14px; margin-top:10px;">${opts.body}</div>` : ''}
|
||||
${opts.sub ? `<div style="color:rgba(255,255,255,0.6); font-size:12px; margin-top:6px;">${opts.sub}</div>` : ''}
|
||||
${opts.body ? `<div style="color:rgba(255,255,255,0.9); font-size:14px; margin-top:10px;">${renderMultilineText(opts.body)}</div>` : ''}
|
||||
${opts.sub ? `<div style="color:rgba(255,255,255,0.6); font-size:12px; margin-top:6px;">${renderMultilineText(opts.sub)}</div>` : ''}
|
||||
${buttonsHtml}
|
||||
<div style="color:rgba(255,255,255,0.35); font-size:11px; margin-top:14px;">
|
||||
${new Date().toLocaleTimeString('zh-CN')}
|
||||
|
||||
Reference in New Issue
Block a user