Browse Source

fixed meta generation

master
Kevin Froman 2 years ago
parent
commit
a24a07140d
  1. 4
      generator.html
  2. 16
      main.js

4
generator.html

@ -31,7 +31,9 @@ Contents:
<br>
<h2>Output</h2>
<br>
<input type="text" id="timeResult" placeholder="Time taken" readonly>
<input type="text" id="timeResult" placeholder="Time taken" readonly> <a id="download" class="button" download>Download</a>
<br><br>
<input id="hashResult" type="text" placeholder="Hash result" readonly>
<br><br>
<textarea id="output" cols="75" rows="50" readonly></textarea>
</body>

16
main.js

@ -9,10 +9,12 @@ function getEpoch(){
document.getElementById('generate').onclick = function(){
document.getElementById('generate').setAttribute("disabled", true)
document.getElementById('output').value = "computing..."
document.getElementById('timeResult').value = ""
document.getElementById('hashResult').value = ""
var metadata = {
"meta": {
"meta": JSON.stringify({
"type": document.getElementById("type").value
},
}),
"time": getEpoch()
}
// todo web workers
@ -31,7 +33,13 @@ document.getElementById('generate').onclick = function(){
worker.addEventListener('message', function(e) {
var finishTime = getEpoch() - startTime
document.getElementById('generate').removeAttribute("disabled")
document.getElementById('hashResult').value = doHashHex(e.data)
document.getElementById('timeResult').value = finishTime + "s"
document.getElementById('output').value = doHashHex(e.data) + "\n"
document.getElementById('output').value += new TextDecoder("utf-8").decode(e.data)
document.getElementById('output').value = new TextDecoder("utf-8").decode(e.data)
let a = document.getElementById('download')
var file = new Blob([e.data], {type: type})
a.href = URL.createObjectURL(file)
a.download = document.getElementById('hashResult').value + ".onionr"
})

Loading…
Cancel
Save