Commit 259ebcb6 authored by sajolida's avatar sajolida

Display different error messages on different failures

It's useful to the user to know a bit more precisely what happened and
what they can try to solve it.
parent 72125fb3
......@@ -172,9 +172,12 @@ document.addEventListener("DOMContentLoaded", function() {
else if (result === "failed-again") {
show(document.getElementById("verification-failed-again"));
}
else if (result === "error") {
showVerifyButton();
show(document.getElementById("verification-error"));
else if (result === "error-json") {
show(document.getElementById("verification-error-json"));
document.getElementById("checksum-file").setAttribute('href', URLofJsonFileContainingChecksums);
}
else if (result === "error-image") {
show(document.getElementById("verification-error-image"));
}
}
......@@ -183,7 +186,8 @@ document.addEventListener("DOMContentLoaded", function() {
hide(document.getElementById("verification-successful"));
hide(document.getElementById("verification-failed"));
hide(document.getElementById("verification-failed-again"));
hide(document.getElementById("verification-error"));
hide(document.getElementById("verification-error-json"));
hide(document.getElementById("verification-error-image"));
show(document.getElementById("verification"));
toggleContinueLink("skip-verification");
}
......@@ -261,12 +265,9 @@ document.addEventListener("DOMContentLoaded", function() {
try {
var response=await fetch(URLofJsonFileContainingChecksums);
var checksumjson=await response.text();
console.log('json file containing checksums for ISO and USB images downloaded from ' + URLofJsonFileContainingChecksums + '.');
//console.log(checksumjson);
//console.log('IDF downloaded from ' + URLofJsonFileContainingChecksums + '.');
} catch(err) {
console.log('json file containing checksums for ISO and USB images could not be downloaded from ' + URLofJsonFileContainingChecksums + '.');
console.error(err);
showVerificationResult("error");
showVerificationResult("error-json");
return;
}
......@@ -277,9 +278,7 @@ document.addEventListener("DOMContentLoaded", function() {
var fileactualchecksum = sha256.digest().toHex();
console.log('checksum of downloaded file: ' + fileactualchecksum);
} catch(err) {
console.log('error reading file and calculating checksum.');
console.error(err);
showVerificationResult("error");
showVerificationResult("error-image");
return;
}
......@@ -291,6 +290,10 @@ document.addEventListener("DOMContentLoaded", function() {
}
}
// Retry after error during verification
document.getElementById("retry-json").onclick = function(e) { resetVerificationResult(); showVerifyButton(); }
document.getElementById("retry-image").onclick = function(e) { resetVerificationResult(); showVerifyButton(); }
/* Final initialization */
// Display floating-toggleable-links to prevent people without JS to
......@@ -348,6 +351,7 @@ document.addEventListener("DOMContentLoaded", function() {
// showVerificationResult("successful");
// showVerificationResult("failed");
// showVerificationResult("failed-again");
// showVerificationResult("error");
// showVerificationResult("error-json");
// showVerificationResult("error-image");
});
......@@ -127,9 +127,15 @@ were solved, and known issues that have already been identified.</p>
</div>
<p>Please try to download again from a different place or a different computer&hellip;</p>
</div>
<div id="verification-error" class="block">
<p>[[!img lib/cross.png class="icon" link="no" alt=""]]<b>Error reading file <em><span class="verify-filename">$FILENAME</span></em>.</b></p>
<div id="verification-error-json" class="block">
<p>[[!img lib/cross.png class="icon" link="no" alt=""]]<b>Error downloading <a id="checksum-file" href="">checksum file</a> from our website.</b></p>
<p>Make sure that your browser is connected to the Internet.</p>
<p><a id="retry-json">Retry&hellip;</a></p>
</div>
<div id="verification-error-image" class="block">
<p>[[!img lib/cross.png class="icon" link="no" alt=""]]<b>Error reading image <em><span class="verify-filename">$FILENAME</span></em>.</b></p>
<p>Make sure that <em><span class="verify-filename">$FILENAME</span></em> is readable by your browser. In Tails, copy it to the <em>Tor Browser</em> folder.</p>
<p><a id="retry-image">Retry&hellip;</a></p>
</div>
</div>
</div>
......
......@@ -16,7 +16,8 @@
#verification-successful,
#verification-failed,
#verification-failed-again,
#verification-error,
#verification-error-json,
#verification-error-image,
#skip-download,
#tails-version,
#try-another-mirror,
......@@ -144,10 +145,14 @@ img.icon {
vertical-align: bottom;
}
#verification-error {
#verification-error-json, #verification-error-image {
margin-top: 1.5em;
}
#retry-json, #retry-image {
cursor: pointer;
}
#continue-link li {
margin-left: 1em;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment