The web design and pages for my personal website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB

{{ define "title" }}Download{{ end }}
{{ define "content" }}
{{ $method := or (.Request.FormValue "method") "index" }}
{{ $project := .Request.FormValue "project" }}
{{ $file := .Request.FormValue "file" }}
{{ if eq $project "" }}
<h1>An error has occurred</h1>
{{ else if eq $method "index" }}
<h1>Project {{ $project }}</h1>
8 years ago
You are about to download the file <strong>{{ $file }}</strong> from the
project <strong>{{ $project }}</strong>. <!-- This file has been downloaded
0 time(s). -->
8 years ago
6 years ago
<h1>Download</h1>
8 years ago
6 years ago
To continue your download, click on the button below.
<br><br><br>
8 years ago
6 years ago
<form name="download" action="/download" method="POST">
<input type="hidden" name="_csrf" value="{{ .CSRF }}">
6 years ago
<input type="hidden" name="method" value="get">
<input type="hidden" name="project" value="{{ $project }}">
<input type="hidden" name="file" value="{{ $file }}">
8 years ago
6 years ago
<span style="background-color: #88AADD; padding: 15px; border-top: 2px solid #006699;
border-left: 2px solid #006699; border-right: 2px solid #AACCFF; border-bottom: 2px solid #AACCFF">
<button type="submit">Download Now</button>
</span>
</form>
{{ else if eq $method "get" }}
6 years ago
<h1>Downloading File...</h1>
8 years ago
Your download of <strong>{{ $file }}</strong> will begin shortly. If it doesn't,
<a href="/projects/{{ $project }}/{{ $file }}">download it directly</a>.
<script type="text/javascript">
(function() {
setTimeout(function() {
window.location.href = "/projects/{{ $project }}/{{ $file }}";
}, 2000);
})();
</script>
{{ else }}
<h1>An error has occurred.</h1>
{{ end}}
{{ end }}