From 3c7d7d79af585fda0395ef8d24b6a974f4d7225f Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Sun, 3 Dec 2017 07:05:13 -0500 Subject: [PATCH] Added mojang functions, most of which are pending testing. Once testing is complete, the external 'mojang' module will be removed. The 'Mojang Status' are on the landing page is now displaying the actual statuses of mojang's services. This will be refreshed once every 5 minutes. Enhancements will be made to the UI of this down the line. --- app/assets/css/launcher.css | 2 +- app/assets/js/actionbinder.js | 37 ++++++ app/assets/js/mojang.js | 219 ++++++++++++++++++++++++++++++++++ 3 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 app/assets/js/mojang.js diff --git a/app/assets/css/launcher.css b/app/assets/css/launcher.css index b4a7ccb..a6a17fb 100644 --- a/app/assets/css/launcher.css +++ b/app/assets/css/launcher.css @@ -375,7 +375,7 @@ p { #mojang_status_icon { font-size: 30px; - color: #a5c325; + color: #848484; margin-left: 15px; } diff --git a/app/assets/js/actionbinder.js b/app/assets/js/actionbinder.js index cc44b05..50a1fca 100644 --- a/app/assets/js/actionbinder.js +++ b/app/assets/js/actionbinder.js @@ -4,7 +4,11 @@ const {AssetGuard} = require(path.join(__dirname, 'assets', 'js', 'assetguard.js const ProcessBuilder = require(path.join(__dirname, 'assets', 'js', 'processbuilder.js')) const ConfigManager = require(path.join(__dirname, 'assets', 'js', 'configmanager.js')) const DiscordWrapper = require(path.join(__dirname, 'assets', 'js', 'discordwrapper.js')) +const mojang2 = require(path.join(__dirname, 'assets', 'js', 'mojang.js')) +let mojangStatusListener + +// Synchronous Listener document.addEventListener('readystatechange', function(){ if (document.readyState === 'interactive'){ @@ -18,6 +22,39 @@ document.addEventListener('readystatechange', function(){ // Bind selected server document.getElementById('server_selection').innerHTML = '\u2022 ' + AssetGuard.getServerById(ConfigManager.getGameDirectory(), ConfigManager.getSelectedServer()).name + + // Update Mojang Status Color + const refreshMojangStatuses = async function(){ + console.log('Refreshing Mojang Statuses..') + try { + let status = 'grey' + const statuses = await mojang2.status() + greenCount = 0 + for(let i=0; i