diff options
Diffstat (limited to 'loader/src')
3 files changed, 148 insertions, 0 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java index fb6acadf..6ea7bbfa 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -23,6 +23,8 @@ import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil; import kr.syeyoung.dungeonsguide.launcher.exceptions.*; import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiDisplayer; import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetError; +import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetPrivacyPolicy; +import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetPrivacyPolicyLocal; import kr.syeyoung.dungeonsguide.launcher.gui.screen.version.WidgetChooseVersion; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.Notification; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.NotificationManager; @@ -332,6 +334,15 @@ public class Main if (dgInterface != null) dgInterface.onResourceReload(a); DefaultFontRenderer.DEFAULT_RENDERER.onResourceManagerReload(); }); +// UUID uid = UUID.randomUUID(); +// NotificationManager.getInstance().updateNotification(uid, new WidgetNotification(uid, Notification.builder() +// .title("Privacy Policy") +// .description("Please accept Dungeons Guide\nPrivacy Policy to enjoy server based\nfeatures of Dungeons Guide\n\n(Including Auto-Update/Remote-Jar)") +// .titleColor(0xFFFF0000) +// .onClick(() -> { +// GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(new GlobalHUDScale(new WidgetPrivacyPolicyLocal()))); +// }) +// .build())); } public static Main getMain() { diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java new file mode 100644 index 00000000..eb5eca2f --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java @@ -0,0 +1,94 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +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; +import kr.syeyoung.dungeonsguide.launcher.guiv2.Widget; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.DomElementRegistry; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.ParsedWidgetConverter; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.data.ParserElement; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.data.W3CBackedParser; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import javax.net.ssl.HttpsURLConnection; +import java.net.URL; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class WidgetPrivacyPolicyLocal extends AnnotatedImportOnlyWidget { + public static final ExecutorService executor = Executors.newSingleThreadExecutor(); + @Bind(variableName = "policy") + public final BindableAttribute<Widget> policy = new BindableAttribute<>(Widget.class); + @Bind(variableName = "policyVisibility") + public final BindableAttribute<String> policyVisibility = new BindableAttribute<>(String.class, "loading"); + + @Bind(variableName = "policyVersion") + public final BindableAttribute<Integer> version = new BindableAttribute<>(Integer.class, 0); + + public WidgetPrivacyPolicyLocal() { + super(new ResourceLocation("dungeons_guide_loader:gui/privacyPolicy/privacyPolicy.gui")); + reload0(); + } + + @On(functionName = "accept") + public void accept() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + AuthManager.getInstance().acceptPrivacyPolicy(version.getValue()); + Minecraft.getMinecraft().displayGuiScreen(null); + } + @On(functionName = "deny") + public void deny() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().displayGuiScreen(null); + } + + + public void reload0() { + policyVisibility.setValue("loading"); + executor.submit(() -> { + try { + + try (W3CBackedParser parser = new W3CBackedParser(WidgetPrivacyPolicyLocal.class.getResourceAsStream("/privacyPolicyTest.gui"))) { + ParserElement element = parser.getRootNode(); + ParsedWidgetConverter converter = DomElementRegistry.obtainConverter(element.getNodeName()); + Widget w = converter.convert(this, element); + policy.setValue(w); + policyVisibility.setValue("loaded"); + } + } catch (Exception e) { + e.printStackTrace(); + policyVisibility.setValue("failed"); + } + }); + } + @On(functionName = "reload") + public void reload() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + reload0(); + } +} diff --git a/loader/src/main/resources/privacyPolicyTest.gui b/loader/src/main/resources/privacyPolicyTest.gui new file mode 100644 index 00000000..988a0d8b --- /dev/null +++ b/loader/src/main/resources/privacyPolicyTest.gui @@ -0,0 +1,43 @@ +<!-- + ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + ~ Copyright (C) 2023 cyoung06 (syeyoung) + ~ + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU Affero General Public License as published + ~ by the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU Affero General Public License for more details. + ~ + ~ You should have received a copy of the GNU Affero General Public License + ~ along with this program. If not, see <https://www.gnu.org/licenses/>. + --> + +<padding left="10" top="10" right="10" bottom="10"> + <col crossAlign="STRETCH"> + <PolicyVersion version="2" bind:policyVersion="policyVersion"/> + <Text text="Dungeons Guide Privacy Policy" size="16" align="CENTER"/> + <size width="0" height="5"/> + <Text text="Last updated 12, Nov, 2023" align="RIGHT"/> + <size width="0" height="10"/> + <Text text="Privacy Policy Summary" size="16" align="LEFT"/> + <size width="0" height="10"/> + <Text text="§lWhat data we collect" size="12" align="LEFT"/> + <size width="0" height="10"/> + <Text text="Dungeons Guide collects the following information from users who accept our Privacy Policy and Terms of Service through their continued use of the platform, products, and services:" size="8" align="LEFT"/> + <size width="0" height="5"/> + <Text text="- Minecraft username and UUID" size="8" align="LEFT"/> + <Text text="- users' Hypixel party members" size="8" align="LEFT"/> + <Text text="- The time users last contacted Dungeons Guide backend" size="8" align="LEFT"/> + <Text text="- Dungeon Scores users get (This is anonymized, and it is to reverse engineer the time score formula)" size="8" align="LEFT"/> + <Text text="- Dungeons Guide Error Stacktraces (This is anonymized, Opt out at /dg -> Misc -> Collect Error Logs) Only Applicable to users using 4.0.0-beta8.4 or later." size="8" align="LEFT"/> + <size width="0" height="20"/> + <Text text="Privacy Policy" size="16" align="LEFT"/> + <Text text="There still isn't anything here currently" align="LEFT"/> + <Text text="You will be prompted to accept to the privacy policy again when it actually gets added" align="LEFT"/> + <Text text="The above section exists for the purpose to inform users about the data we collect currently" align="LEFT"/> + </col> +</padding>
\ No newline at end of file |