feat: per-pack public flag + developer installer variants
manifest.json 의 각 pack 에 public(boolean) 을 추가하고, 대상(audience)별로 설치기를 구분한다. - ManifestEntry.public 추가. 미지정=공개(하위호환). store 가 upsert/rename 시 기존 public 보존, 신규 pack 은 public=true 기본. setPackPublic() 추가. - 사이트 pack 편집기에 "공개" 체크박스 추가(체크=일반, 해제=개발자용). 저장 시 manifest 엔트리 public 갱신, 편집기 진입 시 현재 값 표시. - shared/audience.ts: 빌드의 musicQuizAudience(package.json)로 대상 판별. 일반 설치기=public!==false 만, 개발자용=public===false 만 노출. - 간편/리소스팩 설치기 packs 로드에서 audience 필터 적용. - 개발자용 빌드 구성(electron-builder-dev.yml, electron-builder-rp-dev.yml)과 dist:win:dev / dist:win:rp:dev 스크립트 추가(artifact: *-Dev-*). v0.3.20. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { normalizePackDefinition } from '../shared/store.js'
|
||||
import { getAppDataDir, getMcCustomDir } from '../shared/paths.js'
|
||||
import { loadEnv, getManifestUrl } from '../shared/env.js'
|
||||
import { loadComponentI18n } from '../shared/i18n.js'
|
||||
import { resolveAudience, isPackVisibleForAudience, type Audience } from '../shared/audience.js'
|
||||
import type { RpFetchedPack } from './types.js'
|
||||
import { ensureYtDlpExe } from './ytdlp.js'
|
||||
import { ensureFfmpegExe } from './ffmpeg.js'
|
||||
@@ -112,6 +113,16 @@ const state: RpInstallerState = {
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
|
||||
// 이 빌드의 대상(일반/개발자용). package.json 의 musicQuizAudience 로 결정.
|
||||
function getAudience(): Audience {
|
||||
try {
|
||||
const pkg = JSON.parse(fs.readFileSync(path.join(app.getAppPath(), 'package.json'), 'utf8'))
|
||||
return resolveAudience(pkg.musicQuizAudience)
|
||||
} catch {
|
||||
return resolveAudience(undefined)
|
||||
}
|
||||
}
|
||||
|
||||
function deriveBaseUrl(manifestUrl: string): string {
|
||||
try {
|
||||
const parsed = new URL(manifestUrl)
|
||||
@@ -202,9 +213,12 @@ ipcMain.handle('rp:packs:load', async (_event, manifestUrlInput?: string): Promi
|
||||
}
|
||||
sendLog(t('log.manifestDownload', { url: state.manifestUrl }))
|
||||
const manifest = await fetchJson<Manifest>(state.manifestUrl)
|
||||
const audience = getAudience()
|
||||
const results: RpFetchedPack[] = []
|
||||
for (const entry of manifest.packs ?? []) {
|
||||
if (typeof entry?.file !== 'string') continue
|
||||
// 대상(audience)에 맞지 않는 pack 은 건너뛴다(일반=public, 개발자용=non-public).
|
||||
if (!isPackVisibleForAudience(entry.public, audience)) continue
|
||||
const listUrl = `${state.baseUrl}/file/list/${encodeURIComponent(entry.file)}.json`
|
||||
const packUrl = `${state.baseUrl}/manifest/${encodeURIComponent(entry.file)}.json`
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user