(value)
| 1644 | } |
| 1645 | |
| 1646 | function checkFormat(value) { //check format and delete duplicates |
| 1647 | let n, k, c = {}; |
| 1648 | return value.reduce((t, i) => { |
| 1649 | k = ((i.cookie || '').match(/(pt_key|pt_pin)=.+?;/g) || []).sort(); |
| 1650 | if (k.length == 2) { |
| 1651 | if ((n = k[1]) && !c[n]) { |
| 1652 | i.userName = i.userName ? i.userName : decodeURIComponent(n.split(/pt_pin=(.+?);/)[1]); |
| 1653 | i.cookie = k.join('') |
| 1654 | if (i.jrBody && !i.jrBody.includes('reqData=')) { |
| 1655 | console.log(`异常钢镚Body已过滤: ${i.jrBody}`) |
| 1656 | delete i.jrBody; |
| 1657 | } |
| 1658 | c[n] = t.push(i); |
| 1659 | } |
| 1660 | } else { |
| 1661 | console.log(`异常京东Cookie已过滤: ${i.cookie}`) |
| 1662 | } |
| 1663 | return t; |
| 1664 | }, []) |
| 1665 | } |
| 1666 | |
| 1667 | function CookieUpdate(oldValue, newValue, path = 'cookie') { |
| 1668 | let item, type, name = (oldValue || newValue || '').split(/pt_pin=(.+?);/)[1]; |
no test coverage detected