Commit Graph

435 Commits

Author SHA1 Message Date
agessaman
a76c17bb02 Update .gitignore and enhance install-service.sh for virtual environment management
- Added patterns to .gitignore to exclude log files and local configuration files.
- Improved the install-service.sh script to verify the integrity of the virtual environment and ensure pip is available and up to date before installing dependencies.
2026-03-18 18:05:20 -07:00
agessaman
581b2c771d Merge main into dev: resolve DOCKER.md -> docker.md 2026-03-11 20:50:22 -07:00
Adam Gessaman
8d72c9a034 Update funding information in FUNDING.yml
Updated GitHub Sponsors username and commented out other funding options.
2026-03-11 20:48:18 -07:00
Jeroen Vermeulen
1264f49410 Fixed repeater and webviewer usage like #50.
Fixed webviewer responses.
2026-03-11 20:48:18 -07:00
agessaman
53c8b40364 Update Docker documentation to include instructions for connecting COM ports on Windows 11. Added detailed steps for installing USB bridge, binding devices, and configuring Docker to use Linux device names. 2026-03-11 20:48:18 -07:00
agessaman
d28a8b0d1d Fix documentation links 2026-03-11 20:44:47 -07:00
agessaman
2178a80dca Refactor cleanup methods in core.py and mesh_graph.py to suppress logging during shutdown
- Updated the _cleanup_web_viewer and _cleanup_mesh_graph methods to avoid logging errors during shutdown, as the logger's stream may be closed at that time.
- Modified the shutdown method in MeshGraph to prevent logging of flushing errors, enhancing stability during the atexit process.
- Adjusted test configurations to use Path objects for bot_root and local_root, improving path handling in tests.
2026-03-11 20:41:44 -07:00
agessaman
6ee4639ab7 Update test_checkin_service.py to skip tests when checkin_service plugin is not present
- Modified the test file to include a conditional import for the CheckInService, allowing tests to be skipped if the plugin is not installed. This change improves test reliability and clarity regarding plugin dependencies.
2026-03-11 20:29:03 -07:00
agessaman
43a36dd6d7 Update meshcore dependency version in requirements.txt
- Changed the meshcore dependency from a fixed version (2.2.14) to a minimum version (2.2.31) to ensure compatibility with newer features and improvements.
2026-03-10 10:45:33 -07:00
agessaman
58deb123b9 Update RepeaterManager to respect auto-manage contacts configuration
- Modified the RepeaterManager class to enable or disable auto-purge based on the 'auto_manage_contacts' setting from the bot's configuration.
- This change allows for more flexible management of contacts, aligning with the bot's operational mode.
2026-03-10 10:31:39 -07:00
agessaman
8b363afed7 Update IATA code in configuration files and packet capture service
- Changed the default IATA code from 'LOC' to 'XYZ' in `config.ini.example` and `packet-capture.md` to reflect updated routing requirements.
- Updated the `PacketCaptureService` to use 'XYZ' as the fallback IATA code, ensuring consistency across the application.
2026-03-09 22:09:39 -07:00
agessaman
0b58d9fed6 Update ServicePluginLoader to include modules directory in service path
- Enhanced the ServicePluginLoader to add the modules directory to the path for local services, ensuring that utility modules can be resolved correctly.
- This change improves the loading mechanism for service plugins by allowing better integration of local utilities.
2026-03-09 18:07:53 -07:00
agessaman
f908395834 Enhance ServicePluginLoader to support dynamic service paths
- Updated the ServicePluginLoader to include a built-in services directory in the module path, improving the loading mechanism for service plugins.
- Modified the class to accept BaseServicePlugin from both built-in and local services, allowing for greater flexibility in service integration.
- Enhanced the logic for identifying service classes, ensuring compatibility with multiple base service implementations.
2026-03-09 16:26:06 -07:00
agessaman
5a96dec558 Refactor TraceCommand to improve hop labeling logic
- Updated the TraceCommand class to enhance the labeling of hops in the trace output.
- Replaced direct hash retrieval with a conditional approach to determine the source label for each hop, improving clarity in the output format.
- Ensured consistent labeling for the first and last hops, enhancing the readability of the trace results.
2026-03-09 15:56:07 -07:00
agessaman
d084c6bd29 Enhance PrefixCommand to support multi-byte hex prefix lookups
- Updated the command to handle 1-, 2-, or 3-byte hex prefixes, with longer input truncated to 3 bytes.
- Improved usage instructions and examples to clarify accepted prefix formats (2, 4, or 6 hex characters).
- Enhanced validation logic for prefix format, ensuring proper handling of hex strings and truncation.
- Updated documentation strings to reflect changes in prefix handling and expected input formats.
2026-03-09 14:54:23 -07:00
agessaman
6c8151389b Enhance MeshGraph edge promotion logic and update BotDataViewer API
- Updated the MeshGraph class to prevent promoting a 1-byte edge to a 3-byte edge when the existing 1-byte edge lacks public keys, ensuring accurate observation attribution.
- Added a new test case to verify the behavior of edge promotion under specific conditions.
- Modified the BotDataViewer API to return the prefix length dynamically based on the edges, improving data consistency and user experience in the web viewer.
- Enhanced the mesh.html template to support displaying prefix byte counts, providing clearer information on node connections.
2026-03-09 09:43:49 -07:00
agessaman
6df2da5083 Add support for dynamic local services module
- Introduced a check in `load_service_from_path` to ensure the `local_services` module is created in `sys.modules` if it doesn't exist, facilitating proper relative and absolute imports for service plugins.
- This enhancement improves the loading mechanism for local service plugins, ensuring smoother integration and functionality.
2026-03-08 12:51:32 -07:00
agessaman
6b4e6351c4 Enhance logging configuration and documentation
- Added support for rotating log files in `core.py` using `RotatingFileHandler`, with a maximum size of 5 MB and up to 3 backup files.
- Updated `config.ini.example`, `config.ini.minimal-example`, and `config.ini.quickstart` to include descriptions of the new log rotation feature.
- Enhanced `data-retention.md` to clarify log file management and retention policies.
2026-03-08 12:41:15 -07:00
Adam Gessaman
d1f915c256 Update funding information in FUNDING.yml
Updated GitHub Sponsors username and commented out other funding options.
2026-03-08 10:23:32 -07:00
agessaman
adf5bc191e Enhance stats collection for web viewer dashboard
- Updated documentation in `data-retention.md` and `web-viewer.md` to clarify how stats are collected and displayed, including the new `collect_stats` configuration option.
- Modified `StatsCommand` in `stats_command.py` to introduce `collect_stats`, allowing message and command statistics to be recorded even when the `stats` command is disabled.
- Adjusted logic in `record_message`, `record_command_stats`, and `record_path_stats` methods to utilize the new `collect_stats` setting for improved flexibility in stats tracking.
2026-03-07 13:23:37 -08:00
agessaman
f86fe0b140 Add support for local plugins configuration and directory handling
- Updated `config.ini.example` and `config.ini.minimal-example` to include optional `local_dir_path` for specifying a custom local plugins directory.
- Enhanced `install-service.sh` to preserve the `local/` directory during installation and create its structure if it doesn't exist.
- Modified `CommandManager` and `MeshCoreBot` to resolve the local commands and services directory based on the new configuration.
- Added validation in `config_validation.py` to check the existence and readability of the specified local plugins path.
- Improved documentation in `local-plugins.md` to clarify the usage of local plugins and the new configuration options.
2026-03-07 12:31:54 -08:00
agessaman
e9f17ec48e Enhance shutdown process with scheduler thread handling and improved meshcore disconnect logic
- Added a `join` method in `MessageScheduler` to wait for the scheduler thread to finish during shutdown.
- Updated the shutdown sequence in `core.py` to include a timeout for the `meshcore.disconnect()` method, with error handling for potential timeouts and exceptions.
- Improved logging to provide clearer information during the shutdown process.
2026-03-07 11:21:43 -08:00
agessaman
0c060a515b Implement chunked message sending for improved rate limit handling
- Added `send_channel_messages_chunked` method to `CommandManager` for sending multiple messages with appropriate rate-limit spacing.
- Introduced `send_response_chunked` method in `BaseCommand` to facilitate chunked responses in both channels and DMs.
- Updated `GreeterCommand` to utilize the new chunked response functionality, simplifying the greeting message sending process.
- Enhanced documentation in `local-plugins.md` with examples for using chunked message sending, improving clarity on handling long messages and rate limits.
2026-03-07 09:02:12 -08:00
agessaman
69ac3ccdfb Update requirements and enhance documentation for service installation and message handling
- Changed `meshcore` dependency version in `requirements.txt` from `>=2.2.14` to `==2.2.14` for consistency.
- Added detailed instructions in `SERVICE-INSTALLATION.md` regarding Python version compatibility and potential f-string issues with Python 3.11.
- Introduced a new section in `local-plugins.md` explaining how to handle message chunking and bot rate limits, providing code examples for better clarity.
2026-03-06 22:03:13 -08:00
agessaman
f57f480c9f Enhance MeshGraph and BotDataViewer for multi-byte support and improved edge handling
- Updated MeshGraph to support multi-resolution storage and node identity, allowing for better handling of 1-byte, 2-byte, and 3-byte edges.
- Implemented logic for merging and promoting edges based on observation counts and specificity.
- Enhanced BotDataViewer API to dynamically adjust prefix length based on configuration, improving data representation.
- Updated mesh.html template to display prefix byte counts, enhancing user experience with clearer information on node connections.
2026-03-06 16:57:57 -08:00
agessaman
a4d1f678cf Enhance path handling in BotDataViewer and ModernContactsManager
- Added support for bytes per hop in the BotDataViewer, allowing for better path data representation.
- Updated the contacts template to display bytes per hop and adjusted path formatting based on this value.
- Improved the decode path functionality to utilize the correct bytes per hop for decoding paths, enhancing overall path handling and user experience.
2026-03-06 10:02:45 -08:00
agessaman
7d76ed443b Update dependencies and enhance path handling for multi-byte support
- Updated `meshcore` dependency version to `2.2.14` in both `pyproject.toml` and `requirements.txt`.
- Added multi-byte path support in the `PathCommand`, allowing for 1-, 2-, and 3-byte-per-hop paths.
- Enhanced `MessageHandler` to utilize `routing_info` for accurate path extraction and validation.
- Improved path extraction methods in `MultitestCommand` and `TestCommand` to prefer `routing_info` for node IDs.
- Refactored path handling logic across various commands to ensure consistent multi-byte path processing.
2026-03-05 13:37:38 -08:00
agessaman
4e5addd5df Add support for local plugins and services
- Updated `.gitignore` to include local configuration and plugin directories, allowing users to add custom commands and services without modifying core code.
- Enhanced `config.ini.example` with instructions for using local plugins and added sections for local service configurations.
- Refactored `PluginLoader` and `ServicePluginLoader` to support loading local commands and services from specified directories, improving extensibility.
- Updated `mkdocs.yml` to include documentation for local plugins and the check-in API.
- Added tests to verify the discovery and loading of local plugins, ensuring functionality and preventing name collisions with built-in plugins.
2026-03-04 18:33:45 -08:00
agessaman
1474174ba5 Refactor path handling in TraceCommand to prevent truncation of return paths
- Updated the logic in `TraceCommand` to avoid capping the `path_nodes` after building the reciprocal path, ensuring that the return path is preserved.
- Improved clarity in the code by adding a comment to explain the rationale behind the change.
2026-03-03 18:55:44 -08:00
agessaman
83dea195a4 Add hops placeholder for Keywords.
- Added support for `{hops}` and `{hops_label}` placeholders in `config.ini.example` and `core.py`, allowing for dynamic display of total hop count and pluralized labels in messages.
- Updated `format_keyword_response_with_placeholders` function in `utils.py` to extract and format hop count from message data, improving message clarity and detail.
- Ensured backward compatibility by providing default values for hop-related placeholders when not set.
2026-03-03 18:51:05 -08:00
agessaman
f789b72b92 Implement bot response bridging for Discord and Telegram
- Added configuration options to bridge the bot's own channel responses to Discord and Telegram, allowing command replies to be sent to respective channels.
- Updated `DiscordBridgeService` and `TelegramBridgeService` to register listeners for bot-sent messages, ensuring they are included in the bridging process.
- Enhanced `CommandManager` to invoke listeners with a synthetic event when a message is successfully sent, providing context about the message.
- Updated `config.ini.example` to reflect the new `bridge_bot_responses` option for both services.
- Added tests to verify the correct invocation of listeners upon successful message sending.
2026-03-02 16:39:30 -08:00
agessaman
d2f63c1025 Implement channel-specific triggers for random lines
- Added support for channel-specific triggers in the CommandManager, allowing triggers to be restricted to designated channels via `channel.<key>` or `channels.<key>` configuration.
- Updated `config.ini.example` to include examples of channel restrictions for triggers.
- Enhanced tests to verify that triggers only match in specified channels, ensuring proper functionality of the new feature.
2026-03-02 16:04:12 -08:00
agessaman
e348fd8d53 Enhance profanity filtering to include hate symbol detection and censorship
- Updated the profanity filter to check for hate symbols (e.g., swastika Unicode) in addition to word-based profanity, ensuring comprehensive message filtering.
- Modified the `censor` function to replace hate symbols with `***`, maintaining functionality even when the `better-profanity` package is unavailable.
- Updated documentation in `discord-bridge.md` and `telegram-bridge.md` to reflect the new hate symbol handling features.
- Added tests to verify detection and censorship of hate symbols, ensuring robustness of the profanity filter.
2026-03-01 21:56:13 -08:00
agessaman
3c56cbb69d Add profanity filter options for Discord and Telegram bridges
- Introduced `filter_profanity` configuration option in `config.ini.example` to handle profanity in bridged messages: options include `drop` (default), `censor`, or `off`.
- Updated `requirements.txt` to include `better-profanity` for profanity filtering functionality.
- Enhanced `DiscordBridgeService` and `TelegramBridgeService` to implement the profanity filter logic, allowing messages with profanity to be dropped or censored before bridging.
- Updated documentation in `discord-bridge.md` and `telegram-bridge.md` to reflect the new profanity handling feature.
2026-03-01 21:47:53 -08:00
agessaman
4982ba482d Enhance mesh graph handling for multi-resolution prefix support
- Updated `MeshGraph` to support multi-resolution storage of edges, allowing prefixes of 2, 4, or 6 hex chars without truncation.
- Implemented prefix matching logic to ensure distinct links are maintained and accurately retrieved based on prefix queries.
- Refactored methods in `MessageHandler` and `PathCommand` to accommodate variable prefix lengths during graph lookups.
- Enhanced tests to validate prefix match functionality and edge management in the mesh graph.
2026-03-01 20:42:06 -08:00
agessaman
1ac1060c18 Update config example and refactor prefix handling in BotDataViewer
- Commented out the 'help' command output in `config.ini.example` for clarity on overrides.
- Refactored prefix handling in `BotDataViewer` to use a dynamically retrieved `prefix_hex_chars` value instead of a hardcoded reference, improving flexibility and maintainability.
- Ensured consistent prefix handling across multiple instances in the `BotDataViewer` class.
2026-03-01 17:19:49 -08:00
agessaman
5c8ee3564e Fix time zone handling in format_elapsed_display function -- issue #75
- Updated the import statement for time zone handling in the `format_elapsed_display` function to use `timezone.utc` instead of `UTC` from `datetime`.
- Improved clarity and consistency in time zone management within the function.
2026-03-01 17:00:32 -08:00
Adam Gessaman
1cc41bc48a Merge pull request #67 from jeroenvermeulen/fix_repeater_usage_webviewer_responses
Fixed repeater and webviewer usage, fixed webviewer responses.
2026-03-01 16:50:24 -08:00
agessaman
217d2a4089 Refactor database connection handling across multiple modules
- Replaced direct SQLite connection calls with a context manager in various modules to ensure proper resource management and prevent file descriptor leaks.
- Introduced a new `connection` method in `DBManager` to standardize connection handling.
- Updated all relevant database interactions in modules such as `feed_manager`, `scheduler`, `commands`, and others to utilize the new connection method.
- Improved code readability and maintainability by consolidating connection logic.
2026-03-01 14:12:22 -08:00
agessaman
c115d446e1 Improve channel message sending to use meshcore_py directly, initial implementation of optional flood scope
- Added `flood_scope` option to `[Channels]` section in `config.ini.example` for scoped flooding of channel messages.
- Updated `config-validation.md` to reflect the new `flood_scope` feature.
- Modified `CommandManager` to support optional flood scope during message sending, restoring global flood settings afterward.
- Removed unused imports from `core.py` related to meshcore-cli.
2026-03-01 13:33:02 -08:00
agessaman
7dc68cfb82 Enhance path formatting and translation updates for stats command
- Updated `_format_path_for_display` method to support multi-byte path formatting based on `bot.prefix_hex_chars`, ensuring compatibility with both legacy and new path formats.
- Improved handling of descriptive text in paths and added fallback logic for legacy paths.
- Added a synopsis format for path display in the stats command, providing a concise representation when message limits are exceeded.
- Updated translation files for multiple languages to include the new synopsis format for path data.
2026-03-01 11:23:35 -08:00
agessaman
dcb90188c0 feat(telegram-bridge): add one-way MeshCore → Telegram channel bridge
- Add TelegramBridgeService: CHANNEL_MSG_RECV → sendMessage, per-chat queues,
  rate limiting, retries; aiohttp with requests fallback; HTML formatting,
  truncation, no DMs
