Skip to content

Commit

Permalink
ArchiSteamFarm V3.3.0.7+ fix: specify request ContentType as applicat…
Browse files Browse the repository at this point in the history
…ion/json & change URI encoding; version bump to 0.6.4
  • Loading branch information
Luckz committed May 26, 2019
1 parent 1ba58ac commit 6705c74
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,6 @@ paket-files/
.idea/
*.sln.iml

out/
out/

ASFui/FodyWeavers.xsd
4 changes: 3 additions & 1 deletion ASFui/ASFui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ private void btnAPI_Click(object sender, EventArgs e)
private string sendCommand(string str) {
string ret = Util.SendCommand(str);
if (true){//!Settings.Default.IsLocal) {
rtbOutput.AppendText(ret + "\n");
rtbOutput.Invoke(new MethodInvoker(() => {//also needed to avoid errors in debug mode
rtbOutput.AppendText(ret + "\n");
}));
}
if (!"api".Equals(str)) { // don't know, why you did not had that here, but just to be sure.
rtbOutput.Invoke(new MethodInvoker(() => {// In debug mode I get errors here, if I do not use invoke...
Expand Down
4 changes: 2 additions & 2 deletions ASFui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.3.0")]
[assembly: AssemblyFileVersion("0.6.3.0")]
[assembly: AssemblyVersion("0.6.4.0")]
[assembly: AssemblyFileVersion("0.6.4.0")]
9 changes: 6 additions & 3 deletions ASFui/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ public static string SendCommand(string command)
string address = GetEndpointAddress();
string msg="";
using (WebClient webclient = new WebClient()) {
if(!address.Contains("#"))
msg= webclient.UploadString(address + System.Net.WebUtility.UrlEncode(command), String.Empty);
webclient.Encoding = System.Text.Encoding.UTF8;
webclient.Headers[HttpRequestHeader.ContentType] = "application/json";

if (!address.Contains("#"))
msg= webclient.UploadString(address + Uri.EscapeUriString(command), String.Empty);
else {
var regex = new System.Text.RegularExpressions.Regex(System.Text.RegularExpressions.Regex.Escape("#"));
msg= webclient.UploadString(regex.Replace(address, System.Net.WebUtility.UrlEncode(command), 1), String.Empty);
msg= webclient.UploadString(regex.Replace(address, Uri.EscapeUriString(command), 1), String.Empty);
}
}
dynamic tmp= JsonConvert.DeserializeObject(msg);
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.3.0
0.6.4.0

0 comments on commit 6705c74

Please sign in to comment.