Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bc3841147f | |||
| 40986bee11 |
@@ -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}}개 중단…",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "minecraft-music-quiz-installer",
|
"name": "minecraft-music-quiz-installer",
|
||||||
"version": "0.2.4",
|
"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)`)
|
||||||
@@ -421,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 {
|
||||||
|
|||||||
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()
|
||||||
|
|
||||||
@@ -1469,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
|
||||||
|
|||||||
Reference in New Issue
Block a user