diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 15b241c1..b1ed0fd8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,15 +1,18 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 # Avoid interactive prompts during package install ENV DEBIAN_FRONTEND=noninteractive +# Install Node.js 20.x from NodeSource repository (required for selenium-webdriver and other packages) +RUN apt-get update && apt-get install -y curl ca-certificates gnupg \ + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs + # Install required packages RUN apt-get update && apt-get install -y \ build-essential \ cmake \ libsqlite3-dev \ - nodejs \ - npm \ pkg-config \ libavcodec-dev \ libavformat-dev \ @@ -20,6 +23,8 @@ RUN apt-get update && apt-get install -y \ libcjson-dev \ libwolfssl-dev \ libssl-dev \ + file \ + systemd \ && apt-get clean # Create a non-root user for VS Code diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b470b8ed..594f3e1d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,5 @@ ], "forwardPorts": [], "postCreateCommand": "npm install", - "remoteUser": "vscode" + "remoteUser": "root" } \ No newline at end of file diff --git a/.gitignore b/.gitignore index 30ea8f3e..836466d8 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,7 @@ Makefile /external # node modules +node_modules/ web/node_modules/ # Web build artifacts (built during CI/CD, not checked in) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5913e14f..5cb7c2b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,13 +150,26 @@ else() endif() # Find cJSON -find_package(cJSON QUIET) -if(NOT cJSON_FOUND) - # If not found via find_package, try pkg-config - pkg_check_modules(CJSON cjson) - if(NOT CJSON_FOUND) - message(STATUS "cJSON not found via find_package or pkg-config, will use bundled version") - set(CJSON_BUNDLED TRUE) +pkg_check_modules(CJSON QUIET libcjson) +if(CJSON_FOUND) + # Use pkg-config result (CJSON_LIBRARIES is automatically set) + message(STATUS "Found cJSON via pkg-config: ${CJSON_LIBRARIES}") +else() + # Try alternative pkg-config name + pkg_check_modules(CJSON QUIET cjson) + if(CJSON_FOUND) + message(STATUS "Found cJSON via pkg-config (alternative): ${CJSON_LIBRARIES}") + else() + # Try find_package as last resort + find_package(cJSON QUIET) + if(cJSON_FOUND) + set(CJSON_LIBRARIES cjson) + set(CJSON_FOUND TRUE) # Set this for consistency + message(STATUS "Found cJSON via find_package") + else() + message(STATUS "cJSON not found via pkg-config or find_package, will use bundled version") + set(CJSON_BUNDLED TRUE) + endif() endif() endif() diff --git a/include/storage/storage_manager_streams.h b/include/storage/storage_manager_streams.h index 9e631275..09e8dda7 100644 --- a/include/storage/storage_manager_streams.h +++ b/include/storage/storage_manager_streams.h @@ -6,7 +6,7 @@ #ifndef LIGHTNVR_STORAGE_MANAGER_STREAMS_H #define LIGHTNVR_STORAGE_MANAGER_STREAMS_H -#include "../../external/cjson/cJSON.h" +#include /** * Stream storage usage information diff --git a/include/storage/storage_manager_streams_cache.h b/include/storage/storage_manager_streams_cache.h index eda158aa..0826cbc0 100644 --- a/include/storage/storage_manager_streams_cache.h +++ b/include/storage/storage_manager_streams_cache.h @@ -8,7 +8,7 @@ #include #include "storage/storage_manager_streams.h" -#include "../../external/cjson/cJSON.h" +#include /** * Initialize the storage manager streams cache diff --git a/src/core/logger_json.c b/src/core/logger_json.c index 150ea668..504b9891 100644 --- a/src/core/logger_json.c +++ b/src/core/logger_json.c @@ -11,7 +11,7 @@ #include "core/logger.h" #include "core/logger_json.h" -#include "../external/cjson/cJSON.h" +#include // JSON logger state static struct { diff --git a/src/storage/storage_manager_streams.c b/src/storage/storage_manager_streams.c index d1b299ec..22a7c0dc 100644 --- a/src/storage/storage_manager_streams.c +++ b/src/storage/storage_manager_streams.c @@ -16,7 +16,7 @@ #include "storage/storage_manager_streams.h" #include "core/logger.h" #include "core/config.h" -#include "../../external/cjson/cJSON.h" +#include /** * Get storage usage per stream diff --git a/src/storage/storage_manager_streams_cache.c b/src/storage/storage_manager_streams_cache.c index 21db697b..2790bad6 100644 --- a/src/storage/storage_manager_streams_cache.c +++ b/src/storage/storage_manager_streams_cache.c @@ -16,7 +16,7 @@ #include "storage/storage_manager.h" #include "core/logger.h" #include "core/config.h" -#include "../../external/cjson/cJSON.h" +#include // Forward declarations for functions from storage_manager_streams.c extern int get_stream_storage_usage(const char *storage_path, stream_storage_info_t *stream_info, int max_streams); diff --git a/src/video/go2rtc/go2rtc_api.c b/src/video/go2rtc/go2rtc_api.c index 4de8372c..460ba687 100644 --- a/src/video/go2rtc/go2rtc_api.c +++ b/src/video/go2rtc/go2rtc_api.c @@ -17,7 +17,7 @@ #include #include #include -#include "../../external/cjson/cJSON.h" +#include // API client configuration static char *g_api_host = NULL; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e07be9ee..54bbf5ff 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -56,6 +56,8 @@ if(ENABLE_SOD) ) if(CJSON_BUNDLED) target_link_libraries(test_sod_unified cjson_lib) + elseif(CJSON_FOUND) + target_link_libraries(test_sod_unified ${CJSON_LIBRARIES}) endif() target_link_libraries(test_sod_voc @@ -74,6 +76,8 @@ if(ENABLE_SOD) ) if(CJSON_BUNDLED) target_link_libraries(test_sod_voc cjson_lib) + elseif(CJSON_FOUND) + target_link_libraries(test_sod_voc ${CJSON_LIBRARIES}) endif() # Set output directory for test binaries @@ -136,6 +140,8 @@ target_link_libraries(test_stream_detection ) if(CJSON_BUNDLED) target_link_libraries(test_stream_detection cjson_lib) +elseif(CJSON_FOUND) + target_link_libraries(test_stream_detection ${CJSON_LIBRARIES}) endif() if(ENABLE_SOD)