From 7eadc721cf49c15b62fcddd79c0731168c95398d Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Wed, 10 Aug 2022 04:58:36 +0300 Subject: [PATCH] disable helios services checks --- app/assets/js/scripts/landing.js | 334 +++++++++++++++--------------- app/assets/js/scripts/uibinder.js | 6 +- 2 files changed, 170 insertions(+), 170 deletions(-) diff --git a/app/assets/js/scripts/landing.js b/app/assets/js/scripts/landing.js index bf7ca5f..d2f2584 100644 --- a/app/assets/js/scripts/landing.js +++ b/app/assets/js/scripts/landing.js @@ -159,65 +159,65 @@ server_selection_button.onclick = (e) => { } // Update Mojang Status Color -const refreshMojangStatuses = async function(){ - loggerLanding.log('Refreshing Mojang Statuses..') +// const refreshMojangStatuses = async function(){ +// loggerLanding.log('Refreshing Mojang Statuses..') - let status = 'grey' - let tooltipEssentialHTML = '' - let tooltipNonEssentialHTML = '' +// let status = 'grey' +// let tooltipEssentialHTML = '' +// let tooltipNonEssentialHTML = '' - const response = await MojangRestAPI.status() - let statuses - if(response.responseStatus === RestResponseStatus.SUCCESS) { - statuses = response.data - } else { - loggerLanding.warn('Unable to refresh Mojang service status.') - statuses = MojangRestAPI.getDefaultStatuses() - } +// const response = await MojangRestAPI.status() +// let statuses +// if(response.responseStatus === RestResponseStatus.SUCCESS) { +// statuses = response.data +// } else { +// loggerLanding.warn('Unable to refresh Mojang service status.') +// statuses = MojangRestAPI.getDefaultStatuses() +// } - greenCount = 0 - greyCount = 0 +// greenCount = 0 +// greyCount = 0 - for(let i=0; i - - ${service.name} - ` - } else { - tooltipNonEssentialHTML += `
- - ${service.name} -
` - } +// if(service.essential){ +// tooltipEssentialHTML += `
+// +// ${service.name} +//
` +// } else { +// tooltipNonEssentialHTML += `
+// +// ${service.name} +//
` +// } - if(service.status === 'yellow' && status !== 'red'){ - status = 'yellow' - } else if(service.status === 'red'){ - status = 'red' - } else { - if(service.status === 'grey'){ - ++greyCount - } - ++greenCount - } +// if(service.status === 'yellow' && status !== 'red'){ +// status = 'yellow' +// } else if(service.status === 'red'){ +// status = 'red' +// } else { +// if(service.status === 'grey'){ +// ++greyCount +// } +// ++greenCount +// } - } +// } - if(greenCount === statuses.length){ - if(greyCount === statuses.length){ - status = 'grey' - } else { - status = 'green' - } - } +// if(greenCount === statuses.length){ +// if(greyCount === statuses.length){ +// status = 'grey' +// } else { +// status = 'green' +// } +// } - document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML - document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML - document.getElementById('mojang_status_icon').style.color = MojangRestAPI.statusToHex(status) -} +// document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML +// document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML +// document.getElementById('mojang_status_icon').style.color = MojangRestAPI.statusToHex(status) +// } const refreshServerStatus = async function(fade = false){ loggerLanding.log('Refreshing Server Status') @@ -251,12 +251,12 @@ const refreshServerStatus = async function(fade = false){ } -refreshMojangStatuses() +//refreshMojangStatuses() // Server Status is refreshed in uibinder.js on distributionIndexDone. // Set refresh rate to once every 5 minutes. -let mojangStatusListener = setInterval(() => refreshMojangStatuses(true), 300000) -let serverStatusListener = setInterval(() => refreshServerStatus(true), 300000) +//let mojangStatusListener = setInterval(() => refreshMojangStatuses(true), 300000) +//let serverStatusListener = setInterval(() => refreshServerStatus(true), 300000) /** * Shows an error overlay, toggles off the launch area. @@ -868,42 +868,42 @@ let newsLoadingListener = null * * @param {boolean} val True to set loading animation, otherwise false. */ -function setNewsLoading(val){ - if(val){ - const nLStr = 'Checking for News' - let dotStr = '..' - nELoadSpan.innerHTML = nLStr + dotStr - newsLoadingListener = setInterval(() => { - if(dotStr.length >= 3){ - dotStr = '' - } else { - dotStr += '.' - } - nELoadSpan.innerHTML = nLStr + dotStr - }, 750) - } else { - if(newsLoadingListener != null){ - clearInterval(newsLoadingListener) - newsLoadingListener = null - } - } -} +// function setNewsLoading(val){ +// if(val){ +// const nLStr = 'Checking for News' +// let dotStr = '..' +// nELoadSpan.innerHTML = nLStr + dotStr +// newsLoadingListener = setInterval(() => { +// if(dotStr.length >= 3){ +// dotStr = '' +// } else { +// dotStr += '.' +// } +// nELoadSpan.innerHTML = nLStr + dotStr +// }, 750) +// } else { +// if(newsLoadingListener != null){ +// clearInterval(newsLoadingListener) +// newsLoadingListener = null +// } +// } +// } // Bind retry button. -newsErrorRetry.onclick = () => { - $('#newsErrorFailed').fadeOut(250, () => { - initNews() - $('#newsErrorLoading').fadeIn(250) - }) -} +// newsErrorRetry.onclick = () => { +// $('#newsErrorFailed').fadeOut(250, () => { +// initNews() +// $('#newsErrorLoading').fadeIn(250) +// }) +// } -newsArticleContentScrollable.onscroll = (e) => { - if(e.target.scrollTop > Number.parseFloat($('.newsArticleSpacerTop').css('height'))){ - newsContent.setAttribute('scrolled', '') - } else { - newsContent.removeAttribute('scrolled') - } -} +// newsArticleContentScrollable.onscroll = (e) => { +// if(e.target.scrollTop > Number.parseFloat($('.newsArticleSpacerTop').css('height'))){ +// newsContent.setAttribute('scrolled', '') +// } else { +// newsContent.removeAttribute('scrolled') +// } +// } /** * Reload the news without restarting. @@ -939,107 +939,107 @@ function showNewsAlert(){ * @returns {Promise.} A promise which resolves when the news * content has finished loading and transitioning. */ -function initNews(){ +// function initNews(){ - return new Promise((resolve, reject) => { - setNewsLoading(true) +// return new Promise((resolve, reject) => { +// setNewsLoading(true) - let news = {} - loadNews().then(news => { +// let news = {} +// loadNews().then(news => { - newsArr = news.articles || null +// newsArr = news.articles || null - if(newsArr == null){ - // News Loading Failed - setNewsLoading(false) +// if(newsArr == null){ +// // News Loading Failed +// setNewsLoading(false) - $('#newsErrorLoading').fadeOut(250, () => { - $('#newsErrorFailed').fadeIn(250, () => { - resolve() - }) - }) - } else if(newsArr.length === 0) { - // No News Articles - setNewsLoading(false) +// $('#newsErrorLoading').fadeOut(250, () => { +// $('#newsErrorFailed').fadeIn(250, () => { +// resolve() +// }) +// }) +// } else if(newsArr.length === 0) { +// // No News Articles +// setNewsLoading(false) - ConfigManager.setNewsCache({ - date: null, - content: null, - dismissed: false - }) - ConfigManager.save() +// ConfigManager.setNewsCache({ +// date: null, +// content: null, +// dismissed: false +// }) +// ConfigManager.save() - $('#newsErrorLoading').fadeOut(250, () => { - $('#newsErrorNone').fadeIn(250, () => { - resolve() - }) - }) - } else { - // Success - setNewsLoading(false) +// $('#newsErrorLoading').fadeOut(250, () => { +// $('#newsErrorNone').fadeIn(250, () => { +// resolve() +// }) +// }) +// } else { +// // Success +// setNewsLoading(false) - const lN = newsArr[0] - const cached = ConfigManager.getNewsCache() - let newHash = crypto.createHash('sha1').update(lN.content).digest('hex') - let newDate = new Date(lN.date) - let isNew = false +// const lN = newsArr[0] +// const cached = ConfigManager.getNewsCache() +// let newHash = crypto.createHash('sha1').update(lN.content).digest('hex') +// let newDate = new Date(lN.date) +// let isNew = false - if(cached.date != null && cached.content != null){ +// if(cached.date != null && cached.content != null){ - if(new Date(cached.date) >= newDate){ +// if(new Date(cached.date) >= newDate){ - // Compare Content - if(cached.content !== newHash){ - isNew = true - showNewsAlert() - } else { - if(!cached.dismissed){ - isNew = true - showNewsAlert() - } - } +// // Compare Content +// if(cached.content !== newHash){ +// isNew = true +// showNewsAlert() +// } else { +// if(!cached.dismissed){ +// isNew = true +// showNewsAlert() +// } +// } - } else { - isNew = true - showNewsAlert() - } +// } else { +// isNew = true +// showNewsAlert() +// } - } else { - isNew = true - showNewsAlert() - } +// } else { +// isNew = true +// showNewsAlert() +// } - if(isNew){ - ConfigManager.setNewsCache({ - date: newDate.getTime(), - content: newHash, - dismissed: false - }) - ConfigManager.save() - } +// if(isNew){ +// ConfigManager.setNewsCache({ +// date: newDate.getTime(), +// content: newHash, +// dismissed: false +// }) +// ConfigManager.save() +// } - const switchHandler = (forward) => { - let cArt = parseInt(newsContent.getAttribute('article')) - let nxtArt = forward ? (cArt >= newsArr.length-1 ? 0 : cArt + 1) : (cArt <= 0 ? newsArr.length-1 : cArt - 1) +// const switchHandler = (forward) => { +// let cArt = parseInt(newsContent.getAttribute('article')) +// let nxtArt = forward ? (cArt >= newsArr.length-1 ? 0 : cArt + 1) : (cArt <= 0 ? newsArr.length-1 : cArt - 1) - displayArticle(newsArr[nxtArt], nxtArt+1) - } +// displayArticle(newsArr[nxtArt], nxtArt+1) +// } - document.getElementById('newsNavigateRight').onclick = () => { switchHandler(true) } - document.getElementById('newsNavigateLeft').onclick = () => { switchHandler(false) } +// document.getElementById('newsNavigateRight').onclick = () => { switchHandler(true) } +// document.getElementById('newsNavigateLeft').onclick = () => { switchHandler(false) } - $('#newsErrorContainer').fadeOut(250, () => { - displayArticle(newsArr[0], 1) - $('#newsContent').fadeIn(250, () => { - resolve() - }) - }) - } +// $('#newsErrorContainer').fadeOut(250, () => { +// displayArticle(newsArr[0], 1) +// $('#newsContent').fadeIn(250, () => { +// resolve() +// }) +// }) +// } - }) +// }) - }) -} +// }) +// } /** * Add keyboard controls to the news UI. Left and right arrows toggle diff --git a/app/assets/js/scripts/uibinder.js b/app/assets/js/scripts/uibinder.js index 16354a8..237c430 100644 --- a/app/assets/js/scripts/uibinder.js +++ b/app/assets/js/scripts/uibinder.js @@ -107,9 +107,9 @@ function showMainUI(data){ }, 750) // Disable tabbing to the news container. - initNews().then(() => { - $('#newsContainer *').attr('tabindex', '-1') - }) + // initNews().then(() => { + // $('#newsContainer *').attr('tabindex', '-1') + // }) } function showFatalStartupError(){