From 6fead9a79ed265914afd410df2f1ed4f362c1f9e Mon Sep 17 00:00:00 2001 From: kouchao Date: Sat, 29 Sep 2018 08:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=9E=E6=B3=95=E5=8F=82?= =?UTF-8?q?=E6=95=B0403=20#335,=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20#334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/comment_hot.js | 2 +- router/comment_like.js | 2 +- util/util.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/router/comment_hot.js b/router/comment_hot.js index 4977a52..88f643a 100644 --- a/router/comment_hot.js +++ b/router/comment_hot.js @@ -1,6 +1,6 @@ module.exports = (req, res, createWebAPIRequest) => { let cookie = req.get('Cookie') ? req.get('Cookie') : '' - cookie += ';os=pc;' + cookie = 'os=pc;' + cookie const rid = req.query.id const typeMap = { 0: 'R_SO_4_', // 歌曲 diff --git a/router/comment_like.js b/router/comment_like.js index 041568f..bcb62ce 100644 --- a/router/comment_like.js +++ b/router/comment_like.js @@ -1,7 +1,7 @@ //comment like module.exports = (req, res, createWebAPIRequest, request) => { let cookie = req.get('Cookie') ? req.get('Cookie') : '' - cookie += ';os=pc;' + cookie = 'os=pc;' + cookie const cid = req.query.cid //评论 id const id = req.query.id const typeMap = { diff --git a/util/util.js b/util/util.js index c514644..acc8ab2 100644 --- a/util/util.js +++ b/util/util.js @@ -39,13 +39,13 @@ function createWebAPIRequest( callback, errorCallback ) { + const proxy = cookie.split('__proxy__')[1] + cookie = cookie.split('__proxy__')[0] + const csrfToken = cookie.match(/_csrf=([^(;|$)]+)/) if (csrfToken) data.csrf_token = csrfToken[1] else data.csrf_token = '' - const proxy = cookie.split('__proxy__')[1] - cookie = cookie.split('__proxy__')[0] - const encryptedData = Encrypt(data) const options = { url: `http://${host}${path}`,