fix: allow qdreader save without js user identity
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//[author: Hermes]
|
||||
//[service: BOSS]
|
||||
//[class: 工具类]
|
||||
//[version: 2.3.7]
|
||||
//[version: 2.3.8]
|
||||
//[platform: web,qq,wx,tg,tb,fs,we]
|
||||
//[public: false]
|
||||
//[price: 0]
|
||||
@@ -26,6 +26,7 @@ var RETRY_KEY = "qdreader_retry_count"
|
||||
var CRON_SILENT_KEY = "qdreader_cron_silent"
|
||||
var LAST_RESULT_KEY = "qdreader_last_result_json"
|
||||
var LAST_RUN_KEY = "qdreader_last_run_json"
|
||||
var DEFAULT_OWNER = "__qdreader_default_owner__"
|
||||
var DEFAULT_SIGN_API = "https://api.120399.xyz/qdreader"
|
||||
var QIDIAN_BASE = "https://h5.if.qidian.com"
|
||||
var CHECKIN_PATH = "/argus/api/v3/checkin/checkin"
|
||||
@@ -101,6 +102,9 @@ function currentUserId() {
|
||||
for (var k = 0; k < names.length && !v; k++) { try { if (typeof this[names[k]] === "function") v = this[names[k]]() || "" } catch (e) {} }
|
||||
return trim(v)
|
||||
}
|
||||
function currentOwnerId() {
|
||||
return currentUserId() || DEFAULT_OWNER
|
||||
}
|
||||
function currentUserDebug() {
|
||||
var parts = []
|
||||
try { if (typeof sender !== "undefined" && sender) {
|
||||
@@ -113,7 +117,7 @@ function currentUserDebug() {
|
||||
}
|
||||
function boundToCurrent(uid, bind) {
|
||||
var owner = bind && bind[String(uid)] ? String(bind[String(uid)]) : ""
|
||||
var me = currentUserId()
|
||||
var me = currentOwnerId()
|
||||
return !!owner && !!me && owner === me
|
||||
}
|
||||
function visibleUids(store, bind, allUsers) {
|
||||
@@ -195,7 +199,7 @@ function contentText() {
|
||||
}
|
||||
function usage() {
|
||||
return [
|
||||
"启点读书签到插件 v2.3.7",
|
||||
"启点读书签到插件 v2.3.8",
|
||||
"【一级菜单】",
|
||||
"账号管理:启点账号",
|
||||
"执行查询:启点查询",
|
||||
@@ -595,7 +599,7 @@ function normalizeCookieInput(arg) {
|
||||
function handleSaveCookie(arg, store, bind) {
|
||||
var entries = normalizeCookieInput(arg)
|
||||
if (!entries.length) return "未识别到 Cookie。请发送:启点ck {\"uid\":\"cookie\"} 或 启点ck <QX抓到的完整cookie>"
|
||||
var me = currentUserId()
|
||||
var me = currentOwnerId()
|
||||
var lines = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var cookie = entries[i].cookie
|
||||
@@ -609,10 +613,6 @@ function handleSaveCookie(arg, store, bind) {
|
||||
lines.push("无权更新 uid: " + uid + "(该账号已绑定其他用户)")
|
||||
continue
|
||||
}
|
||||
if (!me) {
|
||||
lines.push("无法识别当前用户,拒绝保存 uid: " + uid + "。诊断: " + currentUserDebug())
|
||||
continue
|
||||
}
|
||||
var changed = store[uid] !== cookie
|
||||
store[uid] = cookie
|
||||
bind[uid] = me
|
||||
|
||||
Reference in New Issue
Block a user