[ai] Many (memory) improvements, cleanup script, still problems

This commit is contained in:
2025-10-06 23:13:26 +02:00
parent 083dfd6e2a
commit abfe564891
7 changed files with 190 additions and 194 deletions

View File

@@ -245,7 +245,7 @@ function displayState(state) {
var uidEl = document.getElementById("uid");
if (uidEl) uidEl.innerHTML = 'Last NFC ID: ' + (state['uid'] || '');
/* ==== Autofill convenience fields ==== */
/* Autofill convenience fields */
var fm = document.getElementById('fileManager');
if (state['filepath'] && fm && fm.style.display == 'none') {
var moveFrom = document.getElementById('moveFrom');
@@ -301,7 +301,6 @@ function playNamedSong(song) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/playnamed");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
//application/x-www-form-urlencoded
var body = song;
xhr.send("title="+encodeURIComponent(body));
}
@@ -327,8 +326,8 @@ function editMapping() {
// Validate file before upload
function validateFile(file) {
var maxSize = 50 * 1024 * 1024; // 50MB limit
var allowedTypes = ['audio/mpeg', 'audio/wav', 'audio/flac', 'audio/mp4', 'audio/ogg'];
var allowedExtensions = ['.mp3', '.wav', '.flac', '.m4a', '.ogg'];
var allowedTypes = ['audio/mpeg', 'audio/wav'];
var allowedExtensions = ['.mp3'];
if (file.size > maxSize) {
return 'File too large. Maximum size is 50MB.';
@@ -338,7 +337,7 @@ function validateFile(file) {
var hasValidExtension = allowedExtensions.some(ext => fileName.endsWith(ext));
if (!hasValidExtension) {
return 'Invalid file type. Only audio files (.mp3, .wav, .flac, .m4a, .ogg) are allowed.';
return 'Invalid file type';
}
return null; // No error
@@ -443,7 +442,7 @@ function resetUploadForm() {
document.getElementById('uploadFile').value = '';
}
/* ================= File Manager Functions ================= */
/* File Manager Functions */
function toggleFileManager() {
var fm = document.getElementById('fileManager');