diff options
author | syeyoung <cyoung06@naver.com> | 2022-11-17 00:26:20 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2022-11-17 00:26:20 +0900 |
commit | b42e3286fa3b2ac52989a83d1fac45bf47b3d1ed (patch) | |
tree | d74c9a3932d738f4065662f72bd54bb0b3c11577 /loader/src/main/java/kr | |
parent | d07321fe03f6316f28d8421b7cd4e93dfdfd6b2e (diff) | |
download | Skyblock-Dungeons-Guide-b42e3286fa3b2ac52989a83d1fac45bf47b3d1ed.tar.gz Skyblock-Dungeons-Guide-b42e3286fa3b2ac52989a83d1fac45bf47b3d1ed.tar.bz2 Skyblock-Dungeons-Guide-b42e3286fa3b2ac52989a83d1fac45bf47b3d1ed.zip |
- Fix base64 encode mismatch
- Privacy Policy Gui v1
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java/kr')
3 files changed, 18 insertions, 6 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java index c6834a47..27a0b6dc 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java @@ -112,7 +112,7 @@ public class AuthManager { } - AuthToken acceptPrivacyPolicy() { + public AuthToken acceptPrivacyPolicy() { if (reauthLock) { while(reauthLock); return currentToken; 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 68a31ccd..be247c88 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 @@ -59,7 +59,7 @@ public class DgAuthUtil { json.isNull("qrCode") ? null: json.getString("qrCode") ); - if (!"SUCCESS".equals(response.getStatus())) { + if (!"Success".equals(response.getStatus())) { throw new AuthServerException(response); } @@ -129,7 +129,7 @@ public class DgAuthUtil { urlConnection.setDoInput(true); urlConnection.setDoOutput(true); - urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"sharedSecret\":\""+Base64.encodeBase64URLSafeString(encSecret)+"\"}").getBytes()); + urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"sharedSecret\":\""+Base64.encodeBase64String(encSecret)+"\"}").getBytes()); JSONObject data = getResponse(urlConnection, JSONObject.class); try { diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java index f7acb18a..72d08cea 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java @@ -1,5 +1,8 @@ package kr.syeyoung.dungeonsguide.launcher.gui.screen; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.launcher.exceptions.auth.AuthFailedExeption; +import kr.syeyoung.dungeonsguide.launcher.exceptions.auth.PrivacyPolicyRequiredException; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import org.lwjgl.opengl.GL11; @@ -10,8 +13,11 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen { @Override public void initGui() { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2+50,sr.getScaledHeight()-40, 300, 20,"Accept Privacy Policy")); - this.buttonList.add(new GuiButton(1, sr.getScaledWidth()/2-50-300,sr.getScaledHeight()-40, 300, 20,"Deny and Play Without DG")); + + int width = Math.min(300, sr.getScaledWidth() / 2 - 20); + + this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2 + 10,sr.getScaledHeight()-40, width, 20,"Accept Privacy Policy")); + this.buttonList.add(new GuiButton(1, sr.getScaledWidth() / 2 - 10 - width,sr.getScaledHeight()-40, width, 20,"Deny and Play Without DG")); } @@ -20,6 +26,12 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen { super.actionPerformed(button); if (button.id == 0) { // accept + try { + AuthManager.getInstance().acceptPrivacyPolicy(); + } catch (PrivacyPolicyRequiredException e) { +// GuiDisplayer.INSTANCE.displayGui(new GuiLoadingError(e)); + // display tooltip. + } dismiss(); } else if (button.id == 1) { dismiss(); @@ -35,7 +47,7 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; fontRenderer.drawString("Please accept or deny Dungeons Guide Privacy Policy to continue", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please accept or deny Dungeons Guide Privacy Policy to continue"))/2,40,0xFFFF0000); - + fontRenderer.drawString("Blah blah legal stuff", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please accept or deny Dungeons Guide Privacy Policy to continue"))/2,sr.getScaledHeight() / 2, 0xFFFFFFFF); super.drawScreen(mouseX, mouseY, partialTicks); } |