Skip to content

Commit 080ab7f

Browse files
committed
Merge branch 'release-3.1.14'
2 parents a8115b5 + 01e4f74 commit 080ab7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+5149
-3429
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ utils/onvif_tool
2626
/stage/
2727

2828
.DS_Store
29+
30+
.k*

.kilocode/api.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
api_structure:
2+
- REST-like AJAX endpoints in www/ajax/ (e.g., devices.php, events.php, storage.php)
3+
- Some endpoints grouped in subfolders (e.g., events/, media/)
4+
- C++ backend exposes HTTP API on port 7005 (e.g., /stats, /stats/cpu, /stats/memory)
5+
- Endpoints use JSON for data exchange
6+
naming_conventions:
7+
- Endpoints: lowercase, underscore-separated, .php extension for PHP endpoints
8+
- C++ API: RESTful, path-based (e.g., /stats/cpu)
9+
authentication:
10+
- Web UI: PHP session (session cookie, $_SESSION['id'])
11+
- API: HTTP Basic Auth (server-to-server, not exposed to browser)
12+
legacy_vs_modern:
13+
- Legacy: PHP endpoints in www/ajax/ (procedural, some inline SQL)
14+
- Modern: C++ API (structured, JSON, background-updated stats)

.kilocode/config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
project_name: Bluecherry
2+
summary: |
3+
Bluecherry is a modular, open-source video surveillance and management system. It includes a C++ server backend for video processing and streaming, a PHP web frontend for configuration and monitoring, and a set of tools for device management, event handling, and user access control.
4+
5+
Licensing and feature restrictions are enforced using Cryptlex, a commercial licensing and activation system. Cryptlex is integrated into both the backend (C++ daemons) and the web UI to validate license keys, enforce feature restrictions, and manage trial/activation states. Licensing checks occur at startup, during feature access, and when users attempt to activate or update their license. The system supports online activation, trial periods, and periodic license validation with the Cryptlex cloud service. License status and metadata are stored in the database (Licenses table) and referenced throughout the codebase for access control.
6+
7+
**Integration Points:**
8+
- C++ backend: Integrates Cryptlex SDK in files such as `server/v3license_server.cpp`, `server/v3license_processor.cpp`, and related headers. Handles license activation, validation, and feature gating.
9+
- PHP web UI: License management and activation handled in `www/ajax/licenses.php`, `www/template/licenses.php`, and related AJAX endpoints. UI for entering license keys, viewing status, and triggering activation.
10+
- Database: License data stored in the `Licenses` table (see `misc/sql/schema_mysql.sql`).
11+
- API calls: Backend communicates with Cryptlex cloud via HTTPS for activation, validation, and status checks. Example API endpoints include `/api/licenses.php` (PHP) and internal C++ calls to Cryptlex SDK.
12+
- Licensing logic: Enforced in both backend (C++ feature checks, daemon startup) and frontend (PHP access checks, UI restrictions).
13+
- Trial and activation: Trial status, activation, and periodic re-validation are managed by both the backend and web UI, with status reflected in the database and UI.
14+
major_components:
15+
- Bluecherry Server (C++): Handles video ingest, RTSP/HLS streaming, event processing, API, and Cryptlex license enforcement (see `server/v3license_server.cpp`, `server/v3license_processor.cpp`).
16+
- www Frontend (PHP): Web UI for configuration, monitoring, user management, and license activation/validation (see `www/ajax/licenses.php`, `www/template/licenses.php`).
17+
- RTSP/HLS Streaming: Real-time and historical video delivery.
18+
- Licensing & User Restrictions: Enforces access and feature controls using Cryptlex (see `Licenses` table, `misc/sql/schema_mysql.sql`).
19+
primary_languages:
20+
- C++
21+
- PHP
22+
- JavaScript (Chart.js, AJAX)
23+
- SQL (MySQL, SQLite)
24+
- Bash (scripts)
25+
language_guidance:
26+
- Use C++ for performance-critical backend and streaming logic, including Cryptlex SDK integration (see `server/v3license_server.cpp`).
27+
- Use PHP for web UI, AJAX endpoints, business logic, and license management UI (see `www/ajax/licenses.php`).
28+
- Use SQL for relational data and event storage, including license metadata (see `Licenses` table).
29+
- Use JavaScript for dynamic frontend features and charting.

