yz-yuki-plugin 2.0.8-5 → 2.0.8-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/apps/weibo.js
CHANGED
|
@@ -184,12 +184,12 @@ message.use(async (e) => {
|
|
|
184
184
|
await e.reply('请注意账号安全,请手动撤回发送的cookie,并私聊进行添加绑定!');
|
|
185
185
|
}
|
|
186
186
|
else {
|
|
187
|
-
let
|
|
188
|
-
const XSRF_TOKEN = await WeiboMainModels.readSavedCookieItems(
|
|
187
|
+
let localWeiboCookie = e.msg.replace(/^(#|\/)(yuki|优纪)?(绑定|添加|ADD|add)(微博|weibo|WEIBO)(ck|CK|cookie|COOKIE)(:|:)?/g, '').trim();
|
|
188
|
+
const XSRF_TOKEN = await WeiboMainModels.readSavedCookieItems(localWeiboCookie, ['XSRF-TOKEN'], false);
|
|
189
189
|
if (XSRF_TOKEN) {
|
|
190
190
|
//筛选ck
|
|
191
|
-
|
|
192
|
-
await WeiboMainModels.saveLocalBiliCk(
|
|
191
|
+
localWeiboCookie = await WeiboMainModels.readSavedCookieItems(localWeiboCookie, ['XSRF-TOKEN', 'SUB', 'SUBP', 'SRF', 'SCF', 'SRT', ' _T_WM', 'M_WEIBOCN_PARAMS', 'SSOLoginState', 'ALF'], false);
|
|
192
|
+
await WeiboMainModels.saveLocalBiliCk(localWeiboCookie);
|
|
193
193
|
logger.mark(`${e.logFnc} 保存微博cookie成功 [XSRF_TOKEN: ${XSRF_TOKEN}]`);
|
|
194
194
|
let uidMsg = [`好耶~绑定微博cookie成功:\nXSRF_TOKEN: ${XSRF_TOKEN}`];
|
|
195
195
|
await e.reply(uidMsg);
|
|
@@ -290,7 +290,7 @@ class WeiboMainModels {
|
|
|
290
290
|
}
|
|
291
291
|
const cookiePairs = String(Wck)
|
|
292
292
|
.trim()
|
|
293
|
-
.match(/(
|
|
293
|
+
.match(/([a-zA-Z0-9_-]+)=([^;|,]+)/g) //正则 /(\w+)=([^;]+);/g 匹配 a=b 的内容,并分组为 [^;|,]+ 来匹配值,其中 [^;|,] 表示除了分号和,以外的任意字符
|
|
294
294
|
?.map(match => match.split('='))
|
|
295
295
|
.filter(([key, value]) => (isInverted ? !items.includes(key) : items.includes(key)) && value !== '')
|
|
296
296
|
.map(([key, value]) => `${key}=${value}`)
|