v0.0.1-alpha.5

Added tooltip UI which shows the status of each Mojang service.
Updated dependencies.
This commit is contained in:
Daniel Scalzi 2018-05-17 03:11:44 -04:00
parent f5f5b72bed
commit ba916aa953
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9
6 changed files with 181 additions and 45 deletions

View File

@ -1495,6 +1495,13 @@ p {
margin-left: 10px; margin-left: 10px;
} }
/* Wrapper container for the mojang status bar. */
#mojangStatusWrapper {
position: relative;
display: flex;
cursor: pointer;
}
/* Icon which displays the status of the mojang services. */ /* Icon which displays the status of the mojang services. */
#mojang_status_icon { #mojang_status_icon {
font-size: 30px; font-size: 30px;
@ -1502,6 +1509,94 @@ p {
margin-left: 15px; margin-left: 15px;
} }
/* Tooltip which displays more details about the mojang statuses. */
#mojangStatusTooltip {
position: absolute;
visibility: hidden;
opacity: 0;
width: 145px;
min-height: 150px;
background-color: rgba(0, 0, 0, 0.75);
color: #fff;
border-radius: 4px;
padding: 5px 10px;
z-index: 1;
font-family: 'Avenir Medium';
font-size: 12px;
transition: visibility 0s linear 0.25s, opacity 0.25s ease;
bottom: calc(100% + 15px);
transform: translateX(-50%);
margin-left: 50%;
box-shadow: 0px 0px 20px rgb(0, 0, 0);
cursor: default;
}
#mojangStatusTooltip:after {
content: " ";
position: absolute;
left: 50%;
top: 100%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: rgba(0, 0, 0, 0.75) transparent transparent transparent;
}
#mojangStatusWrapper:hover #mojangStatusTooltip {
visibility: visible;
opacity: 1;
transition-delay: 0s;
}
/* Tooltip title for the mojang statuses. */
#mojangStatusTooltipTitle {
width: 100%;
text-align: center;
margin-bottom: 5px;
letter-spacing: 1px;
}
/* Wrapper container for the non essential services title. */
#mojangStatusNEContainer {
display: flex;
align-items: center;
margin: 10px 0px;
}
/* White bar which surrounds the non essential service title. */
.mojangStatusNEBar {
height: 1px;
width: 100%;
background: white;
}
/* Non essential service title text. */
#mojangStatusNETitle {
font-size: 10px;
padding: 0px 3px;
text-align: center;
letter-spacing: 1px;
}
/* Wrapper container for mojang service information. */
.mojangStatusContainer {
display: flex;
}
/* Displays the name of the mojang service. */
.mojangStatusName {
width: 100%;
font-size: 10px;
letter-spacing: 1px;
line-height: 12px;
padding: 6px 0px;
}
/* Displays the status of the mojang service. */
.mojangStatusIcon {
margin-right: 10px;
font-size: 18.5px;
color: #848484;
}
/* * * /* * *
* Landing View (Bottom Styles) | Center Content * Landing View (Bottom Styles) | Center Content
* * */ * * */

View File

