1
0

index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>hokoritemp</title>
  7. <link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}">
  8. <script src="https://cdn.tailwindcss.com"></script>
  9. <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
  10. </head>
  11. <body class="bg-gray-50 min-h-screen flex items-center justify-center">
  12. <div class="container mx-auto px-4 py-8 w-full max-w-4xl">
  13. <!-- Main Container -->
  14. <div class="max-w-4xl mx-auto">
  15. <div class="space-y-8">
  16. <!-- Upload Form -->
  17. <div class="bg-white rounded-lg shadow-lg p-6">
  18. <h2 class="text-xl font-semibold text-gray-800 mb-4">Subir Archivo</h2>
  19. <form id="uploadForm" enctype="multipart/form-data">
  20. <div class="mb-6">
  21. <label class="block text-sm font-medium text-gray-700 mb-2">
  22. Selecciona un archivo para subir
  23. </label>
  24. <div id="dropZone" class="drop-zone border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer hover:border-gray-400 transition-colors">
  25. <div class="space-y-4">
  26. <svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
  27. <path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
  28. </svg>
  29. <div>
  30. <p class="text-lg font-medium text-gray-700">Arrastra y suelta tu archivo aquí</p>
  31. <p class="text-sm text-gray-500">o haz clic para seleccionar</p>
  32. </div>
  33. </div>
  34. <input type="file" id="fileInput" class="hidden" accept="*/*">
  35. </div>
  36. </div>
  37. <!-- Tiempo de vida del archivo -->
  38. <div class="mb-6">
  39. <label class="block text-sm font-medium text-gray-700 mb-2">
  40. Tiempo de vida del archivo
  41. </label>
  42. <select id="expiresHours" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
  43. <option value="1">1 hora</option>
  44. <option value="6">6 horas</option>
  45. <option value="12">12 horas</option>
  46. <option value="24" selected>24 horas (por defecto)</option>
  47. <option value="48">2 días</option>
  48. <option value="72">3 días</option>
  49. <option value="168">7 días</option>
  50. </select>
  51. <p class="text-sm text-gray-500 mt-1">El archivo se eliminará automáticamente después de este tiempo</p>
  52. </div>
  53. <div id="fileInfo" class="hidden mb-6 p-4 bg-blue-50 rounded-lg">
  54. <div class="flex items-center justify-between">
  55. <div class="flex-1 min-w-0 mr-3">
  56. <p class="font-medium text-blue-900 truncate" id="fileName" title=""></p>
  57. <p class="text-sm text-blue-700" id="fileSize"></p>
  58. </div>
  59. <button type="button" id="removeFile" class="text-red-600 hover:text-red-800 flex-shrink-0">
  60. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  61. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  62. </svg>
  63. </button>
  64. </div>
  65. </div>
  66. <!-- Progress Bar -->
  67. <div id="progressContainer" class="hidden mb-4">
  68. <div class="flex items-center justify-between mb-2">
  69. <span class="text-sm font-medium text-gray-700">Progreso de subida</span>
  70. <span id="progressText" class="text-sm text-gray-500">0%</span>
  71. </div>
  72. <div class="w-full bg-gray-200 rounded-full h-2">
  73. <div id="progressBar" class="bg-blue-600 h-2 rounded-full transition-all duration-300 ease-out" style="width: 0%"></div>
  74. </div>
  75. <div class="flex items-center justify-between mt-1">
  76. <span id="uploadedSize" class="text-xs text-gray-500">0 KB</span>
  77. <span id="totalSize" class="text-xs text-gray-500">0 KB</span>
  78. </div>
  79. </div>
  80. <button type="submit" id="uploadBtn" class="w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed">
  81. <span id="uploadBtnText">Subir Archivo</span>
  82. <span id="uploadBtnLoading" class="hidden">
  83. <svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  84. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  85. <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
  86. </svg>
  87. Subiendo...
  88. </span>
  89. </button>
  90. </form>
  91. <!-- Error Section -->
  92. <div id="errorSection" class="hidden mt-6 bg-red-50 border border-red-200 rounded-lg p-4">
  93. <div class="flex">
  94. <div class="flex-shrink-0">
  95. <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
  96. <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
  97. </svg>
  98. </div>
  99. <div class="ml-3">
  100. <h3 class="text-sm font-medium text-red-800" id="errorMessage"></h3>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- Result Section -->
  106. <div id="resultSection" class="hidden bg-white rounded-lg shadow-lg p-6 result-section">
  107. <div class="text-center">
  108. <div class="mb-4">
  109. <svg class="mx-auto h-12 w-12 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  110. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  111. </svg>
  112. </div>
  113. <h3 class="text-lg font-medium text-gray-900 mb-2">¡Archivo subido exitosamente!</h3>
  114. <p class="text-gray-600 mb-4">Tu archivo estará disponible por <span id="selectedExpiresTime">24 horas</span></p>
  115. <div class="bg-gray-50 rounded-lg p-4 mb-4">
  116. <label class="block text-sm font-medium text-gray-700 mb-2">Enlace de descarga:</label>
  117. <div class="flex">
  118. <input type="text" id="downloadLink" class="flex-1 px-3 py-2 border border-gray-300 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" readonly>
  119. <button onclick="copyLink()" class="px-4 py-2 bg-blue-600 text-white rounded-r-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
  120. Copiar
  121. </button>
  122. </div>
  123. </div>
  124. <div class="flex space-x-4">
  125. <button onclick="openLink()" class="flex-1 bg-green-600 text-white py-2 px-4 rounded-lg hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500">
  126. Abrir Enlace
  127. </button>
  128. <button onclick="resetForm()" class="flex-1 bg-gray-600 text-white py-2 px-4 rounded-lg hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-500">
  129. Subir Otro
  130. </button>
  131. </div>
  132. </div>
  133. </div>
  134. <!-- Empty State for Result Section -->
  135. <div id="emptyResultSection" class="hidden bg-gray-50 rounded-lg p-8 text-center result-section">
  136. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  137. <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>
  138. </svg>
  139. <h3 class="mt-2 text-sm font-medium text-gray-900">Listo para subir</h3>
  140. <p class="mt-1 text-sm text-gray-500">Selecciona un archivo para comenzar</p>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <!-- Floating Action Button -->
  146. <div class="fixed bottom-6 right-6 z-50">
  147. <a href="/myfiles" class="bg-blue-600 text-white w-14 h-14 rounded-full flex items-center justify-center hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 shadow-lg transition-all duration-200 hover:scale-110" title="Ver mis enlaces activos">
  148. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  149. <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>
  150. </svg>
  151. </a>
  152. </div>
  153. <script>
  154. // Configuración del servidor
  155. const SERVER_CONFIG = {
  156. maxFileSize: parseInt('{{ max_file_size }}'),
  157. maxFileSizeMB: parseInt('{{ max_file_size_mb }}')
  158. };
  159. </script>
  160. <script src="{{ url_for('static', filename='app.js') }}"></script>
  161. </body>
  162. </html>