diff --git a/MxWs/App.config b/MxWs/App.config
index 2e6d720..634603c 100644
--- a/MxWs/App.config
+++ b/MxWs/App.config
@@ -8,4 +8,13 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MxWs/JSON/AHUrl.cs b/MxWs/JSON/AHUrl.cs
index f54d3d2..9f4095f 100644
--- a/MxWs/JSON/AHUrl.cs
+++ b/MxWs/JSON/AHUrl.cs
@@ -32,10 +32,12 @@ namespace MxWs.JSON
public static string GetURL(string region, string realm, string api)
{
+ string token = Utilities.OAuth.GetOAuth(Server.settings_apiKey, Server.settings_apiSecret);
using (WebClient wc = new WebClient())
{
+ ServicePointManager.ServerCertificateValidationCallback += (p1, p2, p3, p4) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
- var json = wc.DownloadString(@"https://" + Server.region + ".api.battle.net/wow/auction/data/" + Server.realm + "?locale=en_US&apikey=" + Server.settings_apiKey);
+ var json = wc.DownloadString($@"https://{Server.region}.api.blizzard.com/wow/auction/data/{Server.realm}?locale=en_US&access_token={token}");
RootObject j = JsonConvert.DeserializeObject(json);
return j.files[0].url;
}
diff --git a/MxWs/JSON/IndexGen.cs b/MxWs/JSON/IndexGen.cs
index c9c05e9..e03326f 100644
--- a/MxWs/JSON/IndexGen.cs
+++ b/MxWs/JSON/IndexGen.cs
@@ -112,7 +112,6 @@ namespace MxWs.JSON
}
sb.Append(string.Join(",", Rows));
sb.Append(";");
- Utilities.MSG.CMW(sb.ToString(), true, 1);
InsertIndex(sb.ToString());
}
diff --git a/MxWs/JSON/Settings.cs b/MxWs/JSON/Settings.cs
index 5c73614..187e79a 100644
--- a/MxWs/JSON/Settings.cs
+++ b/MxWs/JSON/Settings.cs
@@ -18,6 +18,7 @@ namespace MxWs.JSON
public class SETTINGS
{
public string apikey { get; set; }
+ public string apisecret { get; set; }
public string dbname { get; set; }
public string dbhost { get; set; }
public string dbuser { get; set; }
@@ -33,6 +34,8 @@ namespace MxWs.JSON
SETTINGS j = JsonConvert.DeserializeObject(File.ReadAllText("settings.json"));
Server.settings_apiKey = j.apikey;
Utilities.MSG.CMW(string.Format("APIKey: {0}", j.apikey), true, 1);
+ Server.settings_apiSecret = j.apisecret;
+ Utilities.MSG.CMW(string.Format("APISecret: {0}", j.apisecret), true, 1);
Server.settings_dbname = j.dbname;
Utilities.MSG.CMW(string.Format("DB Name: {0}", j.dbname), true, 1);
Server.settings_dbhost = j.dbhost;
diff --git a/MxWs/MxWs.csproj b/MxWs/MxWs.csproj
index 7a5b9cf..ecfa7b3 100644
--- a/MxWs/MxWs.csproj
+++ b/MxWs/MxWs.csproj
@@ -34,11 +34,12 @@
4
+
..\packages\MySql.Data.6.10.6\lib\net452\MySql.Data.dll
-
- ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
@@ -68,6 +69,7 @@
+
@@ -77,11 +79,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/MxWs/Server.cs b/MxWs/Server.cs
index 1bb317e..43dfab0 100644
--- a/MxWs/Server.cs
+++ b/MxWs/Server.cs
@@ -15,7 +15,7 @@ namespace MxWs
{
class Server
{
- public static string version = ThisAssembly.Git.Commit;
+ public static string version = "3.1.1";
public static bool debug = false;
public static bool serverLoop = true;
public static bool indexBool = false;
@@ -27,6 +27,7 @@ namespace MxWs
// Settings Variables
// Values are set by ReadSettings() during "init" state.
public static string settings_apiKey = ""; // Store the Blizzard Dev API Key
+ public static string settings_apiSecret = ""; // Store the Blizzard Dev API Secret
public static string settings_dbname = ""; // Store the MySQL Database Name
public static string settings_dbhost = ""; // Store the MySQL Database Host
public static string settings_dbuser = ""; // Store the MySQL Database User
diff --git a/MxWs/Utilities/OAuth.cs b/MxWs/Utilities/OAuth.cs
new file mode 100644
index 0000000..0c3c079
--- /dev/null
+++ b/MxWs/Utilities/OAuth.cs
@@ -0,0 +1,33 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MxWs.Utilities
+{
+ class OAuth
+ {
+ public class OAuthObjects
+ {
+ public string access_token { get; set; }
+ public string token_type { get; set; }
+ public int expires_in { get; set; }
+ }
+
+ public static string GetOAuth(string key, string secret)
+ {
+ using (WebClient wc = new WebClient())
+ {
+ ServicePointManager.ServerCertificateValidationCallback += (p1, p2, p3, p4) => true;
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+ var json = wc.DownloadString($@"https://us.battle.net/oauth/token?client_id={key}&client_secret={secret}&grant_type=client_credentials");
+ OAuthObjects j = JsonConvert.DeserializeObject(json);
+ return j.access_token;
+ }
+ }
+ }
+}
diff --git a/MxWs/Utilities/Web.cs b/MxWs/Utilities/Web.cs
index 7b565f5..cbdcc33 100644
--- a/MxWs/Utilities/Web.cs
+++ b/MxWs/Utilities/Web.cs
@@ -20,6 +20,9 @@ namespace MxWs.Utilities
{
using (WebClient wc = new WebClient())
{
+ ServicePointManager
+ .ServerCertificateValidationCallback +=
+ (sender, cert, chain, sslPolicyErrors) => true;
wc.DownloadFile(url, file);
}
}
diff --git a/MxWs/packages.config b/MxWs/packages.config
index daaa430..edae298 100644
--- a/MxWs/packages.config
+++ b/MxWs/packages.config
@@ -1,6 +1,5 @@
-
-
+
\ No newline at end of file