@blueharford/scrypted-spatial-awareness 0.1.3 → 0.1.5
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/package.json +1 -1
- package/src/main.ts +92 -6
- package/src/ui/editor-html.ts +2 -2
package/dist/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -335,19 +335,105 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
|
|
|
335
335
|
async getSettings(): Promise<Setting[]> {
|
|
336
336
|
const settings = await this.storageSettings.getSettings();
|
|
337
337
|
|
|
338
|
-
// Topology editor
|
|
338
|
+
// Topology editor button that opens modal overlay
|
|
339
339
|
settings.push({
|
|
340
340
|
key: 'topologyEditor',
|
|
341
341
|
title: 'Topology Editor',
|
|
342
342
|
type: 'html' as any,
|
|
343
343
|
value: `
|
|
344
|
-
<
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
<style>
|
|
345
|
+
.sa-modal-overlay {
|
|
346
|
+
display: none;
|
|
347
|
+
position: fixed;
|
|
348
|
+
top: 0;
|
|
349
|
+
left: 0;
|
|
350
|
+
right: 0;
|
|
351
|
+
bottom: 0;
|
|
352
|
+
background: rgba(0, 0, 0, 0.85);
|
|
353
|
+
z-index: 10000;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
}
|
|
357
|
+
.sa-modal-overlay.active {
|
|
358
|
+
display: flex;
|
|
359
|
+
}
|
|
360
|
+
.sa-modal-container {
|
|
361
|
+
width: 95vw;
|
|
362
|
+
height: 90vh;
|
|
363
|
+
max-width: 1600px;
|
|
364
|
+
background: #1a1a2e;
|
|
365
|
+
border-radius: 12px;
|
|
366
|
+
overflow: hidden;
|
|
367
|
+
position: relative;
|
|
368
|
+
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
|
|
369
|
+
}
|
|
370
|
+
.sa-modal-close {
|
|
371
|
+
position: absolute;
|
|
372
|
+
top: 10px;
|
|
373
|
+
right: 10px;
|
|
374
|
+
z-index: 10001;
|
|
375
|
+
background: #e94560;
|
|
376
|
+
color: white;
|
|
377
|
+
border: none;
|
|
378
|
+
width: 36px;
|
|
379
|
+
height: 36px;
|
|
380
|
+
border-radius: 50%;
|
|
381
|
+
font-size: 20px;
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: center;
|
|
385
|
+
justify-content: center;
|
|
386
|
+
}
|
|
387
|
+
.sa-modal-close:hover {
|
|
388
|
+
background: #ff6b6b;
|
|
389
|
+
}
|
|
390
|
+
.sa-modal-iframe {
|
|
391
|
+
width: 100%;
|
|
392
|
+
height: 100%;
|
|
393
|
+
border: none;
|
|
394
|
+
}
|
|
395
|
+
.sa-open-btn {
|
|
396
|
+
background: linear-gradient(135deg, #e94560 0%, #0f3460 100%);
|
|
397
|
+
color: white;
|
|
398
|
+
border: none;
|
|
399
|
+
padding: 14px 28px;
|
|
400
|
+
border-radius: 8px;
|
|
401
|
+
font-size: 15px;
|
|
402
|
+
font-weight: 600;
|
|
403
|
+
cursor: pointer;
|
|
404
|
+
display: inline-flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
gap: 10px;
|
|
407
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
408
|
+
}
|
|
409
|
+
.sa-open-btn:hover {
|
|
410
|
+
transform: translateY(-2px);
|
|
411
|
+
box-shadow: 0 8px 20px rgba(233, 69, 96, 0.4);
|
|
412
|
+
}
|
|
413
|
+
.sa-btn-container {
|
|
414
|
+
padding: 20px;
|
|
415
|
+
background: #16213e;
|
|
416
|
+
border-radius: 8px;
|
|
417
|
+
text-align: center;
|
|
418
|
+
}
|
|
419
|
+
.sa-btn-desc {
|
|
420
|
+
color: #888;
|
|
421
|
+
margin-bottom: 15px;
|
|
422
|
+
font-size: 14px;
|
|
423
|
+
}
|
|
424
|
+
</style>
|
|
425
|
+
<div class="sa-btn-container">
|
|
426
|
+
<p class="sa-btn-desc">Configure camera positions, connections, and transit times</p>
|
|
427
|
+
<button class="sa-open-btn" onclick="document.getElementById('sa-topology-modal').classList.add('active')">
|
|
428
|
+
<span>⚙</span> Open Topology Editor
|
|
349
429
|
</button>
|
|
350
430
|
</div>
|
|
431
|
+
<div id="sa-topology-modal" class="sa-modal-overlay" onclick="if(event.target===this)this.classList.remove('active')">
|
|
432
|
+
<div class="sa-modal-container">
|
|
433
|
+
<button class="sa-modal-close" onclick="document.getElementById('sa-topology-modal').classList.remove('active')">×</button>
|
|
434
|
+
<iframe class="sa-modal-iframe" src="/endpoint/@blueharford/scrypted-spatial-awareness/ui/editor"></iframe>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
351
437
|
`,
|
|
352
438
|
group: 'Topology',
|
|
353
439
|
});
|
package/src/ui/editor-html.ts
CHANGED
|
@@ -233,7 +233,7 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
233
233
|
|
|
234
234
|
async function loadTopology() {
|
|
235
235
|
try {
|
|
236
|
-
const response = await fetch('api/topology');
|
|
236
|
+
const response = await fetch('../api/topology');
|
|
237
237
|
if (response.ok) {
|
|
238
238
|
topology = await response.json();
|
|
239
239
|
if (topology.floorPlan?.imageData) {
|
|
@@ -251,7 +251,7 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
251
251
|
async function saveTopology() {
|
|
252
252
|
try {
|
|
253
253
|
setStatus('Saving...', 'warning');
|
|
254
|
-
const response = await fetch('api/topology', {
|
|
254
|
+
const response = await fetch('../api/topology', {
|
|
255
255
|
method: 'PUT',
|
|
256
256
|
headers: { 'Content-Type': 'application/json' },
|
|
257
257
|
body: JSON.stringify(topology)
|