fix: rename photoPicker to cameraInput/galleryInput broke JS IIFE
Two places referenced old photoPicker element ID that was removed: 1. connectFromGallery() — switched to window._connectMode flag + galleryInput.click() 2. Connect mode hook IIFE — now hooks both cameraInput and galleryInput via shared hookPicker() helper using window._connectMode instead of DOM attr This was crashing the entire inline script (TypeError on null) ~line 4040, preventing initAuth()/checkAuthGate() from ever running — no login screen.
This commit is contained in:
+23
-20
@@ -3707,12 +3707,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connectFromGallery() {
|
function connectFromGallery() {
|
||||||
const pp = document.getElementById('photoPicker');
|
window._connectMode = true;
|
||||||
if (pp) {
|
const gi = document.getElementById('galleryInput');
|
||||||
// Override the default handler for connect mode
|
if (gi) gi.click();
|
||||||
pp._connectMode = true;
|
|
||||||
pp.click();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function captureConnectPhoto() {
|
async function captureConnectPhoto() {
|
||||||
@@ -4031,20 +4028,24 @@
|
|||||||
document.getElementById('connectLabelList').innerHTML = '';
|
document.getElementById('connectLabelList').innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Hook into gallery picker for connect mode ────────────────────────────
|
// ── Hook into gallery/camera pickers for connect mode ─────────────────
|
||||||
(function() {
|
(function() {
|
||||||
const pp = document.getElementById('photoPicker');
|
function hookPicker(elId) {
|
||||||
const origHandler = pp.onchange;
|
const el = document.getElementById(elId);
|
||||||
pp.addEventListener('change', function(e) {
|
if (!el) return;
|
||||||
if (pp._connectMode) {
|
el.addEventListener('change', function(e) {
|
||||||
pp._connectMode = false;
|
if (window._connectMode) {
|
||||||
if (e.target.files && e.target.files[0]) {
|
window._connectMode = false;
|
||||||
processConnectLabelPhoto(e.target.files[0]);
|
if (e.target.files && e.target.files[0]) {
|
||||||
|
processConnectLabelPhoto(e.target.files[0]);
|
||||||
|
}
|
||||||
|
el.value = ''; // Reset so same file can be picked again
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
pp.value = ''; // Reset so same file can be picked again
|
});
|
||||||
return;
|
}
|
||||||
}
|
hookPicker('cameraInput');
|
||||||
});
|
hookPicker('galleryInput');
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
@@ -7316,7 +7317,6 @@
|
|||||||
req.onerror = (e) => { reject(e.target.error); };
|
req.onerror = (e) => { reject(e.target.error); };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function queueOfflineCreate(assetPayload, photoBlob) {
|
async function queueOfflineCreate(assetPayload, photoBlob) {
|
||||||
await openOfflineDB();
|
await openOfflineDB();
|
||||||
const entry = {
|
const entry = {
|
||||||
@@ -7578,6 +7578,8 @@
|
|||||||
return { id: null, _queued: true, machine_id: payload.machine_id, name: payload.name };
|
return { id: null, _queued: true, machine_id: payload.machine_id, name: payload.name };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function initOfflineSupport() {
|
async function initOfflineSupport() {
|
||||||
await registerServiceWorker();
|
await registerServiceWorker();
|
||||||
await openOfflineDB();
|
await openOfflineDB();
|
||||||
@@ -7587,6 +7589,7 @@
|
|||||||
if (!navigator.onLine) { showOfflineBanner(); }
|
if (!navigator.onLine) { showOfflineBanner(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.__scriptLineReached = 7593;
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
// T3: Hook EXIF GPS extraction into camera capture
|
// T3: Hook EXIF GPS extraction into camera capture
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
@@ -7635,7 +7638,7 @@
|
|||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
// INIT — only lightweight auth & offline. Camera/GPS/assets start after login.
|
// INIT — only lightweight auth & offline. Camera/GPS/assets start after login.
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
initOfflineSupport();
|
initOfflineSupport().catch(e => console.warn('[Offline] init failed:', e));
|
||||||
initAuth();
|
initAuth();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user