fixed meta generation
This commit is contained in:
parent
052a4742cf
commit
a24a07140d
@ -31,7 +31,9 @@ Contents:
|
|||||||
<br>
|
<br>
|
||||||
<h2>Output</h2>
|
<h2>Output</h2>
|
||||||
<br>
|
<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>
|
<br><br>
|
||||||
<textarea id="output" cols="75" rows="50" readonly></textarea>
|
<textarea id="output" cols="75" rows="50" readonly></textarea>
|
||||||
</body>
|
</body>
|
||||||
|
16
main.js
16
main.js
@ -9,10 +9,12 @@ function getEpoch(){
|
|||||||
document.getElementById('generate').onclick = function(){
|
document.getElementById('generate').onclick = function(){
|
||||||
document.getElementById('generate').setAttribute("disabled", true)
|
document.getElementById('generate').setAttribute("disabled", true)
|
||||||
document.getElementById('output').value = "computing..."
|
document.getElementById('output').value = "computing..."
|
||||||
|
document.getElementById('timeResult').value = ""
|
||||||
|
document.getElementById('hashResult').value = ""
|
||||||
var metadata = {
|
var metadata = {
|
||||||
"meta": {
|
"meta": JSON.stringify({
|
||||||
"type": document.getElementById("type").value
|
"type": document.getElementById("type").value
|
||||||
},
|
}),
|
||||||
"time": getEpoch()
|
"time": getEpoch()
|
||||||
}
|
}
|
||||||
// todo web workers
|
// todo web workers
|
||||||
@ -31,7 +33,13 @@ document.getElementById('generate').onclick = function(){
|
|||||||
worker.addEventListener('message', function(e) {
|
worker.addEventListener('message', function(e) {
|
||||||
var finishTime = getEpoch() - startTime
|
var finishTime = getEpoch() - startTime
|
||||||
document.getElementById('generate').removeAttribute("disabled")
|
document.getElementById('generate').removeAttribute("disabled")
|
||||||
|
document.getElementById('hashResult').value = doHashHex(e.data)
|
||||||
document.getElementById('timeResult').value = finishTime + "s"
|
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…
Reference in New Issue
Block a user