This commit is contained in:
Revadike 2021-06-04 03:26:24 +02:00
parent e6995e337e
commit b4818d6d67

View File

@ -303,8 +303,8 @@ SteamCommunity.prototype.setCookies = function(cookies) {
}); });
}; };
SteamCommunity.prototype.getSessionID = function() { SteamCommunity.prototype.getSessionID = function(host = "http://steamcommunity.com") {
var cookies = this._jar.getCookieString("http://steamcommunity.com").split(';'); var cookies = this._jar.getCookieString(host).split(';');
for(var i = 0; i < cookies.length; i++) { for(var i = 0; i < cookies.length; i++) {
var match = cookies[i].trim().match(/([^=]+)=(.+)/); var match = cookies[i].trim().match(/([^=]+)=(.+)/);
if(match[1] == 'sessionid') { if(match[1] == 'sessionid') {
@ -545,7 +545,7 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRestore", "uri": "https://help.steampowered.com/wizard/AjaxDoPackageRestore",
"form": { "form": {
"packageid": packageID, "packageid": packageID,
"sessionid": this.getSessionID(), "sessionid": this.getSessionID('https://help.steampowered.com'),
"wizard_ajax": 1 "wizard_ajax": 1
}, },
"json": true "json": true
@ -555,10 +555,8 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
return; return;
} }
if (body.success && body.success != SteamCommunity.EResult.OK) { if (!body.success) {
let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]); let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]);
err.eresult = err.code = body.success;
callback(err); callback(err);
return; return;
} }
@ -577,7 +575,7 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRemove", "uri": "https://help.steampowered.com/wizard/AjaxDoPackageRemove",
"form": { "form": {
"packageid": packageID, "packageid": packageID,
"sessionid": this.getSessionID(), "sessionid": this.getSessionID('https://help.steampowered.com'),
"wizard_ajax": 1 "wizard_ajax": 1
}, },
"json": true "json": true
@ -587,10 +585,8 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
return; return;
} }
if (body.success && body.success != SteamCommunity.EResult.OK) { if (!body.success) {
let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]); let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]);
err.eresult = err.code = body.success;
callback(err); callback(err);
return; return;
} }