mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-08-19 13:13:28 +08:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2abc547f49 | ||
|
|
b2bffddfbe | ||
|
|
ab9baeafc6 | ||
|
|
788f34ba7a | ||
|
|
bde2cafaf4 | ||
|
|
36e8c79d87 | ||
|
|
4ca0fc83aa | ||
|
|
2dd5bb490e | ||
|
|
d0da148d6b | ||
|
|
7605dc8a41 | ||
|
|
5f46aee9fc | ||
|
|
e5fbddc00c | ||
|
|
440b2f9ba9 | ||
|
|
e23fa02c91 | ||
|
|
33bc8d83c9 | ||
|
|
f96d25ad52 | ||
|
|
f7d7cf0660 | ||
|
|
27d2daac61 | ||
|
|
4723bd93a6 | ||
|
|
897ad16154 | ||
|
|
81d8dc2a5c | ||
|
|
8538589fef | ||
|
|
c0be17cd61 | ||
|
|
350f6288e4 | ||
|
|
ba2782066d | ||
|
|
d6b0fbd5d0 | ||
|
|
9ec5dcd7b0 | ||
|
|
c8642865a1 | ||
|
|
c92801d25e | ||
|
|
b55516f67f | ||
|
|
f09adc84a4 | ||
|
|
d807f10653 | ||
|
|
18011b3fac | ||
|
|
6f97370710 |
4
.idea/modules.xml
generated
4
.idea/modules.xml
generated
@@ -2,8 +2,8 @@
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/../node-steamcommunity Wiki/.idea/node-steamcommunity Wiki.iml" filepath="$PROJECT_DIR$/../node-steamcommunity Wiki/.idea/node-steamcommunity Wiki.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/steamcommunity.iml" filepath="$PROJECT_DIR$/.idea/steamcommunity.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../steamcommunity Wiki/.idea/steamcommunity Wiki.iml" filepath="$PROJECT_DIR$/../steamcommunity Wiki/.idea/steamcommunity Wiki.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
4
.idea/steamcommunity.iml
generated
4
.idea/steamcommunity.iml
generated
@@ -5,6 +5,6 @@
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="node-steamcommunity Wiki" />
|
||||
<orderEntry type="module" module-name="steamcommunity Wiki" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
@@ -2,6 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../node-steamcommunity Wiki" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../steamcommunity Wiki" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
221
classes/CSteamSharedFile.js
Normal file
221
classes/CSteamSharedFile.js
Normal file
@@ -0,0 +1,221 @@
|
||||
const Cheerio = require('cheerio');
|
||||
const SteamID = require('steamid');
|
||||
|
||||
const SteamCommunity = require('../index.js');
|
||||
const Helpers = require('../components/helpers.js');
|
||||
|
||||
const ESharedFileType = require('../resources/ESharedFileType.js');
|
||||
|
||||
|
||||
/**
|
||||
* Scrape a sharedfile's DOM to get all available information
|
||||
* @param {string} sharedFileId - ID of the sharedfile
|
||||
* @param {function} callback - First argument is null/Error, second is object containing all available information
|
||||
*/
|
||||
SteamCommunity.prototype.getSteamSharedFile = function(sharedFileId, callback) {
|
||||
// Construct object holding all the data we can scrape
|
||||
let sharedfile = {
|
||||
id: sharedFileId,
|
||||
type: null,
|
||||
appID: null,
|
||||
owner: null,
|
||||
fileSize: null,
|
||||
postDate: null,
|
||||
resolution: null,
|
||||
uniqueVisitorsCount: null,
|
||||
favoritesCount: null,
|
||||
upvoteCount: null,
|
||||
guideNumRatings: null,
|
||||
isUpvoted: null,
|
||||
isDownvoted: null
|
||||
};
|
||||
|
||||
// Get DOM of sharedfile
|
||||
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sharedFileId}`, (err, res, body) => {
|
||||
try {
|
||||
|
||||
/* --------------------- Preprocess output --------------------- */
|
||||
|
||||
// Load output into cheerio to make parsing easier
|
||||
let $ = Cheerio.load(body);
|
||||
|
||||
// Dynamically map detailsStatsContainerLeft to detailsStatsContainerRight in an object to make readout easier. It holds size, post date and resolution.
|
||||
let detailsStatsObj = {};
|
||||
let detailsLeft = $(".detailsStatsContainerLeft").children();
|
||||
let detailsRight = $(".detailsStatsContainerRight").children();
|
||||
|
||||
Object.keys(detailsLeft).forEach((e) => { // Dynamically get all details. Don't hardcore so that this also works for guides.
|
||||
if (isNaN(e)) {
|
||||
return; // Ignore invalid entries
|
||||
}
|
||||
|
||||
detailsStatsObj[detailsLeft[e].children[0].data.trim()] = detailsRight[e].children[0].data;
|
||||
});
|
||||
|
||||
// Dynamically map stats_table descriptions to values. This holds Unique Visitors and Current Favorites
|
||||
let statsTableObj = {};
|
||||
let statsTable = $(".stats_table").children();
|
||||
|
||||
Object.keys(statsTable).forEach((e) => {
|
||||
if (isNaN(e)) {
|
||||
return; // Ignore invalid entries
|
||||
}
|
||||
|
||||
// Value description is at index 3, value data at index 1
|
||||
statsTableObj[statsTable[e].children[3].children[0].data] = statsTable[e].children[1].children[0].data.replace(/,/g, ""); // Remove commas from 1k+ values
|
||||
});
|
||||
|
||||
|
||||
/* --------------------- Find and map values --------------------- */
|
||||
|
||||
// Find appID in share button onclick event
|
||||
sharedfile.appID = Number($("#ShareItemBtn").attr()["onclick"].replace(`ShowSharePublishedFilePopup( '${sharedFileId}', '`, "").replace("' );", ""));
|
||||
|
||||
|
||||
// Find fileSize if not guide
|
||||
sharedfile.fileSize = detailsStatsObj["File Size"] || null; // TODO: Convert to bytes? It seems like to always be MB but no guarantee
|
||||
|
||||
|
||||
// Find postDate and convert to timestamp
|
||||
let posted = detailsStatsObj["Posted"].trim();
|
||||
|
||||
sharedfile.postDate = Helpers.decodeSteamTime(posted);
|
||||
|
||||
|
||||
// Find resolution if artwork or screenshot
|
||||
sharedfile.resolution = detailsStatsObj["Size"] || null;
|
||||
|
||||
|
||||
// Find uniqueVisitorsCount. We can't use ' || null' here as Number("0") casts to false
|
||||
if (statsTableObj["Unique Visitors"]) {
|
||||
sharedfile.uniqueVisitorsCount = Number(statsTableObj["Unique Visitors"]);
|
||||
}
|
||||
|
||||
|
||||
// Find favoritesCount. We can't use ' || null' here as Number("0") casts to false
|
||||
if (statsTableObj["Current Favorites"]) {
|
||||
sharedfile.favoritesCount = Number(statsTableObj["Current Favorites"]);
|
||||
}
|
||||
|
||||
|
||||
// Find upvoteCount. We can't use ' || null' here as Number("0") casts to false
|
||||
let upvoteCount = $("#VotesUpCountContainer > #VotesUpCount").text();
|
||||
|
||||
if (upvoteCount) {
|
||||
sharedfile.upvoteCount = Number(upvoteCount);
|
||||
}
|
||||
|
||||
|
||||
// Find numRatings if this is a guide as they use a different voting system
|
||||
let numRatings = $(".ratingSection > .numRatings").text().replace(" ratings", "");
|
||||
|
||||
sharedfile.guideNumRatings = Number(numRatings) || null; // Set to null if not a guide or if the guide does not have enough ratings to show a value
|
||||
|
||||
|
||||
// Determine if this account has already voted on this sharedfile
|
||||
sharedfile.isUpvoted = String($(".workshopItemControlCtn > #VoteUpBtn")[0].attribs["class"]).includes("toggled"); // Check if upvote btn class contains "toggled"
|
||||
sharedfile.isDownvoted = String($(".workshopItemControlCtn > #VoteDownBtn")[0].attribs["class"]).includes("toggled"); // Check if downvote btn class contains "toggled"
|
||||
|
||||
|
||||
// Determine type by looking at the second breadcrumb. Find the first separator as it has a unique name and go to the next element which holds our value of interest
|
||||
let breadcrumb = $(".breadcrumbs > .breadcrumb_separator").next().get(0).children[0].data || "";
|
||||
|
||||
if (breadcrumb.includes("Screenshot")) {
|
||||
sharedfile.type = ESharedFileType.Screenshot;
|
||||
}
|
||||
|
||||
if (breadcrumb.includes("Artwork")) {
|
||||
sharedfile.type = ESharedFileType.Artwork;
|
||||
}
|
||||
|
||||
if (breadcrumb.includes("Guide")) {
|
||||
sharedfile.type = ESharedFileType.Guide;
|
||||
}
|
||||
|
||||
|
||||
// Find owner profile link, convert to steamID64 using SteamIdResolver lib and create a SteamID object
|
||||
let ownerHref = $(".friendBlockLinkOverlay").attr()["href"];
|
||||
|
||||
Helpers.resolveVanityURL(ownerHref, (err, data) => { // This request takes <1 sec
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
sharedfile.owner = new SteamID(data.steamID);
|
||||
|
||||
// Make callback when ID was resolved as otherwise owner will always be null
|
||||
callback(null, new CSteamSharedFile(this, sharedfile));
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
callback(err, null);
|
||||
}
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor - Creates a new SharedFile object
|
||||
* @class
|
||||
* @param {SteamCommunity} community
|
||||
* @param {{ id: string, type: ESharedFileType, appID: number, owner: SteamID|null, fileSize: string|null, postDate: number, resolution: string|null, uniqueVisitorsCount: number, favoritesCount: number, upvoteCount: number|null, guideNumRatings: Number|null, isUpvoted: boolean, isDownvoted: boolean }} data
|
||||
*/
|
||||
function CSteamSharedFile(community, data) {
|
||||
/**
|
||||
* @type {SteamCommunity}
|
||||
*/
|
||||
this._community = community;
|
||||
|
||||
// Clone all the data we received
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a comment from this sharedfile's comment section
|
||||
* @param {String} cid - ID of the comment to delete
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.deleteComment = function(cid, callback) {
|
||||
this._community.deleteSharedFileComment(this.owner, this.id, cid, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Favorites this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.favorite = function(callback) {
|
||||
this._community.favoriteSharedFile(this.id, this.appID, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Posts a comment to this sharedfile
|
||||
* @param {String} message - Content of the comment to post
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.comment = function(message, callback) {
|
||||
this._community.postSharedFileComment(this.owner, this.id, message, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Subscribes to this sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.subscribe = function(callback) {
|
||||
this._community.subscribeSharedFileComments(this.owner, this.id, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unfavorites this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.unfavorite = function(callback) {
|
||||
this._community.unfavoriteSharedFile(this.id, this.appID, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unsubscribes from this sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
CSteamSharedFile.prototype.unsubscribe = function(callback) {
|
||||
this._community.unsubscribeSharedFileComments(this.owner, this.id, callback);
|
||||
};
|
||||
@@ -1,4 +1,6 @@
|
||||
const EResult = require('../resources/EResult.js');
|
||||
const request = require('request');
|
||||
const xml2js = require('xml2js');
|
||||
|
||||
exports.isSteamID = function(input) {
|
||||
var keys = Object.keys(input);
|
||||
@@ -65,4 +67,42 @@ exports.decodeJwt = function(jwt) {
|
||||
.replace(/_/g, '/');
|
||||
|
||||
return JSON.parse(Buffer.from(standardBase64, 'base64').toString('utf8'));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves a Steam profile URL to get steamID64 and vanityURL
|
||||
* @param {String} url - Full steamcommunity profile URL or only the vanity part.
|
||||
* @param {Object} callback - First argument is null/Error, second is object containing vanityURL (String) and steamID (String)
|
||||
*/
|
||||
exports.resolveVanityURL = function(url, callback) {
|
||||
// Precede url param if only the vanity was provided
|
||||
if (!url.includes("steamcommunity.com")) {
|
||||
url = "https://steamcommunity.com/id/" + url;
|
||||
}
|
||||
|
||||
// Make request to get XML data
|
||||
request(url + "/?xml=1", function(err, response, body) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse XML data returned from Steam into an object
|
||||
new xml2js.Parser().parseString(body, (err, parsed) => {
|
||||
if (err) {
|
||||
callback(new Error("Couldn't parse XML response"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (parsed.response && parsed.response.error) {
|
||||
callback(new Error("Couldn't find Steam ID"));
|
||||
return;
|
||||
}
|
||||
|
||||
let steamID64 = parsed.profile.steamID64;
|
||||
let vanityURL = parsed.profile.customURL;
|
||||
|
||||
callback(null, {"vanityURL": vanityURL, "steamID": steamID64});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
var SteamCommunity = require('../index.js');
|
||||
var CEconItem = require('../classes/CEconItem.js');
|
||||
var Helpers = require('./helpers.js');
|
||||
var SteamID = require('steamid');
|
||||
var request = require('request');
|
||||
var Cheerio = require('cheerio');
|
||||
@@ -142,7 +143,7 @@ SteamCommunity.prototype.getInventoryHistory = function(options, callback) {
|
||||
}
|
||||
|
||||
if (options.resolveVanityURLs) {
|
||||
Async.map(vanityURLs, resolveVanityURL, function(err, results) {
|
||||
Async.map(vanityURLs, Helpers.resolveVanityURL, function(err, results) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
@@ -170,19 +171,3 @@ SteamCommunity.prototype.getInventoryHistory = function(options, callback) {
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
function resolveVanityURL(vanityURL, callback) {
|
||||
request("https://steamcommunity.com/id/" + vanityURL + "/?xml=1", function(err, response, body) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
var match = body.match(/<steamID64>(\d+)<\/steamID64>/);
|
||||
if (!match || !match[1]) {
|
||||
callback(new Error("Couldn't find Steam ID"));
|
||||
return;
|
||||
}
|
||||
|
||||
callback(null, {"vanityURL": vanityURL, "steamID": match[1]});
|
||||
});
|
||||
}
|
||||
|
||||
158
components/sharedfiles.js
Normal file
158
components/sharedfiles.js
Normal file
@@ -0,0 +1,158 @@
|
||||
var SteamID = require('steamid');
|
||||
|
||||
var SteamCommunity = require('../index.js');
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a comment from a sharedfile's comment section
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} cid - ID of the comment to delete
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.deleteSharedFileComment = function(userID, sharedFileId, cid, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/delete/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"gidcomment": cid,
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Favorites a sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} appid - ID of the app associated to this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.favoriteSharedFile = function(sharedFileId, appid, callback) {
|
||||
this.httpRequestPost({
|
||||
"uri": "https://steamcommunity.com/sharedfiles/favorite",
|
||||
"form": {
|
||||
"id": sharedFileId,
|
||||
"appid": appid,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Posts a comment to a sharedfile
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} message - Content of the comment to post
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.postSharedFileComment = function(userID, sharedFileId, message, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/post/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"comment": message,
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Subscribes to a sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {SteamID | String} userID ID of the user associated to this sharedfile
|
||||
* @param {String} sharedFileId ID of the sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.subscribeSharedFileComments = function(userID, sharedFileId, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) { // eslint-disable-line
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Unfavorites a sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} appid - ID of the app associated to this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.unfavoriteSharedFile = function(sharedFileId, appid, callback) {
|
||||
this.httpRequestPost({
|
||||
"uri": "https://steamcommunity.com/sharedfiles/unfavorite",
|
||||
"form": {
|
||||
"id": sharedFileId,
|
||||
"appid": appid,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
|
||||
/**
|
||||
* Unsubscribes from a sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.unsubscribeSharedFileComments = function(userID, sharedFileId, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
}, function(err, response, body) { // eslint-disable-line
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
}, "steamcommunity");
|
||||
};
|
||||
35
examples/README.md
Normal file
35
examples/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# node-steamcommunity examples
|
||||
|
||||
The files in this directory are example scripts that you can use as a getting-started point for using node-steamcommunity.
|
||||
|
||||
## Enable or Disable Two-Factor Authentication
|
||||
|
||||
If you need to enable or disable 2FA on your bot account, you can use enable_twofactor.js and disable_twofactor.js to do so.
|
||||
The way that you're intended to use these scripts is by cloning the repository locally, and then running them directly
|
||||
from this examples directory.
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/DoctorMcKay/node-steamcommunity node-steamcommunity
|
||||
cd node-steamcommunity
|
||||
npm install
|
||||
cd examples
|
||||
node enable_twofactor.js
|
||||
```
|
||||
|
||||
## Accept All Confirmations
|
||||
|
||||
If you need to accept trade or market confirmations on your bot account for which you have your identity secret, you can
|
||||
use accept_all_confirmations.js to do so. The way that you're intended to use this script is by cloning the repository
|
||||
locally, and then running it directly from this examples directory.
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/DoctorMcKay/node-steamcommunity node-steamcommunity
|
||||
cd node-steamcommunity
|
||||
npm install
|
||||
cd examples
|
||||
node accept_all_confirmations.js
|
||||
```
|
||||
173
examples/accept_all_confirmations.js
Normal file
173
examples/accept_all_confirmations.js
Normal file
@@ -0,0 +1,173 @@
|
||||
// If you aren't running this script inside of the repository, replace the following line with:
|
||||
// const SteamCommunity = require('steamcommunity');
|
||||
const SteamCommunity = require('../index.js');
|
||||
const SteamSession = require('steam-session');
|
||||
const SteamTotp = require('steam-totp');
|
||||
const ReadLine = require('readline');
|
||||
|
||||
const EConfirmationType = SteamCommunity.ConfirmationType;
|
||||
|
||||
let g_AbortPromptFunc = null;
|
||||
|
||||
let community = new SteamCommunity();
|
||||
|
||||
main();
|
||||
async function main() {
|
||||
let accountName = await promptAsync('Username: ');
|
||||
let password = await promptAsync('Password (hidden): ', true);
|
||||
|
||||
// Create a LoginSession for us to use to attempt to log into steam
|
||||
let session = new SteamSession.LoginSession(SteamSession.EAuthTokenPlatformType.MobileApp);
|
||||
|
||||
// Go ahead and attach our event handlers before we do anything else.
|
||||
session.on('authenticated', async () => {
|
||||
abortPrompt();
|
||||
|
||||
let cookies = await session.getWebCookies();
|
||||
community.setCookies(cookies);
|
||||
|
||||
doConfirmations();
|
||||
});
|
||||
|
||||
session.on('timeout', () => {
|
||||
abortPrompt();
|
||||
console.log('This login attempt has timed out.');
|
||||
});
|
||||
|
||||
session.on('error', (err) => {
|
||||
abortPrompt();
|
||||
|
||||
// This should ordinarily not happen. This only happens in case there's some kind of unexpected error while
|
||||
// polling, e.g. the network connection goes down or Steam chokes on something.
|
||||
|
||||
console.log(`ERROR: This login attempt has failed! ${err.message}`);
|
||||
});
|
||||
|
||||
// Start our login attempt
|
||||
let startResult = await session.startWithCredentials({accountName, password});
|
||||
if (startResult.actionRequired) {
|
||||
// Some Steam Guard action is required. We only care about email and device codes; in theory an
|
||||
// EmailConfirmation and/or DeviceConfirmation action could be possible, but we're just going to ignore those.
|
||||
// If the user does receive a confirmation and accepts it, LoginSession will detect and handle that automatically.
|
||||
// The only consequence of ignoring it here is that we don't print a message to the user indicating that they
|
||||
// could accept an email or device confirmation.
|
||||
|
||||
let codeActionTypes = [SteamSession.EAuthSessionGuardType.EmailCode, SteamSession.EAuthSessionGuardType.DeviceCode];
|
||||
let codeAction = startResult.validActions.find(action => codeActionTypes.includes(action.type));
|
||||
if (codeAction) {
|
||||
if (codeAction.type == SteamSession.EAuthSessionGuardType.EmailCode) {
|
||||
console.log(`A code has been sent to your email address at ${codeAction.detail}.`);
|
||||
} else {
|
||||
// We wouldn't expect this to happen since we're trying to enable 2FA, but just in case...
|
||||
console.log('You need to provide a Steam Guard Mobile Authenticator code.');
|
||||
}
|
||||
|
||||
let code = await promptAsync('Code or Shared Secret: ');
|
||||
if (code) {
|
||||
// The code might've been a shared secret
|
||||
if (code.length > 10) {
|
||||
code = SteamTotp.getAuthCode(code);
|
||||
}
|
||||
await session.submitSteamGuardCode(code);
|
||||
}
|
||||
|
||||
// If we fall through here without submitting a Steam Guard code, that means one of two things:
|
||||
// 1. The user pressed enter without providing a code, in which case the script will simply exit
|
||||
// 2. The user approved a device/email confirmation, in which case 'authenticated' was emitted and the prompt was canceled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function doConfirmations() {
|
||||
let identitySecret = await promptAsync('Identity Secret: ');
|
||||
|
||||
let confs = await new Promise((resolve, reject) => {
|
||||
let time = SteamTotp.time();
|
||||
let key = SteamTotp.getConfirmationKey(identitySecret, time, 'conf');
|
||||
community.getConfirmations(time, key, (err, confs) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
resolve(confs);
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`Found ${confs.length} outstanding confirmations.`);
|
||||
|
||||
// We need to track the previous timestamp we used, as we cannot reuse timestamps.
|
||||
let previousTime = 0;
|
||||
|
||||
for (let i = 0; i < confs.length; i++) {
|
||||
let conf = confs[i];
|
||||
|
||||
process.stdout.write(`Accepting confirmation for ${EConfirmationType[conf.type]} - ${conf.title}... `);
|
||||
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
let time = SteamTotp.time();
|
||||
if (time == previousTime) {
|
||||
time++;
|
||||
}
|
||||
|
||||
previousTime = time;
|
||||
let key = SteamTotp.getConfirmationKey(identitySecret, time, 'allow');
|
||||
conf.respond(time, key, true, (err) => {
|
||||
err ? reject(err) : resolve();
|
||||
});
|
||||
});
|
||||
|
||||
console.log('success');
|
||||
} catch (ex) {
|
||||
console.log(`error: ${ex.message}`);
|
||||
}
|
||||
|
||||
// sleep 500ms so we don't run too far away from the current timestamp
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
}
|
||||
|
||||
console.log('Finished processing confirmations');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Nothing interesting below here, just code for prompting for input from the console.
|
||||
|
||||
function promptAsync(question, sensitiveInput = false) {
|
||||
return new Promise((resolve) => {
|
||||
let rl = ReadLine.createInterface({
|
||||
input: process.stdin,
|
||||
output: sensitiveInput ? null : process.stdout,
|
||||
terminal: true
|
||||
});
|
||||
|
||||
g_AbortPromptFunc = () => {
|
||||
rl.close();
|
||||
resolve('');
|
||||
};
|
||||
|
||||
if (sensitiveInput) {
|
||||
// We have to write the question manually if we didn't give readline an output stream
|
||||
process.stdout.write(question);
|
||||
}
|
||||
|
||||
rl.question(question, (result) => {
|
||||
if (sensitiveInput) {
|
||||
// We have to manually print a newline
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
|
||||
g_AbortPromptFunc = null;
|
||||
rl.close();
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function abortPrompt() {
|
||||
if (!g_AbortPromptFunc) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_AbortPromptFunc();
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
@@ -1,73 +1,85 @@
|
||||
// If you aren't running this script inside of the repository, replace the following line with:
|
||||
// const SteamCommunity = require('steamcommunity');
|
||||
const SteamCommunity = require('../index.js');
|
||||
const SteamSession = require('steam-session');
|
||||
const ReadLine = require('readline');
|
||||
|
||||
let g_AbortPromptFunc = null;
|
||||
|
||||
let community = new SteamCommunity();
|
||||
let rl = ReadLine.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
rl.question('Username: ', (accountName) => {
|
||||
rl.question('Password: ', (password) => {
|
||||
rl.question('Two-Factor Auth Code: ', (authCode) =>{
|
||||
rl.question('Revocation Code: R', (rCode) => {
|
||||
doLogin(accountName, password, authCode, '', rCode);
|
||||
});
|
||||
});
|
||||
main();
|
||||
async function main() {
|
||||
let accountName = await promptAsync('Username: ');
|
||||
let password = await promptAsync('Password (hidden): ', true);
|
||||
|
||||
// Create a LoginSession for us to use to attempt to log into steam
|
||||
let session = new SteamSession.LoginSession(SteamSession.EAuthTokenPlatformType.MobileApp);
|
||||
|
||||
// Go ahead and attach our event handlers before we do anything else.
|
||||
session.on('authenticated', async () => {
|
||||
abortPrompt();
|
||||
|
||||
let accessToken = session.accessToken;
|
||||
let cookies = await session.getWebCookies();
|
||||
|
||||
community.setCookies(cookies);
|
||||
community.setMobileAppAccessToken(accessToken);
|
||||
|
||||
// Enabling or disabling 2FA is presently the only action in node-steamcommunity which requires an access token.
|
||||
// In all other cases, using `community.setCookies(cookies)` is all you need to do in order to be logged in,
|
||||
// although there's never any harm in setting a mobile app access token.
|
||||
|
||||
doRevoke();
|
||||
});
|
||||
});
|
||||
|
||||
function doLogin(accountName, password, authCode, captcha, rCode) {
|
||||
community.login({
|
||||
accountName: accountName,
|
||||
password: password,
|
||||
twoFactorCode: authCode,
|
||||
captcha: captcha
|
||||
}, (err, sessionID, cookies, steamguard) => {
|
||||
if (err) {
|
||||
if (err.message == 'SteamGuard') {
|
||||
console.log('This account does not have two-factor authentication enabled.');
|
||||
process.exit();
|
||||
return;
|
||||
session.on('timeout', () => {
|
||||
abortPrompt();
|
||||
console.log('This login attempt has timed out.');
|
||||
});
|
||||
|
||||
session.on('error', (err) => {
|
||||
abortPrompt();
|
||||
|
||||
// This should ordinarily not happen. This only happens in case there's some kind of unexpected error while
|
||||
// polling, e.g. the network connection goes down or Steam chokes on something.
|
||||
|
||||
console.log(`ERROR: This login attempt has failed! ${err.message}`);
|
||||
});
|
||||
|
||||
// Start our login attempt
|
||||
let startResult = await session.startWithCredentials({accountName, password});
|
||||
if (startResult.actionRequired) {
|
||||
// Some Steam Guard action is required. We only care about email and device codes; in theory an
|
||||
// EmailConfirmation and/or DeviceConfirmation action could be possible, but we're just going to ignore those.
|
||||
// If the user does receive a confirmation and accepts it, LoginSession will detect and handle that automatically.
|
||||
// The only consequence of ignoring it here is that we don't print a message to the user indicating that they
|
||||
// could accept an email or device confirmation.
|
||||
|
||||
let codeActionTypes = [SteamSession.EAuthSessionGuardType.EmailCode, SteamSession.EAuthSessionGuardType.DeviceCode];
|
||||
let codeAction = startResult.validActions.find(action => codeActionTypes.includes(action.type));
|
||||
if (codeAction) {
|
||||
if (codeAction.type == SteamSession.EAuthSessionGuardType.EmailCode) {
|
||||
// We wouldn't expect this to happen since we're trying to disable 2FA, but just in case...
|
||||
console.log(`A code has been sent to your email address at ${codeAction.detail}.`);
|
||||
} else {
|
||||
console.log('You need to provide a Steam Guard Mobile Authenticator code.');
|
||||
}
|
||||
|
||||
if (err.message == 'CAPTCHA') {
|
||||
console.log(err.captchaurl);
|
||||
rl.question('CAPTCHA: ', (captchaInput) => {
|
||||
doLogin(accountName, password, authCode, captchaInput);
|
||||
});
|
||||
|
||||
return;
|
||||
let code = await promptAsync('Code: ');
|
||||
if (code) {
|
||||
await session.submitSteamGuardCode(code);
|
||||
}
|
||||
|
||||
console.log(err);
|
||||
process.exit();
|
||||
return;
|
||||
// If we fall through here without submitting a Steam Guard code, that means one of two things:
|
||||
// 1. The user pressed enter without providing a code, in which case the script will simply exit
|
||||
// 2. The user approved a device/email confirmation, in which case 'authenticated' was emitted and the prompt was canceled
|
||||
}
|
||||
|
||||
console.log('Logged on!');
|
||||
|
||||
if (community.mobileAccessToken) {
|
||||
// If we already have a mobile access token, we don't need to prompt for one.
|
||||
doRevoke(rCode);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('You need to provide a mobile app access token to continue.');
|
||||
console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
|
||||
console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
|
||||
console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
|
||||
|
||||
rl.question('Access Token: ', (accessToken) => {
|
||||
community.setMobileAppAccessToken(accessToken);
|
||||
doRevoke(rCode);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function doRevoke(rCode) {
|
||||
async function doRevoke() {
|
||||
let rCode = await promptAsync('Revocation Code: R');
|
||||
community.disableTwoFactor('R' + rCode, (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
@@ -79,3 +91,45 @@ function doRevoke(rCode) {
|
||||
process.exit();
|
||||
});
|
||||
}
|
||||
|
||||
// Nothing interesting below here, just code for prompting for input from the console.
|
||||
|
||||
function promptAsync(question, sensitiveInput = false) {
|
||||
return new Promise((resolve) => {
|
||||
let rl = ReadLine.createInterface({
|
||||
input: process.stdin,
|
||||
output: sensitiveInput ? null : process.stdout,
|
||||
terminal: true
|
||||
});
|
||||
|
||||
g_AbortPromptFunc = () => {
|
||||
rl.close();
|
||||
resolve('');
|
||||
};
|
||||
|
||||
if (sensitiveInput) {
|
||||
// We have to write the question manually if we didn't give readline an output stream
|
||||
process.stdout.write(question);
|
||||
}
|
||||
|
||||
rl.question(question, (result) => {
|
||||
if (sensitiveInput) {
|
||||
// We have to manually print a newline
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
|
||||
g_AbortPromptFunc = null;
|
||||
rl.close();
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function abortPrompt() {
|
||||
if (!g_AbortPromptFunc) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_AbortPromptFunc();
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
|
||||
@@ -1,78 +1,84 @@
|
||||
// If you aren't running this script inside of the repository, replace the following line with:
|
||||
// const SteamCommunity = require('steamcommunity');
|
||||
const SteamCommunity = require('../index.js');
|
||||
const SteamSession = require('steam-session');
|
||||
const ReadLine = require('readline');
|
||||
const FS = require('fs');
|
||||
|
||||
const EResult = SteamCommunity.EResult;
|
||||
|
||||
let g_AbortPromptFunc = null;
|
||||
|
||||
let community = new SteamCommunity();
|
||||
let rl = ReadLine.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
rl.question('Username: ', (accountName) => {
|
||||
rl.question('Password: ', (password) => {
|
||||
doLogin(accountName, password);
|
||||
main();
|
||||
async function main() {
|
||||
let accountName = await promptAsync('Username: ');
|
||||
let password = await promptAsync('Password (hidden): ', true);
|
||||
|
||||
// Create a LoginSession for us to use to attempt to log into steam
|
||||
let session = new SteamSession.LoginSession(SteamSession.EAuthTokenPlatformType.MobileApp);
|
||||
|
||||
// Go ahead and attach our event handlers before we do anything else.
|
||||
session.on('authenticated', async () => {
|
||||
abortPrompt();
|
||||
|
||||
let accessToken = session.accessToken;
|
||||
let cookies = await session.getWebCookies();
|
||||
|
||||
community.setCookies(cookies);
|
||||
community.setMobileAppAccessToken(accessToken);
|
||||
|
||||
// Enabling or disabling 2FA is presently the only action in node-steamcommunity which requires an access token.
|
||||
// In all other cases, using `community.setCookies(cookies)` is all you need to do in order to be logged in,
|
||||
// although there's never any harm in setting a mobile app access token.
|
||||
|
||||
doSetup();
|
||||
});
|
||||
});
|
||||
|
||||
function doLogin(accountName, password, authCode, captcha) {
|
||||
community.login({
|
||||
accountName: accountName,
|
||||
password: password,
|
||||
authCode: authCode,
|
||||
captcha: captcha
|
||||
}, (err, sessionID, cookies, steamguard) => {
|
||||
if (err) {
|
||||
if (err.message == 'SteamGuardMobile') {
|
||||
console.log('This account already has two-factor authentication enabled.');
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.message == 'SteamGuard') {
|
||||
console.log(`An email has been sent to your address at ${err.emaildomain}`);
|
||||
rl.question('Steam Guard Code: ', (code) => {
|
||||
doLogin(accountName, password, code);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.message == 'CAPTCHA') {
|
||||
console.log(err.captchaurl);
|
||||
rl.question('CAPTCHA: ', (captchaInput) => {
|
||||
doLogin(accountName, password, authCode, captchaInput);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(err);
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Logged on!');
|
||||
|
||||
if (community.mobileAccessToken) {
|
||||
// If we already have a mobile access token, we don't need to prompt for one.
|
||||
doSetup();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('You need to provide a mobile app access token to continue.');
|
||||
console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
|
||||
console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
|
||||
console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
|
||||
|
||||
rl.question('Access Token: ', (accessToken) => {
|
||||
community.setMobileAppAccessToken(accessToken);
|
||||
doSetup();
|
||||
});
|
||||
session.on('timeout', () => {
|
||||
abortPrompt();
|
||||
console.log('This login attempt has timed out.');
|
||||
});
|
||||
|
||||
session.on('error', (err) => {
|
||||
abortPrompt();
|
||||
|
||||
// This should ordinarily not happen. This only happens in case there's some kind of unexpected error while
|
||||
// polling, e.g. the network connection goes down or Steam chokes on something.
|
||||
|
||||
console.log(`ERROR: This login attempt has failed! ${err.message}`);
|
||||
});
|
||||
|
||||
// Start our login attempt
|
||||
let startResult = await session.startWithCredentials({accountName, password});
|
||||
if (startResult.actionRequired) {
|
||||
// Some Steam Guard action is required. We only care about email and device codes; in theory an
|
||||
// EmailConfirmation and/or DeviceConfirmation action could be possible, but we're just going to ignore those.
|
||||
// If the user does receive a confirmation and accepts it, LoginSession will detect and handle that automatically.
|
||||
// The only consequence of ignoring it here is that we don't print a message to the user indicating that they
|
||||
// could accept an email or device confirmation.
|
||||
|
||||
let codeActionTypes = [SteamSession.EAuthSessionGuardType.EmailCode, SteamSession.EAuthSessionGuardType.DeviceCode];
|
||||
let codeAction = startResult.validActions.find(action => codeActionTypes.includes(action.type));
|
||||
if (codeAction) {
|
||||
if (codeAction.type == SteamSession.EAuthSessionGuardType.EmailCode) {
|
||||
console.log(`A code has been sent to your email address at ${codeAction.detail}.`);
|
||||
} else {
|
||||
// We wouldn't expect this to happen since we're trying to enable 2FA, but just in case...
|
||||
console.log('You need to provide a Steam Guard Mobile Authenticator code.');
|
||||
}
|
||||
|
||||
let code = await promptAsync('Code: ');
|
||||
if (code) {
|
||||
await session.submitSteamGuardCode(code);
|
||||
}
|
||||
|
||||
// If we fall through here without submitting a Steam Guard code, that means one of two things:
|
||||
// 1. The user pressed enter without providing a code, in which case the script will simply exit
|
||||
// 2. The user approved a device/email confirmation, in which case 'authenticated' was emitted and the prompt was canceled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doSetup() {
|
||||
@@ -110,22 +116,67 @@ function doSetup() {
|
||||
});
|
||||
}
|
||||
|
||||
function promptActivationCode(response) {
|
||||
rl.question('SMS Code: ', (smsCode) => {
|
||||
community.finalizeTwoFactor(response.shared_secret, smsCode, (err) => {
|
||||
if (err) {
|
||||
if (err.message == 'Invalid activation code') {
|
||||
console.log(err);
|
||||
promptActivationCode(response);
|
||||
return;
|
||||
}
|
||||
async function promptActivationCode(response) {
|
||||
if (response.phone_number_hint) {
|
||||
console.log(`A code has been sent to your phone ending in ${response.phone_number_hint}.`);
|
||||
}
|
||||
|
||||
let smsCode = await promptAsync('SMS Code: ');
|
||||
community.finalizeTwoFactor(response.shared_secret, smsCode, (err) => {
|
||||
if (err) {
|
||||
if (err.message == 'Invalid activation code') {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log('Two-factor authentication enabled!');
|
||||
promptActivationCode(response);
|
||||
return;
|
||||
}
|
||||
|
||||
process.exit();
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log('Two-factor authentication enabled!');
|
||||
}
|
||||
|
||||
process.exit();
|
||||
});
|
||||
}
|
||||
|
||||
// Nothing interesting below here, just code for prompting for input from the console.
|
||||
|
||||
function promptAsync(question, sensitiveInput = false) {
|
||||
return new Promise((resolve) => {
|
||||
let rl = ReadLine.createInterface({
|
||||
input: process.stdin,
|
||||
output: sensitiveInput ? null : process.stdout,
|
||||
terminal: true
|
||||
});
|
||||
|
||||
g_AbortPromptFunc = () => {
|
||||
rl.close();
|
||||
resolve('');
|
||||
};
|
||||
|
||||
if (sensitiveInput) {
|
||||
// We have to write the question manually if we didn't give readline an output stream
|
||||
process.stdout.write(question);
|
||||
}
|
||||
|
||||
rl.question(question, (result) => {
|
||||
if (sensitiveInput) {
|
||||
// We have to manually print a newline
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
|
||||
g_AbortPromptFunc = null;
|
||||
rl.close();
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function abortPrompt() {
|
||||
if (!g_AbortPromptFunc) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_AbortPromptFunc();
|
||||
process.stdout.write('\n');
|
||||
}
|
||||
|
||||
3
index.js
3
index.js
@@ -14,6 +14,7 @@ module.exports = SteamCommunity;
|
||||
SteamCommunity.SteamID = SteamID;
|
||||
SteamCommunity.ConfirmationType = require('./resources/EConfirmationType.js');
|
||||
SteamCommunity.EResult = require('./resources/EResult.js');
|
||||
SteamCommunity.ESharedFileType = require('./resources/ESharedFileType.js');
|
||||
SteamCommunity.EFriendRelationship = require('./resources/EFriendRelationship.js');
|
||||
|
||||
|
||||
@@ -581,6 +582,7 @@ require('./components/profile.js');
|
||||
require('./components/market.js');
|
||||
require('./components/groups.js');
|
||||
require('./components/users.js');
|
||||
require('./components/sharedfiles.js');
|
||||
require('./components/inventoryhistory.js');
|
||||
require('./components/webapi.js');
|
||||
require('./components/twofactor.js');
|
||||
@@ -589,6 +591,7 @@ require('./components/help.js');
|
||||
require('./classes/CMarketItem.js');
|
||||
require('./classes/CMarketSearchResult.js');
|
||||
require('./classes/CSteamGroup.js');
|
||||
require('./classes/CSteamSharedFile.js');
|
||||
require('./classes/CSteamUser.js');
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "steamcommunity",
|
||||
"version": "3.45.3",
|
||||
"version": "3.46.0",
|
||||
"description": "Provides an interface for logging into and interacting with the Steam Community website",
|
||||
"keywords": [
|
||||
"steam",
|
||||
@@ -30,6 +30,9 @@
|
||||
"steamid": "^1.1.3",
|
||||
"xml2js": "^0.4.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"steam-session": "^1.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
|
||||
13
resources/ESharedFileType.js
Normal file
13
resources/ESharedFileType.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @enum ESharedFileType
|
||||
*/
|
||||
module.exports = {
|
||||
"Screenshot": 0,
|
||||
"Artwork": 1,
|
||||
"Guide": 2,
|
||||
|
||||
// Value-to-name mapping for convenience
|
||||
"0": "Screenshot",
|
||||
"1": "Artwork",
|
||||
"2": "Guide"
|
||||
};
|
||||
Reference in New Issue
Block a user