fix: require qdreader user binding for manual access
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//[author: Hermes]
|
||||
//[service: BOSS]
|
||||
//[class: 工具类]
|
||||
//[version: 2.3.2]
|
||||
//[version: 2.3.3]
|
||||
//[platform: web,qq,wx,tg,tb,fs,we]
|
||||
//[public: false]
|
||||
//[price: 0]
|
||||
@@ -102,7 +102,7 @@ function currentUserId() {
|
||||
function boundToCurrent(uid, bind) {
|
||||
var owner = bind && bind[String(uid)] ? String(bind[String(uid)]) : ""
|
||||
var me = currentUserId()
|
||||
return !owner || !me || owner === me
|
||||
return !!owner && !!me && owner === me
|
||||
}
|
||||
function visibleUids(store, bind, allUsers) {
|
||||
var uids = Object.keys(store || {}).sort()
|
||||
@@ -183,7 +183,7 @@ function contentText() {
|
||||
}
|
||||
function usage() {
|
||||
return [
|
||||
"启点读书签到插件 v2.3.2",
|
||||
"启点读书签到插件 v2.3.3",
|
||||
"【一级菜单】",
|
||||
"账号管理:启点账号",
|
||||
"执行查询:启点查询",
|
||||
@@ -592,9 +592,18 @@ function handleSaveCookie(arg, store, bind) {
|
||||
var uid = entries[i].uid || parsedUid
|
||||
if (!uid) return "无法从 Cookie 识别 uid。请确认 QX 抓的是启点读书福利中心 getlogininfo 请求,Cookie 内应包含 QDHeader 或 uid。"
|
||||
var isNew = !store[uid]
|
||||
var oldOwner = bind[uid] || ""
|
||||
if (store[uid] && oldOwner && me && oldOwner !== me) {
|
||||
lines.push("无权更新 uid: " + uid + "(该账号已绑定其他用户)")
|
||||
continue
|
||||
}
|
||||
if (!me) {
|
||||
lines.push("无法识别当前用户,拒绝保存 uid: " + uid)
|
||||
continue
|
||||
}
|
||||
var changed = store[uid] !== cookie
|
||||
store[uid] = cookie
|
||||
if (me) bind[uid] = me
|
||||
bind[uid] = me
|
||||
lines.push("启点读书CK" + (isNew ? "新增" : (changed ? "更新" : "未变化")) + "成功")
|
||||
lines.push("uid: " + uid)
|
||||
if (entries.length > 1 && parsedUid && parsedUid !== uid) lines.push("提示: JSON uid 与 Cookie 解析 uid 不一致,已按 JSON uid 保存")
|
||||
|
||||
Reference in New Issue
Block a user