- Config [TelegramBridge]: api_token (or TELEGRAM_BOT_TOKEN), bridge.<channel>=chat_id
- Normalize channel matching (strip #, case-insensitive) so bridge.HashTagChannel matches #HashTagChannel
- Add config.ini / config.ini.example sections and docs/telegram-bridge.md
  (setup, private chat ID, troubleshooting)
2026-03-01 10:23:38 -08:00
agessaman
b72b7faeab Update Docker documentation to include instructions for connecting COM ports on Windows 11. Added detailed steps for installing USB bridge, binding devices, and configuring Docker to use Linux device names. 2026-02-28 14:01:43 -08:00
agessaman
6b624c567a Enhance path handling and database schema for multi-byte prefix support
- Introduced a new utility function `decode_path_len_byte` to decode RF packet path length bytes, supporting both legacy and multi-byte paths.
- Updated various modules to utilize the new decoding logic, ensuring compatibility with configured prefix lengths.
- Modified database schemas to include `bytes_per_hop` and `out_bytes_per_hop` columns for better path management.
- Enhanced path parsing and validation across commands and services to accommodate variable prefix lengths.
- Improved logging and error handling for path-related operations, ensuring robustness during transitions.
2026-02-28 13:03:48 -08:00
Adam Gessaman
5c00e50cdc Merge pull request #77 from ianrifkin/prefixes
Add transitional support for 2-byte prefixes (while keeping legacy compatibility)
2026-02-28 10:20:09 -08:00
Adam Gessaman
af5961bf53 Merge branch 'dev' into prefixes 2026-02-28 10:19:50 -08:00
Ian Rifkin
36a8a67543 Add transitional support for 2-byte prefixes while keeping legacy 1-byte compatibility
- Update prefix command to accept BOTH legacy 2-char prefixes and
  configured prefix_hex_chars (e.g. 4-char) during firmware transition
- Replace strict length validation with dual-length validation (2 or N)
- Ensure prefix lookups work with either input length via LIKE matching
- Update related SQL prefix extraction to use configured prefix length
- Add fallback handling in path parsing for legacy 2-char route data

Notes:
- This is an interim compatibility change to support mixed networks
  where RF path data is still 1-byte while bot config may be 2-byte.
- Needs additional testing across real multi-hop scenarios and mixed
  bot configurations.
- Translation updates are incomplete: only English strings were updated;
  other translation files still need review.
- Behavior and UX may need refinement after real-world testing.
2026-02-27 23:48:27 -05:00
Adam Gessaman
1a576e80a6 Reverse path nodes in TraceCommand for correct tracing direction 2026-02-27 06:51:04 -08:00
agessaman
e5b6606ace Add output format configuration to trace command
- Updated `config.ini.example` to include an `output_format` option for the trace command, allowing users to choose between inline and vertical formats for trace results.
- Enhanced the `TraceCommand` class to handle the new output format, implementing methods for both inline and vertical formatting of trace results.
- Improved documentation within the code to clarify the behavior of the new output format feature.
2026-02-26 15:19:55 -08:00
agessaman
1921b23395 Enhance trace command functionality and documentation
- Updated the trace command's description and help text to clarify the behavior of the `trace` and `tracer` commands regarding path handling.
- Modified the `_format_trace_result` method to include the sender's ID in the response for better context in trace results.
- Adjusted the logic in the `execute` method to ensure proper path handling for tracer commands and when no path is provided.
2026-02-25 19:09:18 -08:00