Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -840,55 +840,72 @@ HTML_CONTENT = """
|
|
| 840 |
}
|
| 841 |
|
| 842 |
function showHistory() {
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
showEmbedModal(item.url);
|
| 881 |
-
historyModal.style.display = "none";
|
| 882 |
-
};
|
| 883 |
-
actionsContainer.appendChild(embedBtn);
|
| 884 |
-
}
|
| 885 |
-
|
| 886 |
-
historyItem.appendChild(actionsContainer);
|
| 887 |
-
historyList.appendChild(historyItem);
|
| 888 |
});
|
| 889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 890 |
}
|
| 891 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 892 |
function quickOpen(url, fileName, originalExtension) {
|
| 893 |
quickOpenContent.innerHTML = '';
|
| 894 |
const fullUrl = window.location.origin + url;
|
|
|
|
| 840 |
}
|
| 841 |
|
| 842 |
function showHistory() {
|
| 843 |
+
const history = JSON.parse(localStorage.getItem('uploadHistory')) || [];
|
| 844 |
+
historyList.innerHTML = '';
|
| 845 |
+
|
| 846 |
+
// Add Copy All Links button
|
| 847 |
+
const copyAllBtn = document.createElement('button');
|
| 848 |
+
copyAllBtn.textContent = 'Copy All Links';
|
| 849 |
+
copyAllBtn.className = 'small-btn';
|
| 850 |
+
copyAllBtn.style.marginBottom = '15px';
|
| 851 |
+
copyAllBtn.onclick = () => {
|
| 852 |
+
const links = history.map(item => window.location.origin + item.url).join('\n');
|
| 853 |
+
navigator.clipboard.writeText(links).then(() => {
|
| 854 |
+
alert('All links copied to clipboard!');
|
| 855 |
+
}).catch(err => {
|
| 856 |
+
console.error('Failed to copy links:', err);
|
| 857 |
+
alert('Failed to copy links to clipboard');
|
| 858 |
+
});
|
| 859 |
+
};
|
| 860 |
+
historyList.appendChild(copyAllBtn);
|
| 861 |
+
|
| 862 |
+
history.forEach(item => {
|
| 863 |
+
const historyItem = document.createElement('div');
|
| 864 |
+
historyItem.className = 'history-item';
|
| 865 |
+
|
| 866 |
+
const itemName = document.createElement('span');
|
| 867 |
+
itemName.className = 'history-item-name';
|
| 868 |
+
itemName.textContent = item.fileName;
|
| 869 |
+
historyItem.appendChild(itemName);
|
| 870 |
+
|
| 871 |
+
const actionsContainer = document.createElement('div');
|
| 872 |
+
actionsContainer.className = 'history-item-actions';
|
| 873 |
+
|
| 874 |
+
const copyBtn = document.createElement('button');
|
| 875 |
+
copyBtn.textContent = 'Copy Link';
|
| 876 |
+
copyBtn.className = 'small-btn';
|
| 877 |
+
copyBtn.onclick = () => {
|
| 878 |
+
navigator.clipboard.writeText(window.location.origin + item.url).then(() => {
|
| 879 |
+
alert('Link copied to clipboard!');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 880 |
});
|
| 881 |
+
};
|
| 882 |
+
actionsContainer.appendChild(copyBtn);
|
| 883 |
+
|
| 884 |
+
const openBtn = document.createElement('button');
|
| 885 |
+
openBtn.textContent = 'Open';
|
| 886 |
+
openBtn.className = 'small-btn';
|
| 887 |
+
openBtn.onclick = () => {
|
| 888 |
+
quickOpen(item.url, item.fileName, item.originalExtension);
|
| 889 |
+
};
|
| 890 |
+
actionsContainer.appendChild(openBtn);
|
| 891 |
+
|
| 892 |
+
if (item.originalExtension.toLowerCase() === 'mp4') {
|
| 893 |
+
const embedBtn = document.createElement('button');
|
| 894 |
+
embedBtn.textContent = 'Embed';
|
| 895 |
+
embedBtn.className = 'small-btn';
|
| 896 |
+
embedBtn.onclick = () => {
|
| 897 |
+
showEmbedModal(item.url);
|
| 898 |
+
historyModal.style.display = "none";
|
| 899 |
+
};
|
| 900 |
+
actionsContainer.appendChild(embedBtn);
|
| 901 |
}
|
| 902 |
|
| 903 |
+
historyItem.appendChild(actionsContainer);
|
| 904 |
+
historyList.appendChild(historyItem);
|
| 905 |
+
});
|
| 906 |
+
historyModal.style.display = "block";
|
| 907 |
+
}
|
| 908 |
+
|
| 909 |
function quickOpen(url, fileName, originalExtension) {
|
| 910 |
quickOpenContent.innerHTML = '';
|
| 911 |
const fullUrl = window.location.origin + url;
|