Files
WebGateway-Download/html/download.html

122 lines
4.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<title>Peernet Download file</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<section class="ftco-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-10">
<div class="wrap d-md-flex">
<div class="text-wrap p-4 p-lg-5 text-center d-flex align-items-center order-md-last">
<div class="text w-100">
<h2 class="Peernetblue">Download this file from Peernet</h2>
<a href="#" style="color:#3ac4e2" id="Download">Download from the browser</a>
<br>
<br>
<a href="https://peernet.org" class="btn btn-white btn-outline-white">Instantly stream it with the Peernet Browser</a>
</div>
</div>
<div class="login-wrap p-4 p-lg-5">
<div class="d-flex">
<div class="w-100">
<h3 class="mb-4">File information</h3>
</div>
<div class="w-100">
</div>
</div>
<form action="#" class="signin-form">
<div class="form-group mb-3">
<label class="label" for="name">File Name:</label>
<p id="FileName">Test.txt</p>
</div>
<div class="form-group mb-3">
<label class="label" for="name">File Size:</label>
<p id="FileSize">15 Mb</p>
</div>
<div class="form-group mb-3">
<label class="label" for="name">File Hash:</label>
<p id="FileHash">blablablablabla</p>
</div>
<!-- <div class="form-group mb-3">
<label class="label" for="password">Password</label>
<input type="password" class="form-control" placeholder="Password" required>
</div><div class="form-group mb-3">
<label class="label" for="name">File Name:</label>
<p>Test.txt</p>
</div> -->
</div>
<div class="form-group d-md-flex">
<!-- <div class="w-50 text-left">
<label class="checkbox-wrap checkbox-primary mb-0">Remember Me
<input type="checkbox" checked>
<span class="checkmark"></span>
</label>
</div>
<div class="w-50 text-md-right">
<a href="#">Forgot Password</a>
</div> -->
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/popper.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/main.js"></script>
<script>
// call a certain api and parse JSON and populate the
// the data in the HTML page
var FileSize = document.getElementById('FileSize');
var FileHash = document.getElementById('FileHash');
var Download = document.getElementById('Download');
var FileName = document.getElementById('FileName');
var promise1 = new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest(),
method = "GET",
url = window.location + "&metadata=true";
xhr.open(method, url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
console.log(xhr.responseText)
resolve(JSON.parse(xhr.responseText));
}
};
xhr.send();
});
promise1.then(function(value) {
FileSize.innerText = value.Size + " Bytes";
FileHash.innerText = value.Hash;
Download.href = window.location + "&download=true"
FileName.innerText = value.Name
});
</script>
</body>
</html>