Skip to content

Commit 1004857

Browse files
feat: Integrate Inja template engine and multi-language support for website crawler
- Disabled test builds in the build script for cleaner deployment. - Added Inja template engine for rendering HTML with localization support. - Implemented multi-language capabilities with English and Persian translations. - Created new HTML templates for crawl request interface, enhancing user experience. - Introduced JSON localization files for dynamic content rendering based on user language selection. - Updated HomeController to handle template rendering and localization data loading. These changes significantly enhance the website crawler's interface, making it more accessible and user-friendly for a diverse audience.
1 parent 8aff144 commit 1004857

19 files changed

+6076
-677
lines changed

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ find_package(Threads REQUIRED)
2525
find_path(WEBSOCKETPP_INCLUDE_DIR NAMES websocketpp/endpoint.hpp PATHS /usr/include /usr/local/include)
2626
find_path(NLOHMANN_JSON_INCLUDE_DIR NAMES nlohmann/json.hpp PATHS /usr/include /usr/local/include)
2727

28+
# Add Inja template engine (header-only)
29+
find_path(INJA_INCLUDE_DIR NAMES inja/inja.hpp PATHS ${CMAKE_SOURCE_DIR}/include /usr/include /usr/local/include)
30+
if(INJA_INCLUDE_DIR)
31+
set(INJA_AVAILABLE TRUE)
32+
message(STATUS "Inja found at: ${INJA_INCLUDE_DIR}")
33+
else()
34+
message(FATAL_ERROR "Inja header file not found. Please run: mkdir -p include/inja && curl -L https://github.com/pantor/inja/releases/download/v3.4.0/inja.hpp -o include/inja/inja.hpp")
35+
endif()
36+
2837
# Remove WebSocket++ and nlohmann/json checks for browserless
2938
# Always build BrowserlessClient if referenced
3039

@@ -65,6 +74,11 @@ include_directories(
6574
# Always include BrowserlessClient if referenced
6675
include_directories(${WEBSOCKETPP_INCLUDE_DIR} ${NLOHMANN_JSON_INCLUDE_DIR})
6776

77+
# Add Inja include directories if available
78+
if(INJA_AVAILABLE AND INJA_INCLUDE_DIR)
79+
include_directories(${INJA_INCLUDE_DIR})
80+
endif()
81+
6882
# Add Redis include directories if available
6983
if(REDIS_AVAILABLE)
7084
include_directories(${REDIS_INCLUDE_DIRS})
@@ -138,6 +152,8 @@ target_link_libraries(server
138152
Threads::Threads
139153
)
140154

155+
# Link Inja if available (header-only library, no linking required)
156+
141157
# Link Redis libraries if available
142158
if(REDIS_AVAILABLE)
143159
target_link_libraries(server PRIVATE ${REDIS_LIBRARIES})

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ cmake .. \
311311
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
312312
-DCMAKE_CXX_EXTENSIONS=OFF \
313313
-DPkgConfig_DIR=/usr/share/pkgconfig \
314-
-DBUILD_TESTS=ON
314+
-DBUILD_TESTS=OFF
315315

316316
# Build the project
317317
echo "Building project..."

0 commit comments

Comments
 (0)