spee.ch/public/claim.html
2017-05-26 00:34:25 -07:00

37 lines
No EOL
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch Claim</title>
</head>
<body>
<h1>spee.ch</h1>
<p>spee.ch is a single-serving site that reads and publishes images to and from the <a href="https://lbry.io">LBRY</a> blockchain.</p>
<h3>Status:</h3>
<p id="status">your image is being retrieved</p>
<div id="image"></div>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
console.log(document.URL)
var url = document.URL.substring(document.URL.indexOf('3000/') + 5); // get from the window?
// request the image through the socket
socket.emit("claim-request", url);
socket.on("claim-update", function(data){
console.log("data:", data);
document.getElementById("status").innerHTML = data;
})
// receive the image through the socket
socket.on("claim-send", function(data){
if (data.image) {
var base64Image = 'data:image/jpeg;base64,' + data.buffer;
document.getElementById("image").innerHTML = '<img src="' + base64Image + '"/>';
}
})
</script>
</body>
</html>