Commit Graph

133 Commits

Author SHA1 Message Date
agessaman
b200c3f500 Enhance WxCommand logic for period handling and improve map uploader service memory management
- Updated WxCommand to better handle period identification for tomorrow's weather, ensuring accurate retrieval of daytime and nighttime periods based on current conditions.
- Added a cleanup mechanism in MapUploaderService to manage memory usage by periodically removing old entries from seen_adverts, preventing unbounded growth and improving performance.
- Optimized packet capture service to utilize indexed lookups for faster data retrieval and ensure fallback mechanisms for backward compatibility.
2025-12-22 23:33:17 -08:00
agessaman
43c217fb0d Update map uploader service documentation for coordinate validation
- Clarified comments in config.ini.example and map_uploader_service.py to specify that adverts with any coordinate exactly 0.0 are considered invalid and will be skipped during uploads. This enhances understanding of the coordinate validation logic in the map uploader service.
2025-12-22 12:02:56 -08:00
agessaman
7e80dedb6d Add map uploader configuration and update requirements
- Introduced a new [MapUploader] section in config.ini.example to configure the map uploader service, including options for enabling the service, API endpoint, private key path, re-upload interval, and verbose logging.
- Updated requirements.txt to include cryptography and pynacl packages for enhanced security features in the map uploader service.
2025-12-22 11:43:25 -08:00
agessaman
c3d3c85f01 Implement service plugin architecture and enhance weather service configuration
- Introduced a new service plugin architecture in core.py to manage multiple services, including the packet capture service.
- Updated the configuration file (config.ini.example) to include a new [Weather_Service] section for enabling weather forecasts and alerts, along with relevant settings.
- Enhanced the base service plugin class to support optional configuration section names and service descriptions for better metadata management.
- Improved the packet capture service with explicit configuration section and description for clarity.
2025-12-22 10:29:43 -08:00
agessaman
5f65d36d8c added a http internet connection check fallback to http 2025-12-21 22:19:16 -08:00
agessaman
d6aec8ce29 Add service plugins configuration and packet capture integration
- Introduced a new [PacketCapture] section in config.ini.example to enable packet capture service with options for output file, verbosity, and MQTT configuration.
- Updated core.py to initialize and manage the packet capture service, including starting and stopping the service during bot operation.
- Enhanced DiceCommand to support mixed dice notation and added functionality for decade dice rolls, improving user experience for tabletop gaming commands.
- Updated translations to reflect new dice command usage and descriptions, ensuring clarity for users.
2025-12-21 15:44:46 -08:00
agessaman
32929dedad Update CommandManager with internet connectivity checks for commands
- Introduced caching mechanisms for internet connectivity status in CommandManager to optimize performance and reduce redundant checks.
- Updated command execution logic to skip commands requiring internet access when connectivity is unavailable, improving user experience and error handling.
- Added synchronous and asynchronous utility functions for checking internet connectivity in utils.py.
- Marked relevant commands (e.g., AlertCommand, AqiCommand, DadJokeCommand) as requiring internet access to ensure proper execution conditions.
2025-12-17 12:38:54 -08:00
agessaman
f0b4f1e078 Refine command manager logging and enhance weather command alert handling
- Updated CommandManager to log rate limiting warnings only for meaningful wait times, avoiding misleading messages.
- Enhanced WxCommand to support a new "alerts" keyword for fetching weather alerts, with special handling for alert data.
- Improved alert fetching logic to differentiate duplicate special statements and prioritize alerts based on severity and urgency.
- Added methods for compactly formatting alerts and abbreviating city names for better display in responses.
2025-12-16 18:28:26 -08:00
agessaman
399a6b9773 Fixed country counts in WebViewer 2025-12-13 21:57:25 -08:00
agessaman
f525d2e1d0 Enhance message handling and web viewer with path information support
- Updated MessageHandler to extract and store path information from packet_info and routing_info, improving data tracking.
- Added a new API endpoint in the web viewer for decoding path hex strings to repeater names.
- Enhanced the contacts template to display path information with tooltips, improving user experience.
- Implemented tooltip functionality for path data in the web viewer, allowing users to view detailed repeater information on hover.
2025-12-13 14:41:56 -08:00
agessaman
bdd3a0fd41 Enhance SportsCommand with improved game fetching logic
- Added mappings for Professional Women's Hockey League (PWHL) teams with placeholders for team IDs.
- Updated city mappings to include PWHL teams for relevant cities.
- Enhanced game fetching logic to prioritize live games, recent past games, and upcoming games within specified timeframes.
- Introduced methods for fetching and formatting team schedules, improving user experience for schedule queries.
- Improved handling of live event data to ensure real-time score updates for ongoing games.
2025-12-12 21:15:40 -08:00
agessaman
4abd6fff69 Update configuration and command handling for prefix settings
- Simplified comments in config.ini.example and core.py to clarify API endpoint configuration.
- Changed default value for prefix_free_days from 30 to 7 in prefix_command.py to align with recent adjustments in prefix handling logic.
- Enhanced logic in prefix_command.py to prioritize API cache for used prefixes and fallback to database only when necessary, improving efficiency and accuracy in prefix data retrieval.
2025-12-11 20:41:31 -08:00
agessaman
4d997afbcc Remove 'repeater_interactions' from the DBManager class whitelist as it isn't used. 2025-12-09 22:08:40 -08:00
agessaman
d62e63cdb9 Apply code quality improvements to PR16 security enhancements
Security Improvements:
- Add DNS timeout (2.0s default) to validate_external_url() to prevent DoS
  attacks from malicious URLs causing DNS resolution to hang
