Revert "v0.0.47: выбор целой папки (webkitdirectory) — рекурсивно, как раскрытие ZIP"
Deploy drhider / validate (push) Canceled after 0s

This reverts commit b5a14cfc3d.
This commit is contained in:
“Naeel”
2026-08-19 18:41:43 +04:00
parent b5a14cfc3d
commit f5ca8c3eb5
3 changed files with 2 additions and 81 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях)
VERSION = "0.0.47"
VERSION = "0.0.46"
def create_app():
+1 -35
View File
@@ -44,8 +44,6 @@
.sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.file-input-wrap { margin-bottom: 10px; }
.file-input-wrap input[type="file"] { width: 100%; font-size: 13px; }
.folder-btn { margin-top: 6px; width: 100%; }
#folderInput { display: none; }
.table-wrap { border: 1px solid var(--brand-gray); border-radius: 8px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
@@ -133,8 +131,6 @@
</p>
<div class="file-input-wrap">
<input type="file" id="fileInput" multiple accept=".doc,.docx,.pdf,.txt,.zip">
<input type="file" id="folderInput" webkitdirectory multiple>
<button class="btn folder-btn" id="folderBtn" type="button" onclick="document.getElementById('folderInput').click()">📁 Выбрать папку</button>
</div>
<div class="table-wrap">
<table>
@@ -192,7 +188,6 @@ const fl = document.getElementById('fileList');
const fc = document.getElementById('fileCount');
const ub = document.getElementById('uploadBtn');
const st = document.getElementById('status');
const folderInput = document.getElementById('folderInput');
const db = document.getElementById('dlBtns');
let sf = [];
let fileMeta = new Map(); // имя -> {size, mtime} для дедупа/суффиксов
@@ -207,7 +202,6 @@ function resetAll() {
sf = [];
fileMeta = new Map();
fi.value = '';
folderInput.value = '';
rr();
st.className = '';
st.textContent = '';
@@ -231,7 +225,7 @@ function rr() {
function rm(i) { fileMeta.delete(sf[i].name); sf.splice(i, 1); const d = new DataTransfer(); sf.forEach(f => d.items.add(f)); fi.files = d.files; rr(); }
window.addEventListener('load', () => { sf = []; fileMeta = new Map(); fi.value = ''; folderInput.value = ''; rr(); /* прогрев upstream-соединения */ fetch('/health').catch(() => {}); });
window.addEventListener('load', () => { sf = []; fileMeta = new Map(); fi.value = ''; rr(); /* прогрев upstream-соединения */ fetch('/health').catch(() => {}); });
// ═══════════ Нативная распаковка ZIP (без внешних библиотек) ═══════════
function dosToMs(date, time) {
@@ -367,34 +361,6 @@ fi.addEventListener('change', async () => {
rr();
});
// ═══ Выбор целой папки: рекурсивно, как раскрытие ZIP ═══
// webkitdirectory отдаёт все файлы папки (включая подпапки) с webkitRelativePath.
folderInput.addEventListener('change', async () => {
const docExts = ['.pdf', '.doc', '.docx', '.txt', '.md'];
const incoming = Array.from(folderInput.files).sort((a, b) =>
(a.webkitRelativePath || a.name).localeCompare(b.webkitRelativePath || b.name));
for (const f of incoming) {
const rel = f.webkitRelativePath || f.name; // сохраняем структуру папок
const low = rel.toLowerCase();
if (low.endsWith('.zip')) {
try {
const nested = await listZipFiles(new File([f], rel, { lastModified: f.lastModified }));
nested.forEach(x => addFileWithDedup(x));
} catch (err) {
addFileWithDedup(new File([f], rel, { lastModified: f.lastModified })); // не удалось — добавить как есть
}
} else if (docExts.some(ext => low.endsWith(ext))) {
addFileWithDedup(new File([f], rel, { lastModified: f.lastModified }));
}
// иначе — не документ, пропускаем
}
const d = new DataTransfer();
sf.forEach(f => d.items.add(f));
fi.files = d.files;
folderInput.files = d.files;
rr();
});
function ss(idx, h) { const e = document.getElementById('st-' + idx); if (e) e.innerHTML = h; }
async function uploadFiles() {