Ind.ie is now Small Technology Foundation.
Commit 351f8f57 authored by Aral Balkan's avatar Aral Balkan

Display errors on page, not just in console

parent 919565fe
......@@ -32,12 +32,16 @@ const changeButton = document.getElementById('change')
const indeterminateProgressIndicator = document.getElementById('indeterminateProgressIndicator')
const generatedTextField = document.getElementById('generated')
const hypercoreContentsTextArea = document.getElementById('hypercoreContents')
const errorsTextArea = document.getElementById('errors')
const publicSigningKeyTextField = document.getElementById('publicSigningKey')
const privateSigningKeyTextArea = document.getElementById('privateSigningKey')
const publicEncryptionKeyTextField = document.getElementById('publicEncryptionKey')
const privateEncryptionKeyTextField = document.getElementById('privateEncryptionKey')
function logError(error) {
errorsTextArea.value += error
}
function generatePassphrase () {
const passphrase = generateEFFDicewarePassphrase.entropy(100)
setupForm.elements.passphrase.value = passphrase.join(' ')
......@@ -74,7 +78,10 @@ function generateKeys() {
hideProgressIndicator()
if (error) { alert(error); return }
if (error) {
logError(error.message)
return
}
// Close the existing feed, if one exists.
if (feed !== null) { feed.close() }
......@@ -157,14 +164,18 @@ function generateKeys() {
obj[key] = value
feed.append(obj, (error, sequence) => {
console.log('Append callback')
console.log('Error', error)
console.log('Sequence', sequence)
if (error) {
logError(error)
return
}
console.log(' Sequence', sequence)
})
}, 1000)
})
feed.on('error', (error) => {
console.log(`Feed [Error] ${error}`)
logError(error)
})
feed.on('download', (index, data) => {
......
......@@ -51,6 +51,11 @@
<textarea id='hypercoreContents'></textarea>
</div>
<div>
<label for='errors'>Errors</label>
<textarea id='errors'>None</textarea>
</div>
<h3>Notes</h3>
<p>Your domain name and <em>hyphalink</em> are two ways for other people to find your Hypha. The difference is that your hyphalink is decentralised and resilient to censorship. If your domain registrar confiscates or blocks your domain, people will still be able to reach your Hypha as long as there is at least one replica of it on the Internet.</p>
......
......@@ -76,7 +76,7 @@ textarea {
height: 3em;
}
#hypercoreContents {
#hypercoreContents, #errors {
height: 6em;
}
......
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