Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bc3841147f | |||
| 40986bee11 | |||
| bf225f51e1 | |||
| 2371af4411 | |||
| 1f59f6a98b | |||
| 794ad9b778 | |||
| f810719d92 | |||
| ae771668de |
@@ -11,6 +11,10 @@ files:
|
|||||||
- dist/installer-rp/**
|
- dist/installer-rp/**
|
||||||
- dist/shared/**
|
- dist/shared/**
|
||||||
- installer-rp/**
|
- installer-rp/**
|
||||||
|
# rp 의 index.html 은 메인 설치기와 동일한 styles.css 를 공유함
|
||||||
|
# (`<link href="../installer/styles.css">`). asar 안에 해당 파일이 없으면
|
||||||
|
# UI 가 무스타일로 렌더링되므로 그 한 파일만 명시적으로 포함.
|
||||||
|
- installer/styles.css
|
||||||
- build/icon.*
|
- build/icon.*
|
||||||
- package.json
|
- package.json
|
||||||
# sharp 는 플랫폼별 prebuilt 가 분리 패키지로 배포됨. Windows 빌드에서는
|
# sharp 는 플랫폼별 prebuilt 가 분리 패키지로 배포됨. Windows 빌드에서는
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
"baseUrl": " URL: {{url}}",
|
"baseUrl": " URL: {{url}}",
|
||||||
"baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)",
|
"baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)",
|
||||||
"baseAbsent": "베이스 리소스팩 없음(resourcepackPath 빈 값) — 새 리소스팩으로 생성",
|
"baseAbsent": "베이스 리소스팩 없음(resourcepackPath 빈 값) — 새 리소스팩으로 생성",
|
||||||
|
"baseRemoved": "베이스 리소스팩 삭제: {{path}}",
|
||||||
"buildingZip": "리소스팩 zip 빌드 중… ({{name}})",
|
"buildingZip": "리소스팩 zip 빌드 중… ({{name}})",
|
||||||
"installComplete": "설치 완료: {{path}}",
|
"installComplete": "설치 완료: {{path}}",
|
||||||
"cancelRequested": "취소 요청됨. 실행 중 프로세스 {{count}}개 중단…",
|
"cancelRequested": "취소 요청됨. 실행 중 프로세스 {{count}}개 중단…",
|
||||||
|
|||||||
@@ -124,8 +124,11 @@
|
|||||||
"serverPathHint": "/file/servers/ 아래 zip 파일 이름. 멀티 모드 전용.",
|
"serverPathHint": "/file/servers/ 아래 zip 파일 이름. 멀티 모드 전용.",
|
||||||
"modsFolder": "모드 폴더 이름",
|
"modsFolder": "모드 폴더 이름",
|
||||||
"modsFolderHint": "/file/mods/<폴더이름>/ 안의 모든 .jar을 자동으로 받습니다. 비워두면 모드를 받지 않습니다.",
|
"modsFolderHint": "/file/mods/<폴더이름>/ 안의 모든 .jar을 자동으로 받습니다. 비워두면 모드를 받지 않습니다.",
|
||||||
"resourcepackPath": "리소스팩 (.zip)",
|
"resourcepackPath": "베이스 리소스팩 (.zip)",
|
||||||
"resourcepackHint": "/file/resourcepacks/ 아래 .zip 파일 이름. 비워두면 리소스팩을 받지 않습니다.",
|
"resourcepackHint": "/file/resourcepacks/ 아래 .zip 파일 이름. 리소스팩 설치기가 이 zip 위에 음악·사진을 얹어 최종 리소스팩을 만듭니다. 비워두면 처음부터 새로 만듭니다.",
|
||||||
|
"outputPackName": "생성되는 리소스팩 이름",
|
||||||
|
"outputPackNamePlaceholder": "예: 음악퀴즈 테스트팩",
|
||||||
|
"outputPackNameHint": "리소스팩 설치기가 만들어 내는 zip 파일 이름이자, 마인크래프트 리소스팩 목록의 제목이 됩니다. 비워두면 파일이름_resourcepack 형태로 자동 지정됩니다. Windows 파일명 금지 문자(\\ / : * ? \" < > |)는 자동으로 _ 로 바뀝니다.",
|
||||||
"ramOrderInvalid": "클라이언트 최소 램은 권장 램보다 클 수 없습니다.",
|
"ramOrderInvalid": "클라이언트 최소 램은 권장 램보다 클 수 없습니다.",
|
||||||
"fabricLoaderRequired": "Fabric 로더 버전을 선택해 주세요."
|
"fabricLoaderRequired": "Fabric 로더 버전을 선택해 주세요."
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "minecraft-music-quiz-installer",
|
"name": "minecraft-music-quiz-installer",
|
||||||
"version": "0.1.0",
|
"version": "0.2.6",
|
||||||
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
|
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
|
||||||
"main": "dist/installer/main.js",
|
"main": "dist/installer/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
"installer": "tsc -p tsconfig.installer.json && electron .",
|
"installer": "tsc -p tsconfig.installer.json && electron .",
|
||||||
"installer:rp": "tsc -p tsconfig.installer-rp.json && electron dist/installer-rp/main.js",
|
"installer:rp": "tsc -p tsconfig.installer-rp.json && electron dist/installer-rp/main.js",
|
||||||
"preinstall:sharp-win32": "npm install --no-save --force @img/sharp-win32-x64@0.34.5",
|
"preinstall:sharp-win32": "npm install --no-save --force @img/sharp-win32-x64@0.34.5",
|
||||||
"dist:win": "npm run preinstall:sharp-win32 && tsc -p tsconfig.installer.json && electron-builder --win --config electron-builder.yml",
|
"build:launcher-icon": "node scripts/build-launcher-icon.cjs",
|
||||||
|
"dist:win": "npm run preinstall:sharp-win32 && npm run build:launcher-icon && tsc -p tsconfig.installer.json && electron-builder --win --config electron-builder.yml",
|
||||||
"dist:win:rp": "npm run preinstall:sharp-win32 && tsc -p tsconfig.installer-rp.json && electron-builder --win --config electron-builder-rp.yml"
|
"dist:win:rp": "npm run preinstall:sharp-win32 && tsc -p tsconfig.installer-rp.json && electron-builder --win --config electron-builder-rp.yml"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
33
scripts/build-launcher-icon.cjs
Normal file
33
scripts/build-launcher-icon.cjs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// build/icon.png 을 읽어 base64 data URL 로 변환해
|
||||||
|
// src/installer/launcherIcon.ts 에 상수로 박는다.
|
||||||
|
//
|
||||||
|
// 마인크래프트 런처의 "설치 설정" 화면 프로필 아이콘은
|
||||||
|
// launcher_profiles.json 의 profile.icon 필드에서 오는데,
|
||||||
|
// `data:image/png;base64,...` 형태의 data URL 을 받는다.
|
||||||
|
// build/ 폴더는 electron-builder 가 exe 아이콘으로만 쓰고 asar 에
|
||||||
|
// 포함되지 않아서, 런타임에 그 파일을 읽을 수 없다. 대신 빌드(개발) 시점에
|
||||||
|
// 이 스크립트를 돌려 PNG 를 소스 코드에 인라인한다.
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const fs = require('node:fs')
|
||||||
|
const path = require('node:path')
|
||||||
|
|
||||||
|
const repoRoot = path.resolve(__dirname, '..')
|
||||||
|
const pngPath = path.join(repoRoot, 'build', 'icon.png')
|
||||||
|
const tsPath = path.join(repoRoot, 'src', 'installer', 'launcherIcon.ts')
|
||||||
|
|
||||||
|
const buf = fs.readFileSync(pngPath)
|
||||||
|
const b64 = buf.toString('base64')
|
||||||
|
|
||||||
|
const ts = `// AUTO-GENERATED by scripts/build-launcher-icon.cjs from build/icon.png.
|
||||||
|
// 마인크래프트 런처의 "설치 설정" 화면에서 보이는 프로필 아이콘. exe 와 같은
|
||||||
|
// 이미지를 쓰기 위해 빌드 시점에 PNG 를 data URL 로 인라인한다. 변경하려면
|
||||||
|
// build/icon.png 교체 후 \`node scripts/build-launcher-icon.cjs\` 재실행.
|
||||||
|
export const LAUNCHER_PROFILE_ICON =
|
||||||
|
'data:image/png;base64,${b64}'
|
||||||
|
`
|
||||||
|
|
||||||
|
fs.writeFileSync(tsPath, ts, 'utf8')
|
||||||
|
console.log(`wrote ${tsPath} (${buf.length} bytes PNG → ${b64.length} chars base64)`)
|
||||||
@@ -3,7 +3,7 @@ import { promises as fs, createWriteStream, constants as fsConst } from 'node:fs
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import https from 'node:https'
|
import https from 'node:https'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import { getMcCustomDir } from '../shared/paths.js'
|
import { getMcCustomDir, getMcCustomInstallerDir } from '../shared/paths.js'
|
||||||
import { loadComponentI18n } from '../shared/i18n.js'
|
import { loadComponentI18n } from '../shared/i18n.js'
|
||||||
|
|
||||||
const { t } = loadComponentI18n('installer-rp')
|
const { t } = loadComponentI18n('installer-rp')
|
||||||
@@ -13,10 +13,30 @@ const extractZip: (source: string, options: { dir: string }) => Promise<void> =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 리소스팩 간편설치기는 Windows .exe 로 배포되므로 ffmpeg.exe 한 종류만 사용.
|
* 리소스팩 간편설치기는 Windows .exe 로 배포되므로 ffmpeg.exe 한 종류만 사용.
|
||||||
* 경로: %appdata%/.mc_custom/ffmpeg.exe
|
* 경로: %appdata%/.mc_custom/installer/ffmpeg.exe
|
||||||
*/
|
*/
|
||||||
export function getFfmpegExePath(): string {
|
export function getFfmpegExePath(): string {
|
||||||
return path.join(getMcCustomDir(), 'ffmpeg.exe')
|
return path.join(getMcCustomInstallerDir(), 'ffmpeg.exe')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0.2.1 이전 버전이 `.mc_custom/ffmpeg.exe` 에 받아둔 파일이 있으면 새 위치로
|
||||||
|
* 옮긴다.
|
||||||
|
*/
|
||||||
|
async function migrateLegacyExe(target: string): Promise<void> {
|
||||||
|
const legacy = path.join(getMcCustomDir(), 'ffmpeg.exe')
|
||||||
|
if (legacy === target) return
|
||||||
|
try {
|
||||||
|
await fs.access(legacy, fsConst.F_OK)
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await fs.mkdir(path.dirname(target), { recursive: true })
|
||||||
|
await fs.rename(legacy, target)
|
||||||
|
} catch {
|
||||||
|
try { await fs.unlink(legacy) } catch { /* noop */ }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** BtbN/FFmpeg-Builds 의 win64-gpl 빌드. zip 내부에 bin/ffmpeg.exe 가 들어 있음. */
|
/** BtbN/FFmpeg-Builds 의 win64-gpl 빌드. zip 내부에 bin/ffmpeg.exe 가 들어 있음. */
|
||||||
@@ -33,6 +53,7 @@ export async function ensureFfmpegExe(
|
|||||||
log?: (line: string) => void
|
log?: (line: string) => void
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const target = getFfmpegExePath()
|
const target = getFfmpegExePath()
|
||||||
|
await migrateLegacyExe(target)
|
||||||
if (await canExecute(target)) {
|
if (await canExecute(target)) {
|
||||||
log?.(t('log.ffmpegExists', { path: target }))
|
log?.(t('log.ffmpegExists', { path: target }))
|
||||||
return target
|
return target
|
||||||
@@ -40,7 +61,7 @@ export async function ensureFfmpegExe(
|
|||||||
if (installPromise) return installPromise
|
if (installPromise) return installPromise
|
||||||
|
|
||||||
installPromise = (async () => {
|
installPromise = (async () => {
|
||||||
const dir = getMcCustomDir()
|
const dir = getMcCustomInstallerDir()
|
||||||
const zipPath = path.join(dir, '.tmp_ffmpeg.zip')
|
const zipPath = path.join(dir, '.tmp_ffmpeg.zip')
|
||||||
const extractDir = path.join(dir, '.tmp_ffmpeg')
|
const extractDir = path.join(dir, '.tmp_ffmpeg')
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -35,6 +35,20 @@ interface RpInstallerState {
|
|||||||
activeChildren: Set<ChildProcess>
|
activeChildren: Set<ChildProcess>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 사용자가 사이트에서 지정한 "생성되는 리소스팩 이름" 을 Windows 파일명으로 쓸 수
|
||||||
|
* 있게 정리한다. 금지 문자(\<\>:"/\\|?*\x00-\x1f) 는 `_` 로, 끝의 공백/마침표는
|
||||||
|
* 제거, 예약어(CON/PRN/...)는 앞에 `_` 를 붙인다. 빈 입력은 빈 문자열 반환 →
|
||||||
|
* 호출 측에서 폴백을 결정한다.
|
||||||
|
*/
|
||||||
|
function sanitizeOutputPackName(name: string): string {
|
||||||
|
let cleaned = (name || '').replace(/[<>:"/\\|?*\x00-\x1f]/g, '_')
|
||||||
|
cleaned = cleaned.replace(/[ .]+$/, '')
|
||||||
|
if (!cleaned) return ''
|
||||||
|
if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(cleaned)) cleaned = '_' + cleaned
|
||||||
|
return cleaned
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 동시 yt-dlp 프로세스 수를 CPU 코어 수로 자동 결정.
|
* 동시 yt-dlp 프로세스 수를 CPU 코어 수로 자동 결정.
|
||||||
* - yt-dlp + ffmpeg 변환이 CPU 바운드라 코어 수가 가장 좋은 프록시.
|
* - yt-dlp + ffmpeg 변환이 CPU 바운드라 코어 수가 가장 좋은 프록시.
|
||||||
@@ -201,11 +215,13 @@ ipcMain.handle('rp:packs:load', async (_event, manifestUrlInput?: string): Promi
|
|||||||
const normalized = packRaw ? normalizePackDefinition(packRaw as Partial<PackDefinition>) : null
|
const normalized = packRaw ? normalizePackDefinition(packRaw as Partial<PackDefinition>) : null
|
||||||
const mcVersion = normalized?.mcVersion ?? ''
|
const mcVersion = normalized?.mcVersion ?? ''
|
||||||
const resourcepackPath = normalized?.resourcepackPath ?? ''
|
const resourcepackPath = normalized?.resourcepackPath ?? ''
|
||||||
|
const outputPackName = normalized?.outputPackName ?? ''
|
||||||
results.push({
|
results.push({
|
||||||
key: entry.file,
|
key: entry.file,
|
||||||
name: entry.name || entry.file,
|
name: entry.name || entry.file,
|
||||||
mcVersion,
|
mcVersion,
|
||||||
resourcepackPath,
|
resourcepackPath,
|
||||||
|
outputPackName,
|
||||||
list
|
list
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -383,7 +399,11 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
|
|||||||
|
|
||||||
// 2-5. 리소스팩 zip 빌드 (pack.mcmeta + sounds.json + 음악·이미지, 베이스 위에 얹기)
|
// 2-5. 리소스팩 zip 빌드 (pack.mcmeta + sounds.json + 음악·이미지, 베이스 위에 얹기)
|
||||||
throwIfCancelled()
|
throwIfCancelled()
|
||||||
const resourcepackName = `${state.selectedKey}_musicquiz.zip`
|
// 사이트에서 지정한 "생성되는 리소스팩 이름" 을 우선 사용. 비어있거나 sanitize
|
||||||
|
// 결과가 빈 문자열이면 `<packKey>_resourcepack` 로 폴백.
|
||||||
|
const sanitizedOutputName = sanitizeOutputPackName(pack.outputPackName)
|
||||||
|
const resourcepackBaseName = sanitizedOutputName || `${state.selectedKey}_resourcepack`
|
||||||
|
const resourcepackName = `${resourcepackBaseName}.zip`
|
||||||
const resourcepackDir = path.join(getMcCustomDir(), 'resourcepacks')
|
const resourcepackDir = path.join(getMcCustomDir(), 'resourcepacks')
|
||||||
const resourcepackPath = path.join(resourcepackDir, resourcepackName)
|
const resourcepackPath = path.join(resourcepackDir, resourcepackName)
|
||||||
sendLog(t('log.buildingZip', { name: resourcepackName }))
|
sendLog(t('log.buildingZip', { name: resourcepackName }))
|
||||||
@@ -401,6 +421,22 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
|
|||||||
|
|
||||||
// 2-6. %appdata%/.mc_custom/resourcepacks/ 에 배치 (위 빌드가 직접 outZipPath 에 저장)
|
// 2-6. %appdata%/.mc_custom/resourcepacks/ 에 배치 (위 빌드가 직접 outZipPath 에 저장)
|
||||||
sendLog(t('log.installComplete', { path: resourcepackPath }))
|
sendLog(t('log.installComplete', { path: resourcepackPath }))
|
||||||
|
|
||||||
|
// 2-7. 베이스 리소스팩은 우리가 임시폴더에 받아서 빌드에 이미 얹었으므로,
|
||||||
|
// 메인 설치기가 `.mc_custom/resourcepacks/<resourcepackPath>` 에 받아둔
|
||||||
|
// 원본 zip 은 MC 리소스팩 목록에 굳이 남길 필요 없다. 삭제하되, 사용자가
|
||||||
|
// outputPackName 을 base 파일명과 똑같이 둬서 우리가 방금 쓴 최종 zip 과
|
||||||
|
// 같은 경로면 그대로 둔다(우리 산출물을 지우면 안 되므로).
|
||||||
|
if (pack.resourcepackPath) {
|
||||||
|
const basePackPath = path.join(resourcepackDir, pack.resourcepackPath)
|
||||||
|
if (path.resolve(basePackPath) !== path.resolve(resourcepackPath)) {
|
||||||
|
try {
|
||||||
|
await fsp.rm(basePackPath, { force: true })
|
||||||
|
sendLog(t('log.baseRemoved', { path: basePackPath }))
|
||||||
|
} catch { /* 없으면 무시 */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sendProgress({ phase: 'package', message: t('progress.installComplete'), done: true })
|
sendProgress({ phase: 'package', message: t('progress.installComplete'), done: true })
|
||||||
return { resourcepackPath }
|
return { resourcepackPath }
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ export interface RpFetchedPack {
|
|||||||
* 빈 문자열이면 새 리소스팩을 처음부터 생성.
|
* 빈 문자열이면 새 리소스팩을 처음부터 생성.
|
||||||
*/
|
*/
|
||||||
resourcepackPath: string
|
resourcepackPath: string
|
||||||
|
/**
|
||||||
|
* /manifest/<key>.json 의 outputPackName. 관리 사이트에서 설정한 "생성되는
|
||||||
|
* 리소스팩 이름". 비어 있으면 설치기가 `<key>_resourcepack` 형식으로 폴백.
|
||||||
|
* 파일명으로 쓰기 전에 Windows 금지 문자(\<\>:"/\\|?*) 는 `_` 로 치환.
|
||||||
|
*/
|
||||||
|
outputPackName: string
|
||||||
/** /file/list/<key>.json 의 음악·사진 목록. */
|
/** /file/list/<key>.json 의 음악·사진 목록. */
|
||||||
list: PackList
|
list: PackList
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,38 @@ import { promises as fs, createWriteStream, constants as fsConst } from 'node:fs
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import https from 'node:https'
|
import https from 'node:https'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import { getMcCustomDir } from '../shared/paths.js'
|
import { getMcCustomDir, getMcCustomInstallerDir } from '../shared/paths.js'
|
||||||
import { loadComponentI18n } from '../shared/i18n.js'
|
import { loadComponentI18n } from '../shared/i18n.js'
|
||||||
|
|
||||||
const { t } = loadComponentI18n('installer-rp')
|
const { t } = loadComponentI18n('installer-rp')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 리소스팩 간편설치기는 Windows .exe 로 배포되므로 yt-dlp.exe 한 종류만 사용.
|
* 리소스팩 간편설치기는 Windows .exe 로 배포되므로 yt-dlp.exe 한 종류만 사용.
|
||||||
* 경로: %appdata%/.mc_custom/yt-dlp.exe
|
* 경로: %appdata%/.mc_custom/installer/yt-dlp.exe
|
||||||
*/
|
*/
|
||||||
export function getYtDlpExePath(): string {
|
export function getYtDlpExePath(): string {
|
||||||
return path.join(getMcCustomDir(), 'yt-dlp.exe')
|
return path.join(getMcCustomInstallerDir(), 'yt-dlp.exe')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0.2.1 이전 버전이 `.mc_custom/yt-dlp.exe` 에 받아둔 파일이 있으면 새 위치로
|
||||||
|
* 옮긴다. 마인크래프트 게임 폴더 루트가 외부 도구 파일로 더럽혀지지 않도록.
|
||||||
|
*/
|
||||||
|
async function migrateLegacyExe(target: string): Promise<void> {
|
||||||
|
const legacy = path.join(getMcCustomDir(), 'yt-dlp.exe')
|
||||||
|
if (legacy === target) return
|
||||||
|
try {
|
||||||
|
await fs.access(legacy, fsConst.F_OK)
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await fs.mkdir(path.dirname(target), { recursive: true })
|
||||||
|
await fs.rename(legacy, target)
|
||||||
|
} catch {
|
||||||
|
// 권한·드라이브 문제 등으로 실패하면 그냥 새로 받으면 되므로 무시.
|
||||||
|
try { await fs.unlink(legacy) } catch { /* noop */ }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const YT_DLP_DOWNLOAD_URL =
|
const YT_DLP_DOWNLOAD_URL =
|
||||||
@@ -29,6 +50,7 @@ export async function ensureYtDlpExe(
|
|||||||
log?: (line: string) => void
|
log?: (line: string) => void
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const target = getYtDlpExePath()
|
const target = getYtDlpExePath()
|
||||||
|
await migrateLegacyExe(target)
|
||||||
if (await canExecute(target)) {
|
if (await canExecute(target)) {
|
||||||
log?.(t('log.ytdlpExists', { path: target }))
|
log?.(t('log.ytdlpExists', { path: target }))
|
||||||
return target
|
return target
|
||||||
|
|||||||
6
src/installer/launcherIcon.ts
Normal file
6
src/installer/launcherIcon.ts
Normal file
File diff suppressed because one or more lines are too long
@@ -22,6 +22,7 @@ import type { Manifest, PackDefinition } from '../shared/types.js'
|
|||||||
import { normalizePackDefinition } from '../shared/store.js'
|
import { normalizePackDefinition } from '../shared/store.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'
|
||||||
|
import { LAUNCHER_PROFILE_ICON } from './launcherIcon.js'
|
||||||
|
|
||||||
loadEnv()
|
loadEnv()
|
||||||
|
|
||||||
@@ -1128,6 +1129,7 @@ ipcMain.handle('client:install', async (_event, payload: ClientInstallPayload) =
|
|||||||
await fsp.mkdir(path.join(customRoot, 'mods'), { recursive: true })
|
await fsp.mkdir(path.join(customRoot, 'mods'), { recursive: true })
|
||||||
await fsp.mkdir(path.join(customRoot, 'resourcepacks'), { recursive: true })
|
await fsp.mkdir(path.join(customRoot, 'resourcepacks'), { recursive: true })
|
||||||
|
|
||||||
|
try {
|
||||||
// 사용자가 기존 .minecraft 에 저장해둔 설정(options.txt, servers.dat 등)을
|
// 사용자가 기존 .minecraft 에 저장해둔 설정(options.txt, servers.dat 등)을
|
||||||
// .mc_custom 으로 가져온다. 이미 있는 파일은 보존.
|
// .mc_custom 으로 가져온다. 이미 있는 파일은 보존.
|
||||||
await copyMinecraftUserSettings(customRoot)
|
await copyMinecraftUserSettings(customRoot)
|
||||||
@@ -1163,6 +1165,13 @@ ipcMain.handle('client:install', async (_event, payload: ClientInstallPayload) =
|
|||||||
await linkMinecraftRuntimeDirs(customRoot)
|
await linkMinecraftRuntimeDirs(customRoot)
|
||||||
|
|
||||||
await updateLauncherProfile(pack.pack, customRoot)
|
await updateLauncherProfile(pack.pack, customRoot)
|
||||||
|
} finally {
|
||||||
|
// 설치가 끝나면(또는 실패해도) 더 이상 필요 없는 platform-cache(다운받은
|
||||||
|
// fabric/forge/neoforge installer jar 캐시)를 삭제한다. 다음 실행에서 다시
|
||||||
|
// 받으면 되고, 남겨두면 사용자 .mc_custom 폴더만 차지한다. 실패 경로에서도
|
||||||
|
// 정리되도록 finally 에 둔다.
|
||||||
|
await fsp.rm(path.join(customRoot, 'platform-cache'), { recursive: true, force: true }).catch(() => {})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
interface FabricInstallerMeta {
|
interface FabricInstallerMeta {
|
||||||
@@ -1211,7 +1220,16 @@ async function installFabricLoader(pack: PackDefinition, customRoot: string): Pr
|
|||||||
|
|
||||||
// 4) fabric-installer CLI 자동 실행.
|
// 4) fabric-installer CLI 자동 실행.
|
||||||
// client 모드 + -noprofile: launcher_profiles.json 은 우리 코드가 직접 갱신하므로 fabric-installer 가 덮어쓰지 않게 한다.
|
// client 모드 + -noprofile: launcher_profiles.json 은 우리 코드가 직접 갱신하므로 fabric-installer 가 덮어쓰지 않게 한다.
|
||||||
|
// JVM stdout 인코딩 강제 UTF-8:
|
||||||
|
// 한국 윈도우의 시스템 codepage 는 cp949(MS949) 라서 fabric-installer 가
|
||||||
|
// 한글을 cp949 로 stdout 에 쓰면 우리가 utf-8 로 디코드해서 깨져 보인다.
|
||||||
|
// `file.encoding` 은 default Charset, `stdout/stderr.encoding` 은
|
||||||
|
// System.out/err 의 PrintStream 인코딩(Java 18+). 둘 다 지정하면
|
||||||
|
// 구버전·신버전 JDK 모두에서 안전.
|
||||||
const args = [
|
const args = [
|
||||||
|
'-Dfile.encoding=UTF-8',
|
||||||
|
'-Dstdout.encoding=UTF-8',
|
||||||
|
'-Dstderr.encoding=UTF-8',
|
||||||
'-jar', installerJar,
|
'-jar', installerJar,
|
||||||
'client',
|
'client',
|
||||||
'-mcversion', pack.mcVersion,
|
'-mcversion', pack.mcVersion,
|
||||||
@@ -1452,6 +1470,7 @@ async function updateLauncherProfile(pack: PackDefinition, gameDir: string): Pro
|
|||||||
...existingProfile,
|
...existingProfile,
|
||||||
name: profileKey,
|
name: profileKey,
|
||||||
type: 'custom',
|
type: 'custom',
|
||||||
|
icon: LAUNCHER_PROFILE_ICON,
|
||||||
gameDir,
|
gameDir,
|
||||||
lastVersionId,
|
lastVersionId,
|
||||||
javaArgs
|
javaArgs
|
||||||
|
|||||||
@@ -314,6 +314,7 @@ 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),
|
||||||
|
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)),
|
||||||
|
|||||||
@@ -32,3 +32,13 @@ export function getAppDataDir(): string {
|
|||||||
export function getMcCustomDir(): string {
|
export function getMcCustomDir(): string {
|
||||||
return path.join(getAppDataDir(), '.mc_custom')
|
return path.join(getAppDataDir(), '.mc_custom')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* %appdata%/.mc_custom/installer — 설치기가 자체적으로 다운로드해 사용하는
|
||||||
|
* 외부 바이너리(yt-dlp.exe, ffmpeg.exe 등) 보관 위치. .mc_custom 루트가
|
||||||
|
* 마인크래프트 게임 폴더(`mods/`, `resourcepacks/`, `saves/` 등)와 섞이지
|
||||||
|
* 않도록 별도 하위 폴더에 둔다.
|
||||||
|
*/
|
||||||
|
export function getMcCustomInstallerDir(): string {
|
||||||
|
return path.join(getMcCustomDir(), 'installer')
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export function defaultPackDefinition(name: string): PackDefinition {
|
|||||||
platform: { type: 'vanilla' },
|
platform: { type: 'vanilla' },
|
||||||
modsFolder: '',
|
modsFolder: '',
|
||||||
resourcepackPath: '',
|
resourcepackPath: '',
|
||||||
|
outputPackName: '',
|
||||||
serverMinRam: 2048,
|
serverMinRam: 2048,
|
||||||
serverMaxRam: 4096,
|
serverMaxRam: 4096,
|
||||||
clientMinRam: 2048,
|
clientMinRam: 2048,
|
||||||
@@ -95,6 +96,8 @@ export function normalizePackDefinition(input: Partial<PackDefinition> & Record<
|
|||||||
},
|
},
|
||||||
modsFolder: sanitizeFolderName(input.modsFolder),
|
modsFolder: sanitizeFolderName(input.modsFolder),
|
||||||
resourcepackPath: sanitizeZipFileName(input.resourcepackPath),
|
resourcepackPath: sanitizeZipFileName(input.resourcepackPath),
|
||||||
|
// 표시명은 사용자 입력을 보존(공백/마침표 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),
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ export interface PackDefinition {
|
|||||||
modsFolder: string
|
modsFolder: string
|
||||||
/** /file/resourcepacks/<resourcepackPath> 의 단일 .zip을 그대로 다운로드. */
|
/** /file/resourcepacks/<resourcepackPath> 의 단일 .zip을 그대로 다운로드. */
|
||||||
resourcepackPath: string
|
resourcepackPath: string
|
||||||
|
/**
|
||||||
|
* 리소스팩 설치기가 만들어 내는 최종 zip 파일의 이름(확장자 제외).
|
||||||
|
* 빈 문자열이면 설치기가 `<packKey>_resourcepack` 형식으로 기본 이름을 만든다.
|
||||||
|
* 마인크래프트 리소스팩 목록에서 사용자에게 제목처럼 보이는 값이므로
|
||||||
|
* 한글 등 자유 입력을 그대로 보존하고, 파일 시스템에서 사용할 때 금지 문자만
|
||||||
|
* `_` 로 치환한다(치환 책임은 설치기 측에 있음).
|
||||||
|
*/
|
||||||
|
outputPackName: string
|
||||||
serverMinRam: number
|
serverMinRam: number
|
||||||
serverMaxRam: number
|
serverMaxRam: number
|
||||||
clientMinRam: number
|
clientMinRam: number
|
||||||
|
|||||||
@@ -98,6 +98,11 @@
|
|||||||
<input name="resourcepackPath" value="<%= pack.resourcepackPath %>" placeholder="my-pack.zip" pattern=".*\.zip|" />
|
<input name="resourcepackPath" value="<%= pack.resourcepackPath %>" placeholder="my-pack.zip" pattern=".*\.zip|" />
|
||||||
<small class="muted"><%= t('editor.resourcepackHint') %></small>
|
<small class="muted"><%= t('editor.resourcepackHint') %></small>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="fullSpan">
|
||||||
|
<span><%= t('editor.outputPackName') %></span>
|
||||||
|
<input name="outputPackName" value="<%= pack.outputPackName %>" placeholder="<%= t('editor.outputPackNamePlaceholder') %>" />
|
||||||
|
<small class="muted"><%= t('editor.outputPackNameHint') %></small>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="primaryButton" type="submit"><%= t('common.save') %></button>
|
<button class="primaryButton" type="submit"><%= t('common.save') %></button>
|
||||||
|
|||||||
Reference in New Issue
Block a user