- Make path validation OS-aware: supports Windows, macOS (Darwin), and Linux
  with platform-specific dangerous path detection
- Add validation for negative max_length values in sanitize_input()

Code Quality Improvements:
- Extract bot_root property in MeshCoreBot class to eliminate code duplication
  (was calculated twice in __init__ and setup_logging)
- Use explicit bot_root directory instead of '.' for predictable path validation
  in both database and log file path validation
- Make sanitize_input() max_length parameter Optional to allow disabling length
  check for radio messages (firmware enforces 150-char limit at hardware level)
- Update message_handler.py to use max_length=None for radio messages while
  preserving control character stripping for security
- Replace inline regex with centralized validate_pubkey_format() function in
  base_command.py for consistency and maintainability
- Improve documentation: add comments about socket timeout behavior and
  firmware-enforced message length limits

All improvements have been tested and verified:
- Syntax checks pass
- All functions work correctly
- No circular dependencies
- Bot initializes successfully with all attributes present

Files modified:
- modules/security_utils.py: DNS timeout, OS-aware paths, Optional max_length
- modules/core.py: bot_root property, explicit base directory usage
- modules/message_handler.py: max_length=None for radio messages
- modules/commands/base_command.py: centralized validation function
2025-12-09 21:44:42 -08:00
eddieoz
8a35dc8270 feat: Add security utilities for path validation, SQL injection prevention, and input sanitization. 2025-12-09 21:26:42 -08:00
agessaman
7bacd5b485 Implement upgrade mode in install-service.sh for non-destructive updates and enhance channel fetching logic in MessageScheduler to eliminate periodic refresh. The upgrade mode allows users to update files and dependencies without losing existing configurations. Additionally, the channel fetching now occurs only once on launch to prevent data loss during updates. 2025-12-07 19:40:38 -08:00
agessaman
d446640a50 Enhance channel fetching logic in ChannelManager to include device connectivity checks and implement timeout protection during channel refresh in MessageScheduler. Introduce sender location prioritization in PathCommand and TestCommand for improved repeater selection accuracy. Update logging for better diagnostics on fetch operations and proximity calculations. 2025-12-07 14:02:14 -08:00
agessaman
cc53ab4268 Refactor proximity selection logic in PathCommand and TestCommand to prioritize bot location for the last repeater. Introduce configurable recency and proximity weights for scoring, enhancing the accuracy of repeater selection. Update logging for better debugging of selection scores. 2025-12-06 19:38:03 -08:00
agessaman
36b6746550 Enhance channel management and dark mode styling in web viewer. Update BotDataViewer to dynamically retrieve max channel limits from configuration, improving error messages for channel availability. Implement dark mode styles for modals, tables, and other UI elements across multiple templates, ensuring better contrast and readability. Update JavaScript logic in RadioManager to reflect dynamic channel limits and provide user feedback on available slots. 2025-12-06 19:03:55 -08:00
agessaman
d52b0f8744 added backup script for the databases, added device time setting to radio connection handler 2025-12-06 18:27:11 -08:00
agessaman
b34ca9fa07 Implement retry logic for NOAA API calls in WxCommand to enhance resilience against timeouts and transient errors. Reduce URL timeout from 10 to 8 seconds for faster failure detection. Update weather data fetching methods to utilize a retry-enabled session, improving error handling and logging for better diagnostics. 2025-12-06 16:18:00 -08:00
agessaman
183976e899 Add dark mode support across web viewer templates. 2025-12-06 12:35:58 -08:00
agessaman
ff1adf719e Implement bot reply rate calculations for 24-hour, 7-day, and 30-day time windows in the analytics. Update web viewer template to display these new reply rates and adjust JavaScript to handle the updated data structure. 2025-12-06 10:29:55 -08:00
agessaman
c151fba7a5 Enhance configuration and database management for feed and channel operations. Add channel refresh interval setting to config.ini.example, implement feed manager functionality with new database tables for feed subscriptions and activity tracking, and improve greeter command logic with human greeting detection and Levenshtein distance matching for user greetings. Update web viewer to include feed management pages and integrate global template variables for better user experience. 2025-12-06 10:18:12 -08:00
agessaman
4cc9cc4c9c Implement duplicate greeting cleanup and enhance greeter command logic. Add new API endpoints for greeter management and update web viewer to include greeter statistics. Improve error handling and logging for greeted users, ensuring unique entries in the database. 2025-12-02 21:15:40 -08:00
agessaman
99c4dd55e7 Improved success and failure conditions for message delivery, including handling unexpected event types and timeouts. 2025-12-02 20:01:15 -08:00
agessaman
3687dde3fd Add response format configuration for multitest command and enhance greeter command rollout logic. Update .gitignore to exclude database write-ahead logs and shared memory files. Improve error handling and logging in greeter command for better tracking of rollout status and user greetings. 2025-12-02 19:46:32 -08:00
agessaman
71d157a974 Enhance command execution and analytics features. Update CommandManager to allow DM-only commands in public channels to silently ignore errors if the channel is not configured. Refactor BaseCommand to improve execution checks based on channel permissions. In the web viewer, add time window parameters for analytics in the database stats API, and implement Chart.js for visualizing activity trends over the last 30 days. Update dashboard templates to include time window selectors for top users, commands, paths, and channels, improving user experience and data accessibility. 2025-11-30 20:04:20 -08:00
agessaman
b1c39edbb8 Add contact deletion functionality to the API and UI. Implement a new endpoint for deleting contacts, including error handling and logging. Update the contacts management interface to include a delete confirmation modal and handle the deletion process, ensuring proper updates to the displayed contact list and statistics. 2025-11-30 16:37:35 -08:00
agessaman
f40eda8a85 Improve installation and uninstallation scripts. Add user to dialout group for serial port access in install-service.sh, and implement safety features in uninstall-service.sh, including backup options and confirmation prompts for destructive actions. Update error handling and messaging for clarity across both scripts. 2025-11-27 21:44:38 -08:00
agessaman
7982cdce4c Add alert command configuration to config.ini.example and README. Update install-service.sh to support macOS and Linux service installations with improved user prompts and error handling. Enhance installation script with detailed steps for setting up the bot as a system service, including virtual environment creation and dependency installation. 2025-11-27 21:07:08 -08:00
agessaman
6de424f894 Refactor geocoding methods in commands to utilize shared utility functions for improved consistency and efficiency. Introduce geocode_zipcode_sync and geocode_city_sync for streamlined location retrieval, enhancing error handling and caching mechanisms. Update AQI, solar forecast, and weather commands to leverage these new methods, reducing code duplication and improving maintainability. 2025-11-26 15:29:37 -08:00
agessaman
92f063b4bc Add Nominatim rate limiting and caching enhancements across commands. Introduce NominatimRateLimiter for API compliance, update geocoding methods to utilize rate-limited calls, and extend caching duration for geocoding results to 30 days. Refactor command implementations to improve efficiency and prevent duplicate API requests. 2025-11-26 14:34:45 -08:00
agessaman
a6d2065379 Enhance command execution logic in CommandManager by adding channel access checks and improved error handling for message sending. Commands that cannot execute due to channel restrictions or cooldowns are now skipped. Additionally, refine error logging to differentiate between timeout warnings and actual failures when sending messages. 2025-11-26 08:38:56 -08:00
agessaman
e0347edf08 Implement score extraction methods in SportsCommand for consistent score formatting and enhance game data fetching logic. Refactor existing methods to utilize new score extraction, improving handling of various score formats and game statuses, including penalty shootouts. 2025-11-25 22:16:12 -08:00
agessaman
c8437999f3 update logging on the greeter command to be more intuitive 2025-11-25 21:42:14 -08:00
agessaman
5c2af1a014 added generic per-command channel configuration, allows commands to be mapped to different channels or dms only 2025-11-25 21:19:48 -08:00
agessaman
82aa5ee160 Add greeter command configuration to config.ini.example and implement greeter functionality in message handling. Introduce favorite status management for repeaters, allowing users to toggle favorite status via API. Update path command and test command to incorporate favorite bias in scoring. Enhance database schema to support star status tracking for repeaters and roomservers. 2025-11-25 17:26:40 -08:00
agessaman
732b7551ba Enhance message handling and repeater management by adding packet_hash support for tracking advertisements. Implement geocoding cache to prevent duplicate API calls based on packet_hash, improving efficiency in location data retrieval. Update relevant methods to accept packet_hash and ensure proper handling in geocoding logic. 2025-11-23 11:45:31 -08:00
agessaman
9d2d0e325c Add hourly weather forecast support to WxCommand. Updated response formatting to prioritize current conditions and additional details while ensuring display width constraints are respected. Improved observation data retrieval for more accurate current conditions. 2025-11-22 12:13:42 -08:00
agessaman
6b23f977f3 Update README and sports_command.py to enhance command descriptions and team ID stability. Expanded command help text for clarity, added new commands, and updated ESPN team IDs for accuracy. Included notes on verifying team IDs to prevent "no games found" errors. 2025-11-21 19:56:36 -08:00
agessaman
bfd3336fe6 Removed connection toast as redundant. 2025-11-21 19:17:51 -08:00
agessaman
acc599c112 Initialize packet_stream table for real-time monitoring in the database. Added methods to create the table and relevant indexes in both BotDataViewer and BotIntegration classes, ensuring robust data handling and logging for initialization errors. 2025-11-21 19:07:44 -08:00
agessaman
6c660dc14c Enhance configuration and command files to support new distance metrics in message responses. Updated Keywords section to include {path_distance} and {firstlast_distance} placeholders. Refactored distance calculation methods into utils and improved path command logic for better accuracy in distance reporting. Added detailed logging for packet hash calculations and message handling in multitest command. 2025-11-20 21:41:10 -08:00
agessaman
0ec60e48c2 Add multitest functionality to message handler for path collection and implement packet hash calculation for message tracking. Updated translations to support multitest commands. 2025-11-18 20:11:11 -08:00
agessaman
412883ac67 Enhance weather command functionality by adding support for multi-day and tomorrow forecasts. Updated parsing logic to handle forecast type options and improved response formatting. Integrated new weather data retrieval methods for both local and global commands, ensuring consistent user experience across different locales. Added localization support for new forecast messages in multiple languages. 2025-11-18 18:51:10 -08:00
agessaman
7e2c478662 Implement localization support across various commands and configuration. Added language settings in config.ini.example, integrated translation functionality in command responses, and enhanced error handling with localized messages. Improved fallback mechanisms for missing translations and updated help text for better user guidance. 2025-11-16 20:17:58 -08:00
agessaman
46cbf3ffea Add solarforecast command using forecast.solar. Add Forecast.Solar API key configuration to example file and implement major city geocoding queries in utils module for improved location resolution. 2025-11-15 20:49:51 -08:00
agessaman
ed7f5691c7 Add support for plugin overrides in configuration, allowing alternative plugin implementations. Enhanced weather display settings with configurable units for temperature, wind speed, and precipitation. Updated repeater_manager to improve contact removal logic with better error handling and logging. 2025-11-15 15:07:43 -08:00
agessaman
a93ce069a7 Added backwards compatability helper function and migrated some config headers to be more consistent. 2025-11-14 19:01:28 -08:00