NexusV1 commited on
Commit
861255e
·
verified ·
1 Parent(s): 602ce84

Update public/index.html

Browse files
Files changed (1) hide show
  1. public/index.html +14 -13
public/index.html CHANGED
@@ -488,15 +488,16 @@
488
  try {
489
  const formData = new FormData(form);
490
 
491
- // Simulate API call - replace with actual endpoint
492
- await new Promise(resolve => setTimeout(resolve, 2000 + Math.random() * 3000));
493
-
494
- // Mock response - replace with actual API response
495
- const mockResponse = {
496
- viewLink: `https://filesnest.com/f/${Math.random().toString(36).substr(2, 8)}`,
497
- fileName: fileInput.files[0].name,
498
- fileSize: formatFileSize(fileInput.files[0].size)
499
- };
 
500
 
501
  clearInterval(progressInterval);
502
  completeProgress();
@@ -506,10 +507,10 @@
506
  <div style="font-size: 2rem; margin-bottom: 15px;">🎉</div>
507
  <strong style="color: #4caf50; font-size: 1.2rem;">Upload Successful!</strong>
508
  <div style="margin: 15px 0; padding: 15px; background: rgba(76, 175, 80, 0.1); border-radius: 8px;">
509
- <div style="margin-bottom: 8px;"><strong>File:</strong> ${mockResponse.fileName}</div>
510
- <div style="margin-bottom: 15px;"><strong>Size:</strong> ${mockResponse.fileSize}</div>
511
  <div><strong>Permanent Link:</strong></div>
512
- <a href="${mockResponse.viewLink}" target="_blank" class="result-link" style="font-size: 1.1rem;">${mockResponse.viewLink}</a>
513
  </div>
514
  <div style="color: #9d8bcc; font-size: 0.9rem;">Your file is now permanently hosted and accessible worldwide! 🌍</div>
515
  </div>
@@ -523,7 +524,7 @@
523
 
524
  result.innerHTML = `
525
  <strong style="color: #ff6b6b;">Upload Failed</strong>
526
- <div style="margin-top: 10px; color: #ffb3b3;">Please try again or contact support if the problem persists.</div>
527
  `;
528
  result.className = 'result error';
529
  result.style.display = 'block';
 
488
  try {
489
  const formData = new FormData(form);
490
 
491
+ const response = await fetch('https://nexusv1-uploadx.hf.space/upload', {
492
+ method: 'POST',
493
+ body: formData
494
+ });
495
+
496
+ if (!response.ok) {
497
+ throw new Error(`HTTP error! status: ${response.status}`);
498
+ }
499
+
500
+ const data = await response.json();
501
 
502
  clearInterval(progressInterval);
503
  completeProgress();
 
507
  <div style="font-size: 2rem; margin-bottom: 15px;">🎉</div>
508
  <strong style="color: #4caf50; font-size: 1.2rem;">Upload Successful!</strong>
509
  <div style="margin: 15px 0; padding: 15px; background: rgba(76, 175, 80, 0.1); border-radius: 8px;">
510
+ <div style="margin-bottom: 8px;"><strong>File:</strong> ${fileInput.files[0].name}</div>
511
+ <div style="margin-bottom: 15px;"><strong>Size:</strong> ${formatFileSize(fileInput.files[0].size)}</div>
512
  <div><strong>Permanent Link:</strong></div>
513
+ <a href="${data.viewLink}" target="_blank" class="result-link" style="font-size: 1.1rem;">${data.viewLink}</a>
514
  </div>
515
  <div style="color: #9d8bcc; font-size: 0.9rem;">Your file is now permanently hosted and accessible worldwide! 🌍</div>
516
  </div>
 
524
 
525
  result.innerHTML = `
526
  <strong style="color: #ff6b6b;">Upload Failed</strong>
527
+ <div style="margin-top: 10px; color: #ffb3b3;">Error: ${error.message}. Please try again or contact support if the problem persists.</div>
528
  `;
529
  result.className = 'result error';
530
  result.style.display = 'block';