mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Added User-Agent to Ore update checker to fix 403 error
This commit is contained in:
parent
ea7a214ef4
commit
967adb226a
@ -76,6 +76,7 @@ public class OreVersionInfoLoader {
|
|||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
connection.setRequestProperty("Authorization", String.format("OreApi session=\"%s\"", session));
|
connection.setRequestProperty("Authorization", String.format("OreApi session=\"%s\"", session));
|
||||||
|
connection.setRequestProperty("User-Agent", "Player Analytics Update Checker");
|
||||||
connection.connect();
|
connection.connect();
|
||||||
try (InputStream in = connection.getInputStream()) {
|
try (InputStream in = connection.getInputStream()) {
|
||||||
JsonArray versions = new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("result").getAsJsonArray();
|
JsonArray versions = new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("result").getAsJsonArray();
|
||||||
@ -94,6 +95,7 @@ public class OreVersionInfoLoader {
|
|||||||
try {
|
try {
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
connection.setRequestMethod("POST");
|
connection.setRequestMethod("POST");
|
||||||
|
connection.setRequestProperty("User-Agent", "Player Analytics Update Checker");
|
||||||
connection.connect();
|
connection.connect();
|
||||||
try (InputStream in = connection.getInputStream()) {
|
try (InputStream in = connection.getInputStream()) {
|
||||||
return new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("session").getAsString();
|
return new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("session").getAsString();
|
||||||
|
Loading…
Reference in New Issue
Block a user