@blueharford/scrypted-spatial-awareness 0.6.19 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +8 -0
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/main.ts +6 -0
- package/src/ui/editor-html.ts +2 -0
package/out/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -1062,18 +1062,24 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
|
|
|
1062
1062
|
if (request.method === 'GET') {
|
|
1063
1063
|
const topologyJson = this.storage.getItem('topology');
|
|
1064
1064
|
const topology = topologyJson ? JSON.parse(topologyJson) : createEmptyTopology();
|
|
1065
|
+
this.console.log(`[Topology API] GET - drawnZones: ${topology.drawnZones?.length || 0}`);
|
|
1065
1066
|
response.send(JSON.stringify(topology), {
|
|
1066
1067
|
headers: { 'Content-Type': 'application/json' },
|
|
1067
1068
|
});
|
|
1068
1069
|
} else if (request.method === 'PUT' || request.method === 'POST') {
|
|
1069
1070
|
try {
|
|
1070
1071
|
const topology = JSON.parse(request.body!) as CameraTopology;
|
|
1072
|
+
this.console.log(`[Topology API] PUT received - drawnZones: ${topology.drawnZones?.length || 0}`);
|
|
1073
|
+
if (topology.drawnZones?.length) {
|
|
1074
|
+
this.console.log(`[Topology API] Zone names: ${topology.drawnZones.map(z => z.name).join(', ')}`);
|
|
1075
|
+
}
|
|
1071
1076
|
this.storage.setItem('topology', JSON.stringify(topology));
|
|
1072
1077
|
await this.startTrackingEngine(topology);
|
|
1073
1078
|
response.send(JSON.stringify({ success: true }), {
|
|
1074
1079
|
headers: { 'Content-Type': 'application/json' },
|
|
1075
1080
|
});
|
|
1076
1081
|
} catch (e) {
|
|
1082
|
+
this.console.error(`[Topology API] PUT error:`, e);
|
|
1077
1083
|
response.send(JSON.stringify({ error: 'Invalid topology JSON' }), {
|
|
1078
1084
|
code: 400,
|
|
1079
1085
|
headers: { 'Content-Type': 'application/json' },
|
package/src/ui/editor-html.ts
CHANGED
|
@@ -1609,9 +1609,11 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1609
1609
|
// Zone list
|
|
1610
1610
|
const zoneList = document.getElementById('zone-list');
|
|
1611
1611
|
const zones = topology.drawnZones || [];
|
|
1612
|
+
console.log('[updateUI] Zone list update - topology.drawnZones:', zones.length, 'zones');
|
|
1612
1613
|
if (zones.length === 0) {
|
|
1613
1614
|
zoneList.innerHTML = '<div class="zone-item" style="color: #666; text-align: center; cursor: default; padding: 8px;">No zones drawn</div>';
|
|
1614
1615
|
} else {
|
|
1616
|
+
console.log('[updateUI] Rendering', zones.length, 'zones:', zones.map(z => z.name).join(', '));
|
|
1615
1617
|
zoneList.innerHTML = zones.map(z => {
|
|
1616
1618
|
const color = ZONE_STROKE_COLORS[z.type] || ZONE_STROKE_COLORS.custom;
|
|
1617
1619
|
return '<div class="camera-item ' + (selectedItem?.type === 'zone' && selectedItem?.id === z.id ? 'selected' : '') + '" onclick="selectZone(\\'' + z.id + '\\')" style="border-left: 3px solid ' + color + ';"><div class="camera-name">' + z.name + '</div><div class="camera-info">' + z.type + ' | ' + z.polygon.length + ' points</div></div>';
|