From fb7a55284358ee8a2be74efec52a18d62711d453 Mon Sep 17 00:00:00 2001 From: Gravita Date: Mon, 23 Aug 2021 15:56:08 +0700 Subject: [PATCH 01/11] [FIX] JsonAuthCoreProvider Bearer header --- .../pro/gravit/launchserver/auth/core/JsonCoreProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java index 74b8ffc3..5cb8e255 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/JsonCoreProvider.java @@ -58,7 +58,7 @@ public static R jsonRequest(T request, String url, String bearerToken, Cl .header("Accept", "application/json") .timeout(Duration.ofMillis(10000)); if (bearerToken != null) { - request1.header("Authentication", "Bearer ".concat(bearerToken)); + request1.header("Authorization", "Bearer ".concat(bearerToken)); } HttpResponse response = client.send(request1.build(), HttpResponse.BodyHandlers.ofInputStream()); int statusCode = response.statusCode(); From effbb18bbc375f78f3485a68719c27e8b99500ff Mon Sep 17 00:00:00 2001 From: Gravita Date: Mon, 23 Aug 2021 15:58:22 +0700 Subject: [PATCH 02/11] =?UTF-8?q?[ANY]=20=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 929428a7..84a55992 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 929428a7438aeb9a3f90c69a881da43030113e1a +Subproject commit 84a5599243bddf0f7a8081cc7f5672e9140893bd From 27f7082568c0bf0eaabbd0a5536a589cac0d8bd0 Mon Sep 17 00:00:00 2001 From: Gravita Date: Tue, 31 Aug 2021 18:23:40 +0700 Subject: [PATCH 03/11] [ANY] 5.2.1 --- LauncherCore/src/main/java/pro/gravit/utils/Version.java | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 72cdaab5..42a215f8 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -6,7 +6,7 @@ public final class Version implements Comparable { public static final int MAJOR = 5; public static final int MINOR = 2; - public static final int PATCH = 0; + public static final int PATCH = 1; public static final int BUILD = 1; public static final Version.Type RELEASE = Type.STABLE; public final int major; diff --git a/build.gradle b/build.gradle index 13f094e7..ac0b4769 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ id 'org.openjfx.javafxplugin' version '0.0.8' apply false } group = 'pro.gravit.launcher' -version = '5.2.0' +version = '5.2.1' apply from: 'props.gradle' From 6f2f7bee1334614f698777a5d492ae152380defb Mon Sep 17 00:00:00 2001 From: Andrew Molchanov Date: Wed, 1 Sep 2021 00:25:40 +0300 Subject: [PATCH 04/11] [FIX] GitHub Actions --- .github/workflows/push.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a2a04688..23fbe706 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,6 +1,5 @@ name: push -on: - push: +on: push jobs: launcher: name: Launcher @@ -49,26 +48,30 @@ jobs: name: Launcher path: artifacts + - name: Get version value, set to env + if: startsWith(github.event.ref, 'refs/tags') + run: echo "LAUNCHER_VERSION=v$(awk -F\' '/version =/ {print $2}' build.gradle)" >> $GITHUB_ENV + - name: Create release id: create_release uses: actions/create-release@v1 - if: github.event.ref == 'refs/tags/*' + if: startsWith(github.event.ref, 'refs/tags') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: GravitLauncher ${{ github.ref }} + release_name: GravitLauncher ${{ env.LAUNCHER_VERSION }} draft: false prerelease: false - name: Pack release - if: github.event.ref == 'refs/tags/*' + if: startsWith(github.event.ref, 'refs/tags') run: | cd artifacts/ zip -r -9 ../Release.zip * - name: Upload release - if: github.event.ref == 'refs/tags/*' + if: startsWith(github.event.ref, 'refs/tags') uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b424da0d62a4c9f9086045cc0f08a5366473c611 Mon Sep 17 00:00:00 2001 From: Andrew Molchanov Date: Wed, 1 Sep 2021 13:49:54 +0300 Subject: [PATCH 05/11] =?UTF-8?q?[FIX]=20GitHub=20Actions=20-=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D0=B8=20=D0=B8=D0=B7=20=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 23fbe706..9ec80948 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -50,7 +50,7 @@ jobs: - name: Get version value, set to env if: startsWith(github.event.ref, 'refs/tags') - run: echo "LAUNCHER_VERSION=v$(awk -F\' '/version =/ {print $2}' build.gradle)" >> $GITHUB_ENV + run: echo "LAUNCHER_VERSION=$(echo ${{ github.event.ref }} | awk -F\/ '{print $3}')" >> $GITHUB_ENV - name: Create release id: create_release From fe994cdcca78ffbe9e9ad57d648bd466f2c446f0 Mon Sep 17 00:00:00 2001 From: Andrew Molchanov Date: Fri, 3 Sep 2021 16:23:51 +0300 Subject: [PATCH 06/11] =?UTF-8?q?[FIX]=20GitHub=20Actions=20-=20=D0=97?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=20=D0=B2=20=D1=80=D0=B5=D0=BB=D0=B8=D0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9ec80948..55bb0772 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -52,31 +52,40 @@ jobs: if: startsWith(github.event.ref, 'refs/tags') run: echo "LAUNCHER_VERSION=$(echo ${{ github.event.ref }} | awk -F\/ '{print $3}')" >> $GITHUB_ENV + - name: Prebuild release files + if: startsWith(github.event.ref, 'refs/tags') + run: | + cp modules/*_module/build/libs/*.jar artifacts/modules || true + cp modules/*_lmodule/build/libs/*.jar artifacts/lmodules || true + cp modules/*_swmodule/build/libs/*.jar artifacts/swmodules || true + cd artifacts + zip -9 LauncherBase.zip libraries.zip LaunchServer.jar + cd lmodules + zip -9 ../LauncherModules.zip * + cd ../modules + zip -9 ../LaunchServerModules.zip * + cd ../swmodules + zip -9 ../ServerWrapperModules.zip * + cd .. + - name: Create release id: create_release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 if: startsWith(github.event.ref, 'refs/tags') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# Список настроек тута: https://github.com/softprops/action-gh-release#-customizing +# Можно сделать пуш описания релиза из файла with: - tag_name: ${{ github.ref }} release_name: GravitLauncher ${{ env.LAUNCHER_VERSION }} draft: false prerelease: false - - - name: Pack release - if: startsWith(github.event.ref, 'refs/tags') - run: | - cd artifacts/ - zip -r -9 ../Release.zip * - - - name: Upload release - if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Release.zip - asset_name: Release.zip - asset_content_type: application/zip + files: | + libraries.zip + LaunchServer.jar + ServerWrapper.jar + LauncherAuthlib.jar + LauncherModules.zip + LaunchServerModules.zip + ServerWrapperModules.zip + LauncherBase.zip From 8b1f0a7d8c46c4cc3299e6512e025a5f42f04743 Mon Sep 17 00:00:00 2001 From: Andrew Molchanov Date: Fri, 3 Sep 2021 16:48:15 +0300 Subject: [PATCH 07/11] =?UTF-8?q?[FIX]=20GitHub=20Actions=20-=20=D0=9D?= =?UTF-8?q?=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20Prebuild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 55bb0772..7379ae59 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -55,18 +55,11 @@ jobs: - name: Prebuild release files if: startsWith(github.event.ref, 'refs/tags') run: | - cp modules/*_module/build/libs/*.jar artifacts/modules || true - cp modules/*_lmodule/build/libs/*.jar artifacts/lmodules || true - cp modules/*_swmodule/build/libs/*.jar artifacts/swmodules || true cd artifacts zip -9 LauncherBase.zip libraries.zip LaunchServer.jar - cd lmodules - zip -9 ../LauncherModules.zip * - cd ../modules - zip -9 ../LaunchServerModules.zip * - cd ../swmodules - zip -9 ../ServerWrapperModules.zip * - cd .. + zip -j -9 LaunchServerModules.zip ../modules/*_module/build/libs/*.jar + zip -j -9 LauncherModules.zip ../modules/*_lmodule/build/libs/*.jar + zip -j -9 ServerWrapperModules.zip ../modules/*_swmodule/build/libs/*.jar - name: Create release id: create_release From e5cd39e544551d2f9b6c364f906c0ed082de5eb1 Mon Sep 17 00:00:00 2001 From: Gravita Date: Fri, 3 Sep 2021 21:53:09 +0700 Subject: [PATCH 08/11] [FEATURE][EXPERIMENTAL] JVMHelper.getBuild() --- .../pro/gravit/utils/helper/JVMHelper.java | 20 +++++++++++++++++ .../pro/gravit/utils/helper/JavaHelper.java | 22 +++++++++++++++++-- .../pro/gravit/utils/helper/JVMHelper.java | 5 +++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java index dda8ea7c..e4de1756 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/JVMHelper.java @@ -29,6 +29,7 @@ public final class JVMHelper { public static final Runtime RUNTIME = Runtime.getRuntime(); public static final ClassLoader LOADER = ClassLoader.getSystemClassLoader(); public static final int JVM_VERSION = getVersion(); + public static final int JVM_BUILD = getBuild(); static { try { @@ -54,6 +55,25 @@ public static int getVersion() { return Integer.parseInt(version); } + public static int getBuild() { + String version = System.getProperty("java.version"); + int dot; + if (version.startsWith("1.")) { + dot = version.indexOf("_"); + } else { + dot = version.lastIndexOf("."); + } + if (dot != -1) { + version = version.substring(dot + 1); + } + try { + return Integer.parseInt(version); + } catch (NumberFormatException exception) { + return 0; + } + + } + public static void appendVars(ProcessBuilder builder, Map vars) { builder.environment().putAll(vars); } diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java index 286806bd..0aa2f236 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java @@ -170,12 +170,14 @@ public static class JavaVersion { public final Path jvmDir; public final int version; public final int build; + public final int bitness; public boolean enabledJavaFX; public JavaVersion(Path jvmDir, int version) { this.jvmDir = jvmDir; this.version = version; this.build = 0; + this.bitness = JVMHelper.OS_BITS; this.enabledJavaFX = true; } @@ -183,11 +185,20 @@ public JavaVersion(Path jvmDir, int version, int build, boolean enabledJavaFX) { this.jvmDir = jvmDir; this.version = version; this.build = build; + this.bitness = JVMHelper.OS_BITS; + this.enabledJavaFX = enabledJavaFX; + } + + public JavaVersion(Path jvmDir, int version, int build, int bitness, boolean enabledJavaFX) { + this.jvmDir = jvmDir; + this.version = version; + this.build = build; + this.bitness = bitness; this.enabledJavaFX = enabledJavaFX; } public static JavaVersion getCurrentJavaVersion() { - return new JavaVersion(Paths.get(System.getProperty("java.home")), JVMHelper.getVersion(), 0, isCurrentJavaSupportJavaFX()); + return new JavaVersion(Paths.get(System.getProperty("java.home")), JVMHelper.getVersion(), JVMHelper.JVM_BUILD, JVMHelper.JVM_BITS, isCurrentJavaSupportJavaFX()); } private static boolean isCurrentJavaSupportJavaFX() { @@ -212,14 +223,21 @@ public static JavaVersion getByPath(Path jvmDir) throws IOException { } Path releaseFile = jvmDir.resolve("release"); JavaVersionAndBuild versionAndBuild; + int bitness = JVMHelper.OS_BITS; if (IOHelper.isFile(releaseFile)) { Properties properties = new Properties(); properties.load(IOHelper.newReader(releaseFile)); versionAndBuild = getJavaVersion(properties.getProperty("JAVA_VERSION").replaceAll("\"", "")); + String arch = properties.getProperty("JAVA_VERSION").replaceAll("\"", ""); + if (arch.contains("x86_64")) { + bitness = 64; + } else if (arch.contains("x86") || arch.contains("x32")) { + bitness = 32; + } } else { versionAndBuild = new JavaVersionAndBuild(isExistExtJavaLibrary(jvmDir, "jfxrt") ? 8 : 9, 0); } - JavaVersion resultJavaVersion = new JavaVersion(jvmDir, versionAndBuild.version, versionAndBuild.build, false); + JavaVersion resultJavaVersion = new JavaVersion(jvmDir, versionAndBuild.version, versionAndBuild.build, bitness, false); if (versionAndBuild.version <= 8) { resultJavaVersion.enabledJavaFX = isExistExtJavaLibrary(jvmDir, "jfxrt"); } else { diff --git a/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java b/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java index 15e84711..34dd5082 100644 --- a/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java +++ b/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java @@ -29,6 +29,7 @@ public final class JVMHelper { public static final Runtime RUNTIME = Runtime.getRuntime(); public static final ClassLoader LOADER = ClassLoader.getSystemClassLoader(); public static final int JVM_VERSION = getVersion(); + public static final int JVM_BUILD = getBuild(); static { try { @@ -46,6 +47,10 @@ public static int getVersion() { return Runtime.version().feature(); } + public static int getBuild() { + return Runtime.version().patch(); + } + public static void appendVars(ProcessBuilder builder, Map vars) { builder.environment().putAll(vars); } From a91a578c582b705a600a8e50e53b0ce312ce70af Mon Sep 17 00:00:00 2001 From: Gravita Date: Fri, 3 Sep 2021 21:54:45 +0700 Subject: [PATCH 09/11] [ANY] 5.2.2 dev --- LauncherCore/src/main/java/pro/gravit/utils/Version.java | 4 ++-- build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 42a215f8..241f4d14 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -6,9 +6,9 @@ public final class Version implements Comparable { public static final int MAJOR = 5; public static final int MINOR = 2; - public static final int PATCH = 1; + public static final int PATCH = 2; public static final int BUILD = 1; - public static final Version.Type RELEASE = Type.STABLE; + public static final Version.Type RELEASE = Type.DEV; public final int major; public final int minor; public final int patch; diff --git a/build.gradle b/build.gradle index ac0b4769..24f79558 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ id 'org.openjfx.javafxplugin' version '0.0.8' apply false } group = 'pro.gravit.launcher' -version = '5.2.1' +version = '5.2.2-SNAPSHOT' apply from: 'props.gradle' From 12b933c8bd46850051c6c6fa7a7af82101f164a8 Mon Sep 17 00:00:00 2001 From: Gravita Date: Fri, 3 Sep 2021 22:15:53 +0700 Subject: [PATCH 10/11] [FIX] Java 11+ get build fix --- .../src/main/java11/pro/gravit/utils/helper/JVMHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java b/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java index 34dd5082..e5df50f0 100644 --- a/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java +++ b/LauncherCore/src/main/java11/pro/gravit/utils/helper/JVMHelper.java @@ -48,7 +48,7 @@ public static int getVersion() { } public static int getBuild() { - return Runtime.version().patch(); + return Runtime.version().update(); } public static void appendVars(ProcessBuilder builder, Map vars) { From 8694963313e22376c2dcda756eb656e666181a7e Mon Sep 17 00:00:00 2001 From: Gravita Date: Sat, 4 Sep 2021 19:53:56 +0700 Subject: [PATCH 11/11] [FIX] TextureProvider NPE error message --- .../java/pro/gravit/launchserver/manangers/AuthManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java index 0894c9bb..3c356547 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java @@ -303,6 +303,9 @@ public PlayerProfile getPlayerProfile(AuthProviderPair pair, User user) { if (user instanceof UserSupportTextures) { return new PlayerProfile(user.getUUID(), user.getUsername(), ((UserSupportTextures) user).getSkinTexture(), ((UserSupportTextures) user).getCloakTexture()); } + if (pair.textureProvider == null) { + throw new NullPointerException("TextureProvider not found"); + } return getPlayerProfile(user.getUUID(), user.getUsername(), "", pair.textureProvider); }