coollsd commited on
Commit
cd5be0c
·
verified ·
1 Parent(s): 42a903f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -3
app.py CHANGED
@@ -264,7 +264,6 @@ HTML_CONTENT = """
264
  margin-top: 10px;
265
  }
266
 
267
- /* File Types */
268
  .file-types {
269
  margin-top: 2rem;
270
  font-size: 0.8rem;
@@ -431,7 +430,7 @@ HTML_CONTENT = """
431
  padding: 15px;
432
  }
433
 
434
- .history-item {
435
  flex-direction: column;
436
  align-items: flex-start;
437
  }
@@ -445,7 +444,7 @@ HTML_CONTENT = """
445
  font-size: 0.9rem;
446
  }
447
 
448
- .drop-zone {
449
  padding: 15px;
450
  }
451
 
@@ -789,12 +788,39 @@ HTML_CONTENT = """
789
  actionsContainer.appendChild(embedBtn);
790
  }
791
 
 
 
 
 
 
 
 
 
 
 
 
792
  historyItem.appendChild(actionsContainer);
793
  historyList.appendChild(historyItem);
794
  });
795
  historyModal.style.display = "block";
796
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  </script>
 
798
  </body>
799
  </html>
800
  """
 
264
  margin-top: 10px;
265
  }
266
 
 
267
  .file-types {
268
  margin-top: 2rem;
269
  font-size: 0.8rem;
 
430
  padding: 15px;
431
  }
432
 
433
+ .history-item {
434
  flex-direction: column;
435
  align-items: flex-start;
436
  }
 
444
  font-size: 0.9rem;
445
  }
446
 
447
+ .drop-zone {
448
  padding: 15px;
449
  }
450
 
 
788
  actionsContainer.appendChild(embedBtn);
789
  }
790
 
791
+ const encryptBtn = document.createElement('button');
792
+ encryptBtn.textContent = 'Encrypt';
793
+ encryptBtn.className = 'small-btn';
794
+ encryptBtn.onclick = () => {
795
+ const encryptedUrl = encryptUrl(item.url);
796
+ navigator.clipboard.writeText(encryptedUrl).then(() => {
797
+ alert('Encrypted link copied to clipboard!');
798
+ });
799
+ };
800
+ actionsContainer.appendChild(encryptBtn);
801
+
802
  historyItem.appendChild(actionsContainer);
803
  historyList.appendChild(historyItem);
804
  });
805
  historyModal.style.display = "block";
806
  }
807
+
808
+ function encryptUrl(url) {
809
+ const key = generateBrowserFingerprint();
810
+ const encrypted = CryptoJS.AES.encrypt(url, key).toString();
811
+ return `${window.location.origin}/decrypt?data=${encodeURIComponent(encrypted)}`;
812
+ }
813
+
814
+ function generateBrowserFingerprint() {
815
+ const userAgent = navigator.userAgent;
816
+ const screenResolution = `${screen.width}x${screen.height}`;
817
+ const colorDepth = screen.colorDepth;
818
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
819
+ const fingerprint = `${userAgent}|${screenResolution}|${colorDepth}|${timezone}`;
820
+ return CryptoJS.SHA256(fingerprint).toString();
821
+ }
822
  </script>
823
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
824
  </body>
825
  </html>
826
  """