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.5KB

  1. {{ define "title" }}Download{{ end }}
  2. {{ define "content" }}
  3. {{ $method := or (.Request.FormValue "method") "index" }}
  4. {{ $project := .Request.FormValue "project" }}
  5. {{ $file := .Request.FormValue "file" }}
  6. {{ if eq $project "" }}
  7. <h1>An error has occurred</h1>
  8. {{ else if eq $method "index" }}
  9. <h1>Project {{ $project }}</h1>
  10. You are about to download the file <strong>{{ $file }}</strong> from the
  11. project <strong>{{ $project }}</strong>. <!-- This file has been downloaded
  12. 0 time(s). -->
  13. <h1>Download</h1>
  14. To continue your download, click on the button below.
  15. <br><br><br>
  16. <form name="download" action="/download" method="POST">
  17. <input type="hidden" name="_csrf" value="{{ .CSRF }}">
  18. <input type="hidden" name="method" value="get">
  19. <input type="hidden" name="project" value="{{ $project }}">
  20. <input type="hidden" name="file" value="{{ $file }}">
  21. <span style="background-color: #88AADD; padding: 15px; border-top: 2px solid #006699;
  22. border-left: 2px solid #006699; border-right: 2px solid #AACCFF; border-bottom: 2px solid #AACCFF">
  23. <button type="submit">Download Now</button>
  24. </span>
  25. </form>
  26. {{ else if eq $method "get" }}
  27. <h1>Downloading File...</h1>
  28. Your download of <strong>{{ $file }}</strong> will begin shortly. If it doesn't,
  29. <a href="/projects/{{ $project }}/{{ $file }}">download it directly</a>.
  30. <script type="text/javascript">
  31. (function() {
  32. setTimeout(function() {
  33. window.location.href = "/projects/{{ $project }}/{{ $file }}";
  34. }, 2000);
  35. })();
  36. </script>
  37. {{ else }}
  38. <h1>An error has occurred.</h1>
  39. {{ end}}
  40. {{ end }}