index.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>loli-safe - A self hosted upload service</title>
  5. <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.3.0/css/bulma.min.css">
  6. <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.css">
  7. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.js"></script>
  8. <style type="text/css">
  9. #b {
  10. -webkit-animation-delay: 0.5s;
  11. animation-delay: 0.5s;
  12. -webkit-animation-duration: 1.5s;
  13. animation-duration: 1.5s;
  14. -webkit-animation-fill-mode: both;
  15. animation-fill-mode: both;
  16. -webkit-animation-name: floatUp;
  17. animation-name: floatUp;
  18. -webkit-animation-timing-function: cubic-bezier(0, 0.71, 0.29, 1);
  19. animation-timing-function: cubic-bezier(0, 0.71, 0.29, 1);
  20. border-radius: 24px;
  21. display: inline-block;
  22. height: 240px;
  23. margin-bottom: 40px;
  24. position: relative;
  25. vertical-align: top;
  26. width: 240px;
  27. box-shadow: 0 20px 60px rgba(10, 10, 10, 0.05), 0 5px 10px rgba(10, 10, 10, 0.1), 0 1px 1px rgba(10, 10, 10, 0.2);
  28. }
  29. img.logo {
  30. height: 200px;
  31. margin-top: 20px;
  32. }
  33. .dz-preview .dz-details { display: flex; }
  34. .dz-preview .dz-details .dz-size, .dz-preview .dz-details .dz-filename { flex: 1 }
  35. .dz-preview img, .dz-preview .dz-success-mark, .dz-preview .dz-error-mark { display: none }
  36. @keyframes floatUp {
  37. 0% {
  38. opacity: 0;
  39. box-shadow: 0 0 0 rgba(10, 10, 10, 0), 0 0 0 rgba(10, 10, 10, 0), 0 0 0 rgba(10, 10, 10, 0);
  40. -webkit-transform: scale(0.86);
  41. transform: scale(0.86);
  42. }
  43. 25% {
  44. opacity: 100;
  45. }
  46. 67% {
  47. box-shadow: 0 0 0 rgba(10, 10, 10, 0), 0 5px 10px rgba(10, 10, 10, 0.1), 0 1px 1px rgba(10, 10, 10, 0.2);
  48. -webkit-transform: scale(1);
  49. transform: scale(1);
  50. }
  51. 100% {
  52. box-shadow: 0 20px 60px rgba(10, 10, 10, 0.05), 0 5px 10px rgba(10, 10, 10, 0.1), 0 1px 1px rgba(10, 10, 10, 0.2);
  53. -webkit-transform: scale(1);
  54. transform: scale(1);
  55. }
  56. }
  57. </style>
  58. </head>
  59. <body>
  60. <section class="hero is-fullheight has-text-centered">
  61. <div class="hero-body">
  62. <div class="container">
  63. <p id="b">
  64. <img class='logo' src="/images/logo.png">
  65. </p>
  66. <h1 id="bulma" class="title">
  67. loli-safe
  68. </h1>
  69. <h2 id="modern-framework" class="subtitle">
  70. A <strong>modern</strong> self-hosted file upload <strong>service</strong>
  71. </h2>
  72. <div class="columns">
  73. <div class="column"></div>
  74. <div class="column">
  75. <a class="button is-danger is-outlined is-fullwidth" id="upload-button">Upload files</a>
  76. </div>
  77. <div class="column"></div>
  78. </div>
  79. <div class="columns">
  80. <div class="column"></div>
  81. <div class="column">
  82. <div class="notification" id="dropzone">Or drag and drop files here</div>
  83. </div>
  84. <div class="column"></div>
  85. </div>
  86. <div id="uploads">
  87. <div id="template" class="columns">
  88. <div class="column">
  89. <p data-dz-size></p>
  90. </div>
  91. <div class="column">
  92. <p data-dz-name></p>
  93. </div>
  94. <div class="column">
  95. <progress class="progress is-primary" value="100" max="100" data-dz-uploadprogress></progress>
  96. <p data-dz-errormessage></p>
  97. <p class="link"></p>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </section>
  104. <script type="text/javascript">
  105. window.onload = function () {
  106. var previewNode = document.querySelector("#template");
  107. previewNode.id = "";
  108. var previewTemplate = previewNode.parentNode.innerHTML;
  109. previewNode.parentNode.removeChild(previewNode);
  110. var dropzone = new Dropzone('div#dropzone', {
  111. url: '/api/upload',
  112. paramName: 'file',
  113. maxFilesize: 512,
  114. parallelUploads: 2,
  115. uploadMultiple: false,
  116. previewsContainer: 'div#uploads',
  117. previewTemplate: previewTemplate,
  118. createImageThumbnails: false,
  119. maxFiles: 1000,
  120. autoProcessQueue: true
  121. });
  122. // Update the total progress bar
  123. dropzone.on("uploadprogress", function(file, progress) {
  124. file.previewElement.querySelector(".progress").style.width = progress + "%";
  125. });
  126. dropzone.on("success", function(file, response) {
  127. // Handle the responseText here. For example, add the text to the preview element:
  128. a = document.createElement('a');
  129. a.href = 'https://i.kanacchi.moe/' + response.filename;
  130. a.innerHTML = response.filename;
  131. file.previewTemplate.querySelector(".progress").style.display = 'none';
  132. file.previewTemplate.querySelector(".link").appendChild(a);
  133. });
  134. };
  135. </script>
  136. </body>
  137. </html>