...
 
Commits (3)
......@@ -30,6 +30,9 @@ function to_hex(input) {
const setupForm = document.getElementById('setupForm')
const changeButton = document.getElementById('change')
const indeterminateProgressIndicator = document.getElementById('indeterminateProgressIndicator')
const generatedTextField = document.getElementById('generated')
const hypercoreContentsTextArea = document.getElementById('hypercoreContents')
const publicSigningKeyTextField = document.getElementById('publicSigningKey')
const privateSigningKeyTextArea = document.getElementById('privateSigningKey')
const publicEncryptionKeyTextField = document.getElementById('publicEncryptionKey')
......@@ -96,25 +99,37 @@ function generateKeys() {
valueEncoding: 'json',
secretKey: hypercoreWriteKey,
storeSecretKey: false,
onwrite: (index, data, peer, cb) => {
onwrite: (index, data, peer, next) => {
console.log(`Feed: [onWrite] index = ${index}, peer = ${peer}, data:`)
console.log(data)
cb()
next()
}
})
feed.on('ready', () => {
console.log('Feed: [Ready]')
console.log(`Feed writeable? ${feed.writable}`)
generatedTextField.value = 'Yes'
if (!feed.writable) {
generatedTextField.value = 'Yes (warning: but feed is not writable)'
return
}
// Create a read stream
const stream = feed.createReadStream({live:true})
stream.on('data', x => console.log(x))
stream.on('data', (data) => {
// New data is available on the feed. Display it on the page.
for (let [key, value] of Object.entries(data)) {
hypercoreContentsTextArea.value += `${key}: ${value}\n`
}
})
//
// TEST
//
const NUMBER_TO_APPEND = 1
const NUMBER_TO_APPEND = 3
let counter = 0
Date.prototype.getUnixTime = function() { return this.getTime()/1000|0 };
......
......@@ -14,15 +14,18 @@
<fieldset>
<legend>Public details</legend>
<div>
<label for='domain'>Domain name:</label>
<input type='text' id='domain' value='ar.al' readonly>
</div>
<div>
<label for='publicSigningKey'>Hyphalink:</label>
<input type='text' id='publicSigningKey'>
</div>
<div>
</div>
<div>
<label>Passphrase:</label>
<input type='text' id='passphrase' readonly>
<div style='position: relative;'>
......@@ -38,6 +41,16 @@
</div>
</div>
<div>
<label for='generated'>Hypercore created?</label>
<input type='text' id='generated' value='No'>
</div>
<div>
<label for='hypercoreContents'>Hypercore contents</label>
<textarea id='hypercoreContents'></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>
......
......@@ -45,6 +45,11 @@ fieldset > div {
margin-bottom: 0.25em;
}
label {
/* Vertically-centre the labels */
margin: auto 0;
}
form h3 {
margin-top: 1.5em;
margin-bottom: 0;
......@@ -68,7 +73,11 @@ input, textarea {
}
textarea {
height: 2.5em;
height: 3em;
}
#hypercoreContents {
height: 6em;
}
footer {
......