v1.7.0: 新增私信评论区用户(wbi签名+永久按mid去重+2~4分钟间隔)、安装统计上报、有新版本提示

This commit is contained in:
personal82555 committed 2026-10-13 18:38:58 +08:00
1 parent 38b90c1448
commit 0cce6cc2bb
5 files changed
+344 -9

No files matched your search

+35 -6
View File
@@ -13,9 +13,12 @@
region: "",
dlQuality: "80",
maxN: 3,
minPlay: 0
minPlay: 0,
dmEnabled: false,
dmCount: 2,
dmText: ""
};
const FIELDS = ["baseUrl", "apiKey", "model", "keyword", "order", "mode", "customText", "sendMode", "tid", "region", "dlQuality", "maxN", "minPlay"];
const FIELDS = ["baseUrl", "apiKey", "model", "keyword", "order", "mode", "customText", "sendMode", "tid", "region", "dlQuality", "maxN", "minPlay", "dmEnabled", "dmCount", "dmText"];
let settings = Object.assign({}, DEFAULTS);
let running = false;
@@ -50,8 +53,10 @@
for (const k of FIELDS) {
const el = $(k);
if (!el) continue;
el.value = settings[k];
if (el.type === "checkbox") el.checked = (settings[k] === true || settings[k] === "true");
else el.value = settings[k];
}
refreshDmVisibility();
// 地区不记忆:每次打开默认「全部地区」,只在本次会话内有效
settings.region = "";
const reg = $("region");
@@ -67,7 +72,13 @@
await chrome.storage.local.set({ settings: toSave });
}
function refreshCustomVisibility() {
function refreshDmVisibility() {
const cb = $("dmEnabled"), det = $("dmDetail");
if (!cb || !det) return;
det.style.display = cb.checked ? "block" : "none";
}
function refreshCustomVisibility() {
const ta = $("customText");
if (ta) ta.style.display = settings.mode === "custom" ? "block" : "none";
}
@@ -184,6 +195,15 @@
const mt = $("machineIdText");
if (mt) mt.textContent = licState.machine || "";
renderLicense();
// 有新版本时提示(数据来自安装上报时服务端返回的 latest_version)
const upd = res.update || {};
const updMsg = $("updMsg");
if (updMsg && upd.available && upd.latest && upd.latest !== upd.current) {
updMsg.style.display = "block";
updMsg.innerHTML = "⬆ 有新版本 v" + String(upd.latest).replace(/[<>&"]/g, "") + "(当前 v" + String(upd.current).replace(/[<>&"]/g, "") + ')<a href="#" id="updGo" style="color:#00A1D6;margin-left:6px">去更新 →</a>';
const go = $("updGo");
if (go) go.addEventListener("click", ev => { ev.preventDefault(); chrome.tabs.create({ url: "https://dl.88531.cn/bili.html" }); });
}
// 倒计时(仅试用中)
if (licTimer) { clearInterval(licTimer); licTimer = null; }
if (licState && !licState.authorized && !licState.offline && licState.trialLeftMs > 0) {
@@ -315,7 +335,14 @@
let res = null;
try {
res = await chrome.runtime.sendMessage({ action: "startRun", config: Object.assign({}, settings, { keyword: kw, maxN: Number(settings.maxN) || 3, minPlay: Number(settings.minPlay) || 0 }) });
res = await chrome.runtime.sendMessage({ action: "startRun", config: Object.assign({}, settings, {
keyword: kw,
maxN: Number(settings.maxN) || 3,
minPlay: Number(settings.minPlay) || 0,
dmEnabled: settings.dmEnabled === true || settings.dmEnabled === "true",
dmCount: Math.max(1, Math.min(5, Number(settings.dmCount) || 2)),
dmText: String(settings.dmText || "").trim()
}) });
} catch (e) {
res = { ok: false, error: String(e) };
}
@@ -552,9 +579,11 @@
const el = $(k);
if (!el) continue;
el.addEventListener("change", () => {
const v = (el.type === "number") ? (Number(el.value) || 0) : el.value;
const v = (el.type === "checkbox") ? el.checked
: (el.type === "number") ? (Number(el.value) || 0) : el.value;
saveField(k, v);
if (k === "mode") refreshCustomVisibility();
if (k === "dmEnabled") refreshDmVisibility();
if (k === "mode" || k === "apiKey" || k === "baseUrl" || k === "model" || k === "customText") refreshModeWarn();
});
if (el.tagName === "TEXTAREA" || el.type === "text" || el.type === "password") {