detect & show mojang issues

This commit is contained in:
jomo 2015-10-15 01:32:32 +02:00
parent f69eb85c58
commit 882b0753bc
2 changed files with 22 additions and 11 deletions

View File

@ -14,15 +14,23 @@ xhr.onload = function() {
var error = null; var error = null;
if (textures || session && skins) { if (textures || session && skins) {
error = "both"; error = "all";
} else if (skins) { } else if (skins) {
error = "name"; error = "username";
} else if (session) { } else if (session) {
error = "uuid"; error = "UUID";
} }
console.log(error); if (error) {
var warn = document.createElement("div");
warn.setAttribute("class", "alert alert-warning");
warn.setAttribute("role", "alert");
warn.innerHTML = "<h5>Mojang issues</h5> Mojang's servers are having trouble <i>right now</i>, this affects <b>" + error + "</b> requests at Crafatar. <small><a href=\"https://help.mojang.com\" target=\"_blank\">check status</a>";
document.querySelector("#alerts").appendChild(warn);
}
}; };
xhr.open("GET", "https://status.mojang.com/check", true); document.addEventListener("DOMContentLoaded", function(event) {
xhr.send(); xhr.open("GET", "https://status.mojang.com/check", true);
xhr.send();
});

View File

@ -17,6 +17,7 @@
<meta property="og:description" content="A blazing fast Minecraft avatar API with support for avatars, skins, and 3D renders."> <meta property="og:description" content="A blazing fast Minecraft avatar API with support for avatars, skins, and 3D renders.">
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@Crafatar"> <meta name="twitter:creator" content="@Crafatar">
<script src="/javascript/mojang.js"></script>
</head> </head>
<body> <body>
@ -53,12 +54,14 @@
</div> </div>
<div class="container"> <div class="container">
<section id="documentation"> <section id="documentation">
<div id="alerts">
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
<h5>Usernames are deprecated!</h5> <h5>Usernames are deprecated!</h5>
You should only use usernames for <i>testing</i>.<br> You should only use usernames for <i>testing</i>.<br>
Updates are slower, some features are not available, and it may <strong>break anytime</strong>!<br> Updates are slower, some features are not available, and it may <strong>break anytime</strong>!<br>
<i>We strongly advise you to use UUIDs instead of usernames.</i> <small><a href="#usernames">more info</a></small> <i>We strongly advise you to use UUIDs instead of usernames.</i> <small><a href="#usernames">more info</a></small>
</div> </div>
</div>
<h2>Documentation</h2> <h2>Documentation</h2>
<div class="row"> <div class="row">