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;
if (textures || session && skins) {
error = "both";
error = "all";
} else if (skins) {
error = "name";
error = "username";
} 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);
xhr.send();
document.addEventListener("DOMContentLoaded", function(event) {
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 name="twitter:card" content="summary">
<meta name="twitter:creator" content="@Crafatar">
<script src="/javascript/mojang.js"></script>
</head>
<body>
@ -53,11 +54,13 @@
</div>
<div class="container">
<section id="documentation">
<div class="alert alert-danger" role="alert">
<h5>Usernames are deprecated!</h5>
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>
<i>We strongly advise you to use UUIDs instead of usernames.</i> <small><a href="#usernames">more info</a></small>
<div id="alerts">
<div class="alert alert-danger" role="alert">
<h5>Usernames are deprecated!</h5>
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>
<i>We strongly advise you to use UUIDs instead of usernames.</i> <small><a href="#usernames">more info</a></small>
</div>
</div>
<h2>Documentation</h2>