- **Auth Rules Implementation**: Added blacklist/whitelist enforcement in websockets.c
- Events are now checked against auth_rules table before acceptance
- Blacklist blocks specific pubkeys, whitelist enables allow-only mode
- Made check_database_auth_rules() public for cross-module access
- **Subscription Filtering Fixes**:
- Added missing 'ids' filter support in SQL query building
- Fixed test expectations to not require exact event counts for kind filters
- Improved filter validation and error handling
- **Ephemeral Events Compliance**:
- Modified SQL queries to exclude kinds 20000-29999 from historical queries
- Maintains broadcasting to active subscribers while preventing storage/retrieval
- Ensures NIP-01 compliance for ephemeral event handling
- **Comprehensive Testing**:
- Created white_black_test.sh with full blacklist/whitelist functionality testing
- Tests verify blocked posting for blacklisted users
- Tests verify whitelist-only mode when whitelist rules exist
- Includes proper auth rule clearing between test phases
- **Code Quality**:
- Added proper function declarations to websockets.h
- Improved error handling and logging throughout
- Enhanced test script with clear pass/fail reporting
- Add relay_seckey table for secure private key storage
- Implement store_relay_private_key() and get_relay_private_key() functions
- Remove relay private key from public configuration events (kind 33334)
- Update first-time startup sequence to store keys securely after DB init
- Add proper validation and error handling for private key operations
- Fix timing issue where private key storage was attempted before DB initialization
- Security improvement: relay private keys no longer exposed in public events
- Update function declaration in config.h
- Update function definition in config.c
- Update function calls in config.c and main.c
- Maintain consistency with .db file extension naming convention
This resolves the inconsistency between database file extension (.db) and function names (nrdb)
- Add cli_options_t structure for extensible command line options
- Implement port override in create_default_config_event()
- Update main() with robust CLI parsing and validation
- Add comprehensive help text documenting first-time only behavior
- Ensure CLI options only affect initial configuration event creation
- Maintain event-based configuration architecture for ongoing operation
- Include comprehensive error handling and input validation
- Add documentation in CLI_PORT_OVERRIDE_IMPLEMENTATION.md
Tested: First-time startup uses CLI port, subsequent startups use database config
- Change database extension from .nrdb to .db for standard SQLite convention
- Modify make_and_restart_relay.sh to run executable from build/ directory
- Database files now created in build/ directory alongside executable
- Enhanced --preserve-database flag with backup/restore functionality
- Updated source code references in config.c and main.c
- Port auto-increment functionality remains fully functional
- Add --database-path/-D command line parameter for database override
- Store actual database and config file paths as metadata in config tables
- Fix circular dependency by making command line overrides runtime-only
- Support multiple relay instances with separate databases and configurations
- Clean path normalization removes redundant ./ prefixes
- New fields: database_location and config_location for tracking actual usage
- Added -D/--database-path parameter to specify custom database file location
- Fixed port override timing to apply after configuration system initialization
- Updated help message with examples showing database path usage
- Supports both absolute and relative paths for database location
- Enables running multiple relay instances with separate databases
- Resolves database path issues when running from /usr/local/bin