A powerful Go-based reverse proxy for the Steam Workshop that dynamically injects download buttons into workshop and collection pages, allowing you to download items directly using a backend steamcmd
instance.
This project acts as a middleman between you and the Steam Community website. When you browse a Steam Workshop page through this proxy, it intelligently modifies the page on-the-fly to add "Download" buttons next to the standard "Subscribe" buttons. Clicking these new buttons triggers a backend process that uses steamcmd
to download the workshop files to your server.
This is perfect for server administrators, content curators, or anyone who needs to obtain workshop files without subscribing to them through the Steam client.
- Reverse Proxy for Steam Workshop: Forwards requests to
steamcommunity.com
seamlessly. - Dynamic Content Injection: Injects "Download" and "Download Collection" buttons directly into the HTML using
goquery
. - URL Rewriting: All asset URLs (CSS, JS, images) are rewritten to be served through the proxy, ensuring pages render correctly.
steamcmd
Integration: Leverages asteamcmd
wrapper to handle the actual download logic.- Configurable Startup: Use command-line flags to easily configure server settings.
- The user navigates to a proxied Steam Workshop URL (e.g.,
http://localhost:8080/workshop/filedetails/?id=123456789
). - The
SteamProxyHandler
receives the request and forwards it to the official Steam servers. - Before sending the response back to the user, the
ModifyResponse
function intercepts it. - The HTML body is parsed. The proxy finds all "Subscribe" buttons and injects new
<a>
tags next to them, pointing to the downloader API endpoints. - All other URLs within the page (
href
,src
,srcset
) are rewritten to be relative, ensuring all subsequent requests for assets also go through the proxy. - The modified, uncompressed HTML is sent to the user's browser.
- When the user clicks a "Download" button, a request is sent to an API endpoint like
/api/workshop/:app_id/:workshop_id
. - The API handler calls the
steamcmd
wrapper, which executes the necessary commands (workshop_download_item
) to download the files to the server.
-
GET /api/workshop/:app_id/:workshop_id
- Triggers a download for a single workshop item.
app_id
: The ID of the game (e.g.,4000
for Garry's Mod).workshop_id
: The ID of the workshop file.
-
GET /api/collection/:app_id/:collection_id
- Triggers a download for all items within a collection.
app_id
: The ID of the game.collection_id
: The ID of the workshop collection.
- Go (version 1.18 or newer)
- A working installation of
steamcmd
on the server where this API will run (or let the app install it for you).
-
Clone the repository:
git clone https://github.com/SyNdicateFoundation/SteamDownloaderAPI.git cd SteamDownloaderAPI
-
Install dependencies:
go mod tidy
-
Build the application:
go build -o steamdownloaderapi ./cmd/main.go
The application is configured at startup using command-line flags.
-listenhost
: The hostname or IP address for the server to listen on. (Default:0.0.0.0
)-listenport
: The port for the server to listen on. (Default:8080
)-steamcmdpath
: The directory path forsteamcmd
. (Default:steamcmd
)-installsteamcmd
: Iftrue
, the application will install or updatesteamcmd
on startup. (Default:true
)-debug
: Enables debug mode for more verbose logging. (Default:false
)-steamuser
: Your Steam username. Required for downloading certain content. (Default:""
, will login as anonymous)-steampassword
: Your Steam password. (Default:""
)
Once built, you can run the application from your terminal.
Basic startup (installs steamcmd to a 'steamcmd' folder and runs on port 8080):
./steamdownloaderapi -steamuser your_username -steampassword your_password