15m44z 第三部分续:匿名工单回复去玩家名 + token 保留 + 匿名开关 UI
匿名工单(gh_issue_owner=bot)回复/撤单/完结不再在 GitHub 评论写提单人名字; ghSyncReply 按 gh_issue_owner 判:bot 单省略 [sender] 标签,实名单保留; ticketReply 加 guard:bot 单+玩家 token 不匹配时静默跳过评论推送; gh_cfg.php:切匿名模式时玩家 OAuth token 保留(gh_authorized 兜底 true); player.php:匿名开时授权按钮改保留授权不隐藏,匿名关恢复重新授权。
This commit is contained in:
+30
-8
@@ -3997,10 +3997,20 @@ if ($currentVersion !== $BUILD_VERSION) {
|
||||
// ★ 15m44v: 按 gh_authorized 显示授权态(不再只靠 URL gh_ok 参数)
|
||||
const isAuthed = d.gh_authorized === true
|
||||
|| new URLSearchParams(location.search).get('gh_ok') === '1';
|
||||
// ★ 15m44z 第三部分+token保留:匿名模式可用时,gh_authorized=true 可能是
|
||||
// "token 保留但 401 失效"(gh_cfg 兜底逻辑)。区分两种态:
|
||||
// - 匿名模式可用 + gh_authorized=true → "授权已保留(可重新授权)"
|
||||
// - 匿名模式不可用 + gh_authorized=true → "已授权,自动同步"(老态)
|
||||
if (isAuthed) {
|
||||
if (txt) txt.textContent = '✅ GitHub 已授权,工单+附件会自动同步到 issue';
|
||||
if (sub) sub.textContent = '当前账号 token 有效,工单提交将自动同步到 GitHub issue';
|
||||
if (btn) { btn.textContent = '重新授权'; btn.onclick = gotoGhOAuth; }
|
||||
if (d.gh_anon_available === true) {
|
||||
if (txt) txt.textContent = '🔗 GitHub 授权已保留,切匿名模式不影响授权记录';
|
||||
if (sub) sub.textContent = '实名通道 token 可能已失效,点重新授权可刷新;切匿名模式走系统机器人,无需玩家授权';
|
||||
if (btn) { btn.textContent = '重新授权'; btn.onclick = gotoGhOAuth; }
|
||||
} else {
|
||||
if (txt) txt.textContent = '✅ GitHub 已授权,工单+附件会自动同步到 issue';
|
||||
if (sub) sub.textContent = '当前账号 token 有效,工单提交将自动同步到 GitHub issue';
|
||||
if (btn) { btn.textContent = '重新授权'; btn.onclick = gotoGhOAuth; }
|
||||
}
|
||||
} else {
|
||||
if (txt) txt.textContent = '⛓️ GitHub 工单同步(' + (d.gh_repo || 'issue') + ')';
|
||||
if (sub) sub.textContent = '工单与附件都同步到 GitHub issue,点右侧按钮授权你的 GitHub 账号';
|
||||
@@ -4033,18 +4043,30 @@ if ($currentVersion !== $BUILD_VERSION) {
|
||||
window.location.href = url;
|
||||
}
|
||||
// ★ 15m44z 第三部分+开关:匿名开关 UI 联动。
|
||||
// 匿名开 → 隐藏「授权 GitHub」按钮(不需要授权,bot 代发),提示改文案;
|
||||
// 匿名开 → 授权按钮隐藏(不需要玩家 OAuth,bot 代发),文案改匿名说明;
|
||||
// 匿名关 → 恢复授权按钮(走玩家 OAuth 建单,老逻辑)。
|
||||
// ★ 用户定调(15m44z 续):切匿名模式 ≠ 放弃实名授权。
|
||||
// 匿名开时,授权按钮文案改为「保留授权」(仍可重新授权),不隐藏。
|
||||
// 玩家切回关后授权自动恢复。
|
||||
function syncGhAnonUI() {
|
||||
const btn = document.getElementById('ghAuthBtn');
|
||||
const sub = document.getElementById('ghAuthSub');
|
||||
const txt = document.getElementById('ghAuthText');
|
||||
if (ticketState.anonTicket) {
|
||||
if (btn) { btn.style.display = 'none'; }
|
||||
if (txt) txt.textContent = '🤖 匿名工单:本单以匿名身份提交';
|
||||
if (sub) sub.textContent = '这条工单只有你自己和你主动分享的人能看到;取消勾选用你自己的账号提交';
|
||||
if (btn) {
|
||||
// 匿名开:保留授权按钮但不隐藏,改文案提示"保留授权"
|
||||
btn.textContent = '保留授权';
|
||||
btn.style.opacity = '0.7';
|
||||
btn.onclick = gotoGhOAuth;
|
||||
}
|
||||
if (txt) txt.textContent = '🤖 匿名工单:以匿名身份提交,这条工单只有你自己和你主动分享的人能看到';
|
||||
if (sub) sub.textContent = '取消勾选可改回实名授权提交;切匿名不影响已保留的授权记录';
|
||||
} else {
|
||||
if (btn) { btn.style.display = ''; }
|
||||
if (btn) {
|
||||
btn.style.opacity = '1';
|
||||
btn.textContent = '重新授权';
|
||||
btn.onclick = gotoGhOAuth;
|
||||
}
|
||||
// 恢复默认文案(具体已授权/未授权由 loadGhCfg 的 isAuthed 段设置,这里只兜底)
|
||||
if (txt && txt.textContent.indexOf('🤖') === 0) txt.textContent = '⛓️ GitHub 工单同步';
|
||||
if (sub && sub.textContent.indexOf('提单人信息仅后台保留') === 0) {
|
||||
|
||||
Reference in New Issue
Block a user