JustArchiNET / ArchiSteamFarm

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
Apache License 2.0
11.1k stars 1.05k forks source link

Investigate addlicense breaking changes #2925

Closed JustArchi closed 1 year ago

JustArchi commented 1 year ago

Checklist

ASF version

Latest stable release

ASF variant

generic (with latest .NET runtime)

Bug description

addlicense command with subs is currently not working due to Steam breaking changes.

Expected behavior

Should work like before.

Actual behavior

Fail/Timeout status code.

Steps to reproduce

addlicense sub/861909

Possible reason/solution

https://github.com/SteamDatabase/BrowserExtension/commit/27da70af9391026ef194b09e70aaf2bbb302e067

Can you help us with this bug report?

Yes, I can code the solution myself and send a pull request

Full log.txt recorded during reproducing the problem

2023-06-23 10:44:01|dotnet-896320|DEBUG|archi|UrlPostToJsonObject() Request failing: https://store.steampowered.com/checkout/addfreelicense/861909
2023-06-23 10:44:02|dotnet-896320|WARN|archi|UrlPostToJsonObject() Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at ArchiSteamFarm.Web.WebBrowser.UrlPostToJsonObject[TResult,TData](Uri request, IReadOnlyCollection`1 headers, TData data, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)
   at ArchiSteamFarm.Web.WebBrowser.UrlPostToJsonObject[TResult,TData](Uri request, IReadOnlyCollection`1 headers, TData data, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)

Global ASF.json config file

No response

BotName.json config of all affected bot instances

No response

Additional info

If somebody has time, feel free to dig into it for me.

FFace32 commented 1 year ago

It seems like the URL has to be checkout.steampowered.com, the session id has to be the same as on store.steampowered.com, and very importantly, it has to be added as a cookie to the request.

EDIT: (untested) Maybe something like this would work: Add

WebBrowser.CookieContainer.Add(new Cookie("sessionid", sessionID, "/", $".{SteamCheckoutURL.Host}"));

to Init()

And change the base uri in AddFreeLicense()

JustArchi commented 1 year ago

Fixed in #2927

LORD47 commented 1 year ago

@JustArchi I'm getting the same error despite using the latest version image

Abrynos commented 1 year ago

@LORD47 About 9 hours ago a new fix was merged over in #2983 . Next release should fix it once again.