Switch launch selection to library profiles
Some checks failed
Build / release (macos-latest) (push) Has been cancelled
Build / release (ubuntu-latest) (push) Has been cancelled
Build / release (windows-latest) (push) Has been cancelled
Windows Smoke Test / windows-smoke (push) Has been cancelled

This commit is contained in:
2026-05-04 14:48:04 +09:00
parent 0f6c0563db
commit 27c1453aa8
6 changed files with 91 additions and 16 deletions

View File

@@ -117,16 +117,19 @@ function renderDetailPanel(profile){
installDetailBody.textContent = buildDetailText(profile)
installDetailAddButton.disabled = installed || !profile.launchReady
installDetailAddButton.textContent = installed ? '이미 라이브러리에 있음' : '라이브러리에 추가'
installDetailAddButton.onclick = async () => {
try {
const installedProfile = await CatalogManager.installProfile(profile.id)
await ProfileAssetManager.prefetchProfileAssets(installedProfile)
if(installedProfile.kind === 'server-pack' && installedProfile.hostReady){
await ProfileAssetManager.ensureServerBundleInstalled(installedProfile)
}
renderDetailPanel(profile)
await renderInstallView()
if(typeof refreshLibraryView === 'function'){
installDetailAddButton.onclick = async () => {
try {
const installedProfile = await CatalogManager.installProfile(profile.id)
await ProfileAssetManager.prefetchProfileAssets(installedProfile)
if(installedProfile.kind === 'server-pack' && installedProfile.hostReady){
await ProfileAssetManager.ensureServerBundleInstalled(installedProfile)
}
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
renderDetailPanel(profile)
await renderInstallView()
if(typeof refreshLibraryView === 'function'){
await refreshLibraryView()
}
showInstallMessage('추가 완료', `${profile.name} 프로필을 라이브러리에 추가했습니다.`)
@@ -242,6 +245,9 @@ async function renderInstallView(){
if(installedProfile.kind === 'server-pack' && installedProfile.hostReady){
await ProfileAssetManager.ensureServerBundleInstalled(installedProfile)
}
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
selectProfile(profile.id)
await renderInstallView()
if(typeof refreshLibraryView === 'function'){

View File

@@ -30,6 +30,7 @@ const {
// Internal Requirements
const AuthManager = require('./assets/js/authmanager')
const CatalogManager = require('./assets/js/catalogmanager')
const DiscordWrapper = require('./assets/js/discordwrapper')
const ProcessBuilder = require('./assets/js/processbuilder')
@@ -170,11 +171,58 @@ function setLaunchEnabled(val){
document.getElementById('launch_button').disabled = !val
}
function refreshSelectedProfileButton(){
const selectedProfile = CatalogManager.getSelectedProfileSync()
if(selectedProfile == null){
server_selection_button.innerHTML = '• ' + Lang.queryJS('landing.selectedProfile.noSelection')
setLaunchEnabled(false)
return
}
const label = selectedProfile.name?.trim().length > 0
? selectedProfile.name.trim()
: selectedProfile.id
server_selection_button.innerHTML = '• ' + label
setLaunchEnabled(selectedProfile.configured !== false)
}
// Bind launch button
document.getElementById('launch_button').addEventListener('click', async e => {
loggerLanding.info('Launching game..')
try {
const server = (await DistroAPI.getDistribution()).getServerById(ConfigManager.getSelectedServer())
const selectedProfile = CatalogManager.getSelectedProfileSync()
if(selectedProfile == null){
if(typeof refreshLibraryView === 'function'){
await refreshLibraryView()
}
switchView(getCurrentView(), VIEWS.library)
return
}
CatalogManager.applyConfiguredProfile()
const distro = await DistroAPI.refreshDistributionOrFallback()
if(distro == null){
throw new Error('Distribution refresh returned null.')
}
let server = distro.getServerById(ConfigManager.getSelectedServer())
if(server == null && typeof distro.getMainServer === 'function'){
const mainServer = distro.getMainServer()
if(mainServer != null){
ConfigManager.setSelectedServer(mainServer.rawServer.id)
ConfigManager.save()
server = mainServer
}
}
onDistroRefresh(distro)
refreshSelectedProfileButton()
if(server == null){
throw new Error('No server available for selected profile.')
}
const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())
if(jExe == null){
await asyncSystemScan(server.effectiveJavaOptions)
@@ -267,17 +315,19 @@ function updateSelectedServer(serv){
}
ConfigManager.setSelectedServer(serv != null ? serv.rawServer.id : null)
ConfigManager.save()
server_selection_button.innerHTML = '• ' + (serv != null ? serv.rawServer.name : Lang.queryJS('landing.noSelection'))
if(getCurrentView() === VIEWS.settings){
animateSettingsTabRefresh()
}
setLaunchEnabled(serv != null)
refreshSelectedProfileButton()
}
// Real text is set in uibinder.js on distributionIndexDone.
server_selection_button.innerHTML = '• ' + Lang.queryJS('landing.selectedServer.loading')
// Real text is set based on the selected library profile.
server_selection_button.innerHTML = '• ' + Lang.queryJS('landing.selectedProfile.loading')
server_selection_button.onclick = async e => {
e.target.blur()
await toggleServerSelection(true)
if(typeof refreshLibraryView === 'function'){
await refreshLibraryView()
}
switchView(getCurrentView(), VIEWS.library)
}
// Update Mojang Status Color
@@ -1133,4 +1183,5 @@ window.updateSelectedAccount = updateSelectedAccount
window.updateSelectedServer = updateSelectedServer
window.refreshServerStatus = refreshServerStatus
window.initNews = initNews
window.refreshSelectedProfileButton = refreshSelectedProfileButton
})()

View File

@@ -112,6 +112,9 @@ async function activateProfile(profile, launchNow = false){
CatalogManager.selectProfile(profile.id)
CatalogManager.applyConfiguredProfile()
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
try {
const distro = await DistroAPI.refreshDistributionOrFallback()
@@ -302,6 +305,9 @@ async function renderLibraryView(){
selectButton.addEventListener('click', async () => {
CatalogManager.selectProfile(profile.id)
CatalogManager.applyConfiguredProfile()
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
await renderLibraryView()
})
@@ -360,6 +366,9 @@ async function renderLibraryView(){
removeButton.addEventListener('click', async () => {
ServerRuntime.stopHostedProfile(profile.id)
CatalogManager.removeProfile(profile.id)
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
await renderLibraryView()
if(typeof refreshInstallView === 'function'){
await refreshInstallView()