Fix: Add safe localStorage wrapper and QZ Tray toggle feature
- Created storage-utils.js with safeStorage wrapper to prevent tracking prevention errors - Updated script.js to use safeStorage for theme persistence - Added conditional QZ Tray connection based on 'Enable Scan to Boxes' toggle - Fixed 404 error by removing non-existent /api/backup/path endpoint call - Enhanced fg_scan.html to disable QZ Tray and socket connections when toggle is off - Prevents console errors when browser tracking prevention blocks localStorage access
This commit is contained in:
@@ -65,6 +65,8 @@
|
||||
<div class="main-content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<!-- Safe localStorage utility (must load first) -->
|
||||
<script src="{{ url_for('static', filename='js/storage-utils.js') }}"></script>
|
||||
{% if request.endpoint != 'main.fg_quality' %}
|
||||
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
||||
{% endif %}
|
||||
|
||||
@@ -2834,27 +2834,11 @@ document.getElementById('restore-btn')?.addEventListener('click', function() {
|
||||
|
||||
// Load backup location path
|
||||
function loadBackupPath() {
|
||||
fetch('/api/backup/path')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const pathElement = document.getElementById('backup-location-path');
|
||||
if (pathElement) {
|
||||
if (data.success && data.backup_path) {
|
||||
pathElement.textContent = data.backup_path;
|
||||
} else {
|
||||
// Use fallback if API fails
|
||||
pathElement.textContent = '/srv/quality_app/backups';
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error loading backup path:', error);
|
||||
// Set fallback if fetch fails
|
||||
const pathElement = document.getElementById('backup-location-path');
|
||||
if (pathElement) {
|
||||
pathElement.textContent = '/srv/quality_app/backups';
|
||||
}
|
||||
});
|
||||
// Set the default backup path directly (no API call needed)
|
||||
const pathElement = document.getElementById('backup-location-path');
|
||||
if (pathElement) {
|
||||
pathElement.textContent = '/srv/quality_app/backups';
|
||||
}
|
||||
}
|
||||
|
||||
// Load backup data on page load
|
||||
|
||||
Reference in New Issue
Block a user