diff --git a/approve_devices.js b/approve_devices.js new file mode 100644 index 0000000..5ea6e8f --- /dev/null +++ b/approve_devices.js @@ -0,0 +1,18 @@ +const axios = require('axios'); + +// Simple script to approve all pending devices for testing +async function approveAllDevices() { + try { + // First, we need to get an auth token - for now let's use the direct database approach + console.log('This script would need authentication. Instead, run these SQL commands:'); + console.log(''); + console.log('UPDATE devices SET is_approved = true, is_active = true WHERE is_approved = false;'); + console.log(''); + console.log('Or use the admin interface to approve devices individually.'); + + } catch (error) { + console.error('Error approving devices:', error.message); + } +} + +approveAllDevices(); diff --git a/server/routes/detectors.js b/server/routes/detectors.js index 54fdba7..c030451 100644 --- a/server/routes/detectors.js +++ b/server/routes/detectors.js @@ -185,6 +185,8 @@ async function handleHeartbeat(req, res) { approval_required: true }); } + + // Device exists and is approved - continue with heartbeat processing // Update device's last heartbeat await device.update({ last_heartbeat: new Date() });