From 3ae6b14424d2c4482255b0e9bf0a183c58bf7e93 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 14 Dec 2023 21:51:26 +0000 Subject: [PATCH] Hide installer version selection, and fix package name validation. Closes #73 Closes #72 --- scripts/src/lib/Installer.svelte | 3 ++- scripts/src/lib/template/java.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/src/lib/Installer.svelte b/scripts/src/lib/Installer.svelte index a5d5cf73..3e85900b 100644 --- a/scripts/src/lib/Installer.svelte +++ b/scripts/src/lib/Installer.svelte @@ -3,6 +3,7 @@ import DownloadIcon from "./DownloadIcon.svelte"; const win32 = navigator.platform == "Win32" + const showVersionSelection = false; let expertOptions = false; let selectedVersion = ""; @@ -38,7 +39,7 @@

- {:else} + {:else if showVersionSelection} {#await getVersion() then latest}

{#if latest?.stable}Installer Version: {latest.version} (Latest){/if} diff --git a/scripts/src/lib/template/java.ts b/scripts/src/lib/template/java.ts index dbb8ea5a..bf760817 100644 --- a/scripts/src/lib/template/java.ts +++ b/scripts/src/lib/template/java.ts @@ -40,13 +40,13 @@ export function getJavaVersion(minecraftVersion: string): JavaVersion { return JAVA_17; } -const JAVA_PACKAGE_REGEX = /^[a-zA-Z]+(\.[a-zA-Z][a-zA-Z0-9]*)*$/; +const JAVA_PACKAGE_REGEX = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/; const RESERVED_PACKAGE_PREFIXES = ["net.minecraft.", "com.mojang.", "net.fabricmc.", "java."]; export function computePackageNameErrors(packageName: string): string[] { let errorList : string[] = []; - if (!JAVA_PACKAGE_REGEX.test(packageName)) { + if (!JAVA_PACKAGE_REGEX.test(packageName.toLowerCase())) { errorList.push("Package name is not a valid Java package name!"); }