-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: + Fixed Auto-Tune loading without a vaild API key and then breaking on price-calculation. + Fixed compilation errors when compiling manually on 1.15 due to maven-shade-plugin not being updated Features: + Added some more messages on startup surrounding API info + Added some more debug info surrounding API info Other + Updated to 0.8.5
- Loading branch information
1 parent
63b2757
commit c4688ba
Showing
5 changed files
with
72 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,10 @@ public static Double sendPostRequestUsingHttpClient(String model, String algorit | |
if (statusCode == 200) { | ||
client.close(); | ||
} | ||
; | ||
if (statusCode != 200) { | ||
client.close(); | ||
Main.log("Error on status code"); | ||
} | ||
; | ||
Main.debugLog(response.getStatusLine().getReasonPhrase()); | ||
HttpEntity entityResponse = response.getEntity(); | ||
if (entityResponse != null) { | ||
|
@@ -81,6 +79,59 @@ public static Double sendRequestForPrice(String model, String algorithm, String | |
} | ||
return newPrice; | ||
} | ||
|
||
|
||
|
||
public static boolean ghostCheckAPIKey() throws ClientProtocolException, IOException { | ||
if (Config.getApiKey() == "xyz"){ | ||
Main.log("Please change your API key in the config.yml file"); | ||
return false; | ||
} | ||
if (Config.getEmail() == "[email protected]"){ | ||
Main.log("Please change your Email in the config.yml file"); | ||
return false; | ||
} | ||
else{ | ||
Main.debugLog("Api-Key has been changed in config"); | ||
CloseableHttpClient client = HttpClients.createDefault(); | ||
HttpPost httpPost = new HttpPost("https://safe-refuge-09383.herokuapp.com"); | ||
httpPost.setHeader("content-type", "application/json"); | ||
httpPost.setHeader("apikey", Config.getApiKey()); | ||
httpPost.setHeader("email", Config.getEmail()); | ||
JSONObject json = new JSONObject(); | ||
json.put("apikey", Config.getApiKey()); | ||
StringEntity entity = new StringEntity(json.toJSONString()); | ||
httpPost.setEntity(entity); | ||
CloseableHttpResponse response = client.execute(httpPost); | ||
int statusCode = response.getStatusLine().getStatusCode(); | ||
if (statusCode == 200) { | ||
client.close(); | ||
return true; | ||
} | ||
else if (statusCode != 200) { | ||
client.close(); | ||
Main.log("Error on status code"); | ||
return false; | ||
} | ||
} | ||
return false; | ||
|
||
} | ||
|
||
public static boolean checkAPIKey(){ | ||
try { | ||
boolean vaildKey = ghostCheckAPIKey(); | ||
if (vaildKey == true){ | ||
return true; | ||
} | ||
else if (vaildKey != true){ | ||
return false; | ||
} | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
return false; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters