2017-05-25 07:50:02 +02:00
|
|
|
<!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>
|
2017-05-26 10:25:07 +02:00
|
|
|
<div id="image">
|
|
|
|
<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>
|
2017-05-25 07:50:02 +02:00
|
|
|
<script src="/socket.io/socket.io.js"></script>
|
|
|
|
<script>
|
|
|
|
var socket = io();
|
2017-05-26 10:58:00 +02:00
|
|
|
var url = document.URL.substring(document.URL.indexOf('spee.ch/') + 5);
|
2017-05-26 10:25:07 +02:00
|
|
|
// request the claim through the socket
|
2017-05-26 09:34:25 +02:00
|
|
|
socket.emit("claim-request", url);
|
2017-05-26 10:25:07 +02:00
|
|
|
// listen for updates
|
2017-05-26 09:34:25 +02:00
|
|
|
socket.on("claim-update", function(data){
|
2017-05-25 09:59:22 +02:00
|
|
|
console.log("data:", data);
|
|
|
|
document.getElementById("status").innerHTML = data;
|
|
|
|
})
|
2017-05-26 10:25:07 +02:00
|
|
|
// receive the claim through the socket
|
2017-05-26 09:34:25 +02:00
|
|
|
socket.on("claim-send", function(data){
|
2017-05-25 09:59:22 +02:00
|
|
|
if (data.image) {
|
|
|
|
var base64Image = 'data:image/jpeg;base64,' + data.buffer;
|
|
|
|
document.getElementById("image").innerHTML = '<img src="' + base64Image + '"/>';
|
|
|
|
}
|
2017-05-25 07:50:02 +02:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
2017-05-26 10:58:00 +02:00
|
|
|
</html>
|