@ -16,34 +16,40 @@ const minecraftAgent = {
const authpath = 'https://authserver.mojang.com' const authpath = 'https://authserver.mojang.com'
const statuses = [ const statuses = [
{ {
service: 'minecraft.net', service: 'sessionserver.mojang.com',
status: 'grey', status: 'grey',
name: 'Minecraft.net' name: 'Multiplayer Session Service',
}, essential: true
{
service: 'api.mojang.com',
status: 'grey',
name: 'Public API'
},
{
service: 'textures.minecraft.net',
status: 'grey',
name: 'Minecraft Skins'
}, },
{ {
service: 'authserver.mojang.com', service: 'authserver.mojang.com',
status: 'grey', status: 'grey',
name: 'Authentication Service' name: 'Authentication Service',
essential: true
}, },
{ {
service: 'sessionserver.mojang.com', service: 'textures.minecraft.net',
status: 'grey', status: 'grey',
name: 'Multiplayer Session Service' name: 'Minecraft Skins',
essential: false
},
{
service: 'api.mojang.com',
status: 'grey',
name: 'Public API',
essential: false
},
{
service: 'minecraft.net',
status: 'grey',
name: 'Minecraft.net',
essential: false
}, },
{ {
service: 'account.mojang.com', service: 'account.mojang.com',
status: 'grey', status: 'grey',
name: 'Mojang accounts website' name: 'Mojang Accounts Website',
essential: false
} }
] ]

View File

@ -141,27 +141,52 @@ server_selection_button.addEventListener('click', (e) => {
// Update Mojang Status Color // Update Mojang Status Color
const refreshMojangStatuses = async function(){ const refreshMojangStatuses = async function(){
console.log('Refreshing Mojang Statuses..') console.log('Refreshing Mojang Statuses..')
let status = 'grey' let status = 'grey'
let tooltipEssentialHTML = ``
let tooltipNonEssentialHTML = ``
try { try {
const statuses = await Mojang.status() const statuses = await Mojang.status()
greenCount = 0 greenCount = 0
for(let i=0; i<statuses.length; i++){ for(let i=0; i<statuses.length; i++){
if(statuses[i].status === 'yellow' && status !== 'red'){ const service = statuses[i]
if(service.essential){
tooltipEssentialHTML += `<div class="mojangStatusContainer">
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">&#8226;</span>
<span class="mojangStatusName">${service.name}</span>
</div>`
} else {
tooltipNonEssentialHTML += `<div class="mojangStatusContainer">
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">&#8226;</span>
<span class="mojangStatusName">${service.name}</span>
</div>`
}
if(service.status === 'yellow' && status !== 'red'){
status = 'yellow' status = 'yellow'
continue continue
} else if(statuses[i].status === 'red'){ } else if(service.status === 'red'){
status = 'red' status = 'red'
break break
} }
++greenCount ++greenCount
} }
if(greenCount == statuses.length){ if(greenCount == statuses.length){
status = 'green' status = 'green'
} }
} catch (err) { } catch (err) {
console.warn('Unable to refresh Mojang service status.') console.warn('Unable to refresh Mojang service status.')
console.debug(err) console.debug(err)
} }
document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
document.getElementById('mojang_status_icon').style.color = Mojang.statusToHex(status) document.getElementById('mojang_status_icon').style.color = Mojang.statusToHex(status)
} }

View File

@ -97,8 +97,24 @@
<span id="player_count">OFFLINE</span> <span id="player_count">OFFLINE</span>
</div> </div>
<div class="bot_divider"></div> <div class="bot_divider"></div>
<div id="mojangStatusWrapper">
<span class="bot_label">MOJANG STATUS</span> <span class="bot_label">MOJANG STATUS</span>
<span id="mojang_status_icon">&#8226;</span> <span id="mojang_status_icon">&#8226;</span>
<div id="mojangStatusTooltip">
<div id="mojangStatusTooltipTitle">Services</div>
<div id="mojangStatusEssentialContainer">
<!-- Essential Mojang services are populated here. -->
</div>
<div id="mojangStatusNEContainer">
<div class="mojangStatusNEBar"></div>
<div id="mojangStatusNETitle">Non&nbsp;Essential</div>
<div class="mojangStatusNEBar"></div>
</div>
<div id="mojangStatusNonEssentialContainer">
<!-- Non Essential Mojang services are populated here. -->
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

38
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "westeroscraftlauncher", "name": "westeroscraftlauncher",
"version": "0.0.1-alpha.4", "version": "0.0.1-alpha.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -37,9 +37,9 @@
"optional": true "optional": true
}, },
"@types/node": { "@types/node": {
"version": "8.10.11", "version": "8.10.15",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.11.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.15.tgz",
"integrity": "sha512-FM7tvbjbn2BUzM/Qsdk9LUGq3zeh7li8NcHoS398dBzqLzfmSqSP1+yKbMRTCcZzLcu2JAR5lq3IKIEYkto7iQ==", "integrity": "sha512-qNb+m5Cuj6YUMK7YFcvuSgcHCKfVg1uXAUOP91SWvAakZlZTzbGmJaBi99CgDWEAyfZo51NlUhXkuP5WtXsgjg==",
"dev": true "dev": true
}, },
"adm-zip": { "adm-zip": {
@ -846,9 +846,9 @@
} }
}, },
"electron": { "electron": {
"version": "2.0.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-2.0.0.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-2.0.1.tgz",
"integrity": "sha512-FCcVzHgoBmNTPUEhKN7yUxjluCRNAQsHNOfdtFEWKL3DPYEdLdyQW8CpmJEMqIXha5qZ+qdKVAtwvvuJs+b/PQ==", "integrity": "sha512-piSwY2P7L6NWx672MNdSvtGPdQP/mhwAg8ICN6ofTTItPkd7D6kNHBPkq+DXwZcXVH1EifYR9yD/l3Xw1haVpQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "^8.0.24", "@types/node": "^8.0.24",
@ -1425,9 +1425,9 @@
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
}, },
"home-path": { "home-path": {
"version": "1.0.5", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.5.tgz", "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz",
"integrity": "sha1-eIspgVsS1Tus9XVkhHbm+QQdEz8=", "integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==",
"dev": true "dev": true
}, },
"hosted-git-info": { "hosted-git-info": {
@ -2195,9 +2195,9 @@
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
}, },
"qs": { "qs": {
"version": "6.5.1", "version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}, },
"rc": { "rc": {
"version": "1.2.7", "version": "1.2.7",
@ -2320,9 +2320,9 @@
} }
}, },
"request": { "request": {
"version": "2.85.0", "version": "2.86.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.86.0.tgz",
"integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "integrity": "sha512-BQZih67o9r+Ys94tcIW4S7Uu8pthjrQVxhsZ/weOwHbDfACxvIyvnAbzFQxjy1jMtvFSzv5zf4my6cZsJBbVzw==",
"requires": { "requires": {
"aws-sign2": "~0.7.0", "aws-sign2": "~0.7.0",
"aws4": "^1.6.0", "aws4": "^1.6.0",
@ -2342,7 +2342,6 @@
"performance-now": "^2.1.0", "performance-now": "^2.1.0",
"qs": "~6.5.1", "qs": "~6.5.1",
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"stringstream": "~0.0.5",
"tough-cookie": "~2.3.3", "tough-cookie": "~2.3.3",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.1.0" "uuid": "^3.1.0"
@ -2551,11 +2550,6 @@
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true "dev": true
}, },
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="
},
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "westeroscraftlauncher", "name": "westeroscraftlauncher",
"version": "0.0.1-alpha.4", "version": "0.0.1-alpha.5",
"description": "Custom modded launcher for Westeroscraft", "description": "Custom modded launcher for Westeroscraft",
"productName": "WesterosCraft Launcher", "productName": "WesterosCraft Launcher",
"main": "index.js", "main": "index.js",
@ -37,14 +37,14 @@
"electron-updater": "^2.21.10", "electron-updater": "^2.21.10",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"request": "^2.85.0", "request": "^2.86.0",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"tar-fs": "^1.16.2", "tar-fs": "^1.16.2",
"uuid": "^3.2.1", "uuid": "^3.2.1",
"winreg": "^1.2.4" "winreg": "^1.2.4"
}, },
"devDependencies": { "devDependencies": {
"electron": "^2.0.0", "electron": "^2.0.1",
"electron-builder": "^20.13.5" "electron-builder": "^20.13.5"
}, },
"build": { "build": {