diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a2a04688..7379ae59 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,31 +48,37 @@ jobs: name: Launcher path: artifacts + - name: Get version value, set to env + 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: | + cd artifacts + zip -9 LauncherBase.zip libraries.zip LaunchServer.jar + 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 - uses: actions/create-release@v1 - if: github.event.ref == 'refs/tags/*' + 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 ${{ github.ref }} + release_name: GravitLauncher ${{ env.LAUNCHER_VERSION }} draft: false prerelease: false - - - name: Pack release - if: github.event.ref == 'refs/tags/*' - run: | - cd artifacts/ - zip -r -9 ../Release.zip * - - - name: Upload release - if: 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 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(); 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); } diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 72cdaab5..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 = 0; + 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/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..e5df50f0 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().update(); + } + public static void appendVars(ProcessBuilder builder, Map vars) { builder.environment().putAll(vars); } diff --git a/build.gradle b/build.gradle index dd31aa07..872470c3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ id 'org.openjfx.javafxplugin' version '0.0.10' apply false } group = 'pro.gravit.launcher' -version = '5.2.0' +version = '5.2.2-SNAPSHOT' apply from: 'props.gradle' diff --git a/modules b/modules index 929428a7..84a55992 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 929428a7438aeb9a3f90c69a881da43030113e1a +Subproject commit 84a5599243bddf0f7a8081cc7f5672e9140893bd