optimize base cookie for multiple users

This commit is contained in:
Nzix
2018-09-24 16:45:05 +08:00
parent fbd969e36b
commit ac66ae339f
3 changed files with 44 additions and 23 deletions

View File

@ -2,7 +2,15 @@ function randomString(pattern, length){
return Array.apply(null, {length: length}).map(() => (pattern[Math.floor(Math.random() * pattern.length)])).join('');
}
const jsessionid = randomString('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ\\/+',176) + ':' + (new Date).getTime();
const nuid = randomString('0123456789abcdefghijklmnopqrstuvwxyz',32);
function generateCookie(){
const jsessionid = randomString('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ\\/+',176) + ':' + (new Date).getTime();
const nuid = randomString('0123456789abcdefghijklmnopqrstuvwxyz',32);
return {
'JSESSIONID-WYYY': jsessionid,
'_iuqxldmzr_': 32,
'_ntes_nnid': nuid + ',' + (new Date).getTime(),
'_ntes_nuid': nuid
}
}
module.exports = `JSESSIONID-WYYY=${jsessionid}; _iuqxldmzr_=32; _ntes_nnid=${nuid},${(new Date).getTime()}; _ntes_nuid=${nuid}`;
module.exports = generateCookie