悄悄话留言身份与首页打通:openid 读 hash+query+同源缓存,退出登录算访客;广场/专题页也加缓存兜底 (v26110633)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 05:01:16 +00:00
parent 53652c481c
commit 91f29e05c9
5 changed files with 22 additions and 14 deletions

View File

@@ -1007,7 +1007,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
return m ? decodeURIComponent(m[1]).split('?')[0] : '';
} catch (e) { return ''; }
}
var OPENID = (window.mbGate && window.mbGate.out) ? '' : param('openid'); /* 11-07 退出登录后按访客(不拉「我的评论」、不认头像) */
var OPENID = (window.mbGate && window.mbGate.out) ? '' : (param('openid') || (function(){try{var c=JSON.parse(sessionStorage.getItem('mmbox.identity')||'null');return c&&c.openid&&(!c.at||Date.now()-c.at<432e5)?c.openid:'';}catch(e){return '';}})()); /* 11-07 URL 没带身份时用首页存的同源缓存(同 wx-auth.js identity) */ /* 11-07 退出登录后按访客(不拉「我的评论」、不认头像) */
var MYNAME = param('nickname') || '孕妈'; /* 授权回填的昵称在 hash 里;没有就叫「孕妈」,后面另挂「我」标 */
/* ---------- 头像:沿用首页 assets/img/mom/ 写实头像 ---------- */
@@ -1053,7 +1053,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
var CMD = null, CMERR = false;
/* 头像编码:数字 = av/NNNN.webp(旧代码头像);'av:c012' = av/c012.webp(卡通/可爱卡通);'/…' = 站内绝对路径(内置头像库 /_bridge/avatars/);其余 = assets/img/mom/xxx.jpg */
var avP = function (a) { return typeof a === 'number' ? 'av/' + ('000' + a).slice(-4) + '.webp' : a.indexOf('av:') === 0 ? 'av/' + a.slice(3) + '.webp' : a.charAt(0) === '/' ? a : '../assets/img/mom/' + a + '.jpg'; };
fetch('cm.json?v=26110632').then(function (r) { return r.json(); }).then(function (j) {
fetch('cm.json?v=26110633').then(function (r) { return r.json(); }).then(function (j) {
CMD = j; if (openId && NBY[openId]) { renderComments(NBY[openId]); syncBar(NBY[openId]); }
}).catch(function () { CMERR = true; if (openId && NBY[openId]) renderComments(NBY[openId]); });
function commentsOf(n) {