.kilocode/database.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
major_tables:
2+
- Devices: Camera/device configuration, RTSP/ONVIF info
3+
- EventsCam: Camera event records (motion, triggers)
4+
- Users: User accounts, hashed passwords, permissions
5+
- Media: Video/audio file metadata
6+
- Storage: Storage locations and usage
7+
- Licenses: Licensing and feature restrictions
8+
- EventComments, EventTags: Metadata for events
9+
- ActiveUsers: Tracks logged-in users
10+
relationships:
11+
- EventsCam.device_id -> Devices.id
12+
- EventComments.event_id -> EventsCam.id
13+
- EventComments.user_id -> Users.id
14+
- EventTags.event_id -> EventsCam.id
15+
- EventTags.user_id -> Users.id
16+
- EventsCam.media_id -> Media.id
17+
- Storage used by Devices
18+
naming_conventions:
19+
- Tables: PascalCase (Devices, EventsCam, Users)
20+
- Columns: snake_case or lowerCamelCase
21+
orm_vs_raw_sql:
22+
- Raw SQL is used throughout (see www/ajax/ and lib/)
23+
- No ORM; queries are constructed in PHP and C++

.kilocode/naming.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
file_structure:
2+
- server/: C++ backend, daemons, streaming, and API logic
3+
- www/: PHP web frontend, AJAX endpoints, templates, and static assets
4+
- lib/: Shared C++ libraries and device integration
5+
- misc/: Scripts, SQL schema, and utilities
6+
- installer/, debian/, rpm/: Packaging and deployment
7+
- actions/, scripts/, utils/: Automation and helper scripts
8+
naming_conventions:
9+
- Tables: PascalCase (e.g., Devices, EventsCam, Users)
10+
- Columns: snake_case or lowerCamelCase
11+
- PHP: snake_case for files, PascalCase for classes, lowerCamelCase for methods
12+
- C++: snake_case for files, PascalCase for classes, lowerCamelCase for methods
13+
- API endpoints: lowercase, underscore-separated (e.g., /ajax/devices.php)
14+
- Config/constants: UPPER_SNAKE_CASE

.kilocode/preferences.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
preferred_libraries:
2+
- Chart.js (frontend charting)
3+
- Bootstrap (UI styling)
4+
- jQuery (legacy AJAX, DOM manipulation)
5+
- C++ STL (backend data structures)
6+
- MySQL, SQLite (database)
7+
- Bash (automation)
8+
design_patterns:
9+
- PHP: MVC-like separation (templates, AJAX endpoints, lib/ helpers)
10+
- C++: Daemon/service pattern for long-running processes
11+
- Use of singletons for DB and config access
12+
- Helper modules for device and protocol abstraction
13+
- REST-like AJAX endpoints for frontend-backend communication

.kilocode/security.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
security_practices:
2+
- Credentials (DB, API) stored in config files, not in code (recommended, but some legacy code may hardcode)
3+
- Session-based authentication for web UI (PHP $_SESSION['id'])
4+
- Basic Auth for API endpoints (server-side only)
5+
- Access checks in most AJAX endpoints
6+
- Use of prepared statements in some places, but some inline SQL remains
7+
- Passwords hashed in DB (Users table)
8+
- .htaccess and web server config restrict access to sensitive files
9+
do:
10+
- Store secrets in config files with restricted permissions
11+
- Use session checks for all sensitive AJAX endpoints
12+
- Use HTTPS for all web and API traffic
13+
- Regularly audit for inline SQL and credential leakage
14+
dont:
15+
- Hardcode credentials in code (move to config if found)
16+
- Expose API credentials to browser
17+
- Allow unauthenticated access to AJAX endpoints
18+
notable_unsafe_patterns:
19+
- Some inline SQL queries (risk of SQL injection if not sanitized)
20+
- Some legacy endpoints may lack full access checks

.vscode/mcp.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"servers": {
3+
"git": {
4+
"command": "uvx",
5+
"args": [
6+
"mcp-server-git"
7+
]
8+
}
9+
}
10+
}

clear_rrd_data.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Script to clear old RRD data and restart data collection
4+
# This will remove the old data and start fresh with network interface support
5+
6+
echo "Clearing old RRD data..."
7+
8+
# Backup the current RRD file
9+
sudo cp /var/lib/bluecherry/monitor.rrd /var/lib/bluecherry/monitor.rrd.backup.$(date +%Y%m%d_%H%M%S)
10+
11+
# Remove the old RRD file
12+
sudo rm /var/lib/bluecherry/monitor.rrd
13+
14+
# Restart bc-server to recreate RRD file with network interfaces
15+
echo "Restarting bc-server to recreate RRD file with network interface support..."
16+
sudo systemctl restart bc-server
17+
18+
echo "RRD data cleared. New data collection will start with network interface monitoring."
19+
echo "Check the RRD file in a few minutes to see the new data including network interfaces."
20+
echo "Network interfaces will be automatically detected and added to the monitoring."

debian/bluecherry.logrotate

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
notifempty
77
delaycompress
88
compress
9+
create 644 root bluecherry
910
postrotate
1011
/usr/lib/rsyslog/rsyslog-rotate
1112
endscript

0 commit comments

Comments
 (0)