Skip to content

Commit

Permalink
Added User-Agent to Ore update checker to fix 403 error
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 committed Oct 31, 2021
1 parent ea7a214 commit 967adb2
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private static List<OreVersionDto> loadOreVersions(String session) throws IOExce
connection.setDoOutput(true);
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", String.format("OreApi session=\"%s\"", session));
connection.setRequestProperty("User-Agent", "Player Analytics Update Checker");
connection.connect();
try (InputStream in = connection.getInputStream()) {
JsonArray versions = new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("result").getAsJsonArray();
Expand All @@ -94,6 +95,7 @@ private static String newOreSession() throws IOException {
try {
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", "Player Analytics Update Checker");
connection.connect();
try (InputStream in = connection.getInputStream()) {
return new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("session").getAsString();
Expand Down

0 comments on commit 967adb2

Please sign in to comment.