Fix getting privacy settings (#1866)

* Fix getting privacy settings

* Cleanup

* Misc
This commit is contained in:
Vitaliy
2020-06-26 11:52:06 +03:00
committed by GitHub
parent 21efa0371a
commit d13da54dab
2 changed files with 12 additions and 3 deletions

View File

@@ -2626,7 +2626,7 @@ namespace ArchiSteamFarm {
return (false, false);
}
IElement htmlNode = htmlDocument.SelectSingleNode("//div[@data-component='ProfilePrivacySettings']/@data-privacysettings");
IElement htmlNode = htmlDocument.SelectSingleNode("//div[@id='profile_edit_config']");
if (htmlNode == null) {
Bot.ArchiLogger.LogNullError(nameof(htmlNode));
@@ -2634,7 +2634,7 @@ namespace ArchiSteamFarm {
return (false, false);
}
string json = htmlNode.GetAttributeValue("data-privacysettings");
string json = htmlNode.GetAttributeValue("data-profile-edit");
if (string.IsNullOrEmpty(json)) {
Bot.ArchiLogger.LogNullError(nameof(json));
@@ -2648,7 +2648,7 @@ namespace ArchiSteamFarm {
Steam.UserPrivacy userPrivacy;
try {
userPrivacy = JsonConvert.DeserializeObject<Steam.UserPrivacy>(json);
userPrivacy = JsonConvert.DeserializeObject<Steam.ProfileEditData>(json)?.Privacy;
} catch (JsonException e) {
Bot.ArchiLogger.LogGenericException(e);

View File

@@ -702,6 +702,15 @@ namespace ArchiSteamFarm.Json {
private NewDiscoveryQueueResponse() { }
}
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class ProfileEditData {
[JsonProperty(PropertyName = "Privacy", Required = Required.Always)]
internal readonly UserPrivacy Privacy;
[JsonConstructor]
private ProfileEditData() { }
}
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class RedeemWalletResponse : EResultResponse {
[JsonProperty(PropertyName = "wallet", Required = Required.DisallowNull)]