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

@@ -124,6 +124,9 @@ function renderDetailPanel(profile){
if(installedProfile.kind === 'server-pack' && installedProfile.hostReady){
await ProfileAssetManager.ensureServerBundleInstalled(installedProfile)
}
if(typeof refreshSelectedProfileButton === 'function'){
refreshSelectedProfileButton()
}
renderDetailPanel(profile)
await renderInstallView()
if(typeof refreshLibraryView === 'function'){
@@ -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()

View File

@@ -15,6 +15,7 @@ mediaDiscordURL = "https://discord.gg/Z8j6ahF4MJ"
accountPreviewLabel = "계정"
libraryButton = "라이브러리"
installButton = "설치"
launchButtonPlaceholder = "• 라이브러리에서 선택"
[ejs.settings]
backButton = "메인으로"

View File

@@ -164,6 +164,10 @@ okay = "Okay"
noAccountSelected = "No Account Selected"
logoutFailed = "Failed to log out of the selected account. Please try again."
[js.landing.selectedProfile]
noSelection = "Select from Library"
loading = "Loading profile.."
[js.landing.selectedServer]
noSelection = "No Server Selected"
loading = "Loading.."

View File

@@ -164,6 +164,10 @@ okay = "확인"
noAccountSelected = "선택된 계정 없음"
logoutFailed = "계정을 로그아웃하지 못했습니다. 다시 시도해 주세요."
[js.landing.selectedProfile]
noSelection = "라이브러리에서 선택"
loading = "프로필 불러오는 중.."
[js.landing.selectedServer]
noSelection = "선택된 서버 없음"
loading = "로딩 중.."