v0.1.0 - Test
This commit is contained in:
@@ -342,6 +342,15 @@ settingsNavDone.onclick = () => {
|
||||
const msftLoginLogger = LoggerUtil.getLogger('Microsoft Login')
|
||||
const msftLogoutLogger = LoggerUtil.getLogger('Microsoft Logout')
|
||||
|
||||
// Bind the add offline account button.
|
||||
document.getElementById('settingsAddOfflineAccount').onclick = (e) => {
|
||||
switchView(getCurrentView(), VIEWS.offline, 500, 500, () => {
|
||||
offlineLoginViewOnCancel = VIEWS.settings
|
||||
offlineLoginViewOnSuccess = VIEWS.settings
|
||||
offlineLoginCancelEnabled(true)
|
||||
})
|
||||
}
|
||||
|
||||
// Bind the add mojang account button.
|
||||
document.getElementById('settingsAddMojangAccount').onclick = (e) => {
|
||||
switchView(getCurrentView(), VIEWS.login, 500, 500, () => {
|
||||
@@ -374,8 +383,8 @@ ipcRenderer.on(MSFT_OPCODE.REPLY_LOGIN, (_, ...arguments_) => {
|
||||
|
||||
// Unexpected error.
|
||||
setOverlayContent(
|
||||
'Something Went Wrong',
|
||||
'Microsoft authentication failed. Please try again.',
|
||||
'Valami nem sikerült',
|
||||
'Microsoft hitelesítés meghiúsult. Kérlek próbáld újra.',
|
||||
'OK'
|
||||
)
|
||||
setOverlayHandler(() => {
|
||||
@@ -430,8 +439,8 @@ ipcRenderer.on(MSFT_OPCODE.REPLY_LOGIN, (_, ...arguments_) => {
|
||||
// Uh oh.
|
||||
msftLoginLogger.error('Unhandled error during login.', displayableError)
|
||||
actualDisplayableError = {
|
||||
title: 'Unknown Error During Login',
|
||||
desc: 'An unknown error has occurred. Please see the console for details.'
|
||||
title: 'Ismeretlen Hiba Belépés Közben',
|
||||
desc: 'Egy ismeretlen hiba történt. Lásd a konzolt a további részletekért.'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,11 +470,11 @@ function bindAuthAccountSelect(){
|
||||
for(let i=0; i<selectBtns.length; i++){
|
||||
if(selectBtns[i].hasAttribute('selected')){
|
||||
selectBtns[i].removeAttribute('selected')
|
||||
selectBtns[i].innerHTML = 'Select Account'
|
||||
selectBtns[i].innerHTML = 'Kiválaszt'
|
||||
}
|
||||
}
|
||||
val.setAttribute('selected', '')
|
||||
val.innerHTML = 'Selected Account ✔'
|
||||
val.innerHTML = 'Kiválasztott Fiók ✔'
|
||||
setSelectedAccount(val.closest('.settingsAuthAccount').getAttribute('uuid'))
|
||||
}
|
||||
})
|
||||
@@ -483,10 +492,10 @@ function bindAuthAccountLogOut(){
|
||||
if(Object.keys(ConfigManager.getAuthAccounts()).length === 1){
|
||||
isLastAccount = true
|
||||
setOverlayContent(
|
||||
'Warning<br>This is Your Last Account',
|
||||
'In order to use the launcher you must be logged into at least one account. You will need to login again after.<br><br>Are you sure you want to log out?',
|
||||
'I\'m Sure',
|
||||
'Cancel'
|
||||
'Figyelem<br>Ez az utolsó fiókod',
|
||||
'A launcher használatához legalább egy fiókkal be kell lépj. Ki leszel jelentkeztetve ezután.<br><br>Biztos ki szeretnél jelentkezni?',
|
||||
'Igen',
|
||||
'Vissza'
|
||||
)
|
||||
setOverlayHandler(() => {
|
||||
processLogOut(val, isLastAccount)
|
||||
@@ -521,6 +530,23 @@ function processLogOut(val, isLastAccount){
|
||||
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||||
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGOUT, uuid, isLastAccount)
|
||||
})
|
||||
} else if(targetAcc.type === 'offline') {
|
||||
AuthManager.removeOfflineAccount(uuid)
|
||||
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
||||
const selAcc = ConfigManager.getSelectedAccount()
|
||||
refreshAuthAccountSelected(selAcc.uuid)
|
||||
updateSelectedAccount(selAcc)
|
||||
validateSelectedAccount()
|
||||
}
|
||||
if(isLastAccount) {
|
||||
loginOptionsCancelEnabled(false)
|
||||
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
||||
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||
switchView(getCurrentView(), VIEWS.loginOptions)
|
||||
}
|
||||
$(parent).fadeOut(250, () => {
|
||||
parent.remove()
|
||||
})
|
||||
} else {
|
||||
AuthManager.removeMojangAccount(uuid).then(() => {
|
||||
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
||||
@@ -611,18 +637,19 @@ function refreshAuthAccountSelected(uuid){
|
||||
const selBtn = val.getElementsByClassName('settingsAuthAccountSelect')[0]
|
||||
if(uuid === val.getAttribute('uuid')){
|
||||
selBtn.setAttribute('selected', '')
|
||||
selBtn.innerHTML = 'Selected Account ✔'
|
||||
selBtn.innerHTML = 'Kiválasztott Fiók ✔'
|
||||
} else {
|
||||
if(selBtn.hasAttribute('selected')){
|
||||
selBtn.removeAttribute('selected')
|
||||
}
|
||||
selBtn.innerHTML = 'Select Account'
|
||||
selBtn.innerHTML = 'Kiválaszt'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const settingsCurrentMicrosoftAccounts = document.getElementById('settingsCurrentMicrosoftAccounts')
|
||||
const settingsCurrentMojangAccounts = document.getElementById('settingsCurrentMojangAccounts')
|
||||
const settingsCurrentOfflineAccounts = document.getElementById('settingsCurrentOfflineAccounts')
|
||||
|
||||
/**
|
||||
* Add auth account elements for each one stored in the authentication database.
|
||||
@@ -637,18 +664,19 @@ function populateAuthAccounts(){
|
||||
|
||||
let microsoftAuthAccountStr = ''
|
||||
let mojangAuthAccountStr = ''
|
||||
let offlineAuthAccountStr = ''
|
||||
|
||||
authKeys.forEach((val) => {
|
||||
const acc = authAccounts[val]
|
||||
|
||||
const accHtml = `<div class="settingsAuthAccount" uuid="${acc.uuid}">
|
||||
<div class="settingsAuthAccountLeft">
|
||||
<img class="settingsAuthAccountImage" alt="${acc.displayName}" src="https://mc-heads.net/body/${acc.uuid}/60">
|
||||
<img class="settingsAuthAccountImage" alt="${acc.displayName}" src="https://portal.chronika.hu/api/skinrender.php?username=${acc.displayName}">
|
||||
</div>
|
||||
<div class="settingsAuthAccountRight">
|
||||
<div class="settingsAuthAccountDetails">
|
||||
<div class="settingsAuthAccountDetailPane">
|
||||
<div class="settingsAuthAccountDetailTitle">Username</div>
|
||||
<div class="settingsAuthAccountDetailTitle">Felhasználónév</div>
|
||||
<div class="settingsAuthAccountDetailValue">${acc.displayName}</div>
|
||||
</div>
|
||||
<div class="settingsAuthAccountDetailPane">
|
||||
@@ -657,9 +685,9 @@ function populateAuthAccounts(){
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingsAuthAccountActions">
|
||||
<button class="settingsAuthAccountSelect" ${selectedUUID === acc.uuid ? 'selected>Selected Account ✔' : '>Select Account'}</button>
|
||||
<button class="settingsAuthAccountSelect" ${selectedUUID === acc.uuid ? 'selected>Kiválasztott Fiók ✔' : '>Kiválaszt'}</button>
|
||||
<div class="settingsAuthAccountWrapper">
|
||||
<button class="settingsAuthAccountLogOut">Log Out</button>
|
||||
<button class="settingsAuthAccountLogOut">Kijelentkezés</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -667,6 +695,8 @@ function populateAuthAccounts(){
|
||||
|
||||
if(acc.type === 'microsoft') {
|
||||
microsoftAuthAccountStr += accHtml
|
||||
} else if(acc.type === 'offline') {
|
||||
offlineAuthAccountStr += accHtml
|
||||
} else {
|
||||
mojangAuthAccountStr += accHtml
|
||||
}
|
||||
@@ -675,6 +705,7 @@ function populateAuthAccounts(){
|
||||
|
||||
settingsCurrentMicrosoftAccounts.innerHTML = microsoftAuthAccountStr
|
||||
settingsCurrentMojangAccounts.innerHTML = mojangAuthAccountStr
|
||||
settingsCurrentOfflineAccounts.innerHTML = offlineAuthAccountStr
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1093,7 +1124,7 @@ async function loadSelectedServerOnModsTab(){
|
||||
<path class="cls-1" d="M100.93,65.54C89,62,68.18,55.65,63.54,52.13c2.7-5.23,18.8-19.2,28-27.55C81.36,31.74,63.74,43.87,58.09,45.3c-2.41-5.37-3.61-26.52-4.37-39-.77,12.46-2,33.64-4.36,39-5.7-1.46-23.3-13.57-33.49-20.72,9.26,8.37,25.39,22.36,28,27.55C39.21,55.68,18.47,62,6.52,65.55c12.32-2,33.63-6.06,39.34-4.9-.16,5.87-8.41,26.16-13.11,37.69,6.1-10.89,16.52-30.16,21-33.9,4.5,3.79,14.93,23.09,21,34C70,86.84,61.73,66.48,61.59,60.65,67.36,59.49,88.64,63.52,100.93,65.54Z"/>
|
||||
<circle class="cls-2" cx="53.73" cy="53.9" r="38"/>
|
||||
</svg>
|
||||
<span class="serverListingStarTooltip">Main Server</span>
|
||||
<span class="serverListingStarTooltip">Fő Server</span>
|
||||
</div>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1433,11 +1464,11 @@ function isPrerelease(version){
|
||||
function populateVersionInformation(version, valueElement, titleElement, checkElement){
|
||||
valueElement.innerHTML = version
|
||||
if(isPrerelease(version)){
|
||||
titleElement.innerHTML = 'Pre-release'
|
||||
titleElement.innerHTML = 'Teszt Kiadás'
|
||||
titleElement.style.color = '#ff886d'
|
||||
checkElement.style.background = '#ff886d'
|
||||
} else {
|
||||
titleElement.innerHTML = 'Stable Release'
|
||||
titleElement.innerHTML = 'Stabil Kiadás'
|
||||
titleElement.style.color = null
|
||||
checkElement.style.background = null
|
||||
}
|
||||
@@ -1456,7 +1487,7 @@ function populateAboutVersionInformation(){
|
||||
*/
|
||||
function populateReleaseNotes(){
|
||||
$.ajax({
|
||||
url: 'https://github.com/dscalzi/HeliosLauncher/releases.atom',
|
||||
url: 'https://github.com/ChronikaMC/Launcher/releases.atom',
|
||||
success: (data) => {
|
||||
const version = 'v' + remote.app.getVersion()
|
||||
const entries = $(data).find('entry')
|
||||
@@ -1476,7 +1507,7 @@ function populateReleaseNotes(){
|
||||
},
|
||||
timeout: 2500
|
||||
}).catch(err => {
|
||||
settingsAboutChangelogText.innerHTML = 'Failed to load release notes.'
|
||||
settingsAboutChangelogText.innerHTML = 'Nem sikerült betölteni a frissítésekre vonatkozó információkat.'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1524,27 +1555,27 @@ function settingsUpdateButtonStatus(text, disabled = false, handler = null){
|
||||
*/
|
||||
function populateSettingsUpdateInformation(data){
|
||||
if(data != null){
|
||||
settingsUpdateTitle.innerHTML = `New ${isPrerelease(data.version) ? 'Pre-release' : 'Release'} Available`
|
||||
settingsUpdateTitle.innerHTML = `Új ${isPrerelease(data.version) ? 'Teszt' : 'Stabil'} verzió elérhető`
|
||||
settingsUpdateChangelogCont.style.display = null
|
||||
settingsUpdateChangelogTitle.innerHTML = data.releaseName
|
||||
settingsUpdateChangelogText.innerHTML = data.releaseNotes
|
||||
populateVersionInformation(data.version, settingsUpdateVersionValue, settingsUpdateVersionTitle, settingsUpdateVersionCheck)
|
||||
|
||||
if(process.platform === 'darwin'){
|
||||
settingsUpdateButtonStatus('Download from GitHub<span style="font-size: 10px;color: gray;text-shadow: none !important;">Close the launcher and run the dmg to update.</span>', false, () => {
|
||||
settingsUpdateButtonStatus('Töltsd le GitHubról<span style="font-size: 10px;color: gray;text-shadow: none !important;">Zárd be a launchert és futtasd a dmg-t a frissítéshez.</span>', false, () => {
|
||||
shell.openExternal(data.darwindownload)
|
||||
})
|
||||
} else {
|
||||
settingsUpdateButtonStatus('Downloading..', true)
|
||||
settingsUpdateButtonStatus('Letöltés..', true)
|
||||
}
|
||||
} else {
|
||||
settingsUpdateTitle.innerHTML = 'You Are Running the Latest Version'
|
||||
settingsUpdateTitle.innerHTML = 'A legfrisebb verziót használod'
|
||||
settingsUpdateChangelogCont.style.display = 'none'
|
||||
populateVersionInformation(remote.app.getVersion(), settingsUpdateVersionValue, settingsUpdateVersionTitle, settingsUpdateVersionCheck)
|
||||
settingsUpdateButtonStatus('Check for Updates', false, () => {
|
||||
settingsUpdateButtonStatus('Frissítések keresése', false, () => {
|
||||
if(!isDev){
|
||||
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
||||
settingsUpdateButtonStatus('Checking for Updates..', true)
|
||||
settingsUpdateButtonStatus('Frissítések keresése..', true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user