Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
226e4fbbf9 | ||
|
|
99d1d1fe92 | ||
|
|
32f48613c4 |
No files matched your search
@@ -4,6 +4,38 @@ B站评论助手 版本历史。下载:https://dl.88531.cn/bili.html ·
|
||||
|
||||
---
|
||||
|
||||
## v1.10.3 · 2026-10-20
|
||||
|
||||
### 🐛 修复
|
||||
- **买完仍显示试用倒计时**:授权系统的自动发卡只把卡密标成「已使用」并绑定机器码,**从不写入授权表**,而插件原来只查授权表 → 已购用户永远查不到自己的授权、倒计时照旧。现在插件改用**本地记住的卡密直接向卡密系统校验**(`/public/verify`,它读的是卡表),拿到真实授权状态与到期时间
|
||||
- **到期时间显示成「永久」**:购买页原先是 `到期时间 || '永久'` 兜底,而订单接口根本不返回到期时间 → **买 1 天也显示永久**。现在到期时间只在服务端明确给出时才显示,「永久」只在卡类型确为永久时出现
|
||||
|
||||
### ✨ 新功能
|
||||
- 激活成功后插件**永久记住这张卡**(换机绑定或过期时自动清除),不再依赖服务端授权表
|
||||
- 侧边栏已授权状态显示**套餐名 + 真实到期时间**:`已授权 · 1天试用 · 到期 2026-10-21 23:06:36`
|
||||
|
||||
---
|
||||
|
||||
## v1.10.2 · 2026-10-20
|
||||
|
||||
### 🔧 调整
|
||||
- 侧边栏「🤖 没有模型?注册即送额度」**移到 LLM 配置正上方**——原先它卡在授权区和评论记录之间,和 LLM 之间隔着一大块,现在配模型时一眼就能看到注册送额度的入口
|
||||
|
||||
---
|
||||
|
||||
## v1.10.1 · 2026-10-20
|
||||
|
||||
### ✨ 新功能
|
||||
- **支付成功后立刻显示卡密**:只要服务端发出卡,订单状态区马上出现独立的「你的卡密」展示区(大号等宽字体 + 一键复制),**不等自动激活结果**——自动激活失败时用户手里也有码,回侧边栏粘贴即可激活
|
||||
- **「已支付但还没发卡」的明确状态**:订单已是 `paid` 却还没拿到卡密时显示「已支付,正在为你发卡」,超过 90 秒改为「**权益不会丢失**,可凭订单号联系客服补发」,不再无限转在「等待支付中」
|
||||
- 卡密一键复制,剪贴板 API 无权限时自动降级 `execCommand`
|
||||
|
||||
### 🔧 调整
|
||||
- 激活失败时给出可执行路径(卡密展示 + 侧边栏操作步骤 + 订单号),不再只报一句错误
|
||||
- 卡密展示区用 B站蓝虚线框独立成块,`user-select: all` 便于长按全选
|
||||
|
||||
---
|
||||
|
||||
## v1.10.0 · 2026-10-20
|
||||
|
||||
### ✨ 新功能
|
||||
|
||||
+56
-1
@@ -125,6 +125,36 @@ async function checkLicense() {
|
||||
offline = true; // 网络/超时 → 放行
|
||||
}
|
||||
|
||||
// 兜底:卡密直验。自动发卡不写 ca_authorizations,上面的查询对已购用户恒为空;
|
||||
// 用本地记住的卡密直接调 /public/verify(它读 ca_cards,返回真实到期时间)。
|
||||
let cardInfo = null;
|
||||
if (!authorized) {
|
||||
try {
|
||||
const saved = await chrome.storage.local.get(["activeCardKey"]);
|
||||
const key = String(saved.activeCardKey || "").trim();
|
||||
if (key) {
|
||||
const v = await authFetch("/public/verify", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", "X-Api-Key": CARD_API_KEY },
|
||||
body: JSON.stringify({
|
||||
card_key: key,
|
||||
machine_id: machine,
|
||||
client_version: chrome.runtime.getManifest().version
|
||||
})
|
||||
}, 12000);
|
||||
const vd = (v && v.data) || {};
|
||||
if (v && v.code === 200 && vd.valid) {
|
||||
authorized = true;
|
||||
expire = vd.expire_time || "";
|
||||
cardInfo = { type: vd.type || "", expireTime: expire, isPermanent: !!vd.is_permanent, remainingDays: vd.remaining_days };
|
||||
} else if (v && v.code === 200 && vd.valid === false) {
|
||||
// 换机绑定或已过期:清掉本地卡密,别每次都拿废卡打接口
|
||||
await chrome.storage.local.remove(["activeCardKey", "activeCardInfo"]);
|
||||
}
|
||||
}
|
||||
} catch (e) { /* 直验失败不影响试用判定 */ }
|
||||
}
|
||||
|
||||
const st = await chrome.storage.local.get(["trialStart", "trialComments"]);
|
||||
let trialStart = Number(st.trialStart) || 0;
|
||||
if (!trialStart) {
|
||||
@@ -146,6 +176,7 @@ async function checkLicense() {
|
||||
offline: offline,
|
||||
realAuthorized: authorized,
|
||||
expire: expire,
|
||||
cardInfo: cardInfo,
|
||||
machine: machine,
|
||||
trialStart: trialStart,
|
||||
trialEnd: trialEnd,
|
||||
@@ -172,7 +203,27 @@ async function activateCard(cardKey) {
|
||||
}, 12000);
|
||||
const d = (r && r.data) || {};
|
||||
if (r && r.code === 200 && d.valid) {
|
||||
return { ok: true, message: d.message || "激活成功", days: d.duration_days || 0 };
|
||||
// 记住这张卡:CardAuth 的自动发卡只把 ca_cards 标成 used 并绑定机器码,
|
||||
// 从不写 ca_authorizations,所以 /public/authorizations/query 对已购用户恒为空。
|
||||
// 插件自己留着卡密,才能持续向 /public/verify 校验真实授权状态。
|
||||
const key = String(cardKey || "").trim();
|
||||
await chrome.storage.local.set({
|
||||
activeCardKey: key,
|
||||
activeCardInfo: {
|
||||
type: d.type || "",
|
||||
durationDays: Number(d.duration_days) || 0,
|
||||
expireTime: d.expire_time || "",
|
||||
isPermanent: !!d.is_permanent,
|
||||
activatedAt: Date.now()
|
||||
}
|
||||
});
|
||||
return {
|
||||
ok: true, message: d.message || "激活成功",
|
||||
days: d.duration_days || 0,
|
||||
cardType: d.type || "",
|
||||
expireTime: d.expire_time || "",
|
||||
isPermanent: !!d.is_permanent
|
||||
};
|
||||
}
|
||||
return { ok: false, message: (d && d.message) || (r && r.message) || "激活失败" };
|
||||
}
|
||||
@@ -623,6 +674,10 @@ async function authQueryOrder(orderNo) {
|
||||
const act = await activateCard(out.cardKey);
|
||||
out.activated = !!(act && act.ok);
|
||||
out.message = (act && act.message) || "";
|
||||
// /public/orders/query 不返回到期时间,verify 返回的才是真值——别用「永久」兜底
|
||||
out.expireTime = (act && act.expireTime) || "";
|
||||
out.isPermanent = !!(act && act.isPermanent);
|
||||
out.planName = d.card_type_name || "";
|
||||
if (out.activated) {
|
||||
await chrome.storage.local.remove(["pendingOrder"]);
|
||||
await clearOrderAlarm();
|
||||
|
||||
@@ -126,6 +126,76 @@ h2 {
|
||||
.order-status.error { color: #c62828; background: #fdecea; }
|
||||
.order-status.success { color: #1b5e20; background: #eef7ee; }
|
||||
|
||||
/* 卡密展示区:支付成功后必须让用户亲眼看到卡密 */
|
||||
.card-box {
|
||||
margin-top: 14px;
|
||||
border: 2px dashed #00a1d6;
|
||||
border-radius: 10px;
|
||||
background: #f2fbff;
|
||||
padding: 16px 14px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.cb-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #0089ba;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.cb-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #00a1d6;
|
||||
flex: none;
|
||||
box-shadow: 0 0 0 4px rgba(0, 161, 214, 0.18);
|
||||
}
|
||||
|
||||
.cb-key {
|
||||
background: #fff;
|
||||
border: 1px solid #cdeaf7;
|
||||
border-radius: 8px;
|
||||
padding: 14px 12px;
|
||||
text-align: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.cb-key code {
|
||||
font-family: "SF Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
color: #111;
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
.cb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
|
||||
.cb-copy {
|
||||
padding: 9px 22px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: #00a1d6;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: background 0.18s ease;
|
||||
}
|
||||
|
||||
.cb-copy:hover { background: #0089ba; }
|
||||
.cb-tip { font-size: 12px; color: #0089ba; }
|
||||
|
||||
.cb-hint {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
color: #7a7f86;
|
||||
}
|
||||
|
||||
.ok-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
|
||||
.ok-line { font-size: 13px; margin-bottom: 4px; }
|
||||
.ok-line b { color: #1b5e20; }
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
<section id="order-panel" hidden>
|
||||
<h2><span class="num">3</span> 订单状态</h2>
|
||||
<div id="order-status" class="order-status">等待创建订单…</div>
|
||||
<div id="card-box" class="card-box" hidden>
|
||||
<div class="cb-title"><span class="cb-dot"></span>你的卡密</div>
|
||||
<div class="cb-key"><code id="cb-key-text"></code></div>
|
||||
<div class="cb-row">
|
||||
<button type="button" id="cb-copy" class="cb-copy">复制卡密</button>
|
||||
<span id="cb-copy-tip" class="cb-tip"></span>
|
||||
</div>
|
||||
<p class="cb-hint" id="cb-hint">万一自动激活没成功:回到插件侧边栏,在卡密输入框粘贴并点「粘贴卡密并激活」即可,不影响你的权益。</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
@@ -99,20 +99,36 @@ function startPolling() {
|
||||
try {
|
||||
const res = await chrome.runtime.sendMessage({ action: 'authQueryOrder', orderNo });
|
||||
if (!res || !res.ok) return;
|
||||
// 只要拿到卡密就先展示出来,不等激活结果——自动激活失败时用户手里必须有码
|
||||
if (res.cardKey) showCardBox(res.cardKey, !!res.activated);
|
||||
|
||||
if (res.activated) {
|
||||
clearInterval(pollTimer);
|
||||
pollTimer = null;
|
||||
showActivated(res);
|
||||
} else if (res.cardKey && !res.activated) {
|
||||
} else if (res.cardKey) {
|
||||
clearInterval(pollTimer);
|
||||
pollTimer = null;
|
||||
const status = $('order-status');
|
||||
status.className = 'order-status error';
|
||||
status.textContent = '✗ 已支付但激活失败:' + (res.message || '请联系客服,提供订单号补发');
|
||||
status.innerHTML = '✗ <b>已支付并已发卡</b>,但自动激活未成功(' +
|
||||
esc(res.message || '本机绑定可能被占用') + ')。请用上方卡密手动激活:回到插件侧边栏 → 卡密输入框粘贴 → 点「粘贴卡密并激活」。<br>' +
|
||||
'订单号:<b>' + esc(orderNo || '') + '</b>';
|
||||
} else if (res.paid) {
|
||||
// 已付款但服务端还没把卡发出来(最常见原因是卡池库存不足)
|
||||
const waited = attempts * 5;
|
||||
const status = $('order-status');
|
||||
status.className = 'order-status pending';
|
||||
status.textContent = '⏳ 已支付,正在为你发卡…(订单 ' + orderNo + ',已等待 ' + waited + ' 秒)';
|
||||
if (waited >= 90) {
|
||||
status.className = 'order-status error';
|
||||
status.innerHTML = '⏳ <b>已支付</b>,但发卡耗时较长(已 ' + waited + ' 秒)。订单 <b>' + esc(orderNo) +
|
||||
'</b> 付款状态为已支付,<b>权益不会丢失</b>:继续等会自动发放,或凭此订单号联系客服补发。';
|
||||
}
|
||||
} else {
|
||||
const status = $('order-status');
|
||||
status.className = 'order-status pending';
|
||||
status.textContent = `⏳ 等待支付中…(订单 ${orderNo},已等待 ${attempts * 5} 秒)`;
|
||||
status.textContent = '⏳ 等待支付中…(订单 ' + orderNo + ',已等待 ' + attempts * 5 + ' 秒)';
|
||||
}
|
||||
} catch (e) {
|
||||
/* 单次查询失败不中断轮询 */
|
||||
@@ -120,13 +136,33 @@ function startPolling() {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/** 支付成功后立刻把卡密展示给用户(含自动激活失败的场景) */
|
||||
function showCardBox(key, activated) {
|
||||
const box = $('card-box');
|
||||
if (!box || !key) return;
|
||||
if (!box.hidden && $('cb-key-text').textContent === key) return;
|
||||
$('cb-key-text').textContent = key;
|
||||
box.hidden = false;
|
||||
$('cb-copy-tip').textContent = activated ? '已自动激活本机,这是你的卡密,建议留存' : '';
|
||||
box.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
|
||||
function showActivated(res) {
|
||||
const status = $('order-status');
|
||||
const permanent = !!res.isPermanent;
|
||||
const exp = String(res.expireTime || '').trim();
|
||||
const plan = String(res.planName || '').trim();
|
||||
// 绝不默认「永久」:到期时间只在服务端明确给出时才显示
|
||||
let expireLine;
|
||||
if (permanent) expireLine = '到期时间:<b>永久</b>';
|
||||
else if (exp) expireLine = '到期时间:<b>' + esc(exp) + '</b>';
|
||||
else if (plan) expireLine = '套餐:<b>' + esc(plan) + '</b>(实际到期时间以插件侧边栏「已授权 · 到期 …」为准)';
|
||||
else expireLine = '到期时间:以插件侧边栏显示为准';
|
||||
status.className = 'order-status success';
|
||||
status.innerHTML = `
|
||||
<div class="ok-title">✓ 支付成功,已自动激活</div>
|
||||
<div class="ok-line">卡密:<b>${esc(res.cardKey || '')}</b></div>
|
||||
<div class="ok-line">到期时间:${esc(res.expireTime || '永久')}</div>
|
||||
<div class="ok-line">${expireLine}</div>
|
||||
<div class="ok-line muted">回到插件侧边栏即可使用全部功能(本机已授权)。</div>`;
|
||||
}
|
||||
|
||||
@@ -134,4 +170,30 @@ document.querySelectorAll('.pay-btn').forEach((btn) => {
|
||||
btn.addEventListener('click', () => createOrder(btn.dataset.pay));
|
||||
});
|
||||
|
||||
// 复制卡密:优先 clipboard API,无权限时降级 execCommand
|
||||
$('cb-copy') && $('cb-copy').addEventListener('click', async () => {
|
||||
const key = ($('cb-key-text').textContent || '').trim();
|
||||
if (!key) return;
|
||||
let ok = false;
|
||||
try {
|
||||
await navigator.clipboard.writeText(key);
|
||||
ok = true;
|
||||
} catch (e) { /* 降级 */ }
|
||||
if (!ok) {
|
||||
try {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = key;
|
||||
ta.style.position = 'fixed';
|
||||
ta.style.opacity = '0';
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
ok = document.execCommand('copy');
|
||||
document.body.removeChild(ta);
|
||||
} catch (e2) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
$('cb-copy-tip').textContent = ok ? '已复制,可直接粘贴到侧边栏激活' : '复制失败,请手动长按选择卡密';
|
||||
});
|
||||
|
||||
loadPackages();
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "B站评论助手",
|
||||
"version": "1.10.0",
|
||||
"version": "1.10.3",
|
||||
"description": "B站网页版关键词评论助手:按搜索关键词找视频,默认模拟真人(打开视频页、滚到评论区、逐字输入、点发布),也可快速API直发;支持下载当前页视频;带防重复记录、可中断执行与页面实时进度浮层。",
|
||||
"permissions": ["storage", "tabs", "scripting", "sidePanel", "downloads", "declarativeNetRequest", "alarms"],
|
||||
"host_permissions": [
|
||||
|
||||
+5
-5
@@ -64,11 +64,6 @@
|
||||
<div id="licMachine" style="font-size:10px;color:#bbb;margin-top:4px;cursor:pointer" title="点击复制机器码">机器码:<span id="machineIdText">…</span>(点击复制)</div>
|
||||
</div>
|
||||
|
||||
<div class="promo">
|
||||
<span>🤖 没有模型?注册即送额度</span>
|
||||
<a id="promoLink">ai.88531.cn 注册 →</a>
|
||||
</div>
|
||||
|
||||
<div class="sec">
|
||||
<div class="lbl">📊 评论记录</div>
|
||||
<div class="statRow">
|
||||
@@ -79,6 +74,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="promo">
|
||||
<span>🤖 没有模型?注册即送额度</span>
|
||||
<a id="promoLink">ai.88531.cn 注册 →</a>
|
||||
</div>
|
||||
|
||||
<div class="sec">
|
||||
<div class="lbl">LLM 配置(自动保存,仅 AI 模式需要)</div>
|
||||
<input type="text" id="baseUrl" placeholder="https://ai.88531.cn/v1">
|
||||
|
||||
+2
-1
@@ -152,7 +152,8 @@ function refreshCustomVisibility() {
|
||||
actRow.style.display = "none";
|
||||
} else if (lic.authorized) {
|
||||
icon.textContent = "✅";
|
||||
text.textContent = "已授权" + (lic.expire ? " · 到期 " + lic.expire : "(长期)");
|
||||
const planTag = (lic.cardInfo && lic.cardInfo.type) ? " · " + lic.cardInfo.type : "";
|
||||
text.textContent = "已授权" + planTag + (lic.expire ? " · 到期 " + lic.expire : "(长期)");
|
||||
text.style.color = "#0a7";
|
||||
sub.textContent = "感谢支持!全部功能可用";
|
||||
actRow.style.display = "none";
|
||||
|
||||
Reference in new issue
Block a user