|
|
hai 6 meses | |
|---|---|---|
| .. | ||
| bin | hai 6 meses | |
| obj | hai 6 meses | |
| publish | hai 6 meses | |
| youdangdang | hai 7 meses | |
| Program.cs | hai 6 meses | |
| README.md | hai 7 meses | |
| build.ps1 | hai 7 meses | |
| steamAPI.csproj | hai 7 meses | |
| test-api.ps1 | hai 7 meses | |
Steam 登录验证本地服务,供客户端调用:使用账号、密码 + maFile 完成 Steam 登录,返回 session、steam_id、cookies 等。
在项目目录下执行:
cd steam-client/steamAPI
dotnet run
dotnet run --urls "http://localhost:5000"
默认监听 http://localhost:5000(客户端 Tauri 代码中写死为该地址)。
dotnet run --urls "http://localhost:5000"
# 或使用其他端口,例如 5001,同时需修改客户端中 verify_steam_login 的 api_url
dotnet run --urls "http://localhost:5001"
# 在 steamAPI 目录下执行
cd steam-client/steamAPI
# 打包为独立可执行文件(带应用图标)
dotnet publish -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish
打包完成后,可执行文件位于 publish/steamAPI.exe,可直接双击运行。
注意:首次运行会监听 http://localhost:5000
POST /login
{ "Username": "steam用户名", "Password": "密码", "MaFilePath": "maFile 完整路径", "ProxyUrl": "http://127.0.0.1:7890" }session(steamId、accessToken、refreshToken、sessionId)及 cookies(含 steamLoginSecure 等)POST /wallet-balance
{ "SteamLoginSecure": "xxx", "ProxyUrl": "http://127.0.0.1:7890" }{ "amount": "1234", "currency": "USD" }(amount 单位为美分)POST /trade-confirmations/list
FetchConfirmationsAsync)Body (JSON):
{
"MaFilePath": "maFile 完整路径",
"ProxyUrl": "http://127.0.0.1:7890",
"Session": {
"SteamId": 7656,
"AccessToken": "xxx",
"RefreshToken": "xxx",
"SessionId": "optional"
}
}
confirmations 列表(含 id、key、creatorId、type、headline、summary 等)和最新 session失败:400/401/500 + 错误信息
POST /trade-confirmations/operate
用途:执行确认动作(对应 SDA 的 AcceptConfirmation / DenyConfirmation)
Body (JSON):
{
"MaFilePath": "maFile 完整路径",
"ProxyUrl": "http://127.0.0.1:7890",
"Session": {
"SteamId": 7656,
"AccessToken": "xxx",
"RefreshToken": "xxx",
"SessionId": "optional"
},
"ConfirmationId": 1234567890123456789,
"Operation": "accept"
}
或(可选显式传 key,加速执行):
{
"MaFilePath": "maFile 完整路径",
"ProxyUrl": "http://127.0.0.1:7890",
"Session": {
"SteamId": 7656,
"AccessToken": "xxx",
"RefreshToken": "xxx",
"SessionId": "optional"
},
"ConfirmationId": 1234567890123456789,
"ConfirmationKey": 1234567890123456789,
"Operation": "accept"
}
Operation 仅支持:accept、cancel
ConfirmationKey 时,服务端会先拉取确认列表,按 ConfirmationId 自动匹配 key{ "success": true/false, "operation": "...", "confirmationId": ..., "confirmationKey": ..., "keyResolvedFromList": true/false } 和最新 session当本机直连 Steam 受限时,可以只给 steamAPI 进程配置代理,不需要开系统全局代理:
/login 的 JSON 中传 ProxyUrl。STEAM_PROXY_URL 后启动服务。示例(macOS / Linux):
export STEAM_PROXY_URL="http://127.0.0.1:7890"
dotnet run --urls "http://localhost:5000"
SteamAuth 及 NuGet 包 SteamKit2、Microsoft.AspNetCore.App。首次运行会自动还原包。