Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 13e4e0eb13 | |||
| e80933d21e | |||
| df5947f8bb | |||
| 3c404ecd8c | |||
| e30d7418df | |||
| bce87f1362 | |||
| e5dcc47548 | |||
| f53e54493d | |||
| 9abf6da5f1 | |||
| 48d5223671 | |||
| 51af4464e8 | |||
| 971992b530 | |||
| 868bee7931 | |||
| f85e0439b8 | |||
| 812cabd405 | |||
| fefa2dcdd2 | |||
| 9d9b5183b8 | |||
| a1d8435b71 | |||
| a6118039a3 | |||
| 48e0421135 | |||
| cf29270102 | |||
| 10362e204a | |||
| 3f553f958d |
@@ -28,9 +28,16 @@
|
|||||||
|
|
||||||
### 3-2. JDK 확인
|
### 3-2. JDK 확인
|
||||||
|
|
||||||
- 환경변수(`JAVA_HOME`, `JDK_HOME`) → 자동 설치 위치(`%APPDATA%\jdk\temurin-21`) → `C:\Program Files\Java` 순으로 자동 탐색.
|
- 각 음악퀴즈(pack)는 사이트 편집기에서 **권장 JDK 버전**(예: Java 25)을 지정합니다. 편집기 목록은 Adoptium(Temurin)에서 실제 배포되는 버전을 불러오며, "자세히 보기"로 비-LTS·스냅샷까지 확인할 수 있습니다. 설치기는 이 권장 버전을 기준으로 동작합니다.
|
||||||
- **자동 설치** 버튼을 누르면 Adoptium Temurin 21 LTS Windows x64 zip 을 받아 `%APPDATA%\jdk\temurin-21\` 에 풀어 사용합니다.
|
- 탐색 순서:
|
||||||
|
1. **설치기 자동 설치 위치 `%APPDATA%\.mc_custom\jdk`**(구버전 `%APPDATA%\jdk` 호환)에 JDK 가 있으면 **가장 먼저 사용**합니다(권장 버전이면 그대로, 혹시 다른 버전이면 경고).
|
||||||
|
2. 없으면 **환경변수(`JAVA_HOME` / `JDK_HOME`)** 의 JDK 가 **권장 버전이면** 사용합니다.
|
||||||
|
3. 그래도 없으면 **기본 폴더 `C:\Program Files\Java`** 에서 **권장 버전**을 찾아 사용합니다.
|
||||||
|
4. 권장 버전을 어디서도 못 찾으면 **환경변수 자바(없으면 Program Files 자바)로 폴백**하고, "권장 버전과 달라 서버가 정상 실행되지 않을 수 있다"는 **경고**를 띄웁니다.
|
||||||
|
- 직접 선택/입력한 경로도 "다음" 에서 검증해, 권장과 다르면 경고 후 동의(확인) 시에만 진행합니다(무조건 차단이 아니라 경고+동의). 아무 JDK 도 없으면 자동 설치로 유도합니다.
|
||||||
|
- **자동 설치** 버튼을 누르면 Adoptium Temurin(권장 버전) Windows x64 zip 을 받아 **`%APPDATA%\.mc_custom\jdk\temurin-<권장>\`** 에 풀어 사용합니다. (`.mc_custom` 안에 두므로 "음악퀴즈 파일제거" 도구로 한 번에 정리됩니다. `MC_CUSTOM_DIR` 로 폴더명을 바꾼 경우 그 폴더 아래 `jdk`.)
|
||||||
- 설치 중 같은 버튼이 "설치 취소" 로 바뀌고, 누르면 다운로드를 즉시 중단하고 부분 파일을 정리합니다.
|
- 설치 중 같은 버튼이 "설치 취소" 로 바뀌고, 누르면 다운로드를 즉시 중단하고 부분 파일을 정리합니다.
|
||||||
|
- 서버 zip 의 `run.bat` 이 시스템 PATH 의 `java` 를 그대로 쓰면 낡은 자바로 실행돼 실패할 수 있어, 설치기가 준비/선택한 JDK 의 `java` 를 쓰도록 `run.bat` 을 자동으로 수정합니다(자동 설치 JDK 는 `%APPDATA%` 전개형 경로라 한글 사용자명에도 안전).
|
||||||
|
|
||||||
### 3-3. 서버 다운로드 및 설치
|
### 3-3. 서버 다운로드 및 설치
|
||||||
|
|
||||||
@@ -71,7 +78,7 @@
|
|||||||
2. `.minecraft` 최상위 설정 파일(`options.txt`, `optionsof.txt`, `servers.dat`, `usercache.json`, …) 을 `.mc_custom` 으로 복사. 이미 같은 이름이 있으면 보존.
|
2. `.minecraft` 최상위 설정 파일(`options.txt`, `optionsof.txt`, `servers.dat`, `usercache.json`, …) 을 `.mc_custom` 으로 복사. 이미 같은 이름이 있으면 보존.
|
||||||
3. 플랫폼 설치:
|
3. 플랫폼 설치:
|
||||||
- `vanilla` → 건너뜀.
|
- `vanilla` → 건너뜀.
|
||||||
- `fabric` → Adoptium 자동 설치 → 최신 fabric-installer.jar 다운로드 → `java -jar fabric-installer.jar client -mcversion X -loader Y -dir .mc_custom -noprofile` 자동 실행.
|
- `fabric` → Adoptium 자동 설치 → 최신 fabric-installer.jar 다운로드 → `java -jar fabric-installer.jar client -mcversion X -loader Y -dir .minecraft -noprofile` 자동 실행. (fabric 버전/라이브러리는 런처 폴더 `.minecraft` 에 바닐라와 함께 설치해야 런처가 찾을 수 있다. `.mc_custom` 에 설치하면 바닐라 버전·라이브러리가 빠져 "Unable to prepare assets for download" 로 실패한다.)
|
||||||
- `forge` / `neoforge` → `platform.downloadUrl` 의 설치 jar 다운로드(사용자가 직접 실행하거나 마인크래프트 런처가 인식).
|
- `forge` / `neoforge` → `platform.downloadUrl` 의 설치 jar 다운로드(사용자가 직접 실행하거나 마인크래프트 런처가 인식).
|
||||||
4. `modsFolder` 의 모든 `.jar` 와 `resourcepackPath` zip, `mapPath` zip 을 자동 다운로드.
|
4. `modsFolder` 의 모든 `.jar` 와 `resourcepackPath` zip, `mapPath` zip 을 자동 다운로드.
|
||||||
5. `.minecraft\{assets,libraries,versions}` 를 `.mc_custom\{assets,libraries,versions}` 로 junction 링크. (없으면 "Unable to prepare assets for download" 오류로 마인크래프트가 실패하기 때문)
|
5. `.minecraft\{assets,libraries,versions}` 를 `.mc_custom\{assets,libraries,versions}` 로 junction 링크. (없으면 "Unable to prepare assets for download" 오류로 마인크래프트가 실패하기 때문)
|
||||||
|
|||||||
@@ -189,63 +189,61 @@ function showAgreementError(message) {
|
|||||||
section.querySelector('#retry').addEventListener('click', renderAgreement)
|
section.querySelector('#retry').addEventListener('click', renderAgreement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 약관을 한 건씩 페이지로 보여준다. 각 약관마다 "해당 약관에 동의합니다" 체크가 있고,
|
||||||
|
// 끝까지 스크롤해 읽어야 체크할 수 있으며, [다음] 을 누르면 다음 약관 페이지가 화면
|
||||||
|
// 맨 위에서부터 나온다. 마지막 약관까지 동의하면 다음 단계(step2)로 진행한다.
|
||||||
function renderAgreementWithKinds(KINDS) {
|
function renderAgreementWithKinds(KINDS) {
|
||||||
|
var idx = 0
|
||||||
|
var accepted = {} // kind -> true (뒤로 갔다 와도 동의 상태 유지)
|
||||||
|
var cache = {} // kind -> 렌더된 HTML
|
||||||
|
|
||||||
var section = document.createElement('section')
|
var section = document.createElement('section')
|
||||||
section.className = 'page'
|
section.className = 'page'
|
||||||
|
pageHost.appendChild(section)
|
||||||
|
|
||||||
|
function renderCurrent() {
|
||||||
|
var k = KINDS[idx]
|
||||||
|
var isLast = idx === KINDS.length - 1
|
||||||
section.innerHTML =
|
section.innerHTML =
|
||||||
'<h2>' + escapeHtml(tt('agreement.heading')) + '</h2>' +
|
'<h2>' + escapeHtml(tt('agreement.heading')) + '</h2>' +
|
||||||
'<p class="formMessage">' + escapeHtml(tt('agreement.intro')) + '</p>' +
|
'<p class="formMessage">' + escapeHtml(tt('agreement.stepLabel', { current: idx + 1, total: KINDS.length, label: k.tab })) + '</p>' +
|
||||||
'<div class="tabBar" id="agTabs">' +
|
'<div class="agreementBody" id="agBody" style="border-radius:10px;">' + escapeHtml(tt('agreement.loading')) + '</div>' +
|
||||||
KINDS.map(function (k, i) {
|
'<div class="formMessage" id="agHint">' + escapeHtml(tt('agreement.readToBottom')) + '</div>' +
|
||||||
return '<button type="button" class="tabBtn' + (i === 0 ? ' active' : '') + '" data-ag="' + k.id + '">' + escapeHtml(k.tab) + '</button>'
|
'<label class="toggleRow" style="margin-top:8px;"><input type="checkbox" id="agAccept" disabled /> ' +
|
||||||
}).join('') +
|
escapeHtml(tt('agreement.agreeThis')) + '</label>' +
|
||||||
'</div>' +
|
|
||||||
'<div class="agreementBody" id="agBody">' + escapeHtml(tt('agreement.loading')) + '</div>' +
|
|
||||||
'<label class="toggleRow" style="margin-top:12px;"><input type="checkbox" id="agAccept" /> ' +
|
|
||||||
escapeHtml(tt('agreement.agreeAll')) + '</label>' +
|
|
||||||
'<div class="formMessage" id="agMsg"></div>' +
|
'<div class="formMessage" id="agMsg"></div>' +
|
||||||
'<div class="actionRow">' +
|
'<div class="actionRow">' +
|
||||||
' <button class="secondaryBtn" id="back">' + escapeHtml(tt('common.back')) + '</button>' +
|
' <button class="secondaryBtn" id="back">' + escapeHtml(tt('common.back')) + '</button>' +
|
||||||
' <button class="primaryBtn" id="next" disabled>' + escapeHtml(tt('common.next')) + '</button>' +
|
' <button class="primaryBtn" id="next" disabled>' + escapeHtml(tt('common.next')) + '</button>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
pageHost.appendChild(section)
|
|
||||||
|
|
||||||
var body = section.querySelector('#agBody')
|
var body = section.querySelector('#agBody')
|
||||||
var tabs = section.querySelectorAll('[data-ag]')
|
|
||||||
var nextBtn = section.querySelector('#next')
|
|
||||||
var accept = section.querySelector('#agAccept')
|
var accept = section.querySelector('#agAccept')
|
||||||
|
var nextBtn = section.querySelector('#next')
|
||||||
var msg = section.querySelector('#agMsg')
|
var msg = section.querySelector('#agMsg')
|
||||||
|
var hint = section.querySelector('#agHint')
|
||||||
|
|
||||||
// 본문 캐시. 탭 전환 시 재요청하지 않음.
|
// 새 약관 페이지는 화면 맨 위에서부터 보이도록 스크롤을 올린다.
|
||||||
var cache = {}
|
if (pageHost) pageHost.scrollTop = 0
|
||||||
|
|
||||||
function showKind(kind) {
|
// 약관 본문이 정상 로드된 뒤에만 동의를 허용한다. 로드 실패 상태에서는
|
||||||
if (cache[kind]) { body.innerHTML = cache[kind]; return }
|
// 스크롤을 해도 동의 체크가 켜지지 않는다("무조건 약관을 읽도록").
|
||||||
body.textContent = tt('agreement.loading')
|
var termLoaded = false
|
||||||
api.getTerm(kind).then(function (res) {
|
|
||||||
if (!res.ok) {
|
function markReadable() {
|
||||||
body.innerHTML = '<p class="formMessage error">' + escapeHtml(tt('agreement.loadFailed', { message: res.message || '' })) + '</p>'
|
if (!termLoaded || !accept.disabled) return
|
||||||
return
|
accept.disabled = false
|
||||||
|
hint.textContent = ''
|
||||||
}
|
}
|
||||||
var html = renderTermsMarkdown(res.content || '')
|
function checkScrolled() {
|
||||||
cache[kind] = html
|
if (body.scrollHeight - body.scrollTop - body.clientHeight <= 6) markReadable()
|
||||||
body.innerHTML = html
|
|
||||||
}).catch(function (err) {
|
|
||||||
body.innerHTML = '<p class="formMessage error">' + escapeHtml(tt('agreement.loadFailed', { message: err.message })) + '</p>'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
body.addEventListener('scroll', checkScrolled)
|
||||||
tabs.forEach(function (b) {
|
|
||||||
b.addEventListener('click', function () {
|
|
||||||
tabs.forEach(function (x) { x.classList.remove('active') })
|
|
||||||
b.classList.add('active')
|
|
||||||
showKind(b.getAttribute('data-ag'))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
accept.addEventListener('change', function () {
|
accept.addEventListener('change', function () {
|
||||||
|
accepted[k.id] = accept.checked
|
||||||
nextBtn.disabled = !accept.checked
|
nextBtn.disabled = !accept.checked
|
||||||
if (accept.checked) msg.textContent = ''
|
if (accept.checked) { msg.textContent = ''; msg.classList.remove('error') }
|
||||||
})
|
})
|
||||||
|
|
||||||
nextBtn.addEventListener('click', function () {
|
nextBtn.addEventListener('click', function () {
|
||||||
@@ -254,11 +252,69 @@ function renderAgreementWithKinds(KINDS) {
|
|||||||
msg.classList.add('error')
|
msg.classList.add('error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
renderStep2()
|
if (isLast) renderStep2()
|
||||||
|
else { idx++; renderCurrent() }
|
||||||
|
})
|
||||||
|
section.querySelector('#back').addEventListener('click', function () {
|
||||||
|
if (idx === 0) renderStep1()
|
||||||
|
else { idx--; renderCurrent() }
|
||||||
})
|
})
|
||||||
section.querySelector('#back').addEventListener('click', renderStep1)
|
|
||||||
|
|
||||||
showKind(KINDS[0].id)
|
function afterLoad() {
|
||||||
|
termLoaded = true
|
||||||
|
body.scrollTop = 0
|
||||||
|
if (accepted[k.id]) {
|
||||||
|
accept.disabled = false
|
||||||
|
accept.checked = true
|
||||||
|
nextBtn.disabled = false
|
||||||
|
hint.textContent = ''
|
||||||
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
if (body.scrollHeight - body.clientHeight <= 6) markReadable()
|
||||||
|
else checkScrolled()
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 약관 본문 로드 실패: 동의 불가 상태를 유지하고 다시 시도만 허용한다.
|
||||||
|
function showLoadError(message) {
|
||||||
|
termLoaded = false
|
||||||
|
accept.disabled = true
|
||||||
|
accept.checked = false
|
||||||
|
accepted[k.id] = false
|
||||||
|
nextBtn.disabled = true
|
||||||
|
hint.textContent = tt('agreement.readToBottom')
|
||||||
|
body.innerHTML =
|
||||||
|
'<p class="formMessage error">' + escapeHtml(tt('agreement.loadFailed', { message: message || '' })) + '</p>' +
|
||||||
|
'<div class="actionRow" style="margin-top:10px;"><button class="secondaryBtn" id="agRetry">' + escapeHtml(tt('agreement.retry')) + '</button></div>'
|
||||||
|
var retry = section.querySelector('#agRetry')
|
||||||
|
if (retry) retry.addEventListener('click', loadTerm)
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadTerm() {
|
||||||
|
if (cache[k.id]) {
|
||||||
|
body.innerHTML = cache[k.id]
|
||||||
|
afterLoad()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
body.textContent = tt('agreement.loading')
|
||||||
|
api.getTerm(k.id).then(function (res) {
|
||||||
|
if (!res.ok) {
|
||||||
|
showLoadError(res.message || '')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var html = renderTermsMarkdown(res.content || '')
|
||||||
|
cache[k.id] = html
|
||||||
|
body.innerHTML = html
|
||||||
|
afterLoad()
|
||||||
|
}).catch(function (err) {
|
||||||
|
showLoadError(err && err.message ? err.message : '')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTerm()
|
||||||
|
}
|
||||||
|
|
||||||
|
renderCurrent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 인스톨러용 미니 markdown 렌더러. 사이트 termsEditor 와 같은 규칙을 처리한다.
|
// 인스톨러용 미니 markdown 렌더러. 사이트 termsEditor 와 같은 규칙을 처리한다.
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ function renderStep1() {
|
|||||||
tt('step1.subtitle', { mc: pack.pack.mcVersion, platform: pack.pack.platform.type }) + '</small>'
|
tt('step1.subtitle', { mc: pack.pack.mcVersion, platform: pack.pack.platform.type }) + '</small>'
|
||||||
if (state.selectedPackKey === pack.key) btn.classList.add('selected')
|
if (state.selectedPackKey === pack.key) btn.classList.add('selected')
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
|
// 팩이 바뀌면 최종 리소스팩 처리 상태를 초기화(새 팩의 설치 여부를 다시 묻도록).
|
||||||
|
if (state.selectedPackKey !== pack.key) state.finalRpHandled = false
|
||||||
state.selectedPackKey = pack.key
|
state.selectedPackKey = pack.key
|
||||||
nextBtn.disabled = false
|
nextBtn.disabled = false
|
||||||
renderList()
|
renderList()
|
||||||
@@ -232,63 +234,62 @@ function showAgreementError(message) {
|
|||||||
section.querySelector('#retry').addEventListener('click', renderAgreement)
|
section.querySelector('#retry').addEventListener('click', renderAgreement)
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAgreementWithKinds(KINDS) {
|
// 약관을 한 건씩 페이지로 보여준다. 각 약관마다 "해당 약관에 동의합니다" 체크가 있고,
|
||||||
|
// 끝까지 스크롤해 읽어야 체크할 수 있으며, [다음] 을 누르면 다음 약관 페이지가 화면
|
||||||
|
// 맨 위에서부터 나온다. 마지막 약관까지 동의하면 다음 단계(step2)로 진행한다.
|
||||||
|
function renderAgreementWithKinds(KINDS, opts) {
|
||||||
|
opts = opts || {}
|
||||||
|
var onComplete = opts.onComplete || renderStep2 // 마지막 약관 동의 후
|
||||||
|
var onBack = opts.onBack || renderStep1 // 첫 약관에서 뒤로
|
||||||
|
var idx = 0
|
||||||
|
var accepted = {} // kind -> true (뒤로 갔다 와도 동의 상태 유지)
|
||||||
|
var cache = {} // kind -> 렌더된 HTML
|
||||||
|
|
||||||
var section = document.createElement('section')
|
var section = document.createElement('section')
|
||||||
section.className = 'page'
|
section.className = 'page'
|
||||||
section.innerHTML =
|
|
||||||
'<h2>' + tt('agreement.heading') + '</h2>' +
|
|
||||||
'<p class="formMessage">' + tt('agreement.intro') + '</p>' +
|
|
||||||
'<div class="tabBar" id="agTabs">' +
|
|
||||||
KINDS.map(function (k, i) {
|
|
||||||
return '<button type="button" class="tabBtn' + (i === 0 ? ' active' : '') + '" data-ag="' + escapeHtml(k.id) + '">' + escapeHtml(k.tab) + '</button>'
|
|
||||||
}).join('') +
|
|
||||||
'</div>' +
|
|
||||||
'<div class="agreementBody" id="agBody">' + tt('agreement.loading') + '</div>' +
|
|
||||||
'<label class="toggleRow" style="margin-top:12px;"><input type="checkbox" id="agAccept" /> ' +
|
|
||||||
tt('agreement.agreeAll') + '</label>' +
|
|
||||||
'<div class="formMessage" id="agMsg"></div>' +
|
|
||||||
'<div class="actionRow"><button class="secondaryBtn" id="back">' + tt('common.back') + '</button><button class="primaryBtn" id="next" disabled>' + tt('common.next') + '</button></div>'
|
|
||||||
pageHost.appendChild(section)
|
pageHost.appendChild(section)
|
||||||
|
|
||||||
|
function renderCurrent() {
|
||||||
|
var k = KINDS[idx]
|
||||||
|
var isLast = idx === KINDS.length - 1
|
||||||
|
section.innerHTML =
|
||||||
|
'<h2>' + tt('agreement.heading') + '</h2>' +
|
||||||
|
'<p class="formMessage">' + escapeHtml(tt('agreement.stepLabel', { current: idx + 1, total: KINDS.length, label: k.tab })) + '</p>' +
|
||||||
|
'<div class="agreementBody" id="agBody" style="border-radius:10px;">' + tt('agreement.loading') + '</div>' +
|
||||||
|
'<div class="formMessage" id="agHint">' + tt('agreement.readToBottom') + '</div>' +
|
||||||
|
'<label class="toggleRow" style="margin-top:8px;"><input type="checkbox" id="agAccept" disabled /> ' +
|
||||||
|
tt('agreement.agreeThis') + '</label>' +
|
||||||
|
'<div class="formMessage" id="agMsg"></div>' +
|
||||||
|
'<div class="actionRow"><button class="secondaryBtn" id="back">' + tt('common.back') + '</button><button class="primaryBtn" id="next" disabled>' + tt('common.next') + '</button></div>'
|
||||||
|
|
||||||
var body = section.querySelector('#agBody')
|
var body = section.querySelector('#agBody')
|
||||||
var tabs = section.querySelectorAll('[data-ag]')
|
|
||||||
var nextBtn = section.querySelector('#next')
|
|
||||||
var accept = section.querySelector('#agAccept')
|
var accept = section.querySelector('#agAccept')
|
||||||
|
var nextBtn = section.querySelector('#next')
|
||||||
var msg = section.querySelector('#agMsg')
|
var msg = section.querySelector('#agMsg')
|
||||||
|
var hint = section.querySelector('#agHint')
|
||||||
|
|
||||||
// 약관 본문은 한 번 받으면 캐시. 탭 전환 시 재요청하지 않는다.
|
// 새 약관 페이지는 화면 맨 위에서부터 보이도록 스크롤을 올린다.
|
||||||
var cache = {}
|
if (pageHost) pageHost.scrollTop = 0
|
||||||
|
|
||||||
function showKind(kind) {
|
// 약관 본문이 정상 로드된 뒤에만 동의를 허용한다. 로드 실패 상태에서는
|
||||||
if (cache[kind]) {
|
// 스크롤을 해도 동의 체크가 켜지지 않는다("무조건 약관을 읽도록").
|
||||||
body.innerHTML = cache[kind]
|
var termLoaded = false
|
||||||
return
|
|
||||||
}
|
|
||||||
body.textContent = tt('agreement.loading')
|
|
||||||
installerApi.getTerm(kind).then(function (res) {
|
|
||||||
if (!res.ok) {
|
|
||||||
body.innerHTML = '<p class="formMessage error">' + tt('agreement.loadFailed', { message: res.message || '' }) + '</p>'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var html = renderTermsMarkdown(res.content || '')
|
|
||||||
cache[kind] = html
|
|
||||||
body.innerHTML = html
|
|
||||||
}).catch(function (err) {
|
|
||||||
body.innerHTML = '<p class="formMessage error">' + tt('agreement.loadFailed', { message: err.message }) + '</p>'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
tabs.forEach(function (b) {
|
function markReadable() {
|
||||||
b.addEventListener('click', function () {
|
if (!termLoaded || !accept.disabled) return
|
||||||
tabs.forEach(function (x) { x.classList.remove('active') })
|
accept.disabled = false
|
||||||
b.classList.add('active')
|
hint.textContent = ''
|
||||||
showKind(b.getAttribute('data-ag'))
|
}
|
||||||
})
|
function checkScrolled() {
|
||||||
})
|
// 본문을 끝까지(하단 근처) 내렸으면 동의 체크를 허용한다.
|
||||||
|
if (body.scrollHeight - body.scrollTop - body.clientHeight <= 6) markReadable()
|
||||||
|
}
|
||||||
|
body.addEventListener('scroll', checkScrolled)
|
||||||
|
|
||||||
accept.addEventListener('change', function () {
|
accept.addEventListener('change', function () {
|
||||||
|
accepted[k.id] = accept.checked
|
||||||
nextBtn.disabled = !accept.checked
|
nextBtn.disabled = !accept.checked
|
||||||
if (accept.checked) msg.textContent = ''
|
if (accept.checked) { msg.textContent = ''; msg.classList.remove('error') }
|
||||||
})
|
})
|
||||||
|
|
||||||
nextBtn.addEventListener('click', function () {
|
nextBtn.addEventListener('click', function () {
|
||||||
@@ -297,11 +298,71 @@ function renderAgreementWithKinds(KINDS) {
|
|||||||
msg.classList.add('error')
|
msg.classList.add('error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
renderStep2()
|
if (isLast) onComplete()
|
||||||
|
else { idx++; renderCurrent() }
|
||||||
|
})
|
||||||
|
section.querySelector('#back').addEventListener('click', function () {
|
||||||
|
if (idx === 0) onBack()
|
||||||
|
else { idx--; renderCurrent() }
|
||||||
})
|
})
|
||||||
section.querySelector('#back').addEventListener('click', renderStep1)
|
|
||||||
|
|
||||||
showKind(KINDS[0].id)
|
function afterLoad() {
|
||||||
|
termLoaded = true
|
||||||
|
body.scrollTop = 0
|
||||||
|
// 이미 동의했던 약관으로 되돌아온 경우: 체크/다음 활성화 유지.
|
||||||
|
if (accepted[k.id]) {
|
||||||
|
accept.disabled = false
|
||||||
|
accept.checked = true
|
||||||
|
nextBtn.disabled = false
|
||||||
|
hint.textContent = ''
|
||||||
|
}
|
||||||
|
// 레이아웃 확정 후: 스크롤이 필요 없을 만큼 짧은 약관이면 바로 동의 허용.
|
||||||
|
setTimeout(function () {
|
||||||
|
if (body.scrollHeight - body.clientHeight <= 6) markReadable()
|
||||||
|
else checkScrolled()
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 약관 본문 로드 실패: 동의 불가 상태를 유지하고 다시 시도만 허용한다.
|
||||||
|
function showLoadError(message) {
|
||||||
|
termLoaded = false
|
||||||
|
accept.disabled = true
|
||||||
|
accept.checked = false
|
||||||
|
accepted[k.id] = false
|
||||||
|
nextBtn.disabled = true
|
||||||
|
hint.textContent = tt('agreement.readToBottom')
|
||||||
|
body.innerHTML =
|
||||||
|
'<p class="formMessage error">' + tt('agreement.loadFailed', { message: message || '' }) + '</p>' +
|
||||||
|
'<div class="actionRow" style="margin-top:10px;"><button class="secondaryBtn" id="agRetry">' + tt('agreement.retry') + '</button></div>'
|
||||||
|
var retry = section.querySelector('#agRetry')
|
||||||
|
if (retry) retry.addEventListener('click', loadTerm)
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadTerm() {
|
||||||
|
if (cache[k.id]) {
|
||||||
|
body.innerHTML = cache[k.id]
|
||||||
|
afterLoad()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
body.textContent = tt('agreement.loading')
|
||||||
|
installerApi.getTerm(k.id).then(function (res) {
|
||||||
|
if (!res.ok) {
|
||||||
|
showLoadError(res.message || '')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var html = renderTermsMarkdown(res.content || '')
|
||||||
|
cache[k.id] = html
|
||||||
|
body.innerHTML = html
|
||||||
|
afterLoad()
|
||||||
|
}).catch(function (err) {
|
||||||
|
showLoadError(err && err.message ? err.message : '')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTerm()
|
||||||
|
}
|
||||||
|
|
||||||
|
renderCurrent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 인스톨러용 미니 markdown 렌더러. 사이트 termsEditor 와 동일한 규칙을 처리한다.
|
// 인스톨러용 미니 markdown 렌더러. 사이트 termsEditor 와 동일한 규칙을 처리한다.
|
||||||
@@ -537,10 +598,17 @@ function renderSubStep31(host, back, done) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSubStep32(host, back, done) {
|
function renderSubStep32(host, back, done) {
|
||||||
|
// 선택한 음악퀴즈(pack)의 권장 JDK. 설치기는 이 버전을 우선 찾고/설치한다.
|
||||||
|
var selPack = (state.packs && state.packs.find)
|
||||||
|
? state.packs.find(function (p) { return p.key === state.selectedPackKey })
|
||||||
|
: null
|
||||||
|
var recommendedJdk = (selPack && selPack.pack && selPack.pack.recommendedJdk) ? selPack.pack.recommendedJdk : 25
|
||||||
|
|
||||||
host.innerHTML =
|
host.innerHTML =
|
||||||
'<h3>' + tt('step3.sub32.heading') + '</h3>' +
|
'<h3>' + tt('step3.sub32.heading') + '</h3>' +
|
||||||
'<p class="formMessage">' + tt('step3.sub32.description') + '</p>' +
|
'<p class="formMessage">' + tt('step3.sub32.description') + '</p>' +
|
||||||
'<div class="fieldset"><label><input id="jdkPath" type="text" placeholder="C:\\Program Files\\Java\\jdk-17" value="' + (state.serverInstall.jdk || '') + '" /></label>' +
|
'<p class="formMessage"><strong>' + tt('step3.sub32.recommended', { major: recommendedJdk }) + '</strong></p>' +
|
||||||
|
'<div class="fieldset"><label><input id="jdkPath" type="text" placeholder="C:\\Program Files\\Java\\jdk-' + recommendedJdk + '" value="' + (state.serverInstall.jdk || '') + '" /></label>' +
|
||||||
'<button class="secondaryBtn" id="pickJdk">' + tt('step3.sub32.pickFolder') + '</button>' +
|
'<button class="secondaryBtn" id="pickJdk">' + tt('step3.sub32.pickFolder') + '</button>' +
|
||||||
'<button class="secondaryBtn" id="auto">' + tt('step3.sub32.auto') + '</button>' +
|
'<button class="secondaryBtn" id="auto">' + tt('step3.sub32.auto') + '</button>' +
|
||||||
'<button class="secondaryBtn" id="install">' + tt('step3.sub32.install') + '</button></div>' +
|
'<button class="secondaryBtn" id="install">' + tt('step3.sub32.install') + '</button></div>' +
|
||||||
@@ -577,14 +645,20 @@ function renderSubStep32(host, back, done) {
|
|||||||
|
|
||||||
autoBtn.addEventListener('click', async function () {
|
autoBtn.addEventListener('click', async function () {
|
||||||
if (installing) return
|
if (installing) return
|
||||||
var detect = await installerApi.detectJdk()
|
var detect = await installerApi.detectJdk(recommendedJdk)
|
||||||
if (detect.found) {
|
if (detect.found && detect.match) {
|
||||||
input.value = detect.path
|
input.value = detect.path
|
||||||
msg.textContent = tt('step3.sub32.found', { path: detect.path })
|
msg.textContent = tt('step3.sub32.foundRecommended', { path: detect.path, major: recommendedJdk })
|
||||||
msg.classList.remove('error')
|
msg.classList.remove('error')
|
||||||
msg.classList.add('success')
|
msg.classList.add('success')
|
||||||
|
} else if (detect.found) {
|
||||||
|
// 권장 버전이 아닌 다른 JDK 를 찾음 → 경고와 함께 채워 넣는다.
|
||||||
|
input.value = detect.path
|
||||||
|
msg.textContent = tt('step3.sub32.foundMismatch', { path: detect.path, major: detect.major, required: recommendedJdk })
|
||||||
|
msg.classList.remove('success')
|
||||||
|
msg.classList.add('error')
|
||||||
} else {
|
} else {
|
||||||
msg.textContent = tt('step3.sub32.notFound')
|
msg.textContent = tt('step3.sub32.notFound', { major: recommendedJdk })
|
||||||
msg.classList.remove('success')
|
msg.classList.remove('success')
|
||||||
msg.classList.add('error')
|
msg.classList.add('error')
|
||||||
}
|
}
|
||||||
@@ -606,7 +680,7 @@ function renderSubStep32(host, back, done) {
|
|||||||
msg.classList.remove('success', 'error')
|
msg.classList.remove('success', 'error')
|
||||||
msg.textContent = tt('step3.sub32.downloading')
|
msg.textContent = tt('step3.sub32.downloading')
|
||||||
try {
|
try {
|
||||||
var result = await installerApi.installJdk()
|
var result = await installerApi.installJdk(recommendedJdk)
|
||||||
if (result.ok && result.path) {
|
if (result.ok && result.path) {
|
||||||
input.value = result.path
|
input.value = result.path
|
||||||
state.serverInstall.jdk = result.path
|
state.serverInstall.jdk = result.path
|
||||||
@@ -630,24 +704,62 @@ function renderSubStep32(host, back, done) {
|
|||||||
if (installing) return
|
if (installing) return
|
||||||
back()
|
back()
|
||||||
})
|
})
|
||||||
nextBtn.addEventListener('click', function () {
|
nextBtn.addEventListener('click', async function () {
|
||||||
if (installing) return
|
if (installing) return
|
||||||
if (!input.value.trim()) {
|
var val = input.value.trim()
|
||||||
|
if (!val) {
|
||||||
msg.textContent = tt('step3.sub32.pathRequired')
|
msg.textContent = tt('step3.sub32.pathRequired')
|
||||||
msg.classList.add('error')
|
msg.classList.add('error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.serverInstall.jdk = input.value.trim()
|
// 직접 입력/선택한 JDK 를 확인한다. 자바를 못 읽으면 진행을 막고, 권장과 다른
|
||||||
|
// 버전이면 "정상 실행이 안 될 수 있다"는 경고를 띄운 뒤 사용자가 동의하면 진행한다.
|
||||||
|
nextBtn.disabled = true
|
||||||
|
msg.classList.remove('success', 'error')
|
||||||
|
msg.textContent = tt('step3.sub32.verifying')
|
||||||
|
var required = recommendedJdk
|
||||||
|
try {
|
||||||
|
var v = await installerApi.verifyJdk(val, recommendedJdk)
|
||||||
|
required = (v && v.required) || recommendedJdk
|
||||||
|
if (!v || !v.major) {
|
||||||
|
msg.classList.add('error')
|
||||||
|
msg.textContent = tt('step3.sub32.versionUnknown')
|
||||||
|
nextBtn.disabled = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!v.match) {
|
||||||
|
// 권장 버전과 다름 → 경고 후 동의 시에만 계속.
|
||||||
|
var proceed = window.confirm(tt('step3.sub32.mismatchConfirm', { major: v.major, required: required }))
|
||||||
|
if (!proceed) {
|
||||||
|
msg.classList.add('error')
|
||||||
|
msg.textContent = tt('step3.sub32.foundMismatch', { path: val, major: v.major, required: required })
|
||||||
|
nextBtn.disabled = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
msg.classList.add('error')
|
||||||
|
msg.textContent = tt('step3.sub32.versionUnknown')
|
||||||
|
nextBtn.disabled = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nextBtn.disabled = false
|
||||||
|
state.serverInstall.jdk = val
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
;(async function () {
|
;(async function () {
|
||||||
var detect = await installerApi.detectJdk()
|
var detect = await installerApi.detectJdk(recommendedJdk)
|
||||||
if (detect.found && !input.value) {
|
if (detect.found && !input.value) {
|
||||||
input.value = detect.path
|
input.value = detect.path
|
||||||
msg.textContent = tt('step3.sub32.autoDetected', { path: detect.path })
|
if (detect.match) {
|
||||||
|
msg.textContent = tt('step3.sub32.foundRecommended', { path: detect.path, major: recommendedJdk })
|
||||||
msg.classList.add('success')
|
msg.classList.add('success')
|
||||||
|
} else {
|
||||||
|
msg.textContent = tt('step3.sub32.foundMismatch', { path: detect.path, major: detect.major, required: recommendedJdk })
|
||||||
|
msg.classList.add('error')
|
||||||
|
}
|
||||||
} else if (!detect.found) {
|
} else if (!detect.found) {
|
||||||
msg.textContent = tt('step3.sub32.notFoundHint')
|
msg.textContent = tt('step3.sub32.notFoundHint', { major: recommendedJdk })
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
@@ -949,9 +1061,154 @@ function renderSubStep42(host, back, done) {
|
|||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 최종 리소스팩 설치 여부 질문 (예/아니요).
|
||||||
|
function renderResourcepackPrompt() {
|
||||||
|
setActiveStep(5)
|
||||||
|
clearPage()
|
||||||
|
var section = document.createElement('section')
|
||||||
|
section.className = 'page'
|
||||||
|
section.innerHTML =
|
||||||
|
'<h2>' + tt('resourcepack.promptHeading') + '</h2>' +
|
||||||
|
'<p class="formMessage">' + escapeHtml(tt('resourcepack.promptBody')) + '</p>' +
|
||||||
|
'<div class="actionRow">' +
|
||||||
|
' <button class="secondaryBtn" id="rpNo">' + tt('resourcepack.no') + '</button>' +
|
||||||
|
' <button class="primaryBtn" id="rpYes">' + tt('resourcepack.yes') + '</button>' +
|
||||||
|
'</div>'
|
||||||
|
pageHost.appendChild(section)
|
||||||
|
section.querySelector('#rpNo').addEventListener('click', function () {
|
||||||
|
state.finalRpHandled = true
|
||||||
|
renderStep5()
|
||||||
|
})
|
||||||
|
section.querySelector('#rpYes').addEventListener('click', renderResourcepackTerms)
|
||||||
|
}
|
||||||
|
|
||||||
|
// "예" → 최종 리소스팩 다운로드 약관(showInFinalResourcepack) 동의 → 다운로드.
|
||||||
|
function renderResourcepackTerms() {
|
||||||
|
setActiveStep(5)
|
||||||
|
clearPage()
|
||||||
|
var loading = document.createElement('section')
|
||||||
|
loading.className = 'page'
|
||||||
|
loading.innerHTML = '<h2>' + tt('agreement.heading') + '</h2><p class="formMessage">' + tt('agreement.loading') + '</p>'
|
||||||
|
pageHost.appendChild(loading)
|
||||||
|
installerApi.getFinalTermsList().then(function (res) {
|
||||||
|
if (!res || !res.ok) {
|
||||||
|
showResourcepackTermsError((res && res.message) || 'unknown')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var terms = (res.terms || []).map(function (t) { return { id: t.kind, tab: t.label } })
|
||||||
|
if (terms.length === 0) {
|
||||||
|
// 표시할 약관이 없으면 약관 단계를 건너뛰고 바로 다운로드.
|
||||||
|
downloadFinalResourcepack()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
clearPage()
|
||||||
|
renderAgreementWithKinds(terms, { onComplete: downloadFinalResourcepack, onBack: renderResourcepackPrompt })
|
||||||
|
}).catch(function (err) {
|
||||||
|
showResourcepackTermsError(err && err.message ? err.message : 'unknown')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function showResourcepackTermsError(message) {
|
||||||
|
clearPage()
|
||||||
|
var section = document.createElement('section')
|
||||||
|
section.className = 'page'
|
||||||
|
section.innerHTML =
|
||||||
|
'<h2>' + tt('agreement.heading') + '</h2>' +
|
||||||
|
'<p class="formMessage error">' + escapeHtml(tt('agreement.listLoadFailed', { message: message })) + '</p>' +
|
||||||
|
'<div class="actionRow">' +
|
||||||
|
' <button class="secondaryBtn" id="back">' + tt('common.back') + '</button>' +
|
||||||
|
' <button class="primaryBtn" id="retry">' + tt('agreement.retry') + '</button>' +
|
||||||
|
'</div>'
|
||||||
|
pageHost.appendChild(section)
|
||||||
|
section.querySelector('#back').addEventListener('click', renderResourcepackPrompt)
|
||||||
|
section.querySelector('#retry').addEventListener('click', renderResourcepackTerms)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 약관 동의 후 최종 리소스팩 실제 다운로드 → 완료되면 완료 화면으로.
|
||||||
|
function downloadFinalResourcepack() {
|
||||||
|
setActiveStep(5)
|
||||||
|
clearPage()
|
||||||
|
var section = document.createElement('section')
|
||||||
|
section.className = 'page'
|
||||||
|
section.innerHTML =
|
||||||
|
'<h2>' + tt('resourcepack.downloadHeading') + '</h2>' +
|
||||||
|
'<div class="formMessage" id="rpMsg">' + tt('resourcepack.downloading') + '</div>' +
|
||||||
|
'<div id="rpBarWrap" style="margin-top:10px;height:16px;background:rgba(255,255,255,0.08);border:1px solid var(--border,#30363d);border-radius:8px;overflow:hidden;">' +
|
||||||
|
' <div id="rpBar" style="height:100%;width:0%;background:var(--accent,#6cf);transition:width 0.15s;"></div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="formMessage" id="rpPercent" style="margin-top:6px;">0%</div>' +
|
||||||
|
'<div class="actionRow" id="rpActions" hidden></div>'
|
||||||
|
pageHost.appendChild(section)
|
||||||
|
var msg = section.querySelector('#rpMsg')
|
||||||
|
var actions = section.querySelector('#rpActions')
|
||||||
|
var bar = section.querySelector('#rpBar')
|
||||||
|
var barWrap = section.querySelector('#rpBarWrap')
|
||||||
|
var percentEl = section.querySelector('#rpPercent')
|
||||||
|
|
||||||
|
// 다운로드 진행률(퍼센트) 구독. 완료/실패 시 해제.
|
||||||
|
var unsubscribe = null
|
||||||
|
if (installerApi.onFinalResourcepackProgress) {
|
||||||
|
unsubscribe = installerApi.onFinalResourcepackProgress(function (info) {
|
||||||
|
if (info && info.percent >= 0) {
|
||||||
|
bar.style.width = info.percent + '%'
|
||||||
|
percentEl.textContent = info.percent + '%'
|
||||||
|
} else if (info) {
|
||||||
|
// 전체 크기를 모르면 받은 용량(MB)만 표시.
|
||||||
|
percentEl.textContent = (info.loaded / 1048576).toFixed(1) + ' MB'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function stopProgress() { if (unsubscribe) { unsubscribe(); unsubscribe = null } }
|
||||||
|
|
||||||
|
function proceed() { stopProgress(); state.finalRpHandled = true; renderStep5() }
|
||||||
|
|
||||||
|
installerApi.installFinalResourcepack().then(function (res) {
|
||||||
|
stopProgress()
|
||||||
|
if (res && res.ok) {
|
||||||
|
bar.style.width = '100%'
|
||||||
|
percentEl.textContent = '100%'
|
||||||
|
msg.textContent = tt('resourcepack.downloadDone')
|
||||||
|
msg.classList.add('success')
|
||||||
|
actions.innerHTML = '<button class="primaryBtn" id="rpNext">' + tt('common.next') + '</button>'
|
||||||
|
actions.querySelector('#rpNext').addEventListener('click', proceed)
|
||||||
|
} else {
|
||||||
|
barWrap.hidden = true
|
||||||
|
percentEl.hidden = true
|
||||||
|
msg.textContent = tt('resourcepack.downloadFailed', { message: (res && res.message) || 'unknown' })
|
||||||
|
msg.classList.add('error')
|
||||||
|
actions.innerHTML =
|
||||||
|
'<button class="secondaryBtn" id="rpRetry">' + tt('agreement.retry') + '</button>' +
|
||||||
|
'<button class="primaryBtn" id="rpSkip">' + tt('common.next') + '</button>'
|
||||||
|
actions.querySelector('#rpRetry').addEventListener('click', downloadFinalResourcepack)
|
||||||
|
actions.querySelector('#rpSkip').addEventListener('click', proceed)
|
||||||
|
}
|
||||||
|
actions.hidden = false
|
||||||
|
}).catch(function (err) {
|
||||||
|
stopProgress()
|
||||||
|
barWrap.hidden = true
|
||||||
|
percentEl.hidden = true
|
||||||
|
msg.textContent = tt('resourcepack.downloadFailed', { message: (err && err.message) ? err.message : String(err) })
|
||||||
|
msg.classList.add('error')
|
||||||
|
actions.innerHTML =
|
||||||
|
'<button class="secondaryBtn" id="rpRetry">' + tt('agreement.retry') + '</button>' +
|
||||||
|
'<button class="primaryBtn" id="rpSkip">' + tt('common.next') + '</button>'
|
||||||
|
actions.querySelector('#rpRetry').addEventListener('click', downloadFinalResourcepack)
|
||||||
|
actions.querySelector('#rpSkip').addEventListener('click', proceed)
|
||||||
|
actions.hidden = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function renderStep5() {
|
function renderStep5() {
|
||||||
setActiveStep(5)
|
setActiveStep(5)
|
||||||
clearPage()
|
clearPage()
|
||||||
|
// 최종 리소스팩(finalResourcepackPath)이 "." 이 아니고 아직 처리하지 않았으면,
|
||||||
|
// 완료 화면 전에 "리소스팩을 설치하시겠습니까?" 를 먼저 묻는다.
|
||||||
|
var selPack = state.packs.find(function (p) { return p.key === state.selectedPackKey })
|
||||||
|
var finalRp = (selPack && selPack.pack && selPack.pack.finalResourcepackPath) ? selPack.pack.finalResourcepackPath : '.'
|
||||||
|
if (finalRp !== '.' && !state.finalRpHandled) {
|
||||||
|
renderResourcepackPrompt()
|
||||||
|
return
|
||||||
|
}
|
||||||
var section = document.createElement('section')
|
var section = document.createElement('section')
|
||||||
section.className = 'page'
|
section.className = 'page'
|
||||||
// 서버 마무리 액션 (바로가기/서버 실행) 은 step3 를 거친 호스트 만 노출한다.
|
// 서버 마무리 액션 (바로가기/서버 실행) 은 step3 를 거친 호스트 만 노출한다.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
"agreement": {
|
"agreement": {
|
||||||
"heading": "약관 동의",
|
"heading": "약관 동의",
|
||||||
"intro": "리소스팩을 설치하기 전에 아래 약관을 모두 확인하고 동의해 주세요.",
|
"intro": "리소스팩을 설치하기 전에 아래 약관을 한 건씩 끝까지 읽고 동의해 주세요.",
|
||||||
"tabResourcepack": "리소스팩 약관",
|
"tabResourcepack": "리소스팩 약관",
|
||||||
"tabInstaller": "리소스팩 설치기 약관",
|
"tabInstaller": "리소스팩 설치기 약관",
|
||||||
"loading": "약관을 불러오는 중...",
|
"loading": "약관을 불러오는 중...",
|
||||||
@@ -41,6 +41,9 @@
|
|||||||
"listLoadFailed": "약관 표시에 실패하여 설치를 진행할 수 없습니다.\n사유: {{message}}\n네트워크 상태를 확인하고 다시 시도하거나, 처음 단계로 돌아가 주세요.",
|
"listLoadFailed": "약관 표시에 실패하여 설치를 진행할 수 없습니다.\n사유: {{message}}\n네트워크 상태를 확인하고 다시 시도하거나, 처음 단계로 돌아가 주세요.",
|
||||||
"retry": "다시 시도",
|
"retry": "다시 시도",
|
||||||
"agreeAll": "위 모든 약관에 동의합니다.",
|
"agreeAll": "위 모든 약관에 동의합니다.",
|
||||||
|
"agreeThis": "해당 약관에 동의합니다.",
|
||||||
|
"readToBottom": "약관을 끝까지 내려서 확인하면 동의할 수 있습니다.",
|
||||||
|
"stepLabel": "약관 {{current}}/{{total}} — {{label}}",
|
||||||
"agreeRequired": "약관에 동의해야 다음 단계로 진행할 수 있습니다.",
|
"agreeRequired": "약관에 동의해야 다음 단계로 진행할 수 있습니다.",
|
||||||
"cancelling": "취소 중…"
|
"cancelling": "취소 중…"
|
||||||
},
|
},
|
||||||
@@ -91,12 +94,15 @@
|
|||||||
"musicTrackDone": "{{idx}}번 노래 완료: {{name}}",
|
"musicTrackDone": "{{idx}}번 노래 완료: {{name}}",
|
||||||
"musicTrackSkip": "{{idx}}번 노래는 이전에 받아둠 → 건너뜀(이어받기)",
|
"musicTrackSkip": "{{idx}}번 노래는 이전에 받아둠 → 건너뜀(이어받기)",
|
||||||
"musicRefreshRetry": "{{count}}곡 다운로드 실패 → yt-dlp/ffmpeg 최신 버전으로 재설치 후 실패한 곡만 재시도",
|
"musicRefreshRetry": "{{count}}곡 다운로드 실패 → yt-dlp/ffmpeg 최신 버전으로 재설치 후 실패한 곡만 재시도",
|
||||||
|
"musicTrackRetryWait": "{{idx}}번 노래 재시도 {{attempt}}회차 — 유튜브 속도제한(403) 회피로 {{secs}}초 대기 후 다시 시도",
|
||||||
"ytdlpReinstall": "yt-dlp.exe 최신 버전으로 강제 재설치 중…",
|
"ytdlpReinstall": "yt-dlp.exe 최신 버전으로 강제 재설치 중…",
|
||||||
"ffmpegReinstall": "ffmpeg.exe 최신 버전으로 강제 재설치 중…",
|
"ffmpegReinstall": "ffmpeg.exe 최신 버전으로 강제 재설치 중…",
|
||||||
"imageStart": "사진 다운로드 시작 ({{total}}장)",
|
"imageStart": "사진 다운로드 시작 ({{total}}장)",
|
||||||
"imageDownloading": "{{idx}}번 사진 다운로드 중…",
|
"imageDownloading": "{{idx}}번 사진 다운로드 중…",
|
||||||
"imageDone": "{{idx}}번 사진 완료: {{name}}",
|
"imageDone": "{{idx}}번 사진 완료: {{name}}",
|
||||||
"imageSkip": "{{idx}}번 사진은 이전에 받아둠 → 건너뜀(이어받기)",
|
"imageSkip": "{{idx}}번 사진은 이전에 받아둠 → 건너뜀(이어받기)",
|
||||||
|
"imageCooldown": "음악 다운로드 직후라 유튜브 속도제한을 피하려고 {{secs}}초 대기합니다…",
|
||||||
|
"imageRetry": "{{idx}}번 사진 재시도 {{attempt}}회차 (HTTP {{code}}) — {{secs}}초 후 다시 시도",
|
||||||
"baseDownload": "베이스 리소스팩 다운로드: {{path}}",
|
"baseDownload": "베이스 리소스팩 다운로드: {{path}}",
|
||||||
"baseUrl": " URL: {{url}}",
|
"baseUrl": " URL: {{url}}",
|
||||||
"baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)",
|
"baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)",
|
||||||
@@ -130,7 +136,8 @@
|
|||||||
"baseDownloading": "베이스 리소스팩 다운로드 중",
|
"baseDownloading": "베이스 리소스팩 다운로드 중",
|
||||||
"buildingWithBase": "베이스에 음악·사진 추가 중",
|
"buildingWithBase": "베이스에 음악·사진 추가 중",
|
||||||
"buildingZip": "zip 빌드 중",
|
"buildingZip": "zip 빌드 중",
|
||||||
"installComplete": "설치 완료"
|
"installComplete": "설치 완료",
|
||||||
|
"imageRetry": "속도제한(HTTP {{code}}) — {{secs}}초 후 재시도"
|
||||||
},
|
},
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": "음악퀴즈 리소스팩 - {{name}}"
|
"description": "음악퀴즈 리소스팩 - {{name}}"
|
||||||
@@ -142,6 +149,7 @@
|
|||||||
"cancelledByUser": "사용자가 설치를 취소했습니다.",
|
"cancelledByUser": "사용자가 설치를 취소했습니다.",
|
||||||
"musicDownloadFailed": "{{idx}}번 노래 다운로드 실패: {{message}}",
|
"musicDownloadFailed": "{{idx}}번 노래 다운로드 실패: {{message}}",
|
||||||
"imageDownloadFailed": "{{idx}}번 사진 다운로드 실패: {{message}}",
|
"imageDownloadFailed": "{{idx}}번 사진 다운로드 실패: {{message}}",
|
||||||
|
"imageRateLimitHint": "유튜브가 IP를 잠시 속도제한(429)했습니다. 몇 분 뒤 다시 설치를 시도하면 이미 받은 사진은 건너뛰고 이어받습니다.",
|
||||||
"imageNormalizeFailed": "{{idx}}번 사진 정규화 실패: {{message}}",
|
"imageNormalizeFailed": "{{idx}}번 사진 정규화 실패: {{message}}",
|
||||||
"baseDownloadFailed": "베이스 리소스팩 다운로드 실패: {{message}}",
|
"baseDownloadFailed": "베이스 리소스팩 다운로드 실패: {{message}}",
|
||||||
"ytdlpSignal": "yt-dlp 가 신호 {{signal}} 로 종료됨",
|
"ytdlpSignal": "yt-dlp 가 신호 {{signal}} 로 종료됨",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
"agreement": {
|
"agreement": {
|
||||||
"heading": "약관 동의",
|
"heading": "약관 동의",
|
||||||
"intro": "설치 전에 아래 약관을 모두 확인하고 동의해 주세요.",
|
"intro": "설치 전에 아래 약관을 한 건씩 끝까지 읽고 동의해 주세요.",
|
||||||
"tabMap": "맵 약관",
|
"tabMap": "맵 약관",
|
||||||
"tabMod": "모드 약관",
|
"tabMod": "모드 약관",
|
||||||
"tabInstaller": "설치기 약관",
|
"tabInstaller": "설치기 약관",
|
||||||
@@ -50,6 +50,9 @@
|
|||||||
"listLoadFailed": "약관 표시에 실패하여 설치를 진행할 수 없습니다.\n사유: {{message}}\n네트워크 상태를 확인하고 다시 시도하거나, 처음 단계로 돌아가 주세요.",
|
"listLoadFailed": "약관 표시에 실패하여 설치를 진행할 수 없습니다.\n사유: {{message}}\n네트워크 상태를 확인하고 다시 시도하거나, 처음 단계로 돌아가 주세요.",
|
||||||
"retry": "다시 시도",
|
"retry": "다시 시도",
|
||||||
"agreeAll": "위 모든 약관에 동의합니다.",
|
"agreeAll": "위 모든 약관에 동의합니다.",
|
||||||
|
"agreeThis": "해당 약관에 동의합니다.",
|
||||||
|
"readToBottom": "약관을 끝까지 내려서 확인하면 동의할 수 있습니다.",
|
||||||
|
"stepLabel": "약관 {{current}}/{{total}} — {{label}}",
|
||||||
"agreeRequired": "약관에 동의해야 다음 단계로 진행할 수 있습니다."
|
"agreeRequired": "약관에 동의해야 다음 단계로 진행할 수 있습니다."
|
||||||
},
|
},
|
||||||
"step1": {
|
"step1": {
|
||||||
@@ -87,17 +90,24 @@
|
|||||||
"auto": "자동 탐색",
|
"auto": "자동 탐색",
|
||||||
"install": "자동 설치",
|
"install": "자동 설치",
|
||||||
"installCancel": "설치 취소",
|
"installCancel": "설치 취소",
|
||||||
|
"recommended": "권장 JDK: Java {{major}} (이 음악퀴즈 서버 실행용)",
|
||||||
"found": "JDK 발견: {{path}}",
|
"found": "JDK 발견: {{path}}",
|
||||||
|
"foundRecommended": "권장 JDK(Java {{major}}) 발견: {{path}}",
|
||||||
|
"foundMismatch": "⚠ 권장(Java {{required}})이 아닌 Java {{major}} 를 찾았습니다: {{path}} — 권장 버전과 달라 서버가 정상 실행되지 않을 수 있습니다. 권장 버전을 쓰려면 \"자동 설치\" 를 누르세요.",
|
||||||
|
"mismatchConfirm": "선택한 Java {{major}} 는 권장 버전(Java {{required}})과 다릅니다. 권장 버전과 달라 서버가 정상 실행되지 않을 수 있습니다. 이대로 계속하시겠습니까?",
|
||||||
"autoDetected": "JDK 자동 탐색됨: {{path}}",
|
"autoDetected": "JDK 자동 탐색됨: {{path}}",
|
||||||
"notFound": "JDK를 자동으로 찾지 못했습니다. \"자동 설치\" 를 눌러 JDK를 설치하거나 직접 선택해 주세요.",
|
"notFound": "서버 실행에 필요한 Java {{major}} 이상을 찾지 못했습니다(낮은 버전이 설치돼 있어도 서버가 뜨지 않습니다). \"자동 설치\" 를 눌러 설치하거나 직접 선택해 주세요.",
|
||||||
"notFoundHint": "JDK를 자동으로 찾지 못했습니다. \"자동 설치\" 를 누르면 JDK를 받아 설치합니다.",
|
"notFoundHint": "Java {{major}} 이상을 찾지 못했습니다. \"자동 설치\" 를 누르면 Temurin {{major}} 를 받아 설치합니다.",
|
||||||
"cancelRequested": "JDK 설치 취소 요청 중...",
|
"cancelRequested": "JDK 설치 취소 요청 중...",
|
||||||
"downloading": "JDK 다운로드 중...",
|
"downloading": "JDK 다운로드 중...",
|
||||||
"installComplete": "JDK 자동 설치 완료: {{path}}",
|
"installComplete": "JDK 자동 설치 완료: {{path}}",
|
||||||
"installCanceled": "JDK 설치 취소됨",
|
"installCanceled": "JDK 설치 취소됨",
|
||||||
"installFailed": "JDK 설치 실패: {{message}}",
|
"installFailed": "JDK 설치 실패: {{message}}",
|
||||||
"installError": "JDK 설치 오류: {{message}}",
|
"installError": "JDK 설치 오류: {{message}}",
|
||||||
"pathRequired": "JDK 경로를 입력해 주세요."
|
"pathRequired": "JDK 경로를 입력해 주세요.",
|
||||||
|
"verifying": "선택한 JDK 버전을 확인하는 중…",
|
||||||
|
"versionTooLow": "선택한 Java {{major}} 는 너무 낮습니다. 서버 실행에는 Java {{required}} 이상이 필요합니다. \"자동 설치\" 로 Temurin {{required}} 를 받거나 Java {{required}} 이상 폴더를 선택해 주세요.",
|
||||||
|
"versionUnknown": "선택한 경로에서 Java 실행 파일을 찾지 못했거나 버전을 확인할 수 없습니다. JDK 폴더(bin\\java.exe 가 있는 곳)를 선택하거나 \"자동 설치\" 를 눌러 주세요."
|
||||||
},
|
},
|
||||||
"sub33": {
|
"sub33": {
|
||||||
"heading": "서버 다운로드 및 설치",
|
"heading": "서버 다운로드 및 설치",
|
||||||
@@ -150,6 +160,16 @@
|
|||||||
"failed": "설치 실패: {{message}}"
|
"failed": "설치 실패: {{message}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"resourcepack": {
|
||||||
|
"promptHeading": "리소스팩 설치",
|
||||||
|
"promptBody": "이 음악퀴즈의 최종 리소스팩을 설치하시겠습니까? 설치 후에는 마인크래프트 내에서 직접 리소스팩을 적용해야 합니다.",
|
||||||
|
"yes": "예",
|
||||||
|
"no": "아니요",
|
||||||
|
"downloadHeading": "최종 리소스팩 다운로드",
|
||||||
|
"downloading": "최종 리소스팩을 다운로드하는 중…",
|
||||||
|
"downloadDone": "최종 리소스팩 다운로드 완료. 마인크래프트 설정 → 리소스팩에서 직접 적용해 주세요.",
|
||||||
|
"downloadFailed": "최종 리소스팩 다운로드 실패: {{message}}"
|
||||||
|
},
|
||||||
"step5": {
|
"step5": {
|
||||||
"heading": "설치 완료",
|
"heading": "설치 완료",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
@@ -195,10 +215,11 @@
|
|||||||
},
|
},
|
||||||
"log": {
|
"log": {
|
||||||
"manifestDownload": "manifest 다운로드: {{url}}",
|
"manifestDownload": "manifest 다운로드: {{url}}",
|
||||||
|
"downloadRetry": "다운로드 일시 오류({{reason}}) — {{attempt}}번째 재시도, {{secs}}초 후",
|
||||||
"packLoadFail": "pack 로드 실패 ({{file}}): {{message}}",
|
"packLoadFail": "pack 로드 실패 ({{file}}): {{message}}",
|
||||||
"packsLoaded": "로드된 음악퀴즈: {{count}}개",
|
"packsLoaded": "로드된 음악퀴즈: {{count}}개",
|
||||||
"selectedPack": "선택: {{key}}",
|
"selectedPack": "선택: {{key}}",
|
||||||
"jdkInstallStart": "JDK(Temurin 21) 자동 설치 시작 — 다운로드 중...",
|
"jdkInstallStart": "JDK(Temurin {{major}}) 자동 설치 시작 — 다운로드 중...",
|
||||||
"jdkDownloadProgress": "JDK 다운로드: {{percent}}% ({{loaded}}MB / {{total}}MB)",
|
"jdkDownloadProgress": "JDK 다운로드: {{percent}}% ({{loaded}}MB / {{total}}MB)",
|
||||||
"jdkExtracting": "JDK 압축 해제 중...",
|
"jdkExtracting": "JDK 압축 해제 중...",
|
||||||
"jdkDoneRoot": "JDK 자동 설치 완료: {{path}}",
|
"jdkDoneRoot": "JDK 자동 설치 완료: {{path}}",
|
||||||
@@ -220,7 +241,12 @@
|
|||||||
"modDownload": "모드 다운로드: {{file}}",
|
"modDownload": "모드 다운로드: {{file}}",
|
||||||
"skipResourcepack": "resourcepackPath가 비어 있어 리소스팩 다운로드를 건너뜁니다.",
|
"skipResourcepack": "resourcepackPath가 비어 있어 리소스팩 다운로드를 건너뜁니다.",
|
||||||
"resourcepackDownload": "리소스팩 다운로드: {{url}}",
|
"resourcepackDownload": "리소스팩 다운로드: {{url}}",
|
||||||
|
"skipBaseForFinal": "최종 리소스팩이 등록돼 있어 베이스 리소스팩은 건너뜁니다(설치 마지막에 최종 리소스팩만 받음).",
|
||||||
|
"finalResourcepackDownload": "최종 리소스팩 다운로드: {{url}}",
|
||||||
|
"finalResourcepackSaved": "최종 리소스팩 저장: {{path}}",
|
||||||
"serverInstallPath": "서버 설치 경로: {{path}}",
|
"serverInstallPath": "서버 설치 경로: {{path}}",
|
||||||
|
"runBatJavaPatched": "run.bat 이 설치기가 준비한 자바를 쓰도록 수정했습니다: {{java}}",
|
||||||
|
"runBatJavaSkip": "설치기가 준비한 JDK 를 찾지 못해 run.bat 의 자바 경로는 그대로 둡니다(시스템 자바 사용).",
|
||||||
"mojangEulaFetchFail": "Minecraft EULA 페이지 조회 실패: {{message}}",
|
"mojangEulaFetchFail": "Minecraft EULA 페이지 조회 실패: {{message}}",
|
||||||
"eulaAccepted": "EULA 동의 저장 완료.",
|
"eulaAccepted": "EULA 동의 저장 완료.",
|
||||||
"configEditorOpen": "서버 설정 편집기 실행: {{url}}",
|
"configEditorOpen": "서버 설정 편집기 실행: {{url}}",
|
||||||
@@ -264,9 +290,11 @@
|
|||||||
"settingCopyFail": "설정 복사 실패 ({{name}}): {{message}}",
|
"settingCopyFail": "설정 복사 실패 ({{name}}): {{message}}",
|
||||||
"settingCopySummary": "기존 마인크래프트 설정 복사: 새로 복사 {{copied}}개 / 동기화(options 류 덮어쓰기) {{synced}}개 / 보존(이미 존재) {{skipped}}개.",
|
"settingCopySummary": "기존 마인크래프트 설정 복사: 새로 복사 {{copied}}개 / 동기화(options 류 덮어쓰기) {{synced}}개 / 보존(이미 존재) {{skipped}}개.",
|
||||||
"settingCopyError": "기존 설정 복사 중 오류: {{message}}",
|
"settingCopyError": "기존 설정 복사 중 오류: {{message}}",
|
||||||
"runtimeDirMissing": ".minecraft/{{dir}} 가 없습니다. 마인크래프트 런처를 한 번 실행한 뒤 다시 시도해주세요.",
|
"runtimeDirMissing": ".minecraft/{{dir}} 가 없어 공용 링크를 만들 수 없습니다(런처가 이 폴더에 직접 받게 됩니다).",
|
||||||
|
"runtimeDirCreated": ".mc_custom/{{dir}} 폴더를 새로 만들었습니다(런처가 여기에 직접 다운로드).",
|
||||||
"runtimeDirExists": ".mc_custom/{{dir}} 가 실제 폴더로 이미 존재 — 건너뜀.",
|
"runtimeDirExists": ".mc_custom/{{dir}} 가 실제 폴더로 이미 존재 — 건너뜀.",
|
||||||
"runtimeLinkCreated": "링크 생성: .mc_custom/{{dir}} → .minecraft/{{dir}}",
|
"runtimeLinkCreated": "링크 생성: .mc_custom/{{dir}} → .minecraft/{{dir}}",
|
||||||
|
"runtimeLinkReplaced": "불완전한 .mc_custom/{{dir}} 폴더를 .minecraft/{{dir}} 링크로 교체했습니다(바닐라 데이터 포함).",
|
||||||
"runtimeLinkFail": "링크 생성 실패 ({{dir}}): {{message}}",
|
"runtimeLinkFail": "링크 생성 실패 ({{dir}}): {{message}}",
|
||||||
"shortcutCreated": "바로가기 생성: {{path}}",
|
"shortcutCreated": "바로가기 생성: {{path}}",
|
||||||
"shortcutFailed": "바로가기 생성 실패",
|
"shortcutFailed": "바로가기 생성 실패",
|
||||||
|
|||||||
@@ -125,6 +125,13 @@
|
|||||||
"serverMaxRam": "서버 최대 램 (MB)",
|
"serverMaxRam": "서버 최대 램 (MB)",
|
||||||
"clientMinRam": "클라이언트 최소 램 (MB)",
|
"clientMinRam": "클라이언트 최소 램 (MB)",
|
||||||
"clientRecommendedRam": "클라이언트 권장 램 (MB)",
|
"clientRecommendedRam": "클라이언트 권장 램 (MB)",
|
||||||
|
"recommendedJdk": "권장 JDK (서버 실행용)",
|
||||||
|
"recommendedJdkHint": "설치기가 이 버전을 우선 찾고, 없으면 자동 설치합니다. 서버가 요구하는 자바 버전에 맞춰 고르세요(최신 마인크래프트는 보통 Java 25). 목록은 Adoptium(Temurin)에서 실제 배포되는 버전을 불러옵니다.",
|
||||||
|
"jdkShowDetails": "자세히 보기 (모든 버전·스냅샷)",
|
||||||
|
"jdkDetailsGa": "정식(GA)",
|
||||||
|
"jdkDetailsEa": "개발 스냅샷(EA)",
|
||||||
|
"jdkDetailsNone": "상세 버전 정보를 불러오지 못했습니다.",
|
||||||
|
"jdkLtsSuffix": " (LTS)",
|
||||||
"mapPath": "맵 파일 (.zip)",
|
"mapPath": "맵 파일 (.zip)",
|
||||||
"mapPathHint": "/file/maps/ 아래 zip 파일 이름.",
|
"mapPathHint": "/file/maps/ 아래 zip 파일 이름.",
|
||||||
"serverPath": "서버 파일 (.zip)",
|
"serverPath": "서버 파일 (.zip)",
|
||||||
@@ -133,6 +140,8 @@
|
|||||||
"modsFolderHint": "/file/mods/<폴더이름>/ 안의 모든 .jar을 자동으로 받습니다. 비워두면 모드를 받지 않습니다.",
|
"modsFolderHint": "/file/mods/<폴더이름>/ 안의 모든 .jar을 자동으로 받습니다. 비워두면 모드를 받지 않습니다.",
|
||||||
"resourcepackPath": "베이스 리소스팩 (.zip)",
|
"resourcepackPath": "베이스 리소스팩 (.zip)",
|
||||||
"resourcepackHint": "/file/resourcepacks/ 아래 .zip 파일 이름. 리소스팩 설치기가 이 zip 위에 음악·사진을 얹어 최종 리소스팩을 만듭니다. 비워두면 처음부터 새로 만듭니다.",
|
"resourcepackHint": "/file/resourcepacks/ 아래 .zip 파일 이름. 리소스팩 설치기가 이 zip 위에 음악·사진을 얹어 최종 리소스팩을 만듭니다. 비워두면 처음부터 새로 만듭니다.",
|
||||||
|
"finalResourcepackPath": "최종 리소스팩 (.zip)",
|
||||||
|
"finalResourcepackHint": "/file/resourcepacks/outputs/ 아래 .zip 파일 이름. 간편설치기 마지막에 사용자가 선택 설치할 수 있습니다. 없음으로 하려면 \".\" 만 입력하세요.",
|
||||||
"outputPackName": "생성되는 리소스팩 이름",
|
"outputPackName": "생성되는 리소스팩 이름",
|
||||||
"outputPackNamePlaceholder": "예: 음악퀴즈 테스트팩",
|
"outputPackNamePlaceholder": "예: 음악퀴즈 테스트팩",
|
||||||
"outputPackNameHint": "리소스팩 설치기가 만들어 내는 zip 파일 이름이자, 마인크래프트 리소스팩 목록의 제목이 됩니다. 비워두면 파일이름_resourcepack 형태로 자동 지정됩니다. Windows 파일명 금지 문자(\\ / : * ? \" < > |)는 자동으로 _ 로 바뀝니다.",
|
"outputPackNameHint": "리소스팩 설치기가 만들어 내는 zip 파일 이름이자, 마인크래프트 리소스팩 목록의 제목이 됩니다. 비워두면 파일이름_resourcepack 형태로 자동 지정됩니다. Windows 파일명 금지 문자(\\ / : * ? \" < > |)는 자동으로 _ 로 바뀝니다.",
|
||||||
@@ -169,8 +178,10 @@
|
|||||||
"visibilityHeading": "표시 대상 (중복 선택 가능)",
|
"visibilityHeading": "표시 대상 (중복 선택 가능)",
|
||||||
"visibilityInstaller": "설치기에 표시",
|
"visibilityInstaller": "설치기에 표시",
|
||||||
"visibilityInstallerRp": "리소스팩 설치기에 표시",
|
"visibilityInstallerRp": "리소스팩 설치기에 표시",
|
||||||
|
"visibilityFinalResourcepack": "최종 리소스팩에 표시",
|
||||||
"visibilityInstallerShort": "설치기",
|
"visibilityInstallerShort": "설치기",
|
||||||
"visibilityInstallerRpShort": "리소스팩",
|
"visibilityInstallerRpShort": "리소스팩",
|
||||||
|
"visibilityFinalResourcepackShort": "최종팩",
|
||||||
"addHeading": "약관 추가",
|
"addHeading": "약관 추가",
|
||||||
"kindLabel": "식별자",
|
"kindLabel": "식별자",
|
||||||
"kindPlaceholder": "예: privacy",
|
"kindPlaceholder": "예: privacy",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "minecraft-music-quiz-installer",
|
"name": "minecraft-music-quiz-installer",
|
||||||
"version": "0.4.0",
|
"version": "0.4.22",
|
||||||
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
|
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
|
||||||
"main": "dist/installer/main.js",
|
"main": "dist/installer/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
var tabBtns = document.querySelectorAll('.tabBar .tabBtn')
|
var tabBtns = document.querySelectorAll('.tabBar .tabBtn')
|
||||||
var visInstaller = document.getElementById('visInstaller')
|
var visInstaller = document.getElementById('visInstaller')
|
||||||
var visInstallerRp = document.getElementById('visInstallerRp')
|
var visInstallerRp = document.getElementById('visInstallerRp')
|
||||||
|
var visFinalResourcepack = document.getElementById('visFinalResourcepack')
|
||||||
|
|
||||||
editor.value = INITIAL || ''
|
editor.value = INITIAL || ''
|
||||||
var dirty = false
|
var dirty = false
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
// 토글이 바뀌어도 dirty 표시. 저장 시 함께 전송된다.
|
// 토글이 바뀌어도 dirty 표시. 저장 시 함께 전송된다.
|
||||||
if (visInstaller) visInstaller.addEventListener('change', function () { setDirty(true) })
|
if (visInstaller) visInstaller.addEventListener('change', function () { setDirty(true) })
|
||||||
if (visInstallerRp) visInstallerRp.addEventListener('change', function () { setDirty(true) })
|
if (visInstallerRp) visInstallerRp.addEventListener('change', function () { setDirty(true) })
|
||||||
|
if (visFinalResourcepack) visFinalResourcepack.addEventListener('change', function () { setDirty(true) })
|
||||||
|
|
||||||
// ─── markdown 미리 보기용 미니 렌더러 ────────────────────────────────
|
// ─── markdown 미리 보기용 미니 렌더러 ────────────────────────────────
|
||||||
// 정식 markdown 파서는 아니지만, 본 편집기가 만들어 내는 형태(#, ##, ###,
|
// 정식 markdown 파서는 아니지만, 본 편집기가 만들어 내는 형태(#, ##, ###,
|
||||||
@@ -171,6 +173,7 @@
|
|||||||
var payload = { content: editor.value }
|
var payload = { content: editor.value }
|
||||||
if (visInstaller) payload.showInInstaller = !!visInstaller.checked
|
if (visInstaller) payload.showInInstaller = !!visInstaller.checked
|
||||||
if (visInstallerRp) payload.showInInstallerRp = !!visInstallerRp.checked
|
if (visInstallerRp) payload.showInInstallerRp = !!visInstallerRp.checked
|
||||||
|
if (visFinalResourcepack) payload.showInFinalResourcepack = !!visFinalResourcepack.checked
|
||||||
fetch('/op/agreement/' + encodeURIComponent(PACK_KEY) + '/' + encodeURIComponent(TERM_KIND), {
|
fetch('/op/agreement/' + encodeURIComponent(PACK_KEY) + '/' + encodeURIComponent(TERM_KIND), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|||||||
@@ -35,10 +35,16 @@ export function ytIdFromUrl(url: string): string {
|
|||||||
* 5xx 게이트웨이 계열도 잠깐 뒤 다시 받으면 성공하는 경우가 많다.
|
* 5xx 게이트웨이 계열도 잠깐 뒤 다시 받으면 성공하는 경우가 많다.
|
||||||
*/
|
*/
|
||||||
const TRANSIENT_CODES = new Set([408, 425, 429, 500, 502, 503, 504])
|
const TRANSIENT_CODES = new Set([408, 425, 429, 500, 502, 503, 504])
|
||||||
const MAX_RETRIES = 5
|
const MAX_RETRIES = 6
|
||||||
/** 백오프 상한(ms). Retry-After 헤더가 비정상적으로 커도 이 이상은 기다리지 않는다. */
|
/** 백오프 상한(ms). Retry-After 헤더가 비정상적으로 커도 이 이상은 기다리지 않는다. */
|
||||||
const MAX_BACKOFF_MS = 60000
|
const MAX_BACKOFF_MS = 60000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 재시도가 일어날 때 호출되는 훅. 상위(main)에서 로그/진행률로 표시해, 429 백오프
|
||||||
|
* 대기 중에도 화면이 멈춘 것처럼 보이지 않게 한다.
|
||||||
|
*/
|
||||||
|
export type ImageRetryHook = (info: { attempt: number; delayMs: number; code: number | null }) => void
|
||||||
|
|
||||||
/** Retry-After 헤더(초 또는 HTTP-date) → 대기 ms. 못 읽으면 null. */
|
/** Retry-After 헤더(초 또는 HTTP-date) → 대기 ms. 못 읽으면 null. */
|
||||||
function parseRetryAfter(h: string | string[] | undefined): number | null {
|
function parseRetryAfter(h: string | string[] | undefined): number | null {
|
||||||
if (!h) return null
|
if (!h) return null
|
||||||
@@ -57,7 +63,7 @@ const sleep = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms
|
|||||||
* 429/5xx 등 일시적 오류는 지수 백오프(+jitter, Retry-After 우선)로 최대
|
* 429/5xx 등 일시적 오류는 지수 백오프(+jitter, Retry-After 우선)로 최대
|
||||||
* MAX_RETRIES 회 재시도한다. 그 외 4xx 나 재시도 소진 시 reject.
|
* MAX_RETRIES 회 재시도한다. 그 외 4xx 나 재시도 소진 시 reject.
|
||||||
*/
|
*/
|
||||||
function fetchBuffer(url: string, redirects = 0, attempt = 0): Promise<Buffer> {
|
function fetchBuffer(url: string, redirects = 0, attempt = 0, onRetry?: ImageRetryHook): Promise<Buffer> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (redirects > 8) {
|
if (redirects > 8) {
|
||||||
reject(new Error(t('common.tooManyRedirects')))
|
reject(new Error(t('common.tooManyRedirects')))
|
||||||
@@ -65,10 +71,11 @@ function fetchBuffer(url: string, redirects = 0, attempt = 0): Promise<Buffer> {
|
|||||||
}
|
}
|
||||||
const target = new URL(url)
|
const target = new URL(url)
|
||||||
const lib = target.protocol === 'https:' ? https : http
|
const lib = target.protocol === 'https:' ? https : http
|
||||||
const retryLater = (headerDelay: number | null): void => {
|
const retryLater = (headerDelay: number | null, code: number | null): void => {
|
||||||
const backoff = Math.min(MAX_BACKOFF_MS, 1000 * 2 ** attempt) + Math.floor(Math.random() * 500)
|
const backoff = Math.min(MAX_BACKOFF_MS, 1000 * 2 ** attempt) + Math.floor(Math.random() * 500)
|
||||||
const delay = headerDelay ?? backoff
|
const delay = headerDelay ?? backoff
|
||||||
sleep(delay).then(() => fetchBuffer(url, redirects, attempt + 1).then(resolve, reject))
|
try { onRetry?.({ attempt: attempt + 1, delayMs: delay, code }) } catch { /* noop */ }
|
||||||
|
sleep(delay).then(() => fetchBuffer(url, redirects, attempt + 1, onRetry).then(resolve, reject))
|
||||||
}
|
}
|
||||||
const req = lib.get(target, {
|
const req = lib.get(target, {
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
@@ -77,13 +84,13 @@ function fetchBuffer(url: string, redirects = 0, attempt = 0): Promise<Buffer> {
|
|||||||
const code = res.statusCode || 0
|
const code = res.statusCode || 0
|
||||||
if (code >= 300 && code < 400 && res.headers.location) {
|
if (code >= 300 && code < 400 && res.headers.location) {
|
||||||
res.resume()
|
res.resume()
|
||||||
fetchBuffer(new URL(res.headers.location, target).toString(), redirects + 1, attempt)
|
fetchBuffer(new URL(res.headers.location, target).toString(), redirects + 1, attempt, onRetry)
|
||||||
.then(resolve, reject)
|
.then(resolve, reject)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (TRANSIENT_CODES.has(code) && attempt < MAX_RETRIES) {
|
if (TRANSIENT_CODES.has(code) && attempt < MAX_RETRIES) {
|
||||||
res.resume()
|
res.resume()
|
||||||
retryLater(parseRetryAfter(res.headers['retry-after']))
|
retryLater(parseRetryAfter(res.headers['retry-after']), code)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (code !== 200) {
|
if (code !== 200) {
|
||||||
@@ -98,7 +105,7 @@ function fetchBuffer(url: string, redirects = 0, attempt = 0): Promise<Buffer> {
|
|||||||
req.on('error', (err) => {
|
req.on('error', (err) => {
|
||||||
// 연결 끊김/리셋 등 네트워크 오류도 몇 번은 재시도.
|
// 연결 끊김/리셋 등 네트워크 오류도 몇 번은 재시도.
|
||||||
if (attempt < MAX_RETRIES) {
|
if (attempt < MAX_RETRIES) {
|
||||||
retryLater(null)
|
retryLater(null, null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reject(err)
|
reject(err)
|
||||||
@@ -134,18 +141,18 @@ function decodeDataUrl(url: string): Buffer | null {
|
|||||||
* 실패하면 `hqdefault.jpg` 로 폴백.
|
* 실패하면 `hqdefault.jpg` 로 폴백.
|
||||||
* - 그 외 URL 은 HTTP GET 으로 그대로 받음.
|
* - 그 외 URL 은 HTTP GET 으로 그대로 받음.
|
||||||
*/
|
*/
|
||||||
export async function downloadImage(rawUrl: string): Promise<Buffer> {
|
export async function downloadImage(rawUrl: string, onRetry?: ImageRetryHook): Promise<Buffer> {
|
||||||
const dataBuf = decodeDataUrl(rawUrl)
|
const dataBuf = decodeDataUrl(rawUrl)
|
||||||
if (dataBuf) return dataBuf
|
if (dataBuf) return dataBuf
|
||||||
const ytId = ytIdFromUrl(rawUrl)
|
const ytId = ytIdFromUrl(rawUrl)
|
||||||
if (ytId) {
|
if (ytId) {
|
||||||
try {
|
try {
|
||||||
return await fetchBuffer(`https://i.ytimg.com/vi/${ytId}/maxresdefault.jpg`)
|
return await fetchBuffer(`https://i.ytimg.com/vi/${ytId}/maxresdefault.jpg`, 0, 0, onRetry)
|
||||||
} catch {
|
} catch {
|
||||||
return await fetchBuffer(`https://i.ytimg.com/vi/${ytId}/hqdefault.jpg`)
|
return await fetchBuffer(`https://i.ytimg.com/vi/${ytId}/hqdefault.jpg`, 0, 0, onRetry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fetchBuffer(rawUrl)
|
return fetchBuffer(rawUrl, 0, 0, onRetry)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,6 +77,13 @@ function pickMusicConcurrency(): number {
|
|||||||
*/
|
*/
|
||||||
const MUSIC_START_STAGGER_MS = 2000
|
const MUSIC_START_STAGGER_MS = 2000
|
||||||
|
|
||||||
|
/** 사진(썸네일) 동시 다운로드 상한. 순차 대신 병렬로 받아 속도를 높인다. 429 는 images.ts 의 지수 백오프 재시도가 흡수한다. */
|
||||||
|
const IMAGE_CONCURRENCY_CAP = 8
|
||||||
|
/** 음악(yt-dlp) 단계 직후 유튜브 IP throttle 이 남아 있을 수 있어, 사진 단계 전 아주 잠깐만 쉰다. */
|
||||||
|
const IMAGE_PHASE_COOLDOWN_MS = 1000
|
||||||
|
|
||||||
|
const sleep = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms))
|
||||||
|
|
||||||
/** start-gate. 여러 worker 가 동시에 acquire 해도 직렬화되어 순차 통과. */
|
/** start-gate. 여러 worker 가 동시에 acquire 해도 직렬화되어 순차 통과. */
|
||||||
let musicStartChain: Promise<void> = Promise.resolve()
|
let musicStartChain: Promise<void> = Promise.resolve()
|
||||||
let nextMusicStartAt = 0
|
let nextMusicStartAt = 0
|
||||||
@@ -486,11 +493,25 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
|
|||||||
await refreshBinariesOnce()
|
await refreshBinariesOnce()
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
nextMusicStartAt = Date.now()
|
nextMusicStartAt = Date.now()
|
||||||
|
// 403(Forbidden)은 대개 유튜브의 일시적 rate-limit 이라, 곡마다 점점 더 오래
|
||||||
|
// 쉬면서 여러 번 다시 시도한다(마지막 시도에서만 에러 진행률 표시).
|
||||||
|
const MAX_TRACK_RETRIES = 3
|
||||||
for (const i of failed) {
|
for (const i of failed) {
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
|
let ok = false
|
||||||
|
for (let attempt = 1; attempt <= MAX_TRACK_RETRIES; attempt++) {
|
||||||
|
throwIfCancelled()
|
||||||
|
if (attempt > 1) {
|
||||||
|
const waitMs = Math.min(20000, 3000 * attempt)
|
||||||
|
sendLog(t('log.musicTrackRetryWait', { idx: i + 1, attempt, secs: Math.round(waitMs / 1000) }))
|
||||||
|
await sleep(waitMs)
|
||||||
|
throwIfCancelled()
|
||||||
|
}
|
||||||
await acquireMusicStartSlot()
|
await acquireMusicStartSlot()
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
const ok = await tryDownloadTrack(i, true)
|
ok = await tryDownloadTrack(i, attempt === MAX_TRACK_RETRIES)
|
||||||
|
if (ok) break
|
||||||
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
const idx = i + 1
|
const idx = i + 1
|
||||||
@@ -503,12 +524,27 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
|
|||||||
const paintingDir = path.join(tempRoot, 'painting')
|
const paintingDir = path.join(tempRoot, 'painting')
|
||||||
await fsp.mkdir(paintingDir, { recursive: true })
|
await fsp.mkdir(paintingDir, { recursive: true })
|
||||||
sendLog(t('log.imageStart', { total: imageTotal }))
|
sendLog(t('log.imageStart', { total: imageTotal }))
|
||||||
for (let i = 0; i < imageTotal; i++) {
|
// 음악(yt-dlp) 단계에서 유튜브를 많이 두드렸다면 IP throttle 이 남아 사진 첫 장부터
|
||||||
throwIfCancelled()
|
// 429 가 날 수 있다. 다운로드할 사진이 실제로 있고 직전에 음악을 받았다면 잠깐 쉰다.
|
||||||
const entry = pack.list.images[i]
|
if (imageTotal > 0 && musicTotal > 0) {
|
||||||
|
sendLog(t('log.imageCooldown', { secs: Math.round(IMAGE_PHASE_COOLDOWN_MS / 1000) }))
|
||||||
|
await sleep(IMAGE_PHASE_COOLDOWN_MS)
|
||||||
|
}
|
||||||
|
// 여러 장을 동시에 받아 속도를 높인다(순차+딜레이 대신 워커 풀). 유튜브 429 는
|
||||||
|
// 각 다운로드의 지수 백오프 재시도(images.ts)가 흡수하고, 첫 하드 실패를 만나면
|
||||||
|
// 새 작업 배정을 멈춘 뒤 워커가 모두 끝나면 그 오류를 던진다.
|
||||||
|
const images = pack.list.images
|
||||||
|
let imageNext = 0
|
||||||
|
let imageError: Error | null = null
|
||||||
|
async function imageWorker(): Promise<void> {
|
||||||
|
while (true) {
|
||||||
|
if (state.cancelRequested || imageError) return
|
||||||
|
const i = imageNext++
|
||||||
|
if (i >= imageTotal) return
|
||||||
const idx = i + 1
|
const idx = i + 1
|
||||||
// 이전 시도에서 이미 정규화해둔 사진은 건너뛴다(이어받기).
|
const entry = images[i]
|
||||||
const coverPath = path.join(paintingDir, coverFileName(idx))
|
const coverPath = path.join(paintingDir, coverFileName(idx))
|
||||||
|
// 이전 시도에서 이미 정규화해둔 사진은 건너뛴다(이어받기).
|
||||||
if (await fileExists(coverPath)) {
|
if (await fileExists(coverPath)) {
|
||||||
sendLog(t('log.imageSkip', { idx }))
|
sendLog(t('log.imageSkip', { idx }))
|
||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 100, status: 'done' })
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 100, status: 'done' })
|
||||||
@@ -518,27 +554,47 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
|
|||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 10, status: 'running' })
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 10, status: 'running' })
|
||||||
let buf: Buffer
|
let buf: Buffer
|
||||||
try {
|
try {
|
||||||
buf = await downloadImage(entry.url)
|
buf = await downloadImage(entry.url, (info) => {
|
||||||
|
const secs = Math.ceil(info.delayMs / 1000)
|
||||||
|
sendLog(t('log.imageRetry', { idx, attempt: info.attempt, code: info.code ?? '-', secs }))
|
||||||
|
sendProgress({
|
||||||
|
phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 10, status: 'running',
|
||||||
|
message: t('progress.imageRetry', { code: info.code ?? '-', secs })
|
||||||
|
})
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 부분 생성됐을 수 있는 커버 파일 제거(이어받기 시 완성본 오인 방지).
|
// 부분 생성됐을 수 있는 커버 파일 제거(이어받기 시 완성본 오인 방지).
|
||||||
await fsp.rm(coverPath, { force: true }).catch(() => {})
|
await fsp.rm(coverPath, { force: true }).catch(() => {})
|
||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 0, status: 'error', message: (err as Error).message })
|
const rawMsg = (err as Error).message
|
||||||
throw new Error(t('errors.imageDownloadFailed', { idx, message: (err as Error).message }))
|
// 429(rate limit)는 유튜브가 IP 를 일시 차단한 것. 잠시 뒤 다시 시도하면
|
||||||
|
// 이미 받은 사진은 건너뛰고 이어받는다는 안내를 덧붙인다.
|
||||||
|
const msg = /429/.test(rawMsg) ? `${rawMsg} — ${t('errors.imageRateLimitHint')}` : rawMsg
|
||||||
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 0, status: 'error', message: msg })
|
||||||
|
if (!imageError) imageError = new Error(t('errors.imageDownloadFailed', { idx, message: msg }))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
throwIfCancelled()
|
if (state.cancelRequested || imageError) return
|
||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 60, status: 'running' })
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 60, status: 'running' })
|
||||||
const outPath = coverPath
|
|
||||||
try {
|
try {
|
||||||
await normalizeToCover(buf, outPath)
|
await normalizeToCover(buf, coverPath)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 변환 중 부분 생성된 PNG 제거(이어받기 시 완성본 오인 방지).
|
// 변환 중 부분 생성된 PNG 제거(이어받기 시 완성본 오인 방지).
|
||||||
await fsp.rm(coverPath, { force: true }).catch(() => {})
|
await fsp.rm(coverPath, { force: true }).catch(() => {})
|
||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 0, status: 'error', message: (err as Error).message })
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 0, status: 'error', message: (err as Error).message })
|
||||||
throw new Error(t('errors.imageNormalizeFailed', { idx, message: (err as Error).message }))
|
if (!imageError) imageError = new Error(t('errors.imageNormalizeFailed', { idx, message: (err as Error).message }))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
sendLog(t('log.imageDone', { idx, name: path.basename(outPath) }))
|
sendLog(t('log.imageDone', { idx, name: path.basename(coverPath) }))
|
||||||
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 100, status: 'done' })
|
sendProgress({ phase: 'item', kind: 'image', index: idx, total: imageTotal, percent: 100, status: 'done' })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const imageWorkerCount = Math.min(IMAGE_CONCURRENCY_CAP, Math.max(1, imageTotal), Math.max(concurrency, 4))
|
||||||
|
const imageWorkers: Promise<void>[] = []
|
||||||
|
for (let w = 0; w < imageWorkerCount; w++) imageWorkers.push(imageWorker())
|
||||||
|
await Promise.all(imageWorkers)
|
||||||
|
throwIfCancelled()
|
||||||
|
if (imageError) throw imageError
|
||||||
|
|
||||||
// 2-4. 베이스 리소스팩 다운로드 (있을 때만)
|
// 2-4. 베이스 리소스팩 다운로드 (있을 때만)
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
@@ -660,8 +716,37 @@ app.whenReady().then(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 종료 시 임시 파일(.temp) 정리. 예전엔 window-all-closed 에서 fsp.rm 을 fire-and-forget
|
||||||
|
// 으로 호출하고 곧바로 app.quit() 해서, 삭제가 끝나기 전에 프로세스가 죽어 미리 받아둔
|
||||||
|
// 내용이 남곤 했다. 또 '재시도 중' 이면 yt-dlp/ffmpeg 자식이 파일을 잠가 삭제가 실패한다.
|
||||||
|
// → 자식을 먼저 죽여 잠금을 풀고, 삭제가 끝날 때까지 종료를 미룬 뒤 실제로 종료한다.
|
||||||
|
let rpExitCleanupDone = false
|
||||||
|
async function cleanupTempOnExit(): Promise<void> {
|
||||||
|
state.cancelRequested = true
|
||||||
|
for (const child of state.activeChildren) {
|
||||||
|
try { if (!child.killed) child.kill() } catch { /* noop */ }
|
||||||
|
}
|
||||||
|
const tempDir = path.join(getMcCustomDir(), '.temp')
|
||||||
|
// 자식 종료로 파일 잠금이 풀릴 시간을 주며 몇 번 재시도.
|
||||||
|
for (let attempt = 0; attempt < 3; attempt++) {
|
||||||
|
await new Promise((r) => setTimeout(r, attempt === 0 ? 200 : 400))
|
||||||
|
try {
|
||||||
|
await fsp.rm(tempDir, { recursive: true, force: true })
|
||||||
|
if (!fs.existsSync(tempDir)) return
|
||||||
|
} catch { /* 잠금 등 — 다음 시도 */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('before-quit', (event) => {
|
||||||
|
if (rpExitCleanupDone) return
|
||||||
|
event.preventDefault()
|
||||||
|
void cleanupTempOnExit().finally(() => {
|
||||||
|
rpExitCleanupDone = true
|
||||||
|
app.quit()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
// 강제 종료 시에도 임시 파일은 정리.
|
// app.quit() → before-quit 에서 임시 파일을 정리한 뒤 실제 종료.
|
||||||
fsp.rm(path.join(getMcCustomDir(), '.temp'), { recursive: true, force: true }).catch(() => {})
|
|
||||||
if (process.platform !== 'darwin') app.quit()
|
if (process.platform !== 'darwin') app.quit()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -38,6 +38,17 @@ export function downloadMusicTrack(opts: DownloadMusicOptions): Promise<string>
|
|||||||
// 단일 파일이 아니라 HLS/DASH fragmented 스트림일 때 청크를 병렬로.
|
// 단일 파일이 아니라 HLS/DASH fragmented 스트림일 때 청크를 병렬로.
|
||||||
// 일반 progressive 다운로드에는 영향 없음.
|
// 일반 progressive 다운로드에는 영향 없음.
|
||||||
'--concurrent-fragments', '5',
|
'--concurrent-fragments', '5',
|
||||||
|
// 유튜브가 미디어 스트림에 간헐적으로 403(Forbidden) 을 준다(특히 두 번째 곡부터
|
||||||
|
// throttle/클라이언트 이슈). yt-dlp 가 스스로 재시도·재추출하도록 해서 한 번의
|
||||||
|
// 403 으로 곡 전체가 실패하지 않게 한다.
|
||||||
|
'--retries', '10',
|
||||||
|
'--fragment-retries', '10',
|
||||||
|
'--extractor-retries', '3',
|
||||||
|
'--retry-sleep', 'http:exp=1:30',
|
||||||
|
'--socket-timeout', '30',
|
||||||
|
// 특정 플레이어 클라이언트(예: android_vr)의 스트림 URL 이 403 되는 경우가 있어
|
||||||
|
// 여러 클라이언트를 함께 시도한다. 하나가 막혀도 다른 클라이언트 포맷으로 받는다.
|
||||||
|
'--extractor-args', 'youtube:player_client=default,web_safari,tv,ios',
|
||||||
// 진행률 표시 안정화 (yt-dlp 가 \r 대신 새 줄로 출력).
|
// 진행률 표시 안정화 (yt-dlp 가 \r 대신 새 줄로 출력).
|
||||||
'--newline',
|
'--newline',
|
||||||
'--extract-audio',
|
'--extract-audio',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import os from 'node:os'
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
import fsp from 'node:fs/promises'
|
import fsp from 'node:fs/promises'
|
||||||
import { spawn } from 'node:child_process'
|
import { spawn, spawnSync } from 'node:child_process'
|
||||||
import { URL } from 'node:url'
|
import { URL } from 'node:url'
|
||||||
import natUpnp from 'nat-upnp'
|
import natUpnp from 'nat-upnp'
|
||||||
// extract-zip은 CommonJS 기본 export.
|
// extract-zip은 CommonJS 기본 export.
|
||||||
@@ -19,7 +19,7 @@ import type {
|
|||||||
ServerInstallPayload
|
ServerInstallPayload
|
||||||
} from './types.js'
|
} from './types.js'
|
||||||
import type { Manifest, PackDefinition } from '../shared/types.js'
|
import type { Manifest, PackDefinition } from '../shared/types.js'
|
||||||
import { normalizePackDefinition } from '../shared/store.js'
|
import { normalizePackDefinition, normalizeRecommendedJdk } from '../shared/store.js'
|
||||||
import { getMcCustomDirName, withCustomDirName } from '../shared/paths.js'
|
import { getMcCustomDirName, withCustomDirName } from '../shared/paths.js'
|
||||||
import { loadEnv, getManifestUrl } from '../shared/env.js'
|
import { loadEnv, getManifestUrl } from '../shared/env.js'
|
||||||
import { loadComponentI18n } from '../shared/i18n.js'
|
import { loadComponentI18n } from '../shared/i18n.js'
|
||||||
@@ -109,29 +109,61 @@ process.on('unhandledRejection', (reason) => {
|
|||||||
try { sendLog(t('log.internalError', { message: reason instanceof Error ? reason.message : String(reason) })) } catch {}
|
try { sendLog(t('log.internalError', { message: reason instanceof Error ? reason.message : String(reason) })) } catch {}
|
||||||
})
|
})
|
||||||
|
|
||||||
function fetchBuffer(url: string): Promise<Buffer> {
|
// 너무 빠르게/자주 요청해 생기는 일시적 오류(429 Too Many Requests, 5xx, 네트워크
|
||||||
|
// 끊김/타임아웃 등)는 잠깐 쉬고 몇 번 다시 시도한다. 403 도 일부 CDN 이 rate-limit 에
|
||||||
|
// 쓰므로 포함. 그 외 4xx(404 등)나 재시도 소진 시에는 그대로 실패.
|
||||||
|
const DOWNLOAD_TRANSIENT_CODES = new Set([403, 408, 425, 429, 500, 502, 503, 504])
|
||||||
|
const DOWNLOAD_MAX_RETRIES = 3
|
||||||
|
const DOWNLOAD_MAX_BACKOFF_MS = 30000
|
||||||
|
|
||||||
|
/** Retry-After 헤더(초 또는 HTTP-date) → 대기 ms. 못 읽으면 null. */
|
||||||
|
function parseRetryAfterMs(h: string | string[] | undefined): number | null {
|
||||||
|
if (!h) return null
|
||||||
|
const v = Array.isArray(h) ? h[0] : h
|
||||||
|
const secs = Number(v)
|
||||||
|
if (Number.isFinite(secs)) return Math.min(DOWNLOAD_MAX_BACKOFF_MS, Math.max(0, secs * 1000))
|
||||||
|
const date = Date.parse(v)
|
||||||
|
if (!Number.isNaN(date)) return Math.min(DOWNLOAD_MAX_BACKOFF_MS, Math.max(0, date - Date.now()))
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchBuffer(url: string, redirects = 0, attempt = 0): Promise<Buffer> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const target = new URL(url)
|
const target = new URL(url)
|
||||||
const transport = target.protocol === 'https:' ? https : http
|
const transport = target.protocol === 'https:' ? https : http
|
||||||
|
const retryLater = (headerDelay: number | null, reason: string): void => {
|
||||||
|
const backoff = Math.min(DOWNLOAD_MAX_BACKOFF_MS, 1000 * 2 ** attempt) + Math.floor(Math.random() * 500)
|
||||||
|
const delay = headerDelay ?? backoff
|
||||||
|
sendLog(t('log.downloadRetry', { reason, attempt: attempt + 1, secs: Math.ceil(delay / 1000) }))
|
||||||
|
sleep(delay).then(() => fetchBuffer(url, redirects, attempt + 1).then(resolve, reject))
|
||||||
|
}
|
||||||
const request = transport.get(target, { timeout: 30000 }, (response) => {
|
const request = transport.get(target, { timeout: 30000 }, (response) => {
|
||||||
if (response.statusCode === 301 || response.statusCode === 302) {
|
const code = response.statusCode ?? 0
|
||||||
const redirect = response.headers.location
|
if ((code === 301 || code === 302 || code === 303 || code === 307 || code === 308) && response.headers.location) {
|
||||||
if (redirect) {
|
|
||||||
response.resume()
|
response.resume()
|
||||||
fetchBuffer(new URL(redirect, target).toString()).then(resolve, reject)
|
if (redirects > 8) { reject(new Error(`HTTP ${code} (too many redirects)`)); return }
|
||||||
|
fetchBuffer(new URL(response.headers.location, target).toString(), redirects + 1, attempt).then(resolve, reject)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
if (DOWNLOAD_TRANSIENT_CODES.has(code) && attempt < DOWNLOAD_MAX_RETRIES) {
|
||||||
if ((response.statusCode ?? 0) >= 400) {
|
|
||||||
response.resume()
|
response.resume()
|
||||||
reject(new Error(`HTTP ${response.statusCode}`))
|
retryLater(parseRetryAfterMs(response.headers['retry-after']), `HTTP ${code}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (code >= 400) {
|
||||||
|
response.resume()
|
||||||
|
reject(new Error(`HTTP ${code}`))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const chunks: Buffer[] = []
|
const chunks: Buffer[] = []
|
||||||
response.on('data', (chunk: Buffer) => chunks.push(chunk))
|
response.on('data', (chunk: Buffer) => chunks.push(chunk))
|
||||||
response.on('end', () => resolve(Buffer.concat(chunks)))
|
response.on('end', () => resolve(Buffer.concat(chunks)))
|
||||||
})
|
})
|
||||||
request.on('error', reject)
|
request.on('error', (err) => {
|
||||||
|
// 연결 끊김/리셋 등 네트워크 오류도 몇 번은 재시도.
|
||||||
|
if (attempt < DOWNLOAD_MAX_RETRIES) { retryLater(null, (err as Error).message); return }
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
request.on('timeout', () => request.destroy(new Error(t('errors.requestTimeout'))))
|
request.on('timeout', () => request.destroy(new Error(t('errors.requestTimeout'))))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -223,6 +255,65 @@ ipcMain.handle('terms:list', async (): Promise<{ ok: boolean; terms?: Array<{ ki
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 최종 리소스팩 다운로드용 약관 목록. index.json 에서 showInFinalResourcepack=true 만 추린다.
|
||||||
|
ipcMain.handle('terms:listFinal', async (): Promise<{ ok: boolean; terms?: Array<{ kind: string; label: string }>; message?: string }> => {
|
||||||
|
if (!state.selectedKey) return { ok: false, message: 'pack not selected' }
|
||||||
|
try {
|
||||||
|
const url = `${state.baseUrl}/manifest/terms/${encodeURIComponent(state.selectedKey)}/index.json`
|
||||||
|
const buf = await fetchBuffer(url)
|
||||||
|
const parsed = JSON.parse(buf.toString('utf8')) as { terms?: unknown }
|
||||||
|
const items = Array.isArray(parsed.terms) ? parsed.terms : []
|
||||||
|
const terms: Array<{ kind: string; label: string }> = []
|
||||||
|
for (const it of items) {
|
||||||
|
if (!it || typeof it !== 'object') continue
|
||||||
|
const entry = it as Record<string, unknown>
|
||||||
|
if (entry.showInFinalResourcepack !== true) continue
|
||||||
|
const kind = typeof entry.kind === 'string' ? entry.kind : ''
|
||||||
|
const label = typeof entry.label === 'string' ? entry.label : ''
|
||||||
|
if (!TERM_KIND_RE.test(kind) || label.length === 0) continue
|
||||||
|
terms.push({ kind, label })
|
||||||
|
}
|
||||||
|
return { ok: true, terms }
|
||||||
|
} catch (error) {
|
||||||
|
return { ok: false, message: (error as Error).message }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 최종 리소스팩(zip)을 /file/resourcepacks/outputs/ 에서 받아 .mc_custom/resourcepacks/ 에 저장.
|
||||||
|
ipcMain.handle('finalResourcepack:install', async (): Promise<{ ok: boolean; path?: string; message?: string }> => {
|
||||||
|
const pack = state.selectedKey ? state.packs.get(state.selectedKey) : undefined
|
||||||
|
if (!pack) return { ok: false, message: t('errors.packNotFound2') }
|
||||||
|
const finalName = pack.pack.finalResourcepackPath
|
||||||
|
if (!finalName || finalName === '.') return { ok: false, message: 'no final resourcepack' }
|
||||||
|
let dest = ''
|
||||||
|
try {
|
||||||
|
const cleaned = path.basename(finalName.replace(/^\/+/, ''))
|
||||||
|
const url = `${state.baseUrl}/file/resourcepacks/outputs/${encodeURIComponent(cleaned)}`
|
||||||
|
const destDir = path.join(getAppDataDir(), getMcCustomDirName(), 'resourcepacks')
|
||||||
|
dest = path.join(destDir, cleaned)
|
||||||
|
await fsp.mkdir(destDir, { recursive: true })
|
||||||
|
sendLog(t('log.finalResourcepackDownload', { url }))
|
||||||
|
// 진행률(퍼센트)을 렌더러로 흘려보내며 스트리밍 다운로드.
|
||||||
|
let lastPct = -1
|
||||||
|
const controller = new AbortController()
|
||||||
|
await downloadStream(url, dest, controller.signal, (loaded, total) => {
|
||||||
|
const percent = total > 0 ? Math.min(100, Math.max(0, Math.floor((loaded / total) * 100))) : -1
|
||||||
|
if (percent !== lastPct) {
|
||||||
|
lastPct = percent
|
||||||
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
|
mainWindow.webContents.send('finalResourcepack:progress', { loaded, total, percent })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
sendLog(t('log.finalResourcepackSaved', { path: dest }))
|
||||||
|
return { ok: true, path: dest }
|
||||||
|
} catch (error) {
|
||||||
|
// 실패 시 부분/0바이트 zip 이 마인크래프트 리소스팩 목록에 깨진 채로 남지 않도록 삭제.
|
||||||
|
if (dest) await fsp.rm(dest, { force: true }).catch(() => {})
|
||||||
|
return { ok: false, message: (error as Error).message }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
ipcMain.handle('packs:select', async (_event, packKey: string) => {
|
ipcMain.handle('packs:select', async (_event, packKey: string) => {
|
||||||
if (!state.packs.has(packKey)) {
|
if (!state.packs.has(packKey)) {
|
||||||
throw new Error(t('errors.packNotFound'))
|
throw new Error(t('errors.packNotFound'))
|
||||||
@@ -252,43 +343,186 @@ ipcMain.handle('install:validatePath', async (_event, target: string) => {
|
|||||||
return { ok: true, message: absolute }
|
return { ok: true, message: absolute }
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('jdk:detect', async () => {
|
// 권장 JDK 메이저는 사이트의 pack.recommendedJdk 로 결정된다(미지정/이상값은 기본값 25).
|
||||||
const candidates: string[] = []
|
// 최신 마인크래프트 서버 jar 이 "class file version 69.0"(=Java 25)처럼 특정 자바 버전을
|
||||||
if (process.env.JAVA_HOME) candidates.push(process.env.JAVA_HOME)
|
// 요구하며, 그보다 낮은 자바로 실행하면 UnsupportedClassVersionError 로 서버가 뜨지 않는다.
|
||||||
if (process.env.JDK_HOME) candidates.push(process.env.JDK_HOME)
|
/** 자동 설치 폴더 이름(예: temurin-25). */
|
||||||
// 자동 설치 위치(우리 설치기가 만든 JDK)도 후보에 포함.
|
function jdkDirName(major: number): string {
|
||||||
candidates.push(path.join(getAppDataDir(), 'jdk', 'temurin-21'))
|
return `temurin-${major}`
|
||||||
candidates.push('C:\\Program Files\\Java')
|
}
|
||||||
|
|
||||||
for (const candidate of candidates) {
|
/**
|
||||||
if (!candidate) continue
|
* java 실행 파일의 메이저 버전을 조회한다(`java -version` 은 stderr 로 출력).
|
||||||
|
* 'openjdk version "25.0.3"' → 25, '"1.8.0_xx"' → 8.
|
||||||
|
* 실행 실패/파싱 실패 시 0.
|
||||||
|
*/
|
||||||
|
function getJavaMajor(javaExe: string): number {
|
||||||
try {
|
try {
|
||||||
const stat = await fsp.stat(candidate)
|
const res = spawnSync(javaExe, ['-version'], { encoding: 'utf8', timeout: 8000 })
|
||||||
if (stat.isFile()) {
|
const out = `${res.stdout || ''}${res.stderr || ''}`
|
||||||
return { found: true, path: candidate }
|
const m = out.match(/version\s+"(\d+)(?:\.(\d+))?/i)
|
||||||
}
|
if (!m) return 0
|
||||||
if (stat.isDirectory()) {
|
let major = parseInt(m[1], 10)
|
||||||
const javaExe = path.join(candidate, 'bin', process.platform === 'win32' ? 'java.exe' : 'java')
|
if (major === 1 && m[2]) major = parseInt(m[2], 10) // 1.8 → 8
|
||||||
if (fs.existsSync(javaExe)) {
|
return Number.isNaN(major) ? 0 : major
|
||||||
return { found: true, path: candidate }
|
} catch {
|
||||||
}
|
return 0
|
||||||
const entries = await fsp.readdir(candidate)
|
|
||||||
for (const entry of entries) {
|
|
||||||
const child = path.join(candidate, entry)
|
|
||||||
const childJava = path.join(child, 'bin', process.platform === 'win32' ? 'java.exe' : 'java')
|
|
||||||
if (fs.existsSync(childJava)) {
|
|
||||||
return { found: true, path: child }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 후보 JDK 홈에서 java 실행 파일 경로를 찾는다(홈 직하 또는 한 단계 감싼 jdk-* 하위까지). */
|
||||||
|
function findJavaExeInHome(candidate: string): string {
|
||||||
|
const javaName = process.platform === 'win32' ? 'java.exe' : 'java'
|
||||||
|
try {
|
||||||
|
const stat = fs.statSync(candidate)
|
||||||
|
if (stat.isFile()) return candidate
|
||||||
|
const direct = path.join(candidate, 'bin', javaName)
|
||||||
|
if (fs.existsSync(direct)) return direct
|
||||||
|
for (const entry of fs.readdirSync(candidate)) {
|
||||||
|
const childJava = path.join(candidate, entry, 'bin', javaName)
|
||||||
|
if (fs.existsSync(childJava)) return childJava
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
continue
|
return ''
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/** %appdata%/<.mc_custom>. 자동 설치 JDK 는 이 폴더 아래 jdk/ 에 둔다. */
|
||||||
|
function customRootDir(): string {
|
||||||
|
return path.join(getAppDataDir(), getMcCustomDirName())
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 설치기 자동 설치 JDK 의 루트(.mc_custom/jdk). */
|
||||||
|
function installerJdkRoot(): string {
|
||||||
|
return path.join(customRootDir(), 'jdk')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** dir(또는 그 한 단계 하위 jdk-* 폴더)에서 java 를 찾아 실제 JDK 홈(<home>/bin/java)을 돌려준다. 없으면 ''. */
|
||||||
|
function resolveJdkHome(dir: string): string {
|
||||||
|
const javaExe = findJavaExeInHome(dir)
|
||||||
|
if (!javaExe) return ''
|
||||||
|
// findJavaExeInHome 은 항상 <home>/bin/java(.exe) 를 돌려준다 → 상위 두 단계가 홈.
|
||||||
|
return path.basename(path.dirname(javaExe)) === 'bin' ? path.dirname(path.dirname(javaExe)) : dir
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parent 아래에서 JDK 홈들을 모두 찾는다. parent 자신, 그리고 각 하위 폴더를 검사하되,
|
||||||
|
* Adoptium zip 처럼 한 단계 더 감싼 `jdk-*` 하위까지 resolveJdkHome 으로 풀어낸다.
|
||||||
|
* (예: .mc_custom/jdk/temurin-25/jdk-25.0.3+9/bin/java.exe)
|
||||||
|
*/
|
||||||
|
function jdkHomesUnder(parent: string): string[] {
|
||||||
|
const out: string[] = []
|
||||||
|
const add = (h: string): void => { if (h) out.push(h) }
|
||||||
|
add(resolveJdkHome(parent))
|
||||||
|
try {
|
||||||
|
for (const entry of fs.readdirSync(parent)) {
|
||||||
|
add(resolveJdkHome(path.join(parent, entry)))
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
/* 폴더 없음 등 무시 */
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JdkEntry { home: string; major: number }
|
||||||
|
|
||||||
|
/** 홈 목록 → {home, major} 목록(중복/버전0 제거). */
|
||||||
|
function homesToEntries(homes: string[]): JdkEntry[] {
|
||||||
|
const javaName = process.platform === 'win32' ? 'java.exe' : 'java'
|
||||||
|
const seen = new Set<string>()
|
||||||
|
const out: JdkEntry[] = []
|
||||||
|
for (const home of homes) {
|
||||||
|
const key = home.toLowerCase()
|
||||||
|
if (seen.has(key)) continue
|
||||||
|
seen.add(key)
|
||||||
|
const major = getJavaMajor(path.join(home, 'bin', javaName))
|
||||||
|
if (major > 0) out.push({ home, major })
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 설치기 자동 설치 위치(.mc_custom/jdk, 구버전 %APPDATA%/jdk 호환)의 JDK 들. */
|
||||||
|
function mcCustomJdkEntries(): JdkEntry[] {
|
||||||
|
const homes: string[] = []
|
||||||
|
for (const base of [installerJdkRoot(), path.join(getAppDataDir(), 'jdk')]) {
|
||||||
|
homes.push(...jdkHomesUnder(base))
|
||||||
|
}
|
||||||
|
return homesToEntries(homes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 환경변수(JAVA_HOME/JDK_HOME)에 등록된 JDK 들. */
|
||||||
|
function envJdkEntries(): JdkEntry[] {
|
||||||
|
const homes: string[] = []
|
||||||
|
for (const env of [process.env.JAVA_HOME, process.env.JDK_HOME]) {
|
||||||
|
if (env) {
|
||||||
|
const h = resolveJdkHome(env)
|
||||||
|
if (h) homes.push(h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { found: false, path: '' }
|
return homesToEntries(homes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 기본 자바 설치 위치 C:\Program Files\Java 아래의 JDK 들. */
|
||||||
|
function programFilesJdkEntries(): JdkEntry[] {
|
||||||
|
return homesToEntries(jdkHomesUnder('C:\\Program Files\\Java'))
|
||||||
|
}
|
||||||
|
|
||||||
|
// JDK 탐색 우선순위(요청 사양):
|
||||||
|
// ① .mc_custom/jdk(설치기가 설치해둔 위치)가 있으면 먼저 사용 — 권장 버전이면 그대로,
|
||||||
|
// 혹시 다른 버전이면 경고(match=false).
|
||||||
|
// ② 환경변수(JAVA_HOME/JDK_HOME) 가 권장 버전이면 사용.
|
||||||
|
// ③ 기본 폴더 C:\Program Files\Java 에 권장 버전이 있으면 사용.
|
||||||
|
// ④ 없으면 환경변수 자바로 폴백하고 "권장과 다름" 경고(match=false).
|
||||||
|
// (환경변수 자바도 없으면 Program Files 자바로 폴백, 그것도 없으면 not found → 자동 설치 유도.)
|
||||||
|
ipcMain.handle('jdk:detect', async (_event, recommendedInput?: number) => {
|
||||||
|
const required = normalizeRecommendedJdk(recommendedInput)
|
||||||
|
const recommended = (entries: JdkEntry[]): JdkEntry | undefined => entries.find((e) => e.major === required)
|
||||||
|
const best = (entries: JdkEntry[]): JdkEntry => entries.slice().sort((a, b) => b.major - a.major)[0]
|
||||||
|
|
||||||
|
// ① .mc_custom/jdk 우선.
|
||||||
|
const mc = mcCustomJdkEntries()
|
||||||
|
if (mc.length > 0) {
|
||||||
|
const rec = recommended(mc)
|
||||||
|
if (rec) return { found: true, path: rec.home, major: required, match: true }
|
||||||
|
const b = best(mc)
|
||||||
|
return { found: true, path: b.home, major: b.major, match: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ② 환경변수 JDK 가 권장 버전이면 사용.
|
||||||
|
const env = envJdkEntries()
|
||||||
|
const envRec = recommended(env)
|
||||||
|
if (envRec) return { found: true, path: envRec.home, major: required, match: true }
|
||||||
|
|
||||||
|
// ③ 기본 폴더(Program Files\Java)에 권장 버전이 있으면 사용.
|
||||||
|
const pf = programFilesJdkEntries()
|
||||||
|
const pfRec = recommended(pf)
|
||||||
|
if (pfRec) return { found: true, path: pfRec.home, major: required, match: true }
|
||||||
|
|
||||||
|
// ④ 폴백: 환경변수 자바 → (없으면) Program Files 자바 + 경고.
|
||||||
|
if (env.length > 0) {
|
||||||
|
const b = best(env)
|
||||||
|
return { found: true, path: b.home, major: b.major, match: false }
|
||||||
|
}
|
||||||
|
if (pf.length > 0) {
|
||||||
|
const b = best(pf)
|
||||||
|
return { found: true, path: b.home, major: b.major, match: false }
|
||||||
|
}
|
||||||
|
return { found: false, path: '', major: required, match: false }
|
||||||
})
|
})
|
||||||
|
|
||||||
// ── JDK 자동 설치(Temurin 21, 취소 가능) ──────────────────────────────
|
// 사용자가 직접 입력/선택한 JDK 경로의 자바 버전을 확인한다.
|
||||||
|
// major=0 → 경로에서 java 를 못 찾거나 버전을 못 읽음(진행 차단용).
|
||||||
|
// match=true → 권장 버전과 정확히 일치.
|
||||||
|
// match=false → 다른 버전(진행은 허용하되 렌더러가 경고를 띄운다).
|
||||||
|
ipcMain.handle('jdk:verify', async (_event, jdkPath: string, recommendedInput?: number): Promise<{ ok: boolean; major: number; required: number; match: boolean }> => {
|
||||||
|
const required = normalizeRecommendedJdk(recommendedInput)
|
||||||
|
const javaExe = jdkPath ? findJavaExeInHome(jdkPath) : ''
|
||||||
|
const major = javaExe ? getJavaMajor(javaExe) : 0
|
||||||
|
return { ok: major > 0, major, required, match: major === required }
|
||||||
|
})
|
||||||
|
|
||||||
|
// ── JDK 자동 설치(권장 버전 Temurin, .mc_custom/jdk 에 설치, 취소 가능) ──────
|
||||||
interface JdkInstallState {
|
interface JdkInstallState {
|
||||||
controller: AbortController | null
|
controller: AbortController | null
|
||||||
destDir: string | null
|
destDir: string | null
|
||||||
@@ -362,22 +596,24 @@ function downloadStream(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.handle('jdk:install', async (): Promise<{ ok: boolean; path?: string; message?: string }> => {
|
ipcMain.handle('jdk:install', async (_event, recommendedInput?: number): Promise<{ ok: boolean; path?: string; message?: string }> => {
|
||||||
if (jdkInstall.inProgress) {
|
if (jdkInstall.inProgress) {
|
||||||
return { ok: false, message: t('errors.jdkBusy') }
|
return { ok: false, message: t('errors.jdkBusy') }
|
||||||
}
|
}
|
||||||
|
const required = normalizeRecommendedJdk(recommendedInput)
|
||||||
jdkInstall.inProgress = true
|
jdkInstall.inProgress = true
|
||||||
const controller = new AbortController()
|
const controller = new AbortController()
|
||||||
jdkInstall.controller = controller
|
jdkInstall.controller = controller
|
||||||
const tmpRoot = path.join(getAppDataDir(), 'jdk-cache')
|
// 자동 설치 JDK 는 .mc_custom/jdk 아래에 둔다(파일제거기가 .mc_custom 통째로 정리 가능).
|
||||||
|
const tmpRoot = path.join(installerJdkRoot(), '.cache')
|
||||||
await fsp.mkdir(tmpRoot, { recursive: true })
|
await fsp.mkdir(tmpRoot, { recursive: true })
|
||||||
const tempZip = path.join(tmpRoot, `temurin-21-${Date.now()}.zip`)
|
const tempZip = path.join(tmpRoot, `${jdkDirName(required)}-${Date.now()}.zip`)
|
||||||
const destDir = path.join(getAppDataDir(), 'jdk', 'temurin-21')
|
const destDir = path.join(installerJdkRoot(), jdkDirName(required))
|
||||||
jdkInstall.destDir = destDir
|
jdkInstall.destDir = destDir
|
||||||
try {
|
try {
|
||||||
// Adoptium API v3: latest GA JDK 21 Windows x64. 본문은 307 로 GitHub 릴리즈로 리다이렉트.
|
// Adoptium API v3: latest GA JDK(Windows x64). 본문은 307 로 GitHub 릴리즈로 리다이렉트.
|
||||||
const url = 'https://api.adoptium.net/v3/binary/latest/21/ga/windows/x64/jdk/hotspot/normal/eclipse?project=jdk'
|
const url = `https://api.adoptium.net/v3/binary/latest/${required}/ga/windows/x64/jdk/hotspot/normal/eclipse?project=jdk`
|
||||||
sendLog(t('log.jdkInstallStart'))
|
sendLog(t('log.jdkInstallStart', { major: required }))
|
||||||
let lastPctReported = -1
|
let lastPctReported = -1
|
||||||
await downloadStream(url, tempZip, controller.signal, (loaded, total) => {
|
await downloadStream(url, tempZip, controller.signal, (loaded, total) => {
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
@@ -614,6 +850,54 @@ async function downloadResourcepackZip(pack: PackDefinition, customRoot: string)
|
|||||||
await downloadFile(url, target)
|
await downloadFile(url, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run.bat 에 넣을 java 실행 명령을 만든다. 자동 설치 JDK 는 %APPDATA% 아래에 있으므로
|
||||||
|
* 사용자명이 한글이어도 인코딩 문제 없이 실행되도록 `%APPDATA%\...\java.exe` 형태로
|
||||||
|
* 만든다(사용자명은 cmd 가 런타임에 전개). %APPDATA% 밖(예: Program Files)이면 절대경로.
|
||||||
|
*/
|
||||||
|
function javaCommandForRunBat(javaExe: string): string {
|
||||||
|
const appData = getAppDataDir()
|
||||||
|
const rel = path.relative(appData, javaExe)
|
||||||
|
if (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) {
|
||||||
|
return `"%APPDATA%\\${rel.split(/[\\/]/).join('\\')}"`
|
||||||
|
}
|
||||||
|
return `"${javaExe}"`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 서버 zip 의 run.bat 이 시스템 PATH 의 `java` 를 그대로 쓰면, 사용자의 낡은 자바(예: 17)로
|
||||||
|
* 실행돼 최신 마인크래프트 서버가 UnsupportedClassVersionError 로 뜨지 않는다.
|
||||||
|
* 설치기가 준비/선택한 JDK 의 java 를 쓰도록 run.bat 의 `java` 실행 토큰을 치환한다.
|
||||||
|
* - `java ... -jar ...`, `java @args nogui`, `"java" ...` 형태 지원.
|
||||||
|
* - 이미 경로/다른 실행기를 쓰는 줄은 건드리지 않는다.
|
||||||
|
* 바이트 보존을 위해 latin1 로 읽고 쓰되(비-ASCII 주석 깨짐 방지), 삽입하는 경로는
|
||||||
|
* %APPDATA% 전개형이라 ASCII 라 안전하다.
|
||||||
|
*/
|
||||||
|
async function patchServerRunBatJava(installPath: string, jdkPath: string): Promise<void> {
|
||||||
|
const runBat = path.join(installPath, 'run.bat')
|
||||||
|
if (!fs.existsSync(runBat)) return
|
||||||
|
const javaExe = findJavaExeInHome(jdkPath)
|
||||||
|
if (!javaExe) {
|
||||||
|
sendLog(t('log.runBatJavaSkip'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const command = javaCommandForRunBat(javaExe)
|
||||||
|
const original = await fsp.readFile(runBat, { encoding: 'latin1' })
|
||||||
|
const lines = original.split(/\r?\n/)
|
||||||
|
let changed = false
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const m = lines[i].match(/^(\s*)"?java(?:\.exe)?"?(\s+.*)$/i)
|
||||||
|
if (m && /(-jar|\bnogui\b|@|-Xm)/i.test(m[2])) {
|
||||||
|
lines[i] = `${m[1]}${command}${m[2]}`
|
||||||
|
changed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changed) {
|
||||||
|
await fsp.writeFile(runBat, lines.join('\r\n'), { encoding: 'latin1' })
|
||||||
|
sendLog(t('log.runBatJavaPatched', { java: command }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ipcMain.handle('server:install', async (_event, payload: ServerInstallPayload) => {
|
ipcMain.handle('server:install', async (_event, payload: ServerInstallPayload) => {
|
||||||
const pack = state.packs.get(payload.packKey)
|
const pack = state.packs.get(payload.packKey)
|
||||||
if (!pack) throw new Error(t('errors.packNotFound2'))
|
if (!pack) throw new Error(t('errors.packNotFound2'))
|
||||||
@@ -630,6 +914,8 @@ ipcMain.handle('server:install', async (_event, payload: ServerInstallPayload) =
|
|||||||
// 동의 흐름은 renderer가 별도 IPC로 읽고 동의 시 덮어쓴다.
|
// 동의 흐름은 renderer가 별도 IPC로 읽고 동의 시 덮어쓴다.
|
||||||
// 설치기는 포트를 직접 열지 않는다(요청). run.bat 에 UPnP 자동 개방을 주입하지
|
// 설치기는 포트를 직접 열지 않는다(요청). run.bat 에 UPnP 자동 개방을 주입하지
|
||||||
// 않으며, 사용자가 라우터에서 수동 포워딩을 하고 포트포워딩 페이지에서 확인만 한다.
|
// 않으며, 사용자가 라우터에서 수동 포워딩을 하고 포트포워딩 페이지에서 확인만 한다.
|
||||||
|
// 단, run.bat 이 시스템의 낡은 자바를 쓰지 않도록 설치기가 준비한 JDK 로 바꿔준다.
|
||||||
|
await patchServerRunBatJava(installPath, payload.jdkPath)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('server:readEula', async (_event, installPath: string): Promise<{ exists: boolean; content: string }> => {
|
ipcMain.handle('server:readEula', async (_event, installPath: string): Promise<{ exists: boolean; content: string }> => {
|
||||||
@@ -1069,7 +1355,13 @@ ipcMain.handle('client:install', async (_event, payload: ClientInstallPayload) =
|
|||||||
}
|
}
|
||||||
|
|
||||||
await downloadModsFolder(pack.pack, customRoot)
|
await downloadModsFolder(pack.pack, customRoot)
|
||||||
|
// 최종 리소스팩이 등록돼 있으면(finalResourcepackPath !== "."), 완성본을 설치 마지막에
|
||||||
|
// 따로 받으므로 베이스 리소스팩은 받지 않는다("최종 리소스팩만 다운로드").
|
||||||
|
if (pack.pack.finalResourcepackPath && pack.pack.finalResourcepackPath !== '.') {
|
||||||
|
sendLog(t('log.skipBaseForFinal'))
|
||||||
|
} else {
|
||||||
await downloadResourcepackZip(pack.pack, customRoot)
|
await downloadResourcepackZip(pack.pack, customRoot)
|
||||||
|
}
|
||||||
|
|
||||||
if (payload.skipMap) {
|
if (payload.skipMap) {
|
||||||
// 참가자 모드: 이전 설치 흐름에서 설치러가 풀어둔 맵이 있다면 제거한다.
|
// 참가자 모드: 이전 설치 흐름에서 설치러가 풀어둔 맵이 있다면 제거한다.
|
||||||
@@ -1110,11 +1402,19 @@ async function installFabricLoader(pack: PackDefinition, customRoot: string): Pr
|
|||||||
// 다시 쓰려고 시도해서, 마인크래프트나 다른 프로세스가 그 파일을 잡고
|
// 다시 쓰려고 시도해서, 마인크래프트나 다른 프로세스가 그 파일을 잡고
|
||||||
// 있으면 FileSystemException 으로 실패한다. 결과 파일이 그대로 있으면
|
// 있으면 FileSystemException 으로 실패한다. 결과 파일이 그대로 있으면
|
||||||
// 재실행할 필요가 없으므로 그냥 통과.
|
// 재실행할 필요가 없으므로 그냥 통과.
|
||||||
|
// fabric 은 .minecraft(런처 폴더)에 설치한다. gameDir(.mc_custom)에 설치하면 fabric 이
|
||||||
|
// versions/ 와 libraries/ 를 거기에 실제 폴더로 만드는데, 이 폴더에는 fabric 자체 것만
|
||||||
|
// 들어가고 바닐라 마인크래프트의 버전 JSON·라이브러리는 빠져 있다. 그러면 .minecraft 로의
|
||||||
|
// 링크가 "이미 폴더 있음" 으로 건너뛰어져, 런처가 바닐라 데이터를 찾지 못하고
|
||||||
|
// "Unable to prepare assets for download" 로 실패한다. 그래서 .minecraft 에 설치해
|
||||||
|
// 바닐라와 같은 위치에 두고, 링크는 뒤(linkMinecraftRuntimeDirs)에서 성공하게 한다.
|
||||||
|
const mcRoot = path.join(getAppDataDir(), '.minecraft')
|
||||||
|
await fsp.mkdir(mcRoot, { recursive: true })
|
||||||
const versionId = `fabric-loader-${loaderVersion}-${pack.mcVersion}`
|
const versionId = `fabric-loader-${loaderVersion}-${pack.mcVersion}`
|
||||||
const versionDir = path.join(customRoot, 'versions', versionId)
|
const versionDir = path.join(mcRoot, 'versions', versionId)
|
||||||
const versionJar = path.join(versionDir, `${versionId}.jar`)
|
|
||||||
const versionJson = path.join(versionDir, `${versionId}.json`)
|
const versionJson = path.join(versionDir, `${versionId}.json`)
|
||||||
if (fs.existsSync(versionJar) && fs.existsSync(versionJson)) {
|
// 최신 fabric 은 버전 폴더에 .json 만 만든다(.jar 없음). json 존재를 설치 완료 기준으로 본다.
|
||||||
|
if (fs.existsSync(versionJson)) {
|
||||||
sendLog(t('log.fabricAlreadyInstalled', { id: versionId, dir: versionDir }))
|
sendLog(t('log.fabricAlreadyInstalled', { id: versionId, dir: versionDir }))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1154,10 +1454,10 @@ async function installFabricLoader(pack: PackDefinition, customRoot: string): Pr
|
|||||||
'client',
|
'client',
|
||||||
'-mcversion', pack.mcVersion,
|
'-mcversion', pack.mcVersion,
|
||||||
'-loader', loaderVersion,
|
'-loader', loaderVersion,
|
||||||
'-dir', customRoot,
|
'-dir', mcRoot,
|
||||||
'-noprofile'
|
'-noprofile'
|
||||||
]
|
]
|
||||||
sendLog(t('log.fabricInstallStart', { mc: pack.mcVersion, loader: loaderVersion, dir: customRoot }))
|
sendLog(t('log.fabricInstallStart', { mc: pack.mcVersion, loader: loaderVersion, dir: mcRoot }))
|
||||||
await runJavaProcess(javaCmd, args)
|
await runJavaProcess(javaCmd, args)
|
||||||
sendLog(t('log.fabricInstallDone'))
|
sendLog(t('log.fabricInstallDone'))
|
||||||
}
|
}
|
||||||
@@ -1463,13 +1763,39 @@ async function linkMinecraftRuntimeDirs(customRoot: string): Promise<void> {
|
|||||||
const src = path.join(mcRoot, dir)
|
const src = path.join(mcRoot, dir)
|
||||||
const dst = path.join(customRoot, dir)
|
const dst = path.join(customRoot, dir)
|
||||||
if (!fs.existsSync(src)) {
|
if (!fs.existsSync(src)) {
|
||||||
|
// .minecraft 에 원본이 없으면(바닐라를 한 번도 안 받았거나 런처가 다른 위치를 쓰는
|
||||||
|
// 환경) 링크를 만들 수 없다. 이때 그냥 건너뛰면 .mc_custom/<dir> 이 아예 없어
|
||||||
|
// 런처가 "Unable to prepare assets for download" 로 실패한다. 빈 폴더라도 만들어
|
||||||
|
// 런처가 그 gameDir 에 직접 받아갈 수 있게 한다(없을 때만).
|
||||||
sendLog(t('log.runtimeDirMissing', { dir }))
|
sendLog(t('log.runtimeDirMissing', { dir }))
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(dst)) {
|
||||||
|
await fsp.mkdir(dst, { recursive: true })
|
||||||
|
sendLog(t('log.runtimeDirCreated', { dir }))
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
sendLog(t('log.runtimeLinkFail', { dir, message: (err as Error).message }))
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let existing: import('node:fs').Stats | null = null
|
let existing: import('node:fs').Stats | null = null
|
||||||
try { existing = await fsp.lstat(dst) } catch { existing = null }
|
try { existing = await fsp.lstat(dst) } catch { existing = null }
|
||||||
if (existing) {
|
if (existing) {
|
||||||
if (existing.isSymbolicLink()) continue // 이미 링크됨
|
if (existing.isSymbolicLink()) continue // 이미 링크됨
|
||||||
|
// versions/libraries 가 실제 폴더면, 예전 버전이 gameDir 에 fabric 을 설치하며 만든
|
||||||
|
// 불완전한(바닐라 누락) 폴더일 수 있다. .minecraft 의 완전한 데이터로 링크되도록
|
||||||
|
// 교체한다. 이 두 폴더는 런처가 관리하는 데이터라 삭제해도 세이브/리소스팩 같은
|
||||||
|
// 사용자 데이터 손실은 없다. (assets 는 받아둔 에셋 보존을 위해 그대로 둔다.)
|
||||||
|
if (dir === 'versions' || dir === 'libraries') {
|
||||||
|
try {
|
||||||
|
await fsp.rm(dst, { recursive: true, force: true })
|
||||||
|
await fsp.symlink(src, dst, 'junction')
|
||||||
|
sendLog(t('log.runtimeLinkReplaced', { dir }))
|
||||||
|
} catch (err) {
|
||||||
|
sendLog(t('log.runtimeLinkFail', { dir, message: (err as Error).message }))
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
sendLog(t('log.runtimeDirExists', { dir }))
|
sendLog(t('log.runtimeDirExists', { dir }))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ const api = {
|
|||||||
// 메인 인스톨러용 약관 목록 (사이트의 visibility 토글에 따라 필터링됨)
|
// 메인 인스톨러용 약관 목록 (사이트의 visibility 토글에 따라 필터링됨)
|
||||||
getTermsList: (): Promise<{ ok: boolean; terms?: Array<{ kind: string; label: string }>; message?: string }> =>
|
getTermsList: (): Promise<{ ok: boolean; terms?: Array<{ kind: string; label: string }>; message?: string }> =>
|
||||||
ipcRenderer.invoke('terms:list'),
|
ipcRenderer.invoke('terms:list'),
|
||||||
|
// 최종 리소스팩 다운로드용 약관 목록 (showInFinalResourcepack 필터)
|
||||||
|
getFinalTermsList: (): Promise<{ ok: boolean; terms?: Array<{ kind: string; label: string }>; message?: string }> =>
|
||||||
|
ipcRenderer.invoke('terms:listFinal'),
|
||||||
|
// 최종 리소스팩 다운로드 실행
|
||||||
|
installFinalResourcepack: (): Promise<{ ok: boolean; path?: string; message?: string }> =>
|
||||||
|
ipcRenderer.invoke('finalResourcepack:install'),
|
||||||
|
|
||||||
// 3-1
|
// 3-1
|
||||||
pickFolder: (): Promise<string | null> => ipcRenderer.invoke('dialog:pickFolder'),
|
pickFolder: (): Promise<string | null> => ipcRenderer.invoke('dialog:pickFolder'),
|
||||||
@@ -24,8 +30,12 @@ const api = {
|
|||||||
ipcRenderer.invoke('install:validatePath', target),
|
ipcRenderer.invoke('install:validatePath', target),
|
||||||
|
|
||||||
// 3-2
|
// 3-2
|
||||||
detectJdk: (): Promise<{ found: boolean; path: string }> => ipcRenderer.invoke('jdk:detect'),
|
detectJdk: (recommendedJdk?: number): Promise<{ found: boolean; path: string; major: number; match: boolean }> =>
|
||||||
installJdk: (): Promise<{ ok: boolean; path?: string; message?: string }> => ipcRenderer.invoke('jdk:install'),
|
ipcRenderer.invoke('jdk:detect', recommendedJdk),
|
||||||
|
verifyJdk: (jdkPath: string, recommendedJdk?: number): Promise<{ ok: boolean; major: number; required: number; match: boolean }> =>
|
||||||
|
ipcRenderer.invoke('jdk:verify', jdkPath, recommendedJdk),
|
||||||
|
installJdk: (recommendedJdk?: number): Promise<{ ok: boolean; path?: string; message?: string }> =>
|
||||||
|
ipcRenderer.invoke('jdk:install', recommendedJdk),
|
||||||
cancelJdkInstall: (): Promise<{ ok: boolean }> => ipcRenderer.invoke('jdk:cancelInstall'),
|
cancelJdkInstall: (): Promise<{ ok: boolean }> => ipcRenderer.invoke('jdk:cancelInstall'),
|
||||||
|
|
||||||
// 3-3
|
// 3-3
|
||||||
@@ -64,6 +74,15 @@ const api = {
|
|||||||
const listener = (_event: unknown, line: string) => handler(line)
|
const listener = (_event: unknown, line: string) => handler(line)
|
||||||
ipcRenderer.on('log', listener)
|
ipcRenderer.on('log', listener)
|
||||||
return () => ipcRenderer.removeListener('log', listener)
|
return () => ipcRenderer.removeListener('log', listener)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 최종 리소스팩 다운로드 진행률 구독. 반환값을 호출하면 구독 해제.
|
||||||
|
onFinalResourcepackProgress: (
|
||||||
|
handler: (info: { loaded: number; total: number; percent: number }) => void
|
||||||
|
): (() => void) => {
|
||||||
|
const listener = (_event: unknown, info: { loaded: number; total: number; percent: number }) => handler(info)
|
||||||
|
ipcRenderer.on('finalResourcepack:progress', listener)
|
||||||
|
return () => ipcRenderer.removeListener('finalResourcepack:progress', listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ import {
|
|||||||
savePackList,
|
savePackList,
|
||||||
setPackPublic,
|
setPackPublic,
|
||||||
setTermVisibility,
|
setTermVisibility,
|
||||||
writeAccounts
|
writeAccounts,
|
||||||
|
SUPPORTED_JDK_MAJORS
|
||||||
} from '../../shared/store.js'
|
} from '../../shared/store.js'
|
||||||
import { hashPassword, isHashed, verifyPassword } from '../password.js'
|
import { hashPassword, isHashed, verifyPassword } from '../password.js'
|
||||||
import { fetchReleaseVersions } from '../../shared/mojang.js'
|
import { fetchReleaseVersions } from '../../shared/mojang.js'
|
||||||
|
import { fetchJdkAvailability, fetchJdkReleaseNames } from '../../shared/jdkVersions.js'
|
||||||
import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube.js'
|
import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube.js'
|
||||||
import { requireAuth } from '../middleware/auth.js'
|
import { requireAuth } from '../middleware/auth.js'
|
||||||
import type { PackDefinition, PackList } from '../../shared/types.js'
|
import type { PackDefinition, PackList } from '../../shared/types.js'
|
||||||
@@ -187,13 +189,39 @@ opRouter.get('/op/dashboard/:packName', requireAuth, async (req, res, next) => {
|
|||||||
packKey,
|
packKey,
|
||||||
pack: definition,
|
pack: definition,
|
||||||
releases,
|
releases,
|
||||||
isPublic
|
isPublic,
|
||||||
|
jdkOptions: SUPPORTED_JDK_MAJORS
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error)
|
next(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// ─── /op/jdk-versions ───────────────────────────────────────────────────
|
||||||
|
// Adoptium(Temurin) 에서 실제 배포되는 JDK 메이저 목록을 프록시(브라우저 직접 호출은
|
||||||
|
// CORS 로 막힘). 편집기의 "권장 JDK" 드롭다운을 이 결과로 채운다.
|
||||||
|
opRouter.get('/op/jdk-versions', requireAuth, async (_req, res, next) => {
|
||||||
|
try {
|
||||||
|
res.json(await fetchJdkAvailability())
|
||||||
|
} catch (error) {
|
||||||
|
next(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 특정 메이저의 상세 릴리스 이름(GA + EA 스냅샷). "자세히 보기" 에서 사용.
|
||||||
|
opRouter.get('/op/jdk-versions/:major', requireAuth, async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const major = Number(req.params.major)
|
||||||
|
if (!Number.isInteger(major) || major < 8 || major > 99) {
|
||||||
|
res.status(400).json({ error: 'invalid major' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res.json(await fetchJdkReleaseNames(major))
|
||||||
|
} catch (error) {
|
||||||
|
next(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// ─── /op/list ──────────────────────────────────────────────────────────
|
// ─── /op/list ──────────────────────────────────────────────────────────
|
||||||
// 음악퀴즈를 카드 한 줄로 표시. 카드 클릭 → /op/list/:packName
|
// 음악퀴즈를 카드 한 줄로 표시. 카드 클릭 → /op/list/:packName
|
||||||
opRouter.get('/op/list', requireAuth, async (req, res, next) => {
|
opRouter.get('/op/list', requireAuth, async (req, res, next) => {
|
||||||
@@ -507,6 +535,7 @@ opRouter.get('/op/agreement/:packName/:kind', requireAuth, async (req, res, next
|
|||||||
label: entry.label,
|
label: entry.label,
|
||||||
showInInstaller: entry.showInInstaller,
|
showInInstaller: entry.showInInstaller,
|
||||||
showInInstallerRp: entry.showInInstallerRp,
|
showInInstallerRp: entry.showInInstallerRp,
|
||||||
|
showInFinalResourcepack: entry.showInFinalResourcepack,
|
||||||
content
|
content
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -534,10 +563,12 @@ opRouter.post('/op/agreement/:packName/:kind', requireAuth, async (req, res, nex
|
|||||||
if (
|
if (
|
||||||
typeof req.body?.showInInstaller === 'boolean'
|
typeof req.body?.showInInstaller === 'boolean'
|
||||||
|| typeof req.body?.showInInstallerRp === 'boolean'
|
|| typeof req.body?.showInInstallerRp === 'boolean'
|
||||||
|
|| typeof req.body?.showInFinalResourcepack === 'boolean'
|
||||||
) {
|
) {
|
||||||
await setTermVisibility(packKey, kind, {
|
await setTermVisibility(packKey, kind, {
|
||||||
showInInstaller: req.body.showInInstaller === true,
|
showInInstaller: req.body.showInInstaller === true,
|
||||||
showInInstallerRp: req.body.showInInstallerRp === true
|
showInInstallerRp: req.body.showInInstallerRp === true,
|
||||||
|
showInFinalResourcepack: req.body.showInFinalResourcepack === true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
res.json({ ok: true })
|
res.json({ ok: true })
|
||||||
@@ -565,11 +596,13 @@ opRouter.post('/op/dashboard/:packName', requireAuth, async (req, res, next) =>
|
|||||||
} as PackDefinition['platform'] & { loaderVersion?: string },
|
} as PackDefinition['platform'] & { loaderVersion?: string },
|
||||||
modsFolder: pickFirstValue(req.body.modsFolder),
|
modsFolder: pickFirstValue(req.body.modsFolder),
|
||||||
resourcepackPath: pickFirstValue(req.body.resourcepackPath),
|
resourcepackPath: pickFirstValue(req.body.resourcepackPath),
|
||||||
|
finalResourcepackPath: pickFirstValue(req.body.finalResourcepackPath),
|
||||||
outputPackName: pickFirstValue(req.body.outputPackName),
|
outputPackName: pickFirstValue(req.body.outputPackName),
|
||||||
serverMinRam: Number(pickFirstValue(req.body.serverMinRam)),
|
serverMinRam: Number(pickFirstValue(req.body.serverMinRam)),
|
||||||
serverMaxRam: Number(pickFirstValue(req.body.serverMaxRam)),
|
serverMaxRam: Number(pickFirstValue(req.body.serverMaxRam)),
|
||||||
clientMinRam: Number(pickFirstValue(req.body.clientMinRam)),
|
clientMinRam: Number(pickFirstValue(req.body.clientMinRam)),
|
||||||
clientRecommendedRam: Number(pickFirstValue(req.body.clientRecommendedRam)),
|
clientRecommendedRam: Number(pickFirstValue(req.body.clientRecommendedRam)),
|
||||||
|
recommendedJdk: Number(pickFirstValue(req.body.recommendedJdk)),
|
||||||
mapPath: pickFirstValue(req.body.mapPath),
|
mapPath: pickFirstValue(req.body.mapPath),
|
||||||
serverPath: pickFirstValue(req.body.serverPath)
|
serverPath: pickFirstValue(req.body.serverPath)
|
||||||
}
|
}
|
||||||
|
|||||||
118
src/shared/jdkVersions.ts
Normal file
118
src/shared/jdkVersions.ts
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
import https from 'node:https'
|
||||||
|
|
||||||
|
// Adoptium(Temurin) API 로부터 실제 배포되는 JDK 버전을 가져온다. 설치기가 이 벤더를
|
||||||
|
// 쓰므로 사이트의 "권장 JDK" 목록도 같은 소스에서 채운다(하드코딩 금지). 네트워크
|
||||||
|
// 실패 시에는 정적 폴백을 돌려줘 편집기가 항상 동작하도록 한다.
|
||||||
|
|
||||||
|
const AVAILABLE_URL = 'https://api.adoptium.net/v3/info/available_releases'
|
||||||
|
const CACHE_TTL_MS = 6 * 60 * 60 * 1000 // 6시간
|
||||||
|
|
||||||
|
const FALLBACK_MAJORS = [8, 11, 17, 21, 25]
|
||||||
|
const FALLBACK_LTS = [8, 11, 17, 21, 25]
|
||||||
|
|
||||||
|
export interface JdkAvailability {
|
||||||
|
/** 배포되는 모든 메이저(예: 8,11,17,21,25,26). 내림차순. */
|
||||||
|
available: number[]
|
||||||
|
/** LTS 메이저만(예: 8,11,17,21,25). 내림차순. */
|
||||||
|
lts: number[]
|
||||||
|
mostRecentLts: number
|
||||||
|
mostRecentFeature: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface JdkReleaseNames {
|
||||||
|
major: number
|
||||||
|
/** 정식(GA) 릴리스 이름들(예: jdk-25.0.3+9). */
|
||||||
|
ga: string[]
|
||||||
|
/** 개발 스냅샷(EA) 릴리스 이름들(예: jdk-25.0.4+6-ea-beta). */
|
||||||
|
ea: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
let availCache: { data: JdkAvailability; at: number } | null = null
|
||||||
|
const releaseNamesCache = new Map<number, { data: JdkReleaseNames; at: number }>()
|
||||||
|
|
||||||
|
function fetchJson<T>(url: string): Promise<T> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const request = https.get(url, { timeout: 8000, headers: { accept: 'application/json' } }, (response) => {
|
||||||
|
const code = response.statusCode ?? 0
|
||||||
|
if (code !== 200) {
|
||||||
|
response.resume()
|
||||||
|
reject(new Error(`Adoptium HTTP ${code}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const chunks: Buffer[] = []
|
||||||
|
response.on('data', (c: Buffer) => chunks.push(c))
|
||||||
|
response.on('end', () => {
|
||||||
|
try {
|
||||||
|
resolve(JSON.parse(Buffer.concat(chunks).toString('utf8')) as T)
|
||||||
|
} catch (error) {
|
||||||
|
reject(error as Error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
request.on('error', reject)
|
||||||
|
request.on('timeout', () => request.destroy(new Error('Adoptium timeout')))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const sortDesc = (nums: number[]): number[] => [...new Set(nums)].sort((a, b) => b - a)
|
||||||
|
|
||||||
|
export async function fetchJdkAvailability(): Promise<JdkAvailability> {
|
||||||
|
if (availCache && Date.now() - availCache.at < CACHE_TTL_MS) return availCache.data
|
||||||
|
try {
|
||||||
|
const raw = await fetchJson<{
|
||||||
|
available_releases?: number[]
|
||||||
|
available_lts_releases?: number[]
|
||||||
|
most_recent_lts?: number
|
||||||
|
most_recent_feature_release?: number
|
||||||
|
}>(AVAILABLE_URL)
|
||||||
|
const available = sortDesc(
|
||||||
|
(Array.isArray(raw.available_releases) ? raw.available_releases : FALLBACK_MAJORS).filter((n) => Number.isInteger(n))
|
||||||
|
)
|
||||||
|
const lts = sortDesc(
|
||||||
|
(Array.isArray(raw.available_lts_releases) ? raw.available_lts_releases : FALLBACK_LTS).filter((n) => Number.isInteger(n))
|
||||||
|
)
|
||||||
|
const data: JdkAvailability = {
|
||||||
|
available,
|
||||||
|
lts,
|
||||||
|
mostRecentLts: Number(raw.most_recent_lts) || (lts[0] ?? 21),
|
||||||
|
mostRecentFeature: Number(raw.most_recent_feature_release) || (available[0] ?? 25)
|
||||||
|
}
|
||||||
|
availCache = { data, at: Date.now() }
|
||||||
|
return data
|
||||||
|
} catch {
|
||||||
|
return (
|
||||||
|
availCache?.data ?? {
|
||||||
|
available: sortDesc(FALLBACK_MAJORS),
|
||||||
|
lts: sortDesc(FALLBACK_LTS),
|
||||||
|
mostRecentLts: 25,
|
||||||
|
mostRecentFeature: 25
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchReleaseNames(major: number, type: 'ga' | 'ea'): Promise<string[]> {
|
||||||
|
const url =
|
||||||
|
`https://api.adoptium.net/v3/assets/feature_releases/${major}/${type}` +
|
||||||
|
'?architecture=x64&image_type=jdk&os=windows&vendor=eclipse&page_size=10'
|
||||||
|
try {
|
||||||
|
const arr = await fetchJson<Array<{ release_name?: string }>>(url)
|
||||||
|
if (!Array.isArray(arr)) return []
|
||||||
|
const names: string[] = []
|
||||||
|
for (const r of arr) {
|
||||||
|
if (typeof r?.release_name === 'string' && !names.includes(r.release_name)) names.push(r.release_name)
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchJdkReleaseNames(major: number): Promise<JdkReleaseNames> {
|
||||||
|
const cached = releaseNamesCache.get(major)
|
||||||
|
if (cached && Date.now() - cached.at < CACHE_TTL_MS) return cached.data
|
||||||
|
const [ga, ea] = await Promise.all([fetchReleaseNames(major, 'ga'), fetchReleaseNames(major, 'ea')])
|
||||||
|
const data: JdkReleaseNames = { major, ga, ea }
|
||||||
|
releaseNamesCache.set(major, { data, at: Date.now() })
|
||||||
|
return data
|
||||||
|
}
|
||||||
@@ -47,11 +47,13 @@ export function defaultPackDefinition(name: string): PackDefinition {
|
|||||||
platform: { type: 'vanilla' },
|
platform: { type: 'vanilla' },
|
||||||
modsFolder: '',
|
modsFolder: '',
|
||||||
resourcepackPath: '',
|
resourcepackPath: '',
|
||||||
|
finalResourcepackPath: '.',
|
||||||
outputPackName: '',
|
outputPackName: '',
|
||||||
serverMinRam: 2048,
|
serverMinRam: 2048,
|
||||||
serverMaxRam: 4096,
|
serverMaxRam: 4096,
|
||||||
clientMinRam: 2048,
|
clientMinRam: 2048,
|
||||||
clientRecommendedRam: 4096,
|
clientRecommendedRam: 4096,
|
||||||
|
recommendedJdk: DEFAULT_JDK_MAJOR,
|
||||||
mapPath: '',
|
mapPath: '',
|
||||||
serverPath: ''
|
serverPath: ''
|
||||||
}
|
}
|
||||||
@@ -78,6 +80,31 @@ function sanitizeFolderName(input: unknown): string {
|
|||||||
|
|
||||||
const ALLOWED_LOADERS: LoaderType[] = ['vanilla', 'forge', 'fabric', 'neoforge']
|
const ALLOWED_LOADERS: LoaderType[] = ['vanilla', 'forge', 'fabric', 'neoforge']
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 편집기 드롭다운의 정적 폴백 목록(LTS). 실제 목록은 Adoptium API 에서 가져오며,
|
||||||
|
* 네트워크 실패 시에만 이 값을 쓴다.
|
||||||
|
* 마인크래프트 버전대별: 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 메이저로 보정. 특정 목록에 얽매이지 않고 실제 배포되는 자바 메이저
|
||||||
|
* 범위(8~99)면 허용하고, 벗어나면 기본값. (목록은 Adoptium 에서 동적으로 온다.)
|
||||||
|
*/
|
||||||
|
export function normalizeRecommendedJdk(input: unknown): number {
|
||||||
|
const n = Math.floor(Number(input))
|
||||||
|
return Number.isFinite(n) && n >= 8 && n <= 99 ? n : DEFAULT_JDK_MAJOR
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "최종 리소스팩" 값 보정. 빈 값/`.` 은 "없음"을 뜻하는 `.` 으로, 그 외는 zip 파일명으로. */
|
||||||
|
export function normalizeFinalResourcepack(input: unknown): string {
|
||||||
|
const raw = typeof input === 'string' ? input.trim() : ''
|
||||||
|
if (raw === '' || raw === '.') return '.'
|
||||||
|
return sanitizeZipFileName(raw)
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizePackDefinition(input: Partial<PackDefinition> & Record<string, unknown>): PackDefinition {
|
export function normalizePackDefinition(input: Partial<PackDefinition> & Record<string, unknown>): PackDefinition {
|
||||||
const fallback = defaultPackDefinition(typeof input.name === 'string' ? input.name : 'new')
|
const fallback = defaultPackDefinition(typeof input.name === 'string' ? input.name : 'new')
|
||||||
const platform = (input.platform ?? {}) as Partial<PackDefinition['platform']>
|
const platform = (input.platform ?? {}) as Partial<PackDefinition['platform']>
|
||||||
@@ -106,12 +133,14 @@ export function normalizePackDefinition(input: Partial<PackDefinition> & Record<
|
|||||||
},
|
},
|
||||||
modsFolder: sanitizeFolderName(input.modsFolder),
|
modsFolder: sanitizeFolderName(input.modsFolder),
|
||||||
resourcepackPath: sanitizeZipFileName(input.resourcepackPath),
|
resourcepackPath: sanitizeZipFileName(input.resourcepackPath),
|
||||||
|
finalResourcepackPath: normalizeFinalResourcepack(input.finalResourcepackPath),
|
||||||
// 표시명은 사용자 입력을 보존(공백/마침표 trim 만). 파일명 안전 처리는 설치기 측에서.
|
// 표시명은 사용자 입력을 보존(공백/마침표 trim 만). 파일명 안전 처리는 설치기 측에서.
|
||||||
outputPackName: typeof input.outputPackName === 'string' ? input.outputPackName.trim() : '',
|
outputPackName: typeof input.outputPackName === 'string' ? input.outputPackName.trim() : '',
|
||||||
serverMinRam: clampNumber(input.serverMinRam, fallback.serverMinRam),
|
serverMinRam: clampNumber(input.serverMinRam, fallback.serverMinRam),
|
||||||
serverMaxRam: clampNumber(input.serverMaxRam, fallback.serverMaxRam),
|
serverMaxRam: clampNumber(input.serverMaxRam, fallback.serverMaxRam),
|
||||||
clientMinRam: clampNumber(input.clientMinRam, fallback.clientMinRam),
|
clientMinRam: clampNumber(input.clientMinRam, fallback.clientMinRam),
|
||||||
clientRecommendedRam: clampNumber(input.clientRecommendedRam, fallback.clientRecommendedRam),
|
clientRecommendedRam: clampNumber(input.clientRecommendedRam, fallback.clientRecommendedRam),
|
||||||
|
recommendedJdk: normalizeRecommendedJdk(input.recommendedJdk),
|
||||||
mapPath: sanitizeZipFileName(input.mapPath),
|
mapPath: sanitizeZipFileName(input.mapPath),
|
||||||
serverPath: sanitizeZipFileName(input.serverPath)
|
serverPath: sanitizeZipFileName(input.serverPath)
|
||||||
}
|
}
|
||||||
@@ -373,12 +402,13 @@ const DEFAULT_TERM_SEEDS: Array<{
|
|||||||
label: string
|
label: string
|
||||||
showInInstaller: boolean
|
showInInstaller: boolean
|
||||||
showInInstallerRp: boolean
|
showInInstallerRp: boolean
|
||||||
|
showInFinalResourcepack: boolean
|
||||||
}> = [
|
}> = [
|
||||||
{ kind: 'map', label: '맵 약관', showInInstaller: true, showInInstallerRp: false },
|
{ kind: 'map', label: '맵 약관', showInInstaller: true, showInInstallerRp: false, showInFinalResourcepack: false },
|
||||||
{ kind: 'mod', label: '모드 약관', showInInstaller: true, showInInstallerRp: false },
|
{ kind: 'mod', label: '모드 약관', showInInstaller: true, showInInstallerRp: false, showInFinalResourcepack: false },
|
||||||
{ kind: 'installer', label: '설치기 약관', showInInstaller: true, showInInstallerRp: false },
|
{ kind: 'installer', label: '설치기 약관', showInInstaller: true, showInInstallerRp: false, showInFinalResourcepack: false },
|
||||||
{ kind: 'resourcepack', label: '리소스팩 약관', showInInstaller: false, showInInstallerRp: true },
|
{ kind: 'resourcepack', label: '리소스팩 약관', showInInstaller: false, showInInstallerRp: true, showInFinalResourcepack: true },
|
||||||
{ kind: 'installer-rp', label: '리소스팩 설치기 약관', showInInstaller: false, showInInstallerRp: true }
|
{ kind: 'installer-rp', label: '리소스팩 설치기 약관', showInInstaller: false, showInInstallerRp: true, showInFinalResourcepack: false }
|
||||||
]
|
]
|
||||||
|
|
||||||
const TERM_KIND_RE = /^[a-z0-9][a-z0-9-]{0,31}$/
|
const TERM_KIND_RE = /^[a-z0-9][a-z0-9-]{0,31}$/
|
||||||
@@ -391,6 +421,7 @@ export interface TermEntry {
|
|||||||
label: string
|
label: string
|
||||||
showInInstaller: boolean
|
showInInstaller: boolean
|
||||||
showInInstallerRp: boolean
|
showInInstallerRp: boolean
|
||||||
|
showInFinalResourcepack: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TermsMeta {
|
interface TermsMeta {
|
||||||
@@ -482,7 +513,8 @@ async function ensureMetaInitialized(dir: string, dirWasJustCreated: boolean): P
|
|||||||
meta.terms[seed.kind] = {
|
meta.terms[seed.kind] = {
|
||||||
label: seed.label,
|
label: seed.label,
|
||||||
showInInstaller: seed.showInInstaller,
|
showInInstaller: seed.showInInstaller,
|
||||||
showInInstallerRp: seed.showInInstallerRp
|
showInInstallerRp: seed.showInInstallerRp,
|
||||||
|
showInFinalResourcepack: seed.showInFinalResourcepack
|
||||||
}
|
}
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
@@ -523,10 +555,11 @@ async function ensureMetaInitialized(dir: string, dirWasJustCreated: boolean): P
|
|||||||
terms[seed.kind] = {
|
terms[seed.kind] = {
|
||||||
label: seed.label,
|
label: seed.label,
|
||||||
showInInstaller: seed.showInInstaller,
|
showInInstaller: seed.showInInstaller,
|
||||||
showInInstallerRp: seed.showInInstallerRp
|
showInInstallerRp: seed.showInInstallerRp,
|
||||||
|
showInFinalResourcepack: seed.showInFinalResourcepack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 구 스키마의 사용자 정의 약관은 양쪽 인스톨러에 보이도록 기본값으로.
|
// 구 스키마의 사용자 정의 약관은 양쪽 인스톨러에 보이도록 기본값으로(최종 리소스팩은 기본 off).
|
||||||
for (const [k, label] of Object.entries(oldCustomLabels)) {
|
for (const [k, label] of Object.entries(oldCustomLabels)) {
|
||||||
if (terms[k]) continue
|
if (terms[k]) continue
|
||||||
try {
|
try {
|
||||||
@@ -534,7 +567,7 @@ async function ensureMetaInitialized(dir: string, dirWasJustCreated: boolean): P
|
|||||||
} catch {
|
} catch {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
terms[k] = { label, showInInstaller: true, showInInstallerRp: true }
|
terms[k] = { label, showInInstaller: true, showInInstallerRp: true, showInFinalResourcepack: false }
|
||||||
}
|
}
|
||||||
await fsp.writeFile(metaPath, `${JSON.stringify({ terms }, null, 2)}\n`, 'utf8')
|
await fsp.writeFile(metaPath, `${JSON.stringify({ terms }, null, 2)}\n`, 'utf8')
|
||||||
}
|
}
|
||||||
@@ -555,7 +588,8 @@ async function loadTermsMeta(packKey: string): Promise<TermsMeta> {
|
|||||||
result.terms[k] = {
|
result.terms[k] = {
|
||||||
label,
|
label,
|
||||||
showInInstaller: entry.showInInstaller === true,
|
showInInstaller: entry.showInInstaller === true,
|
||||||
showInInstallerRp: entry.showInInstallerRp === true
|
showInInstallerRp: entry.showInInstallerRp === true,
|
||||||
|
showInFinalResourcepack: entry.showInFinalResourcepack === true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,6 +614,7 @@ export interface TermItem {
|
|||||||
label: string
|
label: string
|
||||||
showInInstaller: boolean
|
showInInstaller: boolean
|
||||||
showInInstallerRp: boolean
|
showInInstallerRp: boolean
|
||||||
|
showInFinalResourcepack: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -613,7 +648,8 @@ export async function listTermsWithLabels(packKey: string): Promise<TermItem[]>
|
|||||||
kind: seed.kind,
|
kind: seed.kind,
|
||||||
label: entry.label,
|
label: entry.label,
|
||||||
showInInstaller: entry.showInInstaller,
|
showInInstaller: entry.showInInstaller,
|
||||||
showInInstallerRp: entry.showInInstallerRp
|
showInInstallerRp: entry.showInInstallerRp,
|
||||||
|
showInFinalResourcepack: entry.showInFinalResourcepack
|
||||||
})
|
})
|
||||||
seen.add(seed.kind)
|
seen.add(seed.kind)
|
||||||
}
|
}
|
||||||
@@ -627,7 +663,8 @@ export async function listTermsWithLabels(packKey: string): Promise<TermItem[]>
|
|||||||
kind,
|
kind,
|
||||||
label: entry.label,
|
label: entry.label,
|
||||||
showInInstaller: entry.showInInstaller,
|
showInInstaller: entry.showInInstaller,
|
||||||
showInInstallerRp: entry.showInInstallerRp
|
showInInstallerRp: entry.showInInstallerRp,
|
||||||
|
showInFinalResourcepack: entry.showInFinalResourcepack
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return items
|
return items
|
||||||
@@ -646,7 +683,7 @@ export async function getTermEntry(packKey: string, kind: string): Promise<TermE
|
|||||||
export async function setTermVisibility(
|
export async function setTermVisibility(
|
||||||
packKey: string,
|
packKey: string,
|
||||||
kind: string,
|
kind: string,
|
||||||
visibility: { showInInstaller: boolean; showInInstallerRp: boolean }
|
visibility: { showInInstaller: boolean; showInInstallerRp: boolean; showInFinalResourcepack: boolean }
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (!isTermKind(kind)) throw new Error('invalid term kind')
|
if (!isTermKind(kind)) throw new Error('invalid term kind')
|
||||||
const meta = await loadTermsMeta(packKey)
|
const meta = await loadTermsMeta(packKey)
|
||||||
@@ -654,6 +691,7 @@ export async function setTermVisibility(
|
|||||||
if (!entry) throw new Error('term not found')
|
if (!entry) throw new Error('term not found')
|
||||||
entry.showInInstaller = !!visibility.showInInstaller
|
entry.showInInstaller = !!visibility.showInInstaller
|
||||||
entry.showInInstallerRp = !!visibility.showInInstallerRp
|
entry.showInInstallerRp = !!visibility.showInInstallerRp
|
||||||
|
entry.showInFinalResourcepack = !!visibility.showInFinalResourcepack
|
||||||
await saveTermsMeta(packKey, meta)
|
await saveTermsMeta(packKey, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,7 +741,8 @@ export async function createTerm(packKey: string, kind: string, label: string):
|
|||||||
meta.terms[kind] = {
|
meta.terms[kind] = {
|
||||||
label: cleanLabel,
|
label: cleanLabel,
|
||||||
showInInstaller: seed ? seed.showInInstaller : true,
|
showInInstaller: seed ? seed.showInInstaller : true,
|
||||||
showInInstallerRp: seed ? seed.showInInstallerRp : true
|
showInInstallerRp: seed ? seed.showInInstallerRp : true,
|
||||||
|
showInFinalResourcepack: seed ? seed.showInFinalResourcepack : false
|
||||||
}
|
}
|
||||||
await saveTermsMeta(packKey, meta)
|
await saveTermsMeta(packKey, meta)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,14 @@ export interface PackDefinition {
|
|||||||
platform: PackPlatform
|
platform: PackPlatform
|
||||||
/** /file/mods/<modsFolder>/ 폴더 안의 모든 .jar을 자동 다운로드. */
|
/** /file/mods/<modsFolder>/ 폴더 안의 모든 .jar을 자동 다운로드. */
|
||||||
modsFolder: string
|
modsFolder: string
|
||||||
/** /file/resourcepacks/<resourcepackPath> 의 단일 .zip을 그대로 다운로드. */
|
/** /file/resourcepacks/<resourcepackPath> 의 단일 .zip을 그대로 다운로드(리소스팩 설치기의 베이스). */
|
||||||
resourcepackPath: string
|
resourcepackPath: string
|
||||||
|
/**
|
||||||
|
* 간편설치기 마지막에 선택 설치하는 "최종 리소스팩" zip 파일 이름.
|
||||||
|
* /file/resourcepacks/outputs/<finalResourcepackPath> 에서 받는다.
|
||||||
|
* `"."` 이면 없음(설치 여부 질문 자체를 건너뜀). 기본값은 `"."`.
|
||||||
|
*/
|
||||||
|
finalResourcepackPath: string
|
||||||
/**
|
/**
|
||||||
* 리소스팩 설치기가 만들어 내는 최종 zip 파일의 이름(확장자 제외).
|
* 리소스팩 설치기가 만들어 내는 최종 zip 파일의 이름(확장자 제외).
|
||||||
* 빈 문자열이면 설치기가 `<packKey>_resourcepack` 형식으로 기본 이름을 만든다.
|
* 빈 문자열이면 설치기가 `<packKey>_resourcepack` 형식으로 기본 이름을 만든다.
|
||||||
@@ -28,6 +34,11 @@ export interface PackDefinition {
|
|||||||
serverMaxRam: number
|
serverMaxRam: number
|
||||||
clientMinRam: number
|
clientMinRam: number
|
||||||
clientRecommendedRam: number
|
clientRecommendedRam: number
|
||||||
|
/**
|
||||||
|
* 서버 실행에 권장하는 JDK 메이저 버전(예: 25). 설치기가 이 버전을 우선 탐색/설치한다.
|
||||||
|
* 사이트에서 선택하며, 허용 목록(SUPPORTED_JDK_MAJORS) 밖의 값은 기본값으로 보정된다.
|
||||||
|
*/
|
||||||
|
recommendedJdk: number
|
||||||
/** /file/maps/<mapPath> 에서 받아 .mc_custom/saves 로 풀 zip 파일 이름. */
|
/** /file/maps/<mapPath> 에서 받아 .mc_custom/saves 로 풀 zip 파일 이름. */
|
||||||
mapPath: string
|
mapPath: string
|
||||||
/** /file/servers/<serverPath> 에서 받아 서버 설치 경로로 풀 zip 파일 이름. */
|
/** /file/servers/<serverPath> 에서 받아 서버 설치 경로로 풀 zip 파일 이름. */
|
||||||
|
|||||||
@@ -80,6 +80,17 @@
|
|||||||
<span><%= t('editor.clientRecommendedRam') %></span>
|
<span><%= t('editor.clientRecommendedRam') %></span>
|
||||||
<input type="number" name="clientRecommendedRam" value="<%= pack.clientRecommendedRam %>" min="512" required />
|
<input type="number" name="clientRecommendedRam" value="<%= pack.clientRecommendedRam %>" min="512" required />
|
||||||
</label>
|
</label>
|
||||||
|
<label>
|
||||||
|
<span><%= t('editor.recommendedJdk') %></span>
|
||||||
|
<select name="recommendedJdk" id="recommendedJdk" data-current="<%= pack.recommendedJdk %>" required>
|
||||||
|
<option value="<%= pack.recommendedJdk %>" selected>Java <%= pack.recommendedJdk %></option>
|
||||||
|
</select>
|
||||||
|
<label class="muted" style="font-weight:normal;display:flex;align-items:center;gap:6px;margin-top:4px;">
|
||||||
|
<input type="checkbox" id="jdkShowDetails" style="width:auto;" /> <%= t('editor.jdkShowDetails') %>
|
||||||
|
</label>
|
||||||
|
<div id="jdkDetails" class="muted" hidden style="margin-top:4px;font-size:12px;line-height:1.6;word-break:break-all;"></div>
|
||||||
|
<small class="muted"><%= t('editor.recommendedJdkHint') %></small>
|
||||||
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<span><%= t('editor.mapPath') %></span>
|
<span><%= t('editor.mapPath') %></span>
|
||||||
<input name="mapPath" value="<%= pack.mapPath %>" placeholder="my-map.zip" pattern=".+\.zip" />
|
<input name="mapPath" value="<%= pack.mapPath %>" placeholder="my-map.zip" pattern=".+\.zip" />
|
||||||
@@ -108,6 +119,11 @@
|
|||||||
<input name="outputPackName" value="<%= pack.outputPackName %>" placeholder="<%= t('editor.outputPackNamePlaceholder') %>" />
|
<input name="outputPackName" value="<%= pack.outputPackName %>" placeholder="<%= t('editor.outputPackNamePlaceholder') %>" />
|
||||||
<small class="muted"><%= t('editor.outputPackNameHint') %></small>
|
<small class="muted"><%= t('editor.outputPackNameHint') %></small>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="fullSpan">
|
||||||
|
<span><%= t('editor.finalResourcepackPath') %></span>
|
||||||
|
<input name="finalResourcepackPath" value="<%= pack.finalResourcepackPath %>" placeholder="my-pack.zip ( . = 없음 )" />
|
||||||
|
<small class="muted"><%= t('editor.finalResourcepackHint') %></small>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="primaryButton" type="submit"><%= t('common.save') %></button>
|
<button class="primaryButton" type="submit"><%= t('common.save') %></button>
|
||||||
@@ -126,6 +142,83 @@
|
|||||||
function formatLoaderLoadFailed(message) {
|
function formatLoaderLoadFailed(message) {
|
||||||
return I18N.loaderLoadFailedPrefix.replace('__M__', message)
|
return I18N.loaderLoadFailedPrefix.replace('__M__', message)
|
||||||
}
|
}
|
||||||
|
var JDK = {
|
||||||
|
current: <%= pack.recommendedJdk %>,
|
||||||
|
fallback: <%- JSON.stringify(jdkOptions) %>,
|
||||||
|
detailsGa: <%- JSON.stringify(t('editor.jdkDetailsGa')) %>,
|
||||||
|
detailsEa: <%- JSON.stringify(t('editor.jdkDetailsEa')) %>,
|
||||||
|
detailsLoading: <%- JSON.stringify(t('common.loading')) %>,
|
||||||
|
detailsNone: <%- JSON.stringify(t('editor.jdkDetailsNone')) %>,
|
||||||
|
ltsSuffix: <%- JSON.stringify(t('editor.jdkLtsSuffix')) %>
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var sel = document.getElementById('recommendedJdk')
|
||||||
|
var details = document.getElementById('jdkDetails')
|
||||||
|
var toggle = document.getElementById('jdkShowDetails')
|
||||||
|
if (!sel || !toggle) return
|
||||||
|
var current = Number(sel.getAttribute('data-current')) || JDK.current
|
||||||
|
var avail = null // { available:[], lts:[] }
|
||||||
|
|
||||||
|
function rebuild() {
|
||||||
|
var availList, ltsList
|
||||||
|
if (avail) { availList = avail.available; ltsList = avail.lts }
|
||||||
|
else { availList = JDK.fallback.slice().sort(function (a, b) { return b - a }); ltsList = availList }
|
||||||
|
var ltsSet = {}
|
||||||
|
ltsList.forEach(function (m) { ltsSet[m] = true })
|
||||||
|
var list = toggle.checked ? availList.slice() : ltsList.slice()
|
||||||
|
if (list.indexOf(current) < 0) list = [current].concat(list)
|
||||||
|
var seen = {}, html = ''
|
||||||
|
list.forEach(function (m) {
|
||||||
|
if (seen[m]) return
|
||||||
|
seen[m] = true
|
||||||
|
var label = 'Java ' + m + (ltsSet[m] ? JDK.ltsSuffix : '')
|
||||||
|
html += '<option value="' + m + '"' + (m === current ? ' selected' : '') + '>' + label + '</option>'
|
||||||
|
})
|
||||||
|
sel.innerHTML = html
|
||||||
|
sel.value = String(current)
|
||||||
|
}
|
||||||
|
|
||||||
|
function escHtml(s) {
|
||||||
|
return String(s).replace(/[&<>"']/g, function (c) {
|
||||||
|
return c === '&' ? '&' : c === '<' ? '<' : c === '>' ? '>' : c === '"' ? '"' : '''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function detailRow(label, names) {
|
||||||
|
return '<div><strong>' + escHtml(label) + ':</strong> ' +
|
||||||
|
names.slice(0, 6).map(escHtml).join(', ') + '</div>'
|
||||||
|
}
|
||||||
|
function loadDetails(major) {
|
||||||
|
details.hidden = false
|
||||||
|
details.textContent = JDK.detailsLoading
|
||||||
|
fetch('/op/jdk-versions/' + major)
|
||||||
|
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json() })
|
||||||
|
.then(function (d) {
|
||||||
|
// release_name 은 외부 API 값이라 반드시 escape 후 삽입(관리 페이지 XSS 방지).
|
||||||
|
var html = ''
|
||||||
|
if (d.ga && d.ga.length) html += detailRow(JDK.detailsGa, d.ga)
|
||||||
|
if (d.ea && d.ea.length) html += detailRow(JDK.detailsEa, d.ea)
|
||||||
|
details.innerHTML = html || escHtml(JDK.detailsNone)
|
||||||
|
})
|
||||||
|
.catch(function () { details.textContent = JDK.detailsNone })
|
||||||
|
}
|
||||||
|
|
||||||
|
sel.addEventListener('change', function () {
|
||||||
|
current = Number(sel.value)
|
||||||
|
if (toggle.checked) loadDetails(current)
|
||||||
|
})
|
||||||
|
toggle.addEventListener('change', function () {
|
||||||
|
rebuild()
|
||||||
|
if (toggle.checked) loadDetails(current)
|
||||||
|
else { details.hidden = true; details.innerHTML = '' }
|
||||||
|
})
|
||||||
|
|
||||||
|
fetch('/op/jdk-versions')
|
||||||
|
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json() })
|
||||||
|
.then(function (d) { avail = d; rebuild() })
|
||||||
|
.catch(function () { rebuild() })
|
||||||
|
})()
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
<span class="visibilityBadges">
|
<span class="visibilityBadges">
|
||||||
<span class="visibilityBadge <%= item.showInInstaller ? '' : 'off' %>"><%= t('terms.visibilityInstallerShort') %></span>
|
<span class="visibilityBadge <%= item.showInInstaller ? '' : 'off' %>"><%= t('terms.visibilityInstallerShort') %></span>
|
||||||
<span class="visibilityBadge <%= item.showInInstallerRp ? '' : 'off' %>"><%= t('terms.visibilityInstallerRpShort') %></span>
|
<span class="visibilityBadge <%= item.showInInstallerRp ? '' : 'off' %>"><%= t('terms.visibilityInstallerRpShort') %></span>
|
||||||
|
<span class="visibilityBadge <%= item.showInFinalResourcepack ? '' : 'off' %>"><%= t('terms.visibilityFinalResourcepackShort') %></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="termsRowSub"><%= item.kind %>.md</div>
|
<div class="termsRowSub"><%= item.kind %>.md</div>
|
||||||
|
|||||||
@@ -36,10 +36,14 @@
|
|||||||
<input type="checkbox" id="visInstaller" <%= showInInstaller ? 'checked' : '' %> />
|
<input type="checkbox" id="visInstaller" <%= showInInstaller ? 'checked' : '' %> />
|
||||||
<span><%= t('terms.visibilityInstaller') %></span>
|
<span><%= t('terms.visibilityInstaller') %></span>
|
||||||
</label>
|
</label>
|
||||||
<label style="display:inline-flex; align-items:center; gap:6px;">
|
<label style="display:inline-flex; align-items:center; gap:6px; margin-right:18px;">
|
||||||
<input type="checkbox" id="visInstallerRp" <%= showInInstallerRp ? 'checked' : '' %> />
|
<input type="checkbox" id="visInstallerRp" <%= showInInstallerRp ? 'checked' : '' %> />
|
||||||
<span><%= t('terms.visibilityInstallerRp') %></span>
|
<span><%= t('terms.visibilityInstallerRp') %></span>
|
||||||
</label>
|
</label>
|
||||||
|
<label style="display:inline-flex; align-items:center; gap:6px;">
|
||||||
|
<input type="checkbox" id="visFinalResourcepack" <%= showInFinalResourcepack ? 'checked' : '' %> />
|
||||||
|
<span><%= t('terms.visibilityFinalResourcepack') %></span>
|
||||||
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<p class="muted" style="font-size:12px;"><%= t('terms.slashHint') %></p>
|
<p class="muted" style="font-size:12px;"><%= t('terms.slashHint') %></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user