Download index.html from z0m80z/try2: direct link, hf CLI and curl.
- Browser
- Download file 14.7 kB
-
https://huggingface.co/spaces/z0m80z/try2/resolve/main/index.html
- Command line
-
hf download hf://spaces/z0m80z/try2/index.html
-
curl -L -o index.html https://huggingface.co/spaces/z0m80z/try2/resolve/main/index.html
14.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>FileShare Pro</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .file-drop-area { | |
| transition: all 0.2s ease; | |
| } | |
| .file-drop-area.active { | |
| border-color: #3b82f6; | |
| background-color: #f0f9ff; | |
| } | |
| .progress-bar { | |
| transition: width 0.3s ease; | |
| } | |
| .file-icon { | |
| font-size: 2rem; | |
| } | |
| .file-item:hover { | |
| background-color: #f8fafc; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="mb-10 text-center"> | |
| <h1 class="text-4xl font-bold text-blue-600 mb-2">FileShare Pro</h1> | |
| <p class="text-gray-600">Simple, secure file sharing</p> | |
| </header> | |
| <!-- Main Content --> | |
| <div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden"> | |
| <!-- Upload Section --> | |
| <div class="p-6"> | |
| <h2 class="text-2xl font-semibold text-gray-800 mb-4">Upload Files</h2> | |
| <div id="fileDropArea" | |
| class="file-drop-area border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer mb-4"> | |
| <div class="flex flex-col items-center justify-center"> | |
| <i class="fas fa-cloud-upload-alt text-blue-500 text-5xl mb-4"></i> | |
| <p class="text-lg font-medium text-gray-700">Drag & drop files here</p> | |
| <p class="text-gray-500 mb-4">or</p> | |
| <label for="fileInput" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-6 rounded-lg cursor-pointer transition duration-200"> | |
| Browse Files | |
| </label> | |
| <input id="fileInput" type="file" class="hidden" multiple> | |
| </div> | |
| </div> | |
| <div id="uploadProgress" class="hidden mb-4"> | |
| <div class="flex justify-between text-sm text-gray-600 mb-1"> | |
| <span>Uploading...</span> | |
| <span id="progressText">0%</span> | |
| </div> | |
| <div class="w-full bg-gray-200 rounded-full h-2.5"> | |
| <div id="progressBar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div> | |
| </div> | |
| </div> | |
| <div id="fileList" class="hidden"> | |
| <h3 class="font-medium text-gray-700 mb-2">Selected Files:</h3> | |
| <ul id="selectedFiles" class="divide-y divide-gray-200"></ul> | |
| <button id="uploadBtn" class="mt-4 bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-6 rounded-lg transition duration-200"> | |
| Upload Files | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Uploaded Files Section --> | |
| <div class="border-t border-gray-200 p-6 bg-gray-50"> | |
| <h2 class="text-2xl font-semibold text-gray-800 mb-4">Your Files</h2> | |
| <div class="bg-white rounded-lg border border-gray-200 overflow-hidden"> | |
| <table class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-100"> | |
| <tr> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">File</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Size</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Uploaded</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody id="filesTableBody" class="bg-white divide-y divide-gray-200"> | |
| <!-- Files will be populated here --> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div id="noFilesMessage" class="text-center py-8"> | |
| <i class="fas fa-folder-open text-gray-300 text-5xl mb-4"></i> | |
| <p class="text-gray-500">No files uploaded yet</p> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Footer --> | |
| <footer class="mt-12 text-center text-gray-500 text-sm"> | |
| <p>FileShare Pro © 2023 | Built with Flask</p> | |
| </footer> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // DOM Elements | |
| const fileDropArea = document.getElementById('fileDropArea'); | |
| const fileInput = document.getElementById('fileInput'); | |
| const selectedFiles = document.getElementById('selectedFiles'); | |
| const fileList = document.getElementById('fileList'); | |
| const uploadBtn = document.getElementById('uploadBtn'); | |
| const uploadProgress = document.getElementById('uploadProgress'); | |
| const progressBar = document.getElementById('progressBar'); | |
| const progressText = document.getElementById('progressText'); | |
| const filesTableBody = document.getElementById('filesTableBody'); | |
| const noFilesMessage = document.getElementById('noFilesMessage'); | |
| let files = []; | |
| // Check for existing files on page load | |
| fetchFiles(); | |
| // Drag and drop events | |
| fileDropArea.addEventListener('dragover', (e) => { | |
| e.preventDefault(); | |
| fileDropArea.classList.add('active'); | |
| }); | |
| fileDropArea.addEventListener('dragleave', () => { | |
| fileDropArea.classList.remove('active'); | |
| }); | |
| fileDropArea.addEventListener('drop', (e) => { | |
| e.preventDefault(); | |
| fileDropArea.classList.remove('active'); | |
| handleFiles(e.dataTransfer.files); | |
| }); | |
| fileInput.addEventListener('change', () => { | |
| if (fileInput.files.length > 0) { | |
| handleFiles(fileInput.files); | |
| } | |
| }); | |
| // Handle selected files | |
| function handleFiles(newFiles) { | |
| files = Array.from(newFiles); | |
| if (files.length > 0) { | |
| selectedFiles.innerHTML = ''; | |
| files.forEach((file, index) => { | |
| const listItem = document.createElement('li'); | |
| listItem.className = 'py-2 flex justify-between items-center'; | |
| listItem.innerHTML = ` | |
| <div class="flex items-center"> | |
| <i class="fas fa-file text-blue-500 mr-3 file-icon"></i> | |
| <span class="text-gray-800 truncate max-w-xs">${file.name}</span> | |
| </div> | |
| <span class="text-gray-500 text-sm">${formatFileSize(file.size)}</span> | |
| `; | |
| selectedFiles.appendChild(listItem); | |
| }); | |
| fileList.classList.remove('hidden'); | |
| } | |
| } | |
| // Upload files | |
| uploadBtn.addEventListener('click', async () => { | |
| if (files.length === 0) return; | |
| uploadProgress.classList.remove('hidden'); | |
| const formData = new FormData(); | |
| files.forEach(file => formData.append('file', file)); | |
| try { | |
| const response = await fetch('/upload', { | |
| method: 'POST', | |
| body: formData, | |
| headers: { | |
| 'X-Requested-With': 'XMLHttpRequest' | |
| } | |
| }); | |
| const data = await response.json(); | |
| if (data.success) { | |
| // Reset file selection | |
| files = []; | |
| fileInput.value = ''; | |
| fileList.classList.add('hidden'); | |
| uploadProgress.classList.add('hidden'); | |
| // Fetch updated file list | |
| fetchFiles(); | |
| } else { | |
| alert('Upload failed: ' + (data.message || 'Unknown error')); | |
| } | |
| } catch (error) { | |
| console.error('Upload error:', error); | |
| alert('Upload failed. Please try again.'); | |
| } | |
| }); | |
| // Format file size | |
| function formatFileSize(bytes) { | |
| if (bytes === 0) return '0 Bytes'; | |
| const k = 1024; | |
| const sizes = ['Bytes', 'KB', 'MB', 'GB']; | |
| const i = Math.floor(Math.log(bytes) / Math.log(k)); | |
| return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; | |
| } | |
| // Fetch uploaded files | |
| async function fetchFiles() { | |
| try { | |
| const response = await fetch('/files'); | |
| const files = await response.json(); | |
| filesTableBody.innerHTML = ''; | |
| if (files.length > 0) { | |
| noFilesMessage.classList.add('hidden'); | |
| files.forEach(file => { | |
| const row = document.createElement('tr'); | |
| row.className = 'hover:bg-gray-50 file-item'; | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-file text-blue-500 mr-3"></i> | |
| <div class="text-sm font-medium text-gray-900 truncate max-w-xs">${file.name}</div> | |
| </div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="text-sm text-gray-500">${formatFileSize(file.size)}</div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="text-sm text-gray-500">${new Date(file.uploaded).toLocaleString()}</div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium"> | |
| <a href="/download/${file.name}" class="text-blue-600 hover:text-blue-900 mr-4">Download</a> | |
| <button onclick="deleteFile('${file.name}')" class="text-red-600 hover:text-red-900">Delete</button> | |
| </td> | |
| `; | |
| filesTableBody.appendChild(row); | |
| }); | |
| } else { | |
| noFilesMessage.classList.remove('hidden'); | |
| } | |
| } catch (error) { | |
| console.error('Error fetching files:', error); | |
| } | |
| } | |
| // Global function for deleting files | |
| window.deleteFile = async function(filename) { | |
| if (confirm(`Are you sure you want to delete ${filename}?`)) { | |
| try { | |
| const response = await fetch(`/delete/${filename}`, { | |
| method: 'DELETE' | |
| }); | |
| const data = await response.json(); | |
| if (data.success) { | |
| fetchFiles(); | |
| } else { | |
| alert('Failed to delete file: ' + (data.message || 'Unknown error')); | |
| } | |
| } catch (error) { | |
| console.error('Delete error:', error); | |
| alert('Failed to delete file. Please try again.'); | |
| } | |
| } | |
| }; | |
| // Simulate upload progress (for demo) | |
| function simulateUploadProgress() { | |
| let progress = 0; | |
| const interval = setInterval(() => { | |
| progress += Math.random() * 10; | |
| if (progress > 100) progress = 100; | |
| progressBar.style.width = `${progress}%`; | |
| progressText.textContent = `${Math.round(progress)}%`; | |
| if (progress >= 100) { | |
| clearInterval(interval); | |
| } | |
| }, 200); | |
| } | |
| // For demo purposes | |
| if (window.location.href.includes('demo')) { | |
| uploadBtn.addEventListener('click', simulateUploadProgress); | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=z0m80z/try2" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body> | |
| </html> |