upload.tpl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. % from rest.tool_color import color
  2. % link = setdefault("link", "") or ""
  3. % disabled = setdefault("disabled", "") and 'disabled="true"'
  4. % download_disabled = "" if disabled else 'disabled="true"'
  5. % mimetype = (setdefault("mimetype", None) is not True and mimetype) or None
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9. <style>
  10. html {
  11. --scrollbarBG: #333333;
  12. --thumbBG: #080808;
  13. }
  14. body {
  15. background-color: #080808;
  16. color: #cccccc;
  17. }
  18. img {
  19. background-color: floralwhite;
  20. color: black;
  21. max-height: min(100vh, calc(100vw * 9 / 16));
  22. max-width: calc(100vw - 2em);
  23. }
  24. object {
  25. width: 80%;
  26. margin: 1em 0 0;
  27. }
  28. object.other {
  29. height: 60vh;
  30. }
  31. object.text {
  32. height: 60vh;
  33. border: floralwhite;
  34. border-style: solid;
  35. border-width: thin;
  36. }
  37. </style>
  38. <title>Upload</title>
  39. <link rel="manifest" href="/static/upload-manifest.json"/>
  40. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  41. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css" integrity="sha384-yHIFVG6ClnONEA5yB5DJXfW2/KC173DIQrYoZMEtBvGzmf0PKiGyNEqe9N6BNDBH" crossorigin="anonymous"/>
  42. <link rel="stylesheet" href="https://shandan.one/css/grids-responsive-min.css"/>
  43. <link rel="stylesheet" href="https://shandan.one/css/responsive-visibility-collapse.css"/>
  44. </head>
  45. <body align="center" style="text-align: center">
  46. <div class="pure-g">
  47. <div class="pure-u-1">
  48. % include('buttongroup-upload')
  49. </div>
  50. <div class="pure-u-1">
  51. <div class="pure-button" style="margin: 1em 0 0; background: {{ color['upload'] }};">
  52. <a href="{{link}}" style="color: floralwhite;">{{ link }}</a>
  53. </div>
  54. </div>
  55. <div class="pure-u-1">
  56. <p><details><summary> Show QR code ...</summary><img src="{{qr}}"/></details></p>
  57. {{!form}}
  58. <form id="download" method="get" action="{{link}}"></form>
  59. % if mimetype and mimetype.startswith('text'):
  60. <object class="text" data="{{link}}?download=false&mimetype=text/plain" type={{mimetype}}><p>Unable to display {{mimetype}}</p></object>
  61. % elif mimetype and mimetype.startswith('image'):
  62. <object data="{{link}}?download=false" type="{{mimetype}}"><p>Unable to display {{mimetype}}</p></object>
  63. % elif mimetype:
  64. <object class="other" data="{{link}}?download=false" type={{mimetype}}><p>Unable to display {{mimetype}}</p></object>
  65. % end
  66. </div>
  67. </div>
  68. </body>
  69. </html>