Add error page

This commit is contained in:
Aadi Desai 2023-11-13 00:34:58 +00:00
parent 3bf3f8f12c
commit 5c81502a50
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
2 changed files with 79 additions and 0 deletions

46
error.html Normal file
View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UDlink Docs</title>
<meta property="og:title" content="UDlink Docs" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.udl.ink/" />
<meta property="og:image" content="https://docs.udl.ink/img/udlinklogo.png" />
<meta property="og:image:alt" content="UDlink Logo" />
<meta property="og:description"
content="Readable URLs for Unstoppable Domains IPFS sites, usable on any site or browser!" />
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_GB" />
<meta property="og:site_name" content="UDlink" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@udlinkofficial" />
<meta name="twitter:creator" content="@supleed2" />
<link rel="stylesheet" href="styles.css">
<script defer type="text/javascript" src="error.js"></script>
<script>const BADGE_ID = "8264ad6e254ec18a";</script>
<script type="text/javascript" src="https://static.alchemyapi.io/scripts/badge/alchemy-badge.js"></script>
</head>
<body>
<div class="banner-image">
<img src="img/udl.ink.svg" alt="UDlink Banner">
</div>
<div class="options-description">
<p>Hi! Something went wrong, here's some more information:</p>
<p id="error-info"></p>
</div>
<br>
<a href="#">
<picture>
<source srcset="https://static.alchemyapi.io/images/marketing/badgeLight.png"
media="(prefers-color-scheme: light)" />
<img onclick=logBadgeClick() id="badge-button" style="width:240px;height:53px"
src="https://static.alchemyapi.io/images/marketing/badge.png" alt="Alchemy Supercharged" />
</picture>
</a>
</body>
</html>

33
error.js Normal file
View file

@ -0,0 +1,33 @@
const info = document.getElementById("error-info");
const urlParams = new URLSearchParams(window.location.search);
const error = urlParams.get("e") || undefined;
if (error === undefined) {
window.location.replace("https://docs.udl.ink/");
} else {
if (error == "tokenid") {
const domain = urlParams.get("domain");
info.innerHTML =
`The Unstoppable Domains API did not return a token ID<br>
for that domain: ${domain}. You might want to search for the domain<br>
directly on Etherscan / Opensea / Polygonscan.`;
} else if (error == "gateway") {
const gateway = urlParams.get("gateway");
info.innerHTML =
`Invalid IPFS Gateway selected for redirect: ${gateway}<br>
Check available gateways on <a href="https://docs.udl.ink/">the homepage</a>.`;
} else if (error == "tld") {
const domain = urlParams.get("domain");
info.innerHTML =
`Invalid Unstoppable Domains TLD, requested domain: ${domain}<br>
Check the domain and try again.`;
} else if (error == "nohash") {
const domain = urlParams.get("domain");
info.innerHTML =
`No linked IPFS hash for the requested domain: ${domain}<br>
Check the domain or the Unstoppabe Dashboard and try again.`;
} else {
info.innerHTML =
`Sorry, we're not sure what happened, please try again.`;
}
}