Fixed steamID not being properly set when cookies have a domain attribute

This commit is contained in:
Alex Corn 2024-01-18 06:12:18 -05:00
parent e1820efeca
commit de95e25867
No known key found for this signature in database
GPG Key ID: E51989A3E7A27FDF

View File

@ -165,9 +165,9 @@ SteamCommunity.prototype._setCookie = function(cookie, secure) {
SteamCommunity.prototype.setCookies = function(cookies) { SteamCommunity.prototype.setCookies = function(cookies) {
cookies.forEach((cookie) => { cookies.forEach((cookie) => {
var cookieName = cookie.match(/(.+)=/)[1]; var cookieName = cookie.trim().split('=')[0];
if (cookieName == 'steamLogin' || cookieName == 'steamLoginSecure') { if (cookieName == 'steamLogin' || cookieName == 'steamLoginSecure') {
this.steamID = new SteamID(cookie.match(/=(\d+)/)[1]); this.steamID = new SteamID(cookie.match(/steamLogin(Secure)?=(\d+)/)[2]);
} }
this._setCookie(Request.cookie(cookie), !!(cookieName.match(/^steamMachineAuth/) || cookieName.match(/Secure$/))); this._setCookie(Request.cookie(cookie), !!(cookieName.match(/^steamMachineAuth/) || cookieName.match(/Secure$/)));