download.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Download - {{ filename }} - HokoriTemp</title>
  7. <!-- SVG Favicon -->
  8. <link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
  9. <link rel="stylesheet" href="/static/css/styles.css">
  10. <script src="https://cdn.tailwindcss.com"></script>
  11. <script>
  12. (function() {
  13. const savedTheme = localStorage.getItem('theme') || 'light';
  14. if (savedTheme === 'dark') {
  15. document.documentElement.classList.add('dark');
  16. }
  17. })();
  18. tailwind.config = {
  19. darkMode: 'class',
  20. theme: {
  21. extend: {
  22. animation: {
  23. 'fade-in': 'fadeIn 0.3s ease-in-out',
  24. 'slide-up': 'slideUp 0.3s ease-out',
  25. 'pulse-slow': 'pulse 2s infinite'
  26. }
  27. }
  28. }
  29. }
  30. </script>
  31. </head>
  32. <body class="bg-gray-50 dark:bg-gray-900 min-h-screen transition-colors duration-300">
  33. <div class="container mx-auto px-4 py-8 max-w-4xl">
  34. <!-- Header -->
  35. <div class="flex justify-between items-center mb-8">
  36. <div class="text-center flex-1">
  37. <h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">HokoriTemp</h1>
  38. <p class="text-gray-600 dark:text-gray-400">File Download</p>
  39. </div>
  40. <!-- Theme Toggle Button -->
  41. <button id="themeToggle" class="p-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors ml-4">
  42. <!-- Sun Icon (Light Mode) -->
  43. <svg id="sunIcon" class="w-5 h-5 text-gray-800 dark:text-gray-200 hidden dark:block" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  44. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path>
  45. </svg>
  46. <!-- Moon Icon (Dark Mode) -->
  47. <svg id="moonIcon" class="w-5 h-5 text-gray-800 dark:text-gray-200 block dark:hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  48. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path>
  49. </svg>
  50. </button>
  51. </div>
  52. <!-- File Info Section -->
  53. <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6 transition-colors duration-300">
  54. <div class="flex items-center space-x-4 mb-4">
  55. <div class="flex-shrink-0">
  56. <svg class="w-12 h-12 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  57. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
  58. </svg>
  59. </div>
  60. <div class="flex-1">
  61. <h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-1">{{ filename }}</h2>
  62. <div class="flex flex-wrap gap-4 text-sm text-gray-600 dark:text-gray-400">
  63. <span>Size: {{ "%.2f"|format(file_size / 1024 / 1024) }} MB</span>
  64. {% if mime_type %}
  65. <span>Type: {{ mime_type }}</span>
  66. {% endif %}
  67. <span>Expires: {{ expiration_date[:19].replace('T', ' ') }}</span>
  68. </div>
  69. </div>
  70. </div>
  71. <!-- Download Button -->
  72. <div class="flex gap-3">
  73. <a href="/download/{{ file_id }}/direct"
  74. class="inline-flex items-center px-6 py-3 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600 text-white font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800">
  75. <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  76. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
  77. </svg>
  78. Download File
  79. </a>
  80. <a href="/"
  81. class="inline-flex items-center px-6 py-3 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-gray-200 font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800">
  82. <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  83. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"></path>
  84. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5a2 2 0 012-2h2a2 2 0 012 2v0H8v0z"></path>
  85. </svg>
  86. Upload More Files
  87. </a>
  88. </div>
  89. </div>
  90. <!-- Text File Preview -->
  91. {% if is_text_file and file_content %}
  92. <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 transition-colors duration-300">
  93. <div class="flex items-center justify-between mb-4">
  94. <h3 class="text-lg font-semibold text-gray-900 dark:text-white">File Preview</h3>
  95. <span class="text-sm text-gray-500 dark:text-gray-400">Text file preview</span>
  96. </div>
  97. <div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-4 overflow-auto max-h-96">
  98. <pre class="text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap font-mono">{{ file_content }}</pre>
  99. </div>
  100. <div class="mt-4 text-xs text-gray-500 dark:text-gray-400">
  101. <p>Preview shows the first part of the file content. Download the file to view the complete content.</p>
  102. </div>
  103. </div>
  104. {% elif is_text_file %}
  105. <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 transition-colors duration-300">
  106. <div class="text-center py-8">
  107. <svg class="w-12 h-12 mx-auto mb-4 text-yellow-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  108. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
  109. </svg>
  110. <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Preview Not Available</h3>
  111. <p class="text-gray-600 dark:text-gray-400">This text file couldn't be previewed. Please download it to view the content.</p>
  112. </div>
  113. </div>
  114. {% else %}
  115. <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 transition-colors duration-300">
  116. <div class="text-center py-8">
  117. <svg class="w-12 h-12 mx-auto mb-4 text-gray-400 dark:text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  118. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
  119. </svg>
  120. <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">Binary File</h3>
  121. <p class="text-gray-600 dark:text-gray-400">This file cannot be previewed. Click the download button above to get the file.</p>
  122. </div>
  123. </div>
  124. {% endif %}
  125. </div>
  126. <!-- Toast Notification -->
  127. <div id="toast" class="fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg transform translate-x-full transition-transform duration-300 z-50">
  128. <p id="toastMessage"></p>
  129. </div>
  130. <script>
  131. // Theme management
  132. function initTheme() {
  133. const savedTheme = localStorage.getItem('theme') || 'light';
  134. if (savedTheme === 'dark') {
  135. document.documentElement.classList.add('dark');
  136. } else {
  137. document.documentElement.classList.remove('dark');
  138. }
  139. }
  140. function toggleTheme() {
  141. const isDark = document.documentElement.classList.contains('dark');
  142. if (isDark) {
  143. document.documentElement.classList.remove('dark');
  144. localStorage.setItem('theme', 'light');
  145. } else {
  146. document.documentElement.classList.add('dark');
  147. localStorage.setItem('theme', 'dark');
  148. }
  149. }
  150. // Toast notification
  151. function showToast(message, type = 'success') {
  152. const toast = document.getElementById('toast');
  153. const toastMessage = document.getElementById('toastMessage');
  154. toastMessage.textContent = message;
  155. toast.classList.remove('bg-green-500', 'bg-red-500', 'bg-blue-500');
  156. if (type === 'success') {
  157. toast.classList.add('bg-green-500');
  158. } else if (type === 'error') {
  159. toast.classList.add('bg-red-500');
  160. } else if (type === 'info') {
  161. toast.classList.add('bg-blue-500');
  162. }
  163. toast.classList.remove('translate-x-full');
  164. setTimeout(() => {
  165. toast.classList.add('translate-x-full');
  166. }, 3000);
  167. }
  168. // Initialize
  169. document.addEventListener('DOMContentLoaded', function() {
  170. initTheme();
  171. document.getElementById('themeToggle').addEventListener('click', toggleTheme);
  172. });
  173. </script>
  174. </body>
  175. </html>