Rename sid to sharedFileId

This commit is contained in:
3urobeat 2023-05-15 22:45:33 +02:00
parent f7d7cf0660
commit f96d25ad52
No known key found for this signature in database
GPG Key ID: 6842D80775A4E952
2 changed files with 23 additions and 23 deletions

View File

@ -7,14 +7,14 @@ const ESharedfileType = require('../resources/ESharedfileType.js');
/**
* Scrape a sharedfile's DOM to get all available information
* @param {String} sid - ID of the sharedfile
* @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(sid, callback) {
SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
// Construct object holding all the data we can scrape
let sharedfile = {
id: sid,
id: sharedFileId,
type: null,
appID: null,
owner: null,
@ -28,7 +28,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sid, callback) {
// Get DOM of sharedfile
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sid}`, (err, res, body) => {
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sharedFileId}`, (err, res, body) => {
try {
/* --------------------- Preprocess output --------------------- */
@ -66,7 +66,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sid, callback) {
/* --------------------- Find and map values --------------------- */
// Find appID in share button onclick event
sharedfile.appID = Number($("#ShareItemBtn").attr()["onclick"].replace(`ShowSharePublishedFilePopup( '${sid}', '`, "").replace("' );", ""));
sharedfile.appID = Number($("#ShareItemBtn").attr()["onclick"].replace(`ShowSharePublishedFilePopup( '${sharedFileId}', '`, "").replace("' );", ""));
// Find fileSize if not guide

View File

@ -5,17 +5,17 @@ var SteamID = require('steamid');
/**
* Deletes a comment from a sharedfile's comment section
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
* @param {String} sid - ID of the 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, sid, cid, callback) {
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()}/${sid}/`,
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/delete/${userID.toString()}/${sharedFileId}/`,
"form": {
"gidcomment": cid,
"count": 10,
@ -32,15 +32,15 @@ SteamCommunity.prototype.deleteSharedfileComment = function(userID, sid, cid, ca
/**
* Favorites a sharedfile
* @param {String} sid - ID of the 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(sid, appid, callback) {
SteamCommunity.prototype.favoriteSharedfile = function(sharedFileId, appid, callback) {
this.httpRequestPost({
"uri": "https://steamcommunity.com/sharedfiles/favorite",
"form": {
"id": sid,
"id": sharedFileId,
"appid": appid,
"sessionid": this.getSessionID()
}
@ -56,17 +56,17 @@ SteamCommunity.prototype.favoriteSharedfile = function(sid, appid, callback) {
/**
* Posts a comment to a sharedfile
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
* @param {String} sid - ID of the 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, sid, message, callback) {
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()}/${sid}/`,
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/post/${userID.toString()}/${sharedFileId}/`,
"form": {
"comment": message,
"count": 10,
@ -84,16 +84,16 @@ SteamCommunity.prototype.postSharedfileComment = function(userID, sid, message,
/**
* 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} sid ID of the 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, sid, callback) {
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()}/${sid}/`,
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sharedFileId}/`,
"form": {
"count": 10,
"sessionid": this.getSessionID()
@ -109,15 +109,15 @@ SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sid, cal
/**
* Unfavorites a sharedfile
* @param {String} sid - ID of the 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(sid, appid, callback) {
SteamCommunity.prototype.unfavoriteSharedfile = function(sharedFileId, appid, callback) {
this.httpRequestPost({
"uri": "https://steamcommunity.com/sharedfiles/unfavorite",
"form": {
"id": sid,
"id": sharedFileId,
"appid": appid,
"sessionid": this.getSessionID()
}
@ -133,16 +133,16 @@ SteamCommunity.prototype.unfavoriteSharedfile = function(sid, appid, callback) {
/**
* 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} sid - ID of the 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, sid, callback) {
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()}/${sid}/`,
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sharedFileId}/`,
"form": {
"count": 10,
"sessionid": this.getSessionID()