Skip to content

Commit

Permalink
fix: Fix getSteamSharedFile() failing to detect vote status of greenl…
Browse files Browse the repository at this point in the history
…ight items #256
  • Loading branch information
3urobeat committed Feb 15, 2025
1 parent 9e8d281 commit 19da404
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/data/fileStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
{
"path": "src/libraryPatches/CSteamSharedFile.js",
"url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/libraryPatches/CSteamSharedFile.js",
"checksum": "96f5930f24861d9bc88d684bc887dc7e"
"checksum": "117f79e8196880a8bf4445560cdb5bde"
},
{
"path": "src/libraryPatches/EDiscussionType.js",
Expand Down
7 changes: 5 additions & 2 deletions src/libraryPatches/CSteamSharedFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ SteamCommunity.prototype.getSteamSharedFile = function(sharedFileId, callback) {


// 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"
const voteUpBtn = $(".workshopItemControlCtn > #VoteUpBtn")[0] || $(".greenlight_controls > #VoteUpBtn")[0]; // workshopItemControlCtn for "normal" items, greenlight_controls for items which can be voted into a game (e.g. CS skins)
const voteDownBtn = $(".workshopItemControlCtn > #VoteDownBtn")[0] || $(".greenlight_controls > #VoteDownBtn")[0];

sharedfile.isUpvoted = String(voteUpBtn.attribs["class"]).includes("toggled"); // Check if upvote btn class contains "toggled"
sharedfile.isDownvoted = String(voteDownBtn.attribs["class"]).includes("toggled"); // Check if downvote btn class contains "toggled"


// Find owner profile link, convert to steamID64 using SteamIdResolver lib and create a SteamID object
Expand Down

0 comments on commit 19da404

Please sign in to comment.