From 407ca2e4d71cb054bf8aebb7d4044c1ed39a5342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Thu, 7 May 2026 03:25:25 +0900 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20ISO=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=B2=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/templates/iso.html | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/web/templates/iso.html b/web/templates/iso.html index 1f6ef1d..4644c9a 100644 --- a/web/templates/iso.html +++ b/web/templates/iso.html @@ -11,7 +11,7 @@
ISO
-
Управление образами в /var/lib/virtuality/iso
+
Установочные образы только .iso в /var/lib/virtuality/iso
user: {{ user }} @@ -28,15 +28,15 @@
-

Загрузить ISO

- upload .iso +

Загрузить установочный ISO

+ только .iso
-
Файл ещё не выбран.
+
Файл ещё не выбран. В этом разделе разрешены только установочные образы .iso.
@@ -89,7 +89,7 @@ ls -lh /var/lib/virtuality/iso {% else %} - ISO пока нет. Загрузи первый образ через форму выше. + ISO пока нет. Загрузи первый установочный .iso через форму выше. {% endfor %} @@ -117,15 +117,31 @@ ls -lh /var/lib/virtuality/iso return value.toFixed(value >= 10 || i === 0 ? 0 : 1) + ' ' + units[i]; } + function validIsoFile(file) { + return file && file.name && file.name.toLowerCase().endsWith('.iso'); + } + fileInput.addEventListener('change', function () { const file = fileInput.files[0]; - hint.textContent = file ? file.name + ' · ' + bytesText(file.size) : 'Файл ещё не выбран.'; + if (!file) { + hint.textContent = 'Файл ещё не выбран. В этом разделе разрешены только установочные образы .iso.'; + return; + } + if (!validIsoFile(file)) { + hint.textContent = 'Неверный тип файла. Здесь можно выбрать только .iso.'; + fileInput.value = ''; + return; + } + hint.textContent = file.name + ' · ' + bytesText(file.size); }); form.addEventListener('submit', function (event) { event.preventDefault(); const file = fileInput.files[0]; - if (!file) return; + if (!validIsoFile(file)) { + hint.textContent = 'Выбери установочный образ .iso.'; + return; + } const xhr = new XMLHttpRequest(); const data = new FormData(form);