Compare commits

...

10 Commits

Author SHA1 Message Date
Alexander Corn
f3d88d6b83 3.3.3 2015-07-29 22:31:15 -04:00
Alexander Corn
09327af220 Fixed one more crash 2015-07-29 22:31:05 -04:00
Alexander Corn
0bb2cb6137 3.3.2 2015-07-29 22:29:23 -04:00
Alexander Corn
c9538137d5 Fixed crashes when using various CSteamUser methods 2015-07-29 22:29:14 -04:00
Alexander Corn
df05fd04c4 3.3.1 2015-07-29 22:22:57 -04:00
Alexander Corn
dee52bf7e2 Fixed crashes when using various class methods 2015-07-29 22:22:43 -04:00
Alexander Corn
6d455e8797 3.3.0 2015-07-27 22:56:42 -04:00
Alexander Corn
a0b776ca8b Added setupProfile method 2015-07-27 22:55:25 -04:00
Alexander Corn
3f0db21e02 3.2.1 2015-07-25 01:58:00 -04:00
Alexander Corn
6798b73a17 Made profile callbacks optional 2015-07-25 01:57:53 -04:00
6 changed files with 63 additions and 17 deletions

View File

@@ -92,7 +92,7 @@ CMarketItem.prototype.updatePrice = function(callback) {
"uri": "https://steamcommunity.com/market/itemordershistogram?country=US&language=english&currency=1&item_nameid=" + this.commodityID,
"json": true,
}, function(err, response, body) {
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}

View File

@@ -27,10 +27,11 @@ SteamCommunity.prototype.marketSearch = function(options, callback) {
qs.count = 100;
qs.sort_column = 'price';
qs.sort_dir = 'asc';
performSearch(this.request, qs, [], callback);
performSearch.call(this, this.request, qs, [], callback);
};
function performSearch(request, qs, results, callback) {
var self = this;
request({
"uri": "https://steamcommunity.com/market/search/render/",
"qs": qs,

View File

@@ -65,7 +65,7 @@ CSteamGroup.prototype.getMembers = function(callback, members, link) {
var self = this;
this._community.request(link, function(err, response, body) {
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}
@@ -147,6 +147,7 @@ CSteamGroup.prototype.postAnnouncement = function(headline, content, callback) {
"body": content
};
var self = this;
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/announcements", {"form": form}, function(err, response, body) {
if(!callback) {
return;

View File

@@ -107,12 +107,13 @@ CSteamUser.prototype.getAvatarURL = function(size, protocol) {
};
CSteamUser.prototype.addFriend = function(callback) {
var self = this;
this._community.request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 0, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}
@@ -133,12 +134,13 @@ CSteamUser.prototype.addFriend = function(callback) {
};
CSteamUser.prototype.acceptFriendRequest = function(callback) {
var self = this;
this._community.request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 1, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}
@@ -147,12 +149,13 @@ CSteamUser.prototype.acceptFriendRequest = function(callback) {
};
CSteamUser.prototype.removeFriend = function(callback) {
var self = this;
this._community.request.post('https://steamcommunity.com/actions/RemoveFriendAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}
@@ -161,12 +164,13 @@ CSteamUser.prototype.removeFriend = function(callback) {
};
CSteamUser.prototype.blockCommunication = function(callback) {
var self = this;
this._community.request.post('https://steamcommunity.com/actions/BlockUserAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
if(self._checkHttpError(err, response, callback)) {
if(self._community._checkHttpError(err, response, callback)) {
return;
}

View File

@@ -14,18 +14,39 @@ var CommentPrivacyState = {
"3": "commentanyone"
};
SteamCommunity.prototype.setupProfile = function(callback) {
var self = this;
this._myProfile("edit?welcomed=1", null, function(err, response, body) {
if(!callback) {
return;
}
if(err || response.statusCode != 200) {
callback(err || new Error("HTTP error " + response.statusCode));
} else {
callback(null);
}
});
};
SteamCommunity.prototype.editProfile = function(settings, callback) {
var self = this;
this._myProfile("edit", null, function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || new Error("HTTP error " + response.statusCode));
if(callback) {
callback(err || new Error("HTTP error " + response.statusCode));
}
return;
}
var $ = Cheerio.load(body);
var form = $('#editForm');
if(!form) {
callback(new Error("Malformed response"));
if(callback) {
callback(new Error("Malformed response"));
}
return;
}
@@ -93,7 +114,10 @@ SteamCommunity.prototype.editProfile = function(settings, callback) {
self._myProfile("edit", values, function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || new Error("HTTP error " + response.statusCode));
if(callback) {
callback(err || new Error("HTTP error " + response.statusCode));
}
return;
}
@@ -103,12 +127,17 @@ SteamCommunity.prototype.editProfile = function(settings, callback) {
if(error) {
error = error.text().trim();
if(error) {
callback(new Error(error));
if(callback) {
callback(new Error(error));
}
return;
}
}
callback(null);
if(callback) {
callback(null);
}
});
});
};
@@ -117,14 +146,20 @@ SteamCommunity.prototype.profileSettings = function(settings, callback) {
var self = this;
this._myProfile("edit/settings", null, function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || new Error("HTTP error " + response.statusCode));
if(callback) {
callback(err || new Error("HTTP error " + response.statusCode));
}
return;
}
var $ = Cheerio.load(body);
var form = $('#editForm');
if(!form) {
callback(new Error("Malformed response"));
if(callback) {
callback(new Error("Malformed response"));
}
return;
}
@@ -163,11 +198,16 @@ SteamCommunity.prototype.profileSettings = function(settings, callback) {
self._myProfile("edit/settings", values, function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || new Error("HTTP error " + response.statusCode));
if(callback) {
callback(err || new Error("HTTP error " + response.statusCode));
}
return;
}
callback(null);
if(callback) {
callback(null);
}
});
});
};

View File

@@ -1,6 +1,6 @@
{
"name": "steamcommunity",
"version": "3.2.0",
"version": "3.3.3",
"description": "Provides an interface for logging into and interacting with the Steam Community website",
"keywords": ["steam", "steam community"],
"homepage": "https://github.com/DoctorMcKay/node-steamcommunity",