Kyle Pearson commited on
Commit ·
78cdaef
1
Parent(s): 4ce21b0
Add file type support for and in HTML input, enforce stricter validation in with supported formats list, warn on unsupported files, restrict processing to validated files.
Browse files- index.html +1 -1
- js/app.js +11 -1
index.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
| 26 |
<canvas id="canvas" tabindex="0"></canvas>
|
| 27 |
<div id="main-gui"></div>
|
| 28 |
<div id="second-gui"></div>
|
| 29 |
-
<input id="file-input" type="file" accept=".ply,.spz,.splat,.ksplat,.zip" multiple="true" style="display: none;" />
|
| 30 |
|
| 31 |
<script type="module" src="js/app.js"></script>
|
| 32 |
</body>
|
|
|
|
| 26 |
<canvas id="canvas" tabindex="0"></canvas>
|
| 27 |
<div id="main-gui"></div>
|
| 28 |
<div id="second-gui"></div>
|
| 29 |
+
<input id="file-input" type="file" accept=".ply,.spz,.splat,.ksplat,.zip,.sog,application/octet-stream" multiple="true" style="display: none;" />
|
| 30 |
|
| 31 |
<script type="module" src="js/app.js"></script>
|
| 32 |
</body>
|
js/app.js
CHANGED
|
@@ -75,7 +75,17 @@ orbitControls.maxDistance = 10;
|
|
| 75 |
|
| 76 |
const fileInput = document.querySelector("#file-input");
|
| 77 |
fileInput.onchange = (event) => {
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
};
|
| 80 |
|
| 81 |
const guiOptions = {
|
|
|
|
| 75 |
|
| 76 |
const fileInput = document.querySelector("#file-input");
|
| 77 |
fileInput.onchange = (event) => {
|
| 78 |
+
const allFiles = [...event.target.files];
|
| 79 |
+
const validFiles = allFiles.filter(f => /\.(ply|spz|splat|ksplat|zip|sog)$/i.test(f.name));
|
| 80 |
+
|
| 81 |
+
if (validFiles.length !== allFiles.length) {
|
| 82 |
+
const invalidCount = allFiles.length - validFiles.length;
|
| 83 |
+
alert(`${invalidCount} file(s) skipped. Only .ply, .spz, .splat, .ksplat, .zip, and .sog files are supported.`);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if (validFiles.length > 0) {
|
| 87 |
+
loadFiles(validFiles);
|
| 88 |
+
}
|
| 89 |
};
|
| 90 |
|
| 91 |
const guiOptions = {
|