1
0
mirror of https://github.com/kirsle/kirsle.net synced 2024-11-14 21:09:28 +00:00
kirsle.net/www/download.gohtml

50 lines
1.5 KiB
Plaintext
Raw Normal View History

2017-12-23 02:36:07 +00:00
{{ define "title" }}Download{{ end }}
{{ define "content" }}
2017-12-02 23:02:02 +00:00
2017-12-23 02:36:07 +00:00
{{ $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>
2014-04-09 21:56:29 +00:00
2017-12-23 02:36:07 +00:00
You are about to download the file <strong>{{ $file }}</strong> from the
project <strong>{{ $project }}</strong>. <!-- This file has been downloaded
0 time(s). -->
2014-04-09 21:56:29 +00:00
2015-08-12 00:18:25 +00:00
<h1>Download</h1>
2014-04-09 21:56:29 +00:00
2015-08-12 00:18:25 +00:00
To continue your download, click on the button below.
<br><br><br>
2014-04-09 21:56:29 +00:00
2015-08-12 00:18:25 +00:00
<form name="download" action="/download" method="POST">
2017-12-23 02:36:07 +00:00
<input type="hidden" name="_csrf" value="{{ .CSRF }}">
2015-08-12 00:18:25 +00:00
<input type="hidden" name="method" value="get">
2017-12-23 02:36:07 +00:00
<input type="hidden" name="project" value="{{ $project }}">
<input type="hidden" name="file" value="{{ $file }}">
2014-04-09 21:56:29 +00:00
2015-08-12 00:18:25 +00:00
<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>
2017-12-23 02:36:07 +00:00
{{ else if eq $method "get" }}
2015-08-12 00:18:25 +00:00
<h1>Downloading File...</h1>
2014-04-09 21:56:29 +00:00
2017-12-23 02:36:07 +00:00
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 }}