feat(server): 사이트에서 권장 JDK 선택 + 설치기 권장 JDK 우선 탐색
- pack 에 recommendedJdk 추가(shared/types, store 정규화, 기본 25, 허용목록 [8,11,17,21,25]). 사이트 편집기에 JDK 버전 드롭다운 추가(직접 입력 X). - 설치기 JDK 탐색 순서 변경: ① 권장 JDK 자동설치 위치(temurin-<권장>) 우선 → ② 없으면 컴퓨터 JDK(JAVA_HOME/Program Files, 권장 버전 이상만 인정). - 자동 설치/버전 검증도 pack 의 권장 버전을 사용(하드코딩 25 제거). - 렌더러에 권장 JDK 표시, 관련 안내/문서 갱신. 버전 0.4.5→0.4.6. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,7 @@ export function defaultPackDefinition(name: string): PackDefinition {
|
||||
serverMaxRam: 4096,
|
||||
clientMinRam: 2048,
|
||||
clientRecommendedRam: 4096,
|
||||
recommendedJdk: DEFAULT_JDK_MAJOR,
|
||||
mapPath: '',
|
||||
serverPath: ''
|
||||
}
|
||||
@@ -78,6 +79,20 @@ function sanitizeFolderName(input: unknown): string {
|
||||
|
||||
const ALLOWED_LOADERS: LoaderType[] = ['vanilla', 'forge', 'fabric', 'neoforge']
|
||||
|
||||
/**
|
||||
* 사이트에서 고를 수 있고 설치기가 자동 설치할 수 있는 JDK 메이저 버전 목록(LTS).
|
||||
* 마인크래프트 버전대별: 8(구버전) / 11(1.17) / 17(1.18~1.20.4) / 21(1.20.5~) / 25(최신).
|
||||
*/
|
||||
export const SUPPORTED_JDK_MAJORS: number[] = [8, 11, 17, 21, 25]
|
||||
/** recommendedJdk 미지정/이상값일 때의 기본 권장 버전. */
|
||||
export const DEFAULT_JDK_MAJOR = 25
|
||||
|
||||
/** 입력값을 허용된 JDK 메이저로 보정. 목록 밖이면 기본값. */
|
||||
export function normalizeRecommendedJdk(input: unknown): number {
|
||||
const n = Math.floor(Number(input))
|
||||
return SUPPORTED_JDK_MAJORS.includes(n) ? n : DEFAULT_JDK_MAJOR
|
||||
}
|
||||
|
||||
export function normalizePackDefinition(input: Partial<PackDefinition> & Record<string, unknown>): PackDefinition {
|
||||
const fallback = defaultPackDefinition(typeof input.name === 'string' ? input.name : 'new')
|
||||
const platform = (input.platform ?? {}) as Partial<PackDefinition['platform']>
|
||||
@@ -112,6 +127,7 @@ export function normalizePackDefinition(input: Partial<PackDefinition> & Record<
|
||||
serverMaxRam: clampNumber(input.serverMaxRam, fallback.serverMaxRam),
|
||||
clientMinRam: clampNumber(input.clientMinRam, fallback.clientMinRam),
|
||||
clientRecommendedRam: clampNumber(input.clientRecommendedRam, fallback.clientRecommendedRam),
|
||||
recommendedJdk: normalizeRecommendedJdk(input.recommendedJdk),
|
||||
mapPath: sanitizeZipFileName(input.mapPath),
|
||||
serverPath: sanitizeZipFileName(input.serverPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user