aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-27 02:25:50 +0900
committersyeyoung <cyoung06@naver.com>2023-02-27 02:25:50 +0900
commitbd6d9e260916648d28f21b034d910c81d2c226fa (patch)
treec662540085efacd2e77abaa80e484011cb825054 /loader/src/main/java
parent85680da71fabcbd5179eab1b9e4698b3aa92722c (diff)
downloadSkyblock-Dungeons-Guide-bd6d9e260916648d28f21b034d910c81d2c226fa.tar.gz
Skyblock-Dungeons-Guide-bd6d9e260916648d28f21b034d910c81d2c226fa.tar.bz2
Skyblock-Dungeons-Guide-bd6d9e260916648d28f21b034d910c81d2c226fa.zip
- Proper User Agent
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java7
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/UpdateRetrieverUtil.java11
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicy.java3
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/elements/image/ImageTexture.java3
4 files changed, 14 insertions, 10 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
index d1abadca..c1041192 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
@@ -22,6 +22,7 @@ import com.mojang.authlib.GameProfile;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import kr.syeyoung.dungeonsguide.launcher.LetsEncrypt;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.launcher.auth.token.AuthToken;
import kr.syeyoung.dungeonsguide.launcher.auth.token.DGAuthToken;
@@ -101,7 +102,7 @@ public class DgAuthUtil {
HttpsURLConnection connection = (HttpsURLConnection) new URL(Main.DOMAIN + "/auth/v2/requestAuth").openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setRequestProperty("Content-Type", "application/json");
connection.setConnectTimeout(1000);
connection.setReadTimeout(3000);
@@ -153,7 +154,7 @@ public class DgAuthUtil {
HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(Main.DOMAIN + "/auth/v2/authenticate").openConnection();
urlConnection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
urlConnection.setRequestMethod("POST");
- urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ urlConnection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
urlConnection.setRequestProperty("Content-Type", "application/json");
urlConnection.setConnectTimeout(1000);
urlConnection.setReadTimeout(3000);
@@ -180,7 +181,7 @@ public class DgAuthUtil {
HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(Main.DOMAIN + "/auth/v2/acceptPrivacyPolicy").openConnection();
urlConnection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
urlConnection.setRequestMethod("POST");
- urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ urlConnection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
urlConnection.setRequestProperty("Content-Type", "application/json");
urlConnection.setConnectTimeout(1000);
urlConnection.setReadTimeout(3000);
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/UpdateRetrieverUtil.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/UpdateRetrieverUtil.java
index ef282f1e..f335dc38 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/UpdateRetrieverUtil.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/UpdateRetrieverUtil.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.launcher.branch;
import kr.syeyoung.dungeonsguide.launcher.LetsEncrypt;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager;
import kr.syeyoung.dungeonsguide.launcher.exceptions.AssetNotFoundException;
@@ -51,7 +52,7 @@ public class UpdateRetrieverUtil {
public static List<UpdateBranch> getUpdateBranches() throws IOException {
HttpsURLConnection connection = (HttpsURLConnection) new URL(Main.DOMAIN + "/updates/").openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setRequestProperty("Authorization", "Bearer "+ AuthManager.getInstance().getWorkingTokenOrThrow());
connection.setRequestMethod("GET");
connection.setConnectTimeout(1000);
@@ -83,7 +84,7 @@ public class UpdateRetrieverUtil {
public static List<Update> getLatestUpdates(long branchId, int page) throws IOException {
HttpsURLConnection connection = (HttpsURLConnection) new URL(Main.DOMAIN + "/updates/"+branchId+"/?page="+page).openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setRequestMethod("GET");
connection.setConnectTimeout(1000);
connection.setReadTimeout(3000);
@@ -126,7 +127,7 @@ public class UpdateRetrieverUtil {
public static Update getUpdate(long branchId, long updateId) throws IOException {
HttpsURLConnection connection = (HttpsURLConnection) new URL(Main.DOMAIN + "/updates/"+branchId+"/"+updateId).openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setRequestProperty("Authorization", "Bearer "+ AuthManager.getInstance().getWorkingTokenOrThrow());
connection.setRequestMethod("GET");
connection.setConnectTimeout(1000);
@@ -169,7 +170,7 @@ public class UpdateRetrieverUtil {
try {
HttpsURLConnection connection = (HttpsURLConnection) new URL(Main.DOMAIN + "/updates/" + update.getBranchId() + "/" + update.getId() + "/" + asset.getAssetId()).openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + AuthManager.getInstance().getWorkingTokenOrThrow());
connection.setDoInput(true);
@@ -189,7 +190,7 @@ public class UpdateRetrieverUtil {
try {
connection = (HttpsURLConnection) new URL(url).openConnection();
connection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- connection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ connection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
connection.setConnectTimeout(1000);
connection.setReadTimeout(5000);
connection.setRequestMethod(method);
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicy.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicy.java
index 1ac4556b..bbc82c62 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicy.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicy.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.launcher.gui.screen;
import kr.syeyoung.dungeonsguide.launcher.LetsEncrypt;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager;
import kr.syeyoung.dungeonsguide.launcher.guiv2.BindableAttribute;
@@ -78,7 +79,7 @@ public class WidgetPrivacyPolicy extends AnnotatedImportOnlyWidget {
try {
HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(Main.POLICY).openConnection();
urlConnection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT);
- urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/4.0");
+ urlConnection.setRequestProperty("User-Agent", "DungeonsGuideLoader/"+ LoaderMeta.LOADER_VERSION);
urlConnection.setConnectTimeout(1000);
urlConnection.setReadTimeout(3000);
urlConnection.setRequestMethod("GET");
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/elements/image/ImageTexture.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/elements/image/ImageTexture.java
index 79ca20c9..999f5006 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/elements/image/ImageTexture.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/elements/image/ImageTexture.java
@@ -19,6 +19,7 @@
package kr.syeyoung.dungeonsguide.launcher.guiv2.elements.image;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import lombok.Data;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -75,7 +76,7 @@ public class ImageTexture {
URL urlObj = new URL(url);
HttpURLConnection huc = (HttpURLConnection) urlObj.openConnection();
- huc.addRequestProperty("User-Agent", "DungeonsGuideMod (dungeons.guide, 1.0)");
+ huc.addRequestProperty("User-Agent", "DungeonsGuideLoader (dungeons.guide, "+ LoaderMeta.LOADER_VERSION +")");
ImageInputStream imageInputStream = ImageIO.createImageInputStream(huc.getInputStream());
Iterator<ImageReader> readers = ImageIO.getImageReaders(imageInputStream);
if(!readers.hasNext()) throw new IOException("No image reader what" + url);