v0.1.0 - Test

This commit is contained in:
Cyanoure
2023-07-20 04:05:31 +02:00
parent d89b270c20
commit e553ff87d0
36 changed files with 5490 additions and 5143 deletions

View File

@@ -124,8 +124,8 @@ document.getElementById('launch_button').addEventListener('click', async e => {
}
}
} catch(err) {
loggerLanding.error('Unhandled error in during launch process.', err)
showLaunchFailure('Error During Launch', 'See console (CTRL + Shift + i) for more details.')
loggerLanding.error('Kezeletlen hiba az indítási folyamat közben.', err)
showLaunchFailure('Hiba Indítás Közben', 'Lásd a konzolban (CTRL + Shift + i) a további részleteket.')
}
})
@@ -145,14 +145,15 @@ document.getElementById('avatarOverlay').onclick = async e => {
// Bind selected account
function updateSelectedAccount(authUser){
let username = 'No Account Selected'
let username = 'Nincs fiók kiválasztva'
if(authUser != null){
if(authUser.displayName != null){
username = authUser.displayName
document.getElementById('avatarImage').style.backgroundImage = `url('https://portal.chronika.hu/api/skinrender.php?username=${authUser.displayName}')`
}
if(authUser.uuid != null){
/*if(authUser.uuid != null){
document.getElementById('avatarContainer').style.backgroundImage = `url('https://mc-heads.net/body/${authUser.uuid}/right')`
}
}*/
}
user_text.innerHTML = username
}
@@ -165,14 +166,14 @@ function updateSelectedServer(serv){
}
ConfigManager.setSelectedServer(serv != null ? serv.rawServer.id : null)
ConfigManager.save()
server_selection_button.innerHTML = '\u2022 ' + (serv != null ? serv.rawServer.name : 'No Server Selected')
server_selection_button.innerHTML = '\u2022 ' + (serv != null ? serv.rawServer.name : 'Nincs szerver kiválasztva')
if(getCurrentView() === VIEWS.settings){
animateSettingsTabRefresh()
}
setLaunchEnabled(serv != null)
}
// Real text is set in uibinder.js on distributionIndexDone.
server_selection_button.innerHTML = '\u2022 Loading..'
server_selection_button.innerHTML = '\u2022 Betöltés..'
server_selection_button.onclick = async e => {
e.target.blur()
await toggleServerSelection(true)
@@ -180,7 +181,7 @@ server_selection_button.onclick = async e => {
// Update Mojang Status Color
const refreshMojangStatuses = async function(){
loggerLanding.info('Refreshing Mojang Statuses..')
loggerLanding.info('Mojang Információ Frissítése..')
let status = 'grey'
let tooltipEssentialHTML = ''
@@ -191,7 +192,7 @@ const refreshMojangStatuses = async function(){
if(response.responseStatus === RestResponseStatus.SUCCESS) {
statuses = response.data
} else {
loggerLanding.warn('Unable to refresh Mojang service status.')
loggerLanding.warn('Nem sikerült lekérni a Mojang szervereinek állapotát.')
statuses = MojangRestAPI.getDefaultStatuses()
}
@@ -240,21 +241,21 @@ const refreshMojangStatuses = async function(){
}
const refreshServerStatus = async (fade = false) => {
loggerLanding.info('Refreshing Server Status')
loggerLanding.info('Szerver állapotának frissítése')
const serv = (await DistroAPI.getDistribution()).getServerById(ConfigManager.getSelectedServer())
let pLabel = 'SERVER'
let pLabel = 'SZERVER'
let pVal = 'OFFLINE'
try {
const servStat = await getServerStatus(47, serv.hostname, serv.port)
console.log(servStat)
pLabel = 'PLAYERS'
pLabel = 'JÁTÉKOSOK'
pVal = servStat.players.online + '/' + servStat.players.max
} catch (err) {
loggerLanding.warn('Unable to refresh server status, assuming offline.')
loggerLanding.warn('Nem sikerült lekérni a szerver állapotát, feltehetőleg offline.')
loggerLanding.debug(err)
}
if(fade){
@@ -304,7 +305,7 @@ function showLaunchFailure(title, desc){
*/
async function asyncSystemScan(effectiveJavaOptions, launchAfter = true){
setLaunchDetails('Checking system info..')
setLaunchDetails('Rendszerinformáció ellenőrzése..')
toggleLaunchArea(true)
setLaunchPercentage(0, 100)
@@ -317,30 +318,30 @@ async function asyncSystemScan(effectiveJavaOptions, launchAfter = true){
// If the result is null, no valid Java installation was found.
// Show this information to the user.
setOverlayContent(
'No Compatible<br>Java Installation Found',
`In order to join WesterosCraft, you need a 64-bit installation of Java ${effectiveJavaOptions.suggestedMajor}. Would you like us to install a copy?`,
'Install Java',
'Install Manually'
'Nem található<br>Kompatibilis Java telepítés',
`Ahhoz hogy elindítsd a játékot, 64 bites Java ${effectiveJavaOptions.suggestedMajor} szükséges. Feltelepítsük neked?`,
'Java Telepítése',
'Manuális Telepítés'
)
setOverlayHandler(() => {
setLaunchDetails('Preparing Java Download..')
setLaunchDetails('Java letöltés előkészítése..')
toggleOverlay(false)
try {
downloadJava(effectiveJavaOptions, launchAfter)
} catch(err) {
loggerLanding.error('Unhandled error in Java Download', err)
showLaunchFailure('Error During Java Download', 'See console (CTRL + Shift + i) for more details.')
loggerLanding.error('Kezeletlen hiba Java letöltés közben', err)
showLaunchFailure('Hiba történt java letöltés közben', 'Lásd a konzolban (CTRL + Shift + i) a további részleteket.')
}
})
setDismissHandler(() => {
$('#overlayContent').fadeOut(250, () => {
//$('#overlayDismiss').toggle(false)
setOverlayContent(
'Java is Required<br>to Launch',
`A valid x64 installation of Java ${effectiveJavaOptions.suggestedMajor} is required to launch.<br><br>Please refer to our <a href="https://github.com/dscalzi/HeliosLauncher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Java Management Guide</a> for instructions on how to manually install Java.`,
'I Understand',
'Go Back'
'Java szükséges<br>az indításhoz',
`Egy érvényes x64-es Java ${effectiveJavaOptions.suggestedMajor} szükséges az indításhoz.<br><br>Részleteket a <a href="https://github.com/ChronikaMC/Launcher/wiki/Java-Management#manually-installing-a-valid-version-of-java">Dokumentációnkban</a> találod a Java manuális telepítéséhez.`,
'Értem',
'Vissza'
)
setOverlayHandler(() => {
toggleLaunchArea(false)
@@ -385,7 +386,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
effectiveJavaOptions.distribution)
if(asset == null) {
throw new Error('Failed to find OpenJDK distribution.')
throw new Error('Nem sikerült lekérni a legfrisebb OpenJDK letöltést.')
}
let received = 0
@@ -396,11 +397,11 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
setDownloadPercentage(100)
if(received != asset.size) {
loggerLanding.warn(`Java Download: Expected ${asset.size} bytes but received ${received}`)
loggerLanding.warn(`Java Letöltés: Várt ${asset.size} byte helyett ${received} byte érkezett.`)
if(!await validateLocalFile(asset.path, asset.algo, asset.hash)) {
log.error(`Hashes do not match, ${asset.id} may be corrupted.`)
log.error(`Hashek nem egyeznek, ${asset.id} sérült lehet.`)
// Don't know how this could happen, but report it.
throw new Error('Downloaded JDK has bad hash, file may be corrupted.')
throw new Error('Letöltött JDK nem jó hash-t adott eredményül, valószínűleg hibás a fájl.')
}
}
@@ -409,7 +410,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
remote.getCurrentWindow().setProgressBar(2)
// Wait for extration to complete.
const eLStr = 'Extracting Java'
const eLStr = 'Java Kicsomagolása'
let dotStr = ''
setLaunchDetails(eLStr)
const extractListener = setInterval(() => {
@@ -431,7 +432,7 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
ConfigManager.save()
clearInterval(extractListener)
setLaunchDetails('Java Installed!')
setLaunchDetails('Java Telepítve!')
// TODO Callback hell
// Refactor the launch functions
@@ -456,7 +457,7 @@ async function dlAsync(login = true) {
const loggerLaunchSuite = LoggerUtil.getLogger('LaunchSuite')
setLaunchDetails('Loading server information..')
setLaunchDetails('Szerver információk betöltése..')
let distro
@@ -473,12 +474,12 @@ async function dlAsync(login = true) {
if(login) {
if(ConfigManager.getSelectedAccount() == null){
loggerLanding.error('You must be logged into an account.')
loggerLanding.error('Jelentkezz be egy fiókba.')
return
}
}
setLaunchDetails('Please wait..')
setLaunchDetails('Kérlek várj..')
toggleLaunchArea(true)
setLaunchPercentage(0, 100)
@@ -493,18 +494,18 @@ async function dlAsync(login = true) {
fullRepairModule.spawnReceiver()
fullRepairModule.childProcess.on('error', (err) => {
loggerLaunchSuite.error('Error during launch', err)
showLaunchFailure('Error During Launch', err.message || 'See console (CTRL + Shift + i) for more details.')
loggerLaunchSuite.error('Hiba indítás közben', err)
showLaunchFailure('Hiba indítás közben', err.message || 'Lásd a konzolt (CTRL + Shift + i) a további részletekért.')
})
fullRepairModule.childProcess.on('close', (code, _signal) => {
if(code !== 0){
loggerLaunchSuite.error(`Full Repair Module exited with code ${code}, assuming error.`)
showLaunchFailure('Error During Launch', 'See console (CTRL + Shift + i) for more details.')
loggerLaunchSuite.error(`Teljes Javító Modul kilépett a(z) ${code} kóddal, valószínűleg hiba.`)
showLaunchFailure('Hiba indítás közben', 'Lásd a konzolt (CTRL + Shift + i) a további részletekért.')
}
})
loggerLaunchSuite.info('Validating files.')
setLaunchDetails('Validating file integrity..')
loggerLaunchSuite.info('Fájlok ellenőrzése.')
setLaunchDetails('Fájl integritás ellenőrzése..')
let invalidFileCount = 0
try {
invalidFileCount = await fullRepairModule.verifyFiles(percent => {
@@ -512,15 +513,15 @@ async function dlAsync(login = true) {
})
setLaunchPercentage(100)
} catch (err) {
loggerLaunchSuite.error('Error during file validation.')
showLaunchFailure('Error During File Verification', err.displayable || 'See console (CTRL + Shift + i) for more details.')
loggerLaunchSuite.error('Hiba fájl ellenőrzés közben.')
showLaunchFailure('Hiba fájl ellenőrzés közben', err.displayable || 'Lásd a konzolt (CTRL + Shift + i) a további részletekért.')
return
}
if(invalidFileCount > 0) {
loggerLaunchSuite.info('Downloading files.')
setLaunchDetails('Downloading files..')
loggerLaunchSuite.info('Fájlok letöltése.')
setLaunchDetails('Fájlok letöltése..')
setLaunchPercentage(0)
try {
await fullRepairModule.download(percent => {
@@ -528,12 +529,12 @@ async function dlAsync(login = true) {
})
setDownloadPercentage(100)
} catch(err) {
loggerLaunchSuite.error('Error during file download.')
showLaunchFailure('Error During File Download', err.displayable || 'See console (CTRL + Shift + i) for more details.')
loggerLaunchSuite.error('Hiba fájl letöltés közben.')
showLaunchFailure('Hiba fájl letöltés közben', err.displayable || 'Lásd a konzolt (CTRL + Shift + i) a további részletekért.')
return
}
} else {
loggerLaunchSuite.info('No invalid files, skipping download.')
loggerLaunchSuite.info('Fájlok rendben vannak, letöltés kihagyása.')
}
// Remove download bar.
@@ -541,7 +542,7 @@ async function dlAsync(login = true) {
fullRepairModule.destroyReceiver()
setLaunchDetails('Preparing to launch..')
setLaunchDetails('Indítás előkészítése..')
const mojangIndexProcessor = new MojangIndexProcessor(
ConfigManager.getCommonDirectory(),
@@ -557,17 +558,18 @@ async function dlAsync(login = true) {
if(login) {
const authUser = ConfigManager.getSelectedAccount()
loggerLaunchSuite.info(`Sending selected account (${authUser.displayName}) to ProcessBuilder.`)
loggerLaunchSuite.info(`Kiválasztott fiók elküldése (${authUser.displayName}) a ProcessBuilder-nek.`)
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser, remote.app.getVersion())
setLaunchDetails('Launching game..')
setLaunchDetails('Játék indítása..')
// const SERVER_JOINED_REGEX = /\[.+\]: \[CHAT\] [a-zA-Z0-9_]{1,16} joined the game/
const SERVER_JOINED_REGEX = new RegExp(`\\[.+\\]: \\[CHAT\\] ${authUser.displayName} joined the game`)
// const SERVER_JOINED_REGEX = new RegExp(`\\[.+\\]: \\[CHAT\\] ${authUser.displayName} joined the game`)
const SERVER_JOINED_REGEX = new RegExp('Sikeresen bejelentkeztél.')
const onLoadComplete = () => {
toggleLaunchArea(false)
if(hasRPC){
DiscordWrapper.updateDetails('Loading game..')
DiscordWrapper.updateDetails('Játék betöltése..')
proc.stdout.on('data', gameStateChange)
}
proc.stdout.removeListener('data', tempListener)
@@ -594,17 +596,17 @@ async function dlAsync(login = true) {
const gameStateChange = function(data){
data = data.trim()
if(SERVER_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Exploring the Realm!')
DiscordWrapper.updateDetails('Chronika szerverein lazul.')
} else if(GAME_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Sailing to Westeros!')
DiscordWrapper.updateDetails('Főmenü')
}
}
const gameErrorListener = function(data){
data = data.trim()
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1){
loggerLaunchSuite.error('Game launch failed, LaunchWrapper was not downloaded properly.')
showLaunchFailure('Error During Launch', 'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href="https://github.com/dscalzi/HeliosLauncher/issues">submit an issue</a> and let us know what antivirus software you use. We\'ll contact them and try to straighten things out.')
if(data.indexOf('Nem sikerült betölteni a fő osztályt net.minecraft.launchwrapper.Launch') > -1){
loggerLaunchSuite.error('Játékindítás meghiúsult, LaunchWrapper nem töltődött le megfelelően.')
showLaunchFailure('Hiba indítás közben', 'A fő fájl, LaunchWrapper, nem töltődött le megfelelően. Ennek eredményeképp a játék nem tudott elindulni.<br><br>Próbáld meg kikapcsolni a vírusírtót ideiglenesen és próbáld meg újra elindítani a játékot.<br><br>Ha van egy kis időd, kérlek <a href="https://github.com/ChronikaMC/ChronikaLauncher/issues">jelezd a hibát</a> és tudasd velünk milyen vírusirtót használsz. Megpróbáljuk megoldani a problémát.')
}
}
@@ -616,10 +618,11 @@ async function dlAsync(login = true) {
proc.stdout.on('data', tempListener)
proc.stderr.on('data', gameErrorListener)
setLaunchDetails('Done. Enjoy the server!')
setLaunchDetails('Kész. Élvezd a szervert!')
// Init Discord Hook
if(distro.rawDistribution.discord != null && serv.rawServerdiscord != null){
console.log('DISCORD:', serv.rawServer.discord)
if(distro.rawDistribution.discord != null && serv.rawServer.discord != null){
DiscordWrapper.initRPC(distro.rawDistribution.discord, serv.rawServer.discord)
hasRPC = true
proc.on('close', (code, signal) => {
@@ -632,8 +635,8 @@ async function dlAsync(login = true) {
} catch(err) {
loggerLaunchSuite.error('Error during launch', err)
showLaunchFailure('Error During Launch', 'Please check the console (CTRL + Shift + i) for more details.')
loggerLaunchSuite.error('Hiba indítás közben', err)
showLaunchFailure('Hiba indítás közben', 'Lásd a konzolt (CTRL + Shift + i) a további részletekért.')
}
}
@@ -740,7 +743,7 @@ let newsLoadingListener = null
*/
function setNewsLoading(val){
if(val){
const nLStr = 'Checking for News'
const nLStr = 'Hírek Betöltése'
let dotStr = '..'
nELoadSpan.innerHTML = nLStr + dotStr
newsLoadingListener = setInterval(() => {
@@ -967,7 +970,7 @@ async function loadNews(){
const distroData = await DistroAPI.getDistribution()
if(!distroData.rawDistribution.rss) {
loggerLanding.debug('No RSS feed provided.')
loggerLanding.debug('Nincs RSS hírfolyam.')
return null
}
@@ -986,14 +989,14 @@ async function loadNews(){
const el = $(items[i])
// Resolve date.
const date = new Date(el.find('pubDate').text()).toLocaleDateString('en-US', {month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric'})
const date = new Date(el.find('pubDate').text()).toLocaleDateString('hu-HU', {month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric'})
// Resolve comments.
let comments = el.find('slash\\:comments').text() || '0'
comments = comments + ' Comment' + (comments === '1' ? '' : 's')
let comments = el.find('comments').text() || '0'
comments = comments + ' Komment'
// Fix relative links in content.
let content = el.find('content\\:encoded').text()
let content = el.find('content').text()
let regex = /src="(?!http:\/\/|https:\/\/)(.+?)"/g
let matches
while((matches = regex.exec(content))){
@@ -1002,7 +1005,7 @@ async function loadNews(){
let link = el.find('link').text()
let title = el.find('title').text()
let author = el.find('dc\\:creator').text()
let author = el.find('author').text()
// Generate article.
articles.push(

View File

@@ -215,14 +215,14 @@ loginButton.addEventListener('click', () => {
let actualDisplayableError
if(isDisplayableError(displayableError)) {
msftLoginLogger.error('Error while logging in.', displayableError)
msftLoginLogger.error('Hiba belépés közben.', displayableError)
actualDisplayableError = displayableError
} else {
// Uh oh.
msftLoginLogger.error('Unhandled error during login.', displayableError)
msftLoginLogger.error('Kezeletlen hiba belépés közben.', 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 részletekért.'
}
}

View File

@@ -47,4 +47,12 @@ loginOptionsCancelButton.onclick = (e) => {
loginOptionsViewCancelHandler = null
}
})
}
loginOptionOffline.onclick = (e) => {
switchView(getCurrentView(), VIEWS.offline, 500, 500, () => {
offlineLoginViewOnSuccess = loginOptionsViewOnLoginSuccess
offlineLoginViewOnCancel = loginOptionsViewOnLoginCancel
offlineLoginCancelEnabled(true)
})
}

View File

@@ -0,0 +1,178 @@
/**
* Script for offlineLogin.ejs
*/
// Login Elements
const offlineLoginCancelContainer = document.getElementById('offlineLoginCancelContainer')
const offlineLoginCancelButton = document.getElementById('offlineLoginCancelButton')
const offlineLoginEmailError = document.getElementById('offlineLoginEmailError')
const offlineLoginUsername = document.getElementById('offlineLoginUsername')
const offlineCheckmarkContainer = document.getElementById('offlineCheckmarkContainer')
const offlineLoginRememberOption = document.getElementById('offlineLoginRememberOption')
const offlineLoginButton = document.getElementById('offlineLoginButton')
const offlineLoginForm = document.getElementById('offlineLoginForm')
// Control variables.
let olu = false
/**
* Show a offlineLogin error.
*
* @param {HTMLElement} element The element on which to display the error.
* @param {string} value The error text.
*/
function showError(element, value){
element.innerHTML = value
element.style.opacity = 1
}
/**
* Shake a offlineLogin error to add emphasis.
*
* @param {HTMLElement} element The element to shake.
*/
function shakeError(element){
if(element.style.opacity == 1){
element.classList.remove('shake')
void element.offsetWidth
element.classList.add('shake')
}
}
/**
* Validate that an email field is neither empty nor invalid.
*
* @param {string} value The email value.
*/
function validateOfflineUsername(value){
if(value){
if(!validUsername.test(value)){
showError(offlineLoginEmailError, Lang.queryJS('login.error.invalidValue'))
offlineLoginDisabled(true)
olu = false
} else {
offlineLoginEmailError.style.opacity = 0
olu = true
offlineLoginDisabled(false)
}
} else {
olu = false
showError(offlineLoginEmailError, Lang.queryJS('login.error.requiredValue'))
offlineLoginDisabled(true)
}
}
// Emphasize errors with shake when focus is lost.
offlineLoginUsername.addEventListener('focusout', (e) => {
validateOfflineUsername(e.target.value)
shakeError(offlineLoginEmailError)
})
// Validate input for each field.
offlineLoginUsername.addEventListener('input', (e) => {
validateOfflineUsername(e.target.value)
})
/**
* Enable or disable the offlineLogin button.
*
* @param {boolean} v True to enable, false to disable.
*/
function offlineLoginDisabled(v){
if(offlineLoginButton.disabled !== v){
offlineLoginButton.disabled = v
}
}
/**
* Enable or disable loading elements.
*
* @param {boolean} v True to enable, false to disable.
*/
function offlineLoginLoading(v){
if(v){
offlineLoginButton.setAttribute('loading', v)
offlineLoginButton.innerHTML = offlineLoginButton.innerHTML.replace(Lang.queryJS('login.login'), Lang.queryJS('login.loggingIn'))
} else {
offlineLoginButton.removeAttribute('loading')
offlineLoginButton.innerHTML = offlineLoginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.login'))
}
}
/**
* Enable or disable offlineLogin form.
*
* @param {boolean} v True to enable, false to disable.
*/
function offlineFormDisabled(v){
offlineLoginDisabled(v)
offlineLoginCancelButton.disabled = v
offlineLoginUsername.disabled = v
if(v){
offlineCheckmarkContainer.setAttribute('disabled', v)
} else {
offlineCheckmarkContainer.removeAttribute('disabled')
}
offlineLoginRememberOption.disabled = v
}
let offlineLoginViewOnSuccess = VIEWS.landing
let offlineLoginViewOnCancel = VIEWS.settings
let offlineLoginViewCancelHandler
function offlineLoginCancelEnabled(val){
if(val){
$(offlineLoginCancelContainer).show()
} else {
$(offlineLoginCancelContainer).hide()
}
}
offlineLoginCancelButton.onclick = (e) => {
switchView(getCurrentView(), offlineLoginViewOnCancel, 500, 500, () => {
offlineLoginUsername.value = ''
offlineLoginCancelEnabled(false)
if(offlineLoginViewCancelHandler != null){
offlineLoginViewCancelHandler()
offlineLoginViewCancelHandler = null
}
})
}
// Disable default form behavior.
offlineLoginForm.onsubmit = () => { return false }
// Bind offlineLogin button behavior.
offlineLoginButton.addEventListener('click', () => {
// Disable form.
offlineFormDisabled(true)
// Show loading stuff.
offlineLoginLoading(true)
const username = offlineLoginUsername.value
const value = AuthManager.addOfflineAccount(username)
$('.circle-loader').toggleClass('load-complete')
$('.offlineCheckmark').toggle()
updateSelectedAccount(value)
setTimeout(() => {
switchView(VIEWS.offline, offlineLoginViewOnSuccess, 500, 500, async () => {
// Temporary workaround
if(offlineLoginViewOnSuccess === VIEWS.settings){
await prepareSettings()
}
offlineLoginViewOnSuccess = VIEWS.landing // Reset this for good measure.
offlineLoginCancelEnabled(false) // Reset this for good measure.
offlineLoginViewCancelHandler = null // Reset this for good measure.
offlineLoginUsername.value = ''
$('.circle-loader').toggleClass('load-complete')
$('.offlineCheckmark').toggle()
offlineLoginLoading(false)
loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.success'), Lang.queryJS('login.login'))
offlineFormDisabled(false)
})
}, 1000)
})

View File

@@ -289,7 +289,7 @@ async function populateServerListings(){
<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"> Server</span>
</div>` : ''}
</div>
</div>

View File

@@ -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 &#10004;'
val.innerHTML = 'Kiválasztott Fiók &#10004;'
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 &#10004;'
selBtn.innerHTML = 'Kiválasztott Fiók &#10004;'
} 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 &#10004;' : '>Select Account'}</button>
<button class="settingsAuthAccountSelect" ${selectedUUID === acc.uuid ? 'selected>Kiválasztott Fiók &#10004;' : '>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"> 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)
}
})
}

View File

@@ -21,7 +21,8 @@ const VIEWS = {
login: '#loginContainer',
settings: '#settingsContainer',
welcome: '#welcomeContainer',
waiting: '#waitingContainer'
waiting: '#waitingContainer',
offline: '#offlineLoginContainer'
}
// The currently shown view container.

View File

@@ -26,9 +26,9 @@ window.eval = global.eval = function () {
// Display warning when devtools window is opened.
remote.getCurrentWebContents().on('devtools-opened', () => {
console.log('%cThe console is dark and full of terrors.', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
console.log('%cIf you\'ve been told to paste something here, you\'re being scammed.', 'font-size: 16px')
console.log('%cUnless you know exactly what you\'re doing, close this window.', 'font-size: 16px')
console.log('%cA konzol sötét és tele van terrorral.', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
console.log('%cHa azt mondták, hogy illessz be ide valamit, valószínűleg átverés.', 'font-size: 16px')
console.log('%cHacsak nem tudod pontosan mit csinálsz, zárd be ezt az ablakot.', 'font-size: 16px')
})
// Disable zoom, needed for darwin.
@@ -41,22 +41,22 @@ if(!isDev){
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
switch(arg){
case 'checking-for-update':
loggerAutoUpdater.info('Checking for update..')
settingsUpdateButtonStatus('Checking for Updates..', true)
loggerAutoUpdater.info('Frissítés keresése..')
settingsUpdateButtonStatus('Frissítés keresése..', true)
break
case 'update-available':
loggerAutoUpdater.info('New update available', info.version)
loggerAutoUpdater.info('Új frissítés elérhető', info.version)
if(process.platform === 'darwin'){
info.darwindownload = `https://github.com/dscalzi/HeliosLauncher/releases/download/v${info.version}/Helios-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
info.darwindownload = `https://github.com/ChronikaMC/Launcher/releases/download/v${info.version}/Chronika-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
showUpdateUI(info)
}
populateSettingsUpdateInformation(info)
break
case 'update-downloaded':
loggerAutoUpdater.info('Update ' + info.version + ' ready to be installed.')
settingsUpdateButtonStatus('Install Now', false, () => {
loggerAutoUpdater.info('Frissítés ' + info.version + ' készen áll a telepítésre.')
settingsUpdateButtonStatus('Telepítés Most', false, () => {
if(!isDev){
ipcRenderer.send('autoUpdateAction', 'installUpdateNow')
}
@@ -64,8 +64,8 @@ if(!isDev){
showUpdateUI(info)
break
case 'update-not-available':
loggerAutoUpdater.info('No new update found.')
settingsUpdateButtonStatus('Check for Updates')
loggerAutoUpdater.info('Nem található frissítés.')
settingsUpdateButtonStatus('Frissítés keresése')
break
case 'ready':
updateCheckListener = setInterval(() => {
@@ -76,12 +76,12 @@ if(!isDev){
case 'realerror':
if(info != null && info.code != null){
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
loggerAutoUpdater.info('No suitable releases found.')
loggerAutoUpdater.info('Nem található megfelelő kiadás.')
} else if(info.code === 'ERR_XML_MISSED_ELEMENT'){
loggerAutoUpdater.info('No releases found.')
loggerAutoUpdater.info('Nem találhatóak kiadások.')
} else {
loggerAutoUpdater.error('Error during update check..', info)
loggerAutoUpdater.debug('Error Code:', info.code)
loggerAutoUpdater.error('Hiba történt a frissítések keresése közben..', info)
loggerAutoUpdater.debug('Hibakód:', info.code)
}
}
break