diff options
Diffstat (limited to 'loader')
3 files changed, 25 insertions, 8 deletions
diff --git a/loader/build.gradle b/loader/build.gradle index a86269ce..14bd8e7b 100644 --- a/loader/build.gradle +++ b/loader/build.gradle @@ -10,18 +10,27 @@ version = "4.0.0" group = "kr.syeyoung.dungeonsguide" archivesBaseName = "dungeonsguide" + java { toolchain.languageVersion.set(JavaLanguageVersion.of(8)) } loom { launchConfigs { - "client" { + client { // probably will have to my own mixin tweaker, due to dungeonsguide's weird dynamic loading stuff // property("mixin.debug", "true") // property("asmhelper.verbose", "true") // arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") // arg("--mixin", "mixins.examplemod.json") + + } + } + runs { + client { + runDir = 'runtime' + property('devauth.enabled','true') + client() } } forge { @@ -38,6 +47,8 @@ sourceSets.main { repositories { mavenCentral() maven { url "https://jitpack.io" } + // dev auth + maven {url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1"} } configurations { @@ -54,6 +65,7 @@ dependencies { implementation "org.json:json:20171018" implementation 'io.nayuki:qrcodegen:1.4.0' + runtimeOnly project(':mod') compileOnly "org.projectlombok:lombok:1.18.20" annotationProcessor "org.projectlombok:lombok:1.18.16" @@ -61,7 +73,8 @@ dependencies { testCompileOnly "org.projectlombok:lombok:1.18.20" testAnnotationProcessor "org.projectlombok:lombok:1.18.20" - runtimeOnly project(":mod") + + modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0") } @@ -70,7 +83,7 @@ tasks.withType(JavaCompile) { } tasks.withType(Jar) { - archiveBaseName = "examplemod" + archivesBaseName = "dungeonsguide-loader" manifest { attributes["FMLCorePluginContainsFMLMod"] = "true" attributes["ForceLoadAsMod"] = "true" @@ -83,7 +96,6 @@ tasks.withType(Jar) { tasks.shadowJar { - archiveFileName = jar.archiveFileName relocate "org.java_websocket", "kr.syeyoung.org.java_websocket" 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 1df59f83..66d7e79b 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -18,6 +18,8 @@ package kr.syeyoung.dungeonsguide.launcher; +import com.mojang.authlib.exceptions.AuthenticationUnavailableException; +import com.mojang.authlib.exceptions.InvalidCredentialsException; import kr.syeyoung.dungeonsguide.launcher.exceptions.AuthServerException; import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import kr.syeyoung.dungeonsguide.launcher.branch.ModDownloader; @@ -54,7 +56,7 @@ public class Main { public static final String MOD_ID = "dungeons_guide_wrapper"; public static final String VERSION = "1.0"; - public static final String DOMAIN = "http://testmachine:8080/panel/api"; + public static final String DOMAIN = "http://testmachine:8080/api"; private static Main main; @@ -156,6 +158,10 @@ public class Main } else if (lastError instanceof AuthServerException) { + } else if (lastError instanceof InvalidCredentialsException) { + + } else if (lastError instanceof AuthenticationUnavailableException) { + } else if (lastError != null){ return new GuiLoadingError(lastError, () -> {lastError = null;}); } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java index d06e3a39..d16f70ed 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java @@ -46,7 +46,6 @@ import java.util.concurrent.locks.ReentrantLock; public class Authenticator { private String dgAccessToken; - private Instant validThru; @Getter private TokenStatus tokenStatus = TokenStatus.UNAUTHENTICATED; @@ -55,13 +54,13 @@ public class Authenticator { private Lock authenticationLock = new ReentrantLock(); static { - Reflection.registerFieldsToFilter(Authenticator.class, "token"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here. + Reflection.registerFieldsToFilter(Authenticator.class, "dgAccessToken"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here. } public String getRawToken() { return dgAccessToken; } - public String getUnexpiredToken() { + public String getUnexpiredToken() { // THIS METHOD MAY BLOCK. if (tokenStatus != TokenStatus.AUTHENTICATED) throw new IllegalStateException("Token is not available"); long expiry = getJwtPayload(dgAccessToken).getLong("exp"); if (System.currentTimeMillis() >= expiry-2000 || tokenStatus == TokenStatus.EXPIRED) { |