Add object detection, tracking, mobile notifications, and search to any security camera.
show image
roryclear7ef80fe81f9e
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex 6699685..0c74e65 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -703,7 +703,7 @@NSArray<NSString *> *rangeParts = [byteRange componentsSeparatedByString:@"-"];NSUInteger start = [rangeParts[0] integerValue];NSUInteger end = (rangeParts.count > 1 && rangeParts[1].length > 0) ? [rangeParts[1] integerValue] : fileSize - 1;-+if (start >= fileSize || end >= fileSize || start > end) {dprintf(clientSocket, "HTTP/1.1 416 Requested Range Not Satisfiable\r\n");dprintf(clientSocket, "Content-Range: bytes */%lu\r\n", fileSize);@@ -732,7 +732,14 @@dprintf(clientSocket, "Content-Length: %lu\r\n", fileSize);dprintf(clientSocket, "\r\n");[self sendFileData:file toSocket:clientSocket withContentLength:fileSize];+ } else if ([fileExtension isEqualToString:@"png"]) {+ dprintf(clientSocket, "HTTP/1.1 200 OK\r\n");+ dprintf(clientSocket, "Content-Type: image/png\r\n");+ dprintf(clientSocket, "Content-Length: %lu\r\n", fileSize);+ dprintf(clientSocket, "\r\n");+ [self sendFileData:file toSocket:clientSocket withContentLength:fileSize];}+fclose(file);}@@ -910,7 +917,8 @@NSDictionary *eventDict = @{@"timeStamp": readableDate, // Readable date format@"classType": [event valueForKey:@"classType"] ?: @"unknown",- @"quantity": [event valueForKey:@"quantity"] ?: @(0)+ @"quantity": [event valueForKey:@"quantity"] ?: @(0),+ @"imageURL": [NSString stringWithFormat:@"images/%f.png", timestamp]};[eventDataArray addObject:eventDict];}diff --git a/clearcam/downloads.html b/clearcam/downloads.htmlindex 74afcdc..4150b33 100644--- a/clearcam/downloads.html+++ b/clearcam/downloads.html@@ -47,8 +47,12 @@dateObj.getMinutes() * 60 +dateObj.getSeconds() - 2; // Slightly before so you can see+ // Directly use the imageURL from event data+ const imageURL = event.imageURL;+const row = document.createElement('tr');row.innerHTML = `+ <td><img src="${imageURL}" alt="Event Image" style="width: 100px; height: auto; max-height: 100px;"></td><td>${event.classType}</td><td>${event.quantity}</td><td>${event.timeStamp}</td>@@ -181,6 +185,7 @@<table border="1"><thead><tr>+ <th>Image</th> <!-- Added column for image --><th>Class Type</th><th>Quantity</th><th>Time Stamp</th>