mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-01-15 13:30:20 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # .idea/encodings.xml
This commit is contained in:
commit
fbfff1398b
1
.idea/.name
Normal file
1
.idea/.name
Normal file
@ -0,0 +1 @@
|
|||||||
|
node-steamcommunity
|
13
.idea/codeStyleSettings.xml
Normal file
13
.idea/codeStyleSettings.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectCodeStyleSettingsManager">
|
||||||
|
<option name="PER_PROJECT_SETTINGS">
|
||||||
|
<value>
|
||||||
|
<XML>
|
||||||
|
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||||
|
</XML>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||||
|
</component>
|
||||||
|
</project>
|
3
.idea/copyright/profiles_settings.xml
Normal file
3
.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="" />
|
||||||
|
</component>
|
@ -1,4 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
<component name="Encoding">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
8
.idea/node-steamcommunity.iml
Normal file
8
.idea/node-steamcommunity.iml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
4
.idea/watcherTasks.xml
Normal file
4
.idea/watcherTasks.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectTasksOptions" suppressed-tasks="Babel" />
|
||||||
|
</project>
|
@ -123,6 +123,10 @@ CSteamGroup.prototype.deleteComment = function(cid, callback) {
|
|||||||
this._community.deleteGroupComment(this.steamID, cid, callback);
|
this._community.deleteGroupComment(this.steamID, cid, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CSteamGroup.prototype.comment = function(message, callback) {
|
||||||
|
this._community.postGroupComment(this.steamID, message, callback);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get requests to join this restricted group.
|
* Get requests to join this restricted group.
|
||||||
* @param {function} callback - First argument is null/Error, second is array of SteamID objects
|
* @param {function} callback - First argument is null/Error, second is array of SteamID objects
|
||||||
|
@ -5,6 +5,11 @@ SteamCommunity.ChatState = require('../resources/EChatState.js');
|
|||||||
SteamCommunity.PersonaState = require('../resources/EPersonaState.js');
|
SteamCommunity.PersonaState = require('../resources/EPersonaState.js');
|
||||||
SteamCommunity.PersonaStateFlag = require('../resources/EPersonaStateFlag.js');
|
SteamCommunity.PersonaStateFlag = require('../resources/EPersonaStateFlag.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated No support for new Steam chat. Use steam-user instead.
|
||||||
|
* @param {int} interval
|
||||||
|
* @param {string} uiMode
|
||||||
|
*/
|
||||||
SteamCommunity.prototype.chatLogon = function(interval, uiMode) {
|
SteamCommunity.prototype.chatLogon = function(interval, uiMode) {
|
||||||
if(this.chatState == SteamCommunity.ChatState.LoggingOn || this.chatState == SteamCommunity.ChatState.LoggedOn) {
|
if(this.chatState == SteamCommunity.ChatState.LoggingOn || this.chatState == SteamCommunity.ChatState.LoggedOn) {
|
||||||
return;
|
return;
|
||||||
@ -74,6 +79,13 @@ SteamCommunity.prototype.chatLogon = function(interval, uiMode) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated No support for new Steam chat. Use steam-user instead.
|
||||||
|
* @param {string|SteamID} recipient
|
||||||
|
* @param {string} text
|
||||||
|
* @param {string} [type]
|
||||||
|
* @param {function} [callback]
|
||||||
|
*/
|
||||||
SteamCommunity.prototype.chatMessage = function(recipient, text, type, callback) {
|
SteamCommunity.prototype.chatMessage = function(recipient, text, type, callback) {
|
||||||
if(this.chatState != SteamCommunity.ChatState.LoggedOn) {
|
if(this.chatState != SteamCommunity.ChatState.LoggedOn) {
|
||||||
throw new Error("Chat must be logged on before messages can be sent");
|
throw new Error("Chat must be logged on before messages can be sent");
|
||||||
@ -119,6 +131,9 @@ SteamCommunity.prototype.chatMessage = function(recipient, text, type, callback)
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated No support for new Steam chat. Use steam-user instead.
|
||||||
|
*/
|
||||||
SteamCommunity.prototype.chatLogoff = function() {
|
SteamCommunity.prototype.chatLogoff = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.httpRequestPost({
|
this.httpRequestPost({
|
||||||
@ -141,6 +156,9 @@ SteamCommunity.prototype.chatLogoff = function() {
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
SteamCommunity.prototype._chatPoll = function() {
|
SteamCommunity.prototype._chatPoll = function() {
|
||||||
this.emit('debug', 'Doing chat poll');
|
this.emit('debug', 'Doing chat poll');
|
||||||
|
|
||||||
@ -211,6 +229,9 @@ SteamCommunity.prototype._chatPoll = function() {
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
SteamCommunity.prototype._relogWebChat = function() {
|
SteamCommunity.prototype._relogWebChat = function() {
|
||||||
this.emit('debug', "Relogging web chat");
|
this.emit('debug', "Relogging web chat");
|
||||||
clearTimeout(this._chat.timer);
|
clearTimeout(this._chat.timer);
|
||||||
@ -218,6 +239,10 @@ SteamCommunity.prototype._relogWebChat = function() {
|
|||||||
this.chatLogon(this._chat.interval, this._chat.uiMode);
|
this.chatLogon(this._chat.interval, this._chat.uiMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {SteamID} steamID
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
SteamCommunity.prototype._chatUpdatePersona = function(steamID) {
|
SteamCommunity.prototype._chatUpdatePersona = function(steamID) {
|
||||||
if (!this.chatFriends || this.chatState == SteamCommunity.ChatState.Offline) {
|
if (!this.chatFriends || this.chatState == SteamCommunity.ChatState.Offline) {
|
||||||
return; // we no longer care
|
return; // we no longer care
|
||||||
|
@ -591,6 +591,30 @@ SteamCommunity.prototype.deleteGroupComment = function(gid, cid, callback) {
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SteamCommunity.prototype.postGroupComment = function(gid, message, callback) {
|
||||||
|
if (typeof gid === 'string') {
|
||||||
|
gid = new SteamID(gid);
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
"uri": "https://steamcommunity.com/comment/Clan/post/" + gid.getSteamID64() + "/-1/",
|
||||||
|
"form": {
|
||||||
|
"comment": message,
|
||||||
|
"count": 6,
|
||||||
|
"sessionid": this.getSessionID()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
this.httpRequestPost(options, function(err, response, body) {
|
||||||
|
if(!callback) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(err || null);
|
||||||
|
}, "steamcommunity");
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get requests to join a restricted group.
|
* Get requests to join a restricted group.
|
||||||
* @param {SteamID|string} gid - The SteamID of the group you want to manage
|
* @param {SteamID|string} gid - The SteamID of the group you want to manage
|
||||||
|
@ -44,6 +44,10 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated No longer works if not logged in via mobile login. Will be removed in a future release.
|
||||||
|
* @param {function} callback
|
||||||
|
*/
|
||||||
SteamCommunity.prototype.getWebApiOauthToken = function(callback) {
|
SteamCommunity.prototype.getWebApiOauthToken = function(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
38
index.js
38
index.js
@ -5,7 +5,7 @@ const Request = require('request');
|
|||||||
const RSA = require('node-bignumber').Key;
|
const RSA = require('node-bignumber').Key;
|
||||||
const SteamID = require('steamid');
|
const SteamID = require('steamid');
|
||||||
|
|
||||||
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36";
|
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36";
|
||||||
|
|
||||||
require('util').inherits(SteamCommunity, require('events').EventEmitter);
|
require('util').inherits(SteamCommunity, require('events').EventEmitter);
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ module.exports = SteamCommunity;
|
|||||||
|
|
||||||
SteamCommunity.SteamID = SteamID;
|
SteamCommunity.SteamID = SteamID;
|
||||||
SteamCommunity.ConfirmationType = require('./resources/EConfirmationType.js');
|
SteamCommunity.ConfirmationType = require('./resources/EConfirmationType.js');
|
||||||
SteamCommunity.EResult = require('./resources/EResult.js')
|
SteamCommunity.EResult = require('./resources/EResult.js');
|
||||||
|
|
||||||
|
|
||||||
function SteamCommunity(options) {
|
function SteamCommunity(options) {
|
||||||
@ -249,6 +249,40 @@ SteamCommunity.prototype.oAuthLogin = function(steamguard, token, callback) {
|
|||||||
}, "steamcommunity");
|
}, "steamcommunity");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a token that can be used to log onto Steam using steam-user.
|
||||||
|
* @param {function} callback
|
||||||
|
*/
|
||||||
|
SteamCommunity.prototype.getClientLogonToken = function(callback) {
|
||||||
|
this.httpRequestGet({
|
||||||
|
"uri": "https://steamcommunity.com/chat/clientjstoken",
|
||||||
|
"json": true
|
||||||
|
}, (err, res, body) => {
|
||||||
|
if (err || res.statusCode != 200) {
|
||||||
|
callback(err ? err : new Error('HTTP error ' + res.statusCode));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!body.logged_in) {
|
||||||
|
let e = new Error('Not Logged In');
|
||||||
|
callback(e);
|
||||||
|
this._notifySessionExpired(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!body.steamid || !body.account_name || !body.token) {
|
||||||
|
callback(new Error('Malformed response'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(null, {
|
||||||
|
"steamID": new SteamID(body.steamid),
|
||||||
|
"accountName": body.account_name,
|
||||||
|
"webLogonToken": body.token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
SteamCommunity.prototype._setCookie = function(cookie, secure) {
|
SteamCommunity.prototype._setCookie = function(cookie, secure) {
|
||||||
var protocol = secure ? "https" : "http";
|
var protocol = secure ? "https" : "http";
|
||||||
cookie.secure = !!secure;
|
cookie.secure = !!secure;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "steamcommunity",
|
"name": "steamcommunity",
|
||||||
"version": "3.38.0",
|
"version": "3.39.0",
|
||||||
"description": "Provides an interface for logging into and interacting with the Steam Community website",
|
"description": "Provides an interface for logging into and interacting with the Steam Community website",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"steam",
|
"steam",
|
||||||
|
Loading…
Reference in New Issue
Block a user