Add object detection, tracking, mobile notifications, and search to any security camera.
remove list of files thing
roryclear474575e4c2cf
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex aebba34..9f5ba40 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -168,17 +168,25 @@return;}- if (isDirectory) {- // Directory listing- NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:fullPath error:nil];- NSArray *sortedFiles = [files sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];- dprintf(clientSocket, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");- dprintf(clientSocket, "<html><body><h1>Directory Listing</h1><ul>");- for (NSString *file in sortedFiles) {- NSString *fileLink = [file stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]];- dprintf(clientSocket, "<li>%s <a href=\"/%s\">Stream</a> <a href=\"/%s\" download>Download</a></li>", file.UTF8String, fileLink.UTF8String, fileLink.UTF8String);+ if (isDirectory) { //todo, change url maybe+ NSString *playerFilePath = [[NSBundle mainBundle] pathForResource:@"player" ofType:@"html"];+ if (playerFilePath && [[NSFileManager defaultManager] fileExistsAtPath:playerFilePath]) {+ FILE *file = fopen([playerFilePath UTF8String], "rb");+ if (file) {+ fseek(file, 0, SEEK_END);+ NSUInteger fileSize = ftell(file);+ fseek(file, 0, SEEK_SET);++ dprintf(clientSocket, "HTTP/1.1 200 OK\r\n");+ dprintf(clientSocket, "Content-Type: text/html\r\n");+ dprintf(clientSocket, "Content-Length: %lu\r\n", fileSize);+ dprintf(clientSocket, "\r\n");+ [self sendFileData:file toSocket:clientSocket withContentLength:fileSize];+ fclose(file);+ return;+ }}- dprintf(clientSocket, "</ul></body></html>");+ dprintf(clientSocket, "HTTP/1.1 500 Internal Server Error\r\n\r\n");return;}diff --git a/player.html b/clearcam/player.htmlsimilarity index 99%rename from player.htmlrename to clearcam/player.htmlindex a734ceb..2798e07 100644--- a/player.html+++ b/clearcam/player.html@@ -3,7 +3,6 @@<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">- <title>Live MP4 Stream Player</title><style>#videoContainer {position: relative;@@ -57,7 +56,6 @@</style></head><body>- <h1>Live MP4 Stream Player</h1><div id="videoContainer"><video id="videoPlayer1" playsinline webkit-playsinline muted></video><video id="videoPlayer2" playsinline webkit-playsinline muted style="display: none;"></video>