mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-06 00:50:17 +08:00
Added parentalUnlock method
This commit is contained in:
parent
079db4b7bf
commit
5f4f4a03a4
23
index.js
23
index.js
@ -154,6 +154,29 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
SteamCommunity.prototype.parentalUnlock = function(pin, callback) {
|
||||
this._request.post("https://steamcommunity.com/parental/ajaxunlock", {
|
||||
"json": true,
|
||||
"form": {
|
||||
"pin": pin
|
||||
}
|
||||
}, function(err, response, body) {
|
||||
if(err || response.statusCode != 200) {
|
||||
return callback(err.message || "HTTP error " + response.statusCode);
|
||||
}
|
||||
|
||||
if(!body || typeof body.success !== 'boolean') {
|
||||
return callback("Invalid response");
|
||||
}
|
||||
|
||||
if(!body.success) {
|
||||
return callback("Incorrect PIN");
|
||||
}
|
||||
|
||||
callback();
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
SteamCommunity.prototype._checkCommunityError = function(html, callback) {
|
||||
if(html.match(/<h1>Sorry!<\/h1>/)) {
|
||||
var match = html.match(/<h3>(.+)<\/h3>/);
|
||||
|
Loading…
Reference in New Issue
Block a user