Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

only show used features

roryclear1d4a4b7fdbb1
diff --git a/clearcam.py b/clearcam.py
index edeef9e..eed051f 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -710,6 +710,9 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
self.send_200()
return
+ if parsed_path.path == "/get_features":
+ self.send_200({"object_search":use_clip, "face_search":use_face})
+ return
if parsed_path.path == "/get_max_storage":
self.send_200(body={"max_gb":self.server.max_gb})
return
diff --git a/mainview.html b/mainview.html
index 2df86a6..21bbde5 100644
--- a/mainview.html
+++ b/mainview.html
@@ -1381,7 +1381,7 @@
<div id="searchSpinner" class="spinner" style="display: none;"></div>
</button>
- <button onclick="clearSearch()" style="padding: 6px 12px; background: #6c757d; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s;">Clear</button>
+ <button onclick="clearSearch()" id="clearButton" style="padding: 6px 12px; background: #6c757d; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s;">Clear</button>
</div>
<div id="eventImagesContainer">
<p style="text-align:center; color:#666; width:100%;">No events detected yet.</p>
@@ -2381,6 +2381,36 @@
};
}
+ async function loadFeatureFlags() {
+ const response = await fetch('/get_features');
+ const features = await response.json();
+ const uploadContainer = document.querySelector('div[style*="position: relative; display: flex"]');
+ const imageUploadLabel = uploadContainer.querySelector('label[for="imageUpload"]');
+ const faceUploadLabel = uploadContainer.querySelector('label[for="faceUpload"]');
+ const searchInput = document.getElementById('imageSearchInput');
+ const tooltip = uploadContainer.querySelector('.tooltip');
+ imageUploadLabel.style.display = features.object_search ? 'flex' : 'none';
+ faceUploadLabel.style.display = features.face_search ? 'flex' : 'none';
+ searchInput.style.display = features.object_search ? 'inline-block' : 'none';
+ const searchButton = document.getElementById('searchButton');
+ searchButton.style.display = (features.object_search || features.face_search) ? 'flex' : 'none';
+ const clearButton = document.getElementById('clearButton');
+ clearButton.style.display = (features.object_search || features.face_search) ? 'flex' : 'none';
+ const tooltipText = tooltip.querySelector('.tooltiptext');
+ if (features.object_search && features.face_search) {
+ tooltipText.textContent = 'Use an image or face to find similar objects in your footage.';
+ } else if (features.object_search) {
+ tooltipText.textContent = 'Use an image to find similar objects in your footage.';
+ } else if (features.face_search) {
+ tooltipText.textContent = 'Use a face image to find matching people in your footage.';
+ }
+ const searchRow = uploadContainer.closest('div[style*="display: flex; align-items: center"]');
+ if (searchRow && !features.object_search && !features.face_search) {
+ searchRow.style.display = 'none';
+ }
+ }
+ document.addEventListener('DOMContentLoaded', loadFeatureFlags);
+
function isClickOnPoint(point, clickX, clickY) {
const pointRect = point.getBoundingClientRect();
const previewRect = document.getElementById("zonePreview").getBoundingClientRect();