- Python 98.9%
- Shell 0.5%
- Inno Setup 0.3%
- Makefile 0.2%
- Dockerfile 0.1%
* fix(ci): include rich unicode data in windows build Add --hidden-import=rich._unicode_data to PyInstaller command to prevent ModuleNotFoundError in the Windows executable. * fix(windows): correct rich bundling and installer CLI arguments Update pyinstaller to use --collect-all rich instead of specific hidden imports for complete library packaging. Fix Inno Setup script to use --base-dir instead of --data-dir in generated authentication batch files to match the application CLI interface. * fix(docker): update data directory argument to --base-dir * fix(docker): change base directory from /app/data to /app * fix(db): migrate legacy database and update credential paths Migrate databases from pre-v1.2.10 locations (base_dir) to the new data directory (base_dir/data) automatically on startup. Also add the data directory to the search paths for Matrix credentials.json to support Docker configurations where ~/.mmrelay is mounted to /app/data. * style(matrix): reformat long lines and update data directory comment Reformat global variable declarations and staticmethod assignment for improved readability. Update comment to clarify that data directory credential check is for backward compatibility rather than Docker-specific. * fix(config): unify directory handling and credential path resolution Consolidate base_dir and data_dir resolution with legacy layout support. Centralize credential discovery and improve database migration logic. - Add get_credentials_search_paths() and get_explicit_credentials_path() - Support both MMRELAY_BASE_DIR and legacy MMRELAY_DATA_DIR overrides - Detect and preserve legacy data layouts to prevent migration issues - Update Dockerfile log path and credentials environment variable * fix(config): support legacy layout in credentials and plugin paths Refactor path resolution to support both new base_dir and legacy data_dir layouts - Update load_credentials() to search multiple candidate paths - Add is_legacy_layout_enabled() detection helper - Extend plugin loader to check both base and data directories - Add runtime deprecation warning for legacy layout users - Bump version to 1.2.11 * fix(config): optimize config loading and correct base dir handling Add optional config_paths parameter to load_config() to prevent redundant get_config_paths() calls when paths are already computed. Fix test assertions and fixture cleanup to use correct custom_base_dir variable instead of custom_data_dir. Improve db_utils file modification time checks to handle OSError gracefully and move shutil import to module level. * fix(config): optimize directory handling and docker configuration Optimize get_data_dir() to calculate base_dir only when required based on platform and layout settings. Add MMRELAY_DATA_DIR environment variable to Dockerfile and simplify default command. Fix CLI test assertion for credentials path validation. Update migration docs. * fix(config): restore legacy layout default and optimize path handling Change data directory resolution to use legacy layout (data_dir == base_dir) by default unless new layout is explicitly enabled via MMRELAY_BASE_DIR or MMRELAY_DATA_DIR. Add create parameter to get_data_dir() to prevent unnecessary directory creation when resolving credentials and plugin paths. Remove raw directory entries from credentials search paths. Fix Windows debug logging fallback when config_path is unavailable. * fix(config): add base_data filter and remove legacy layout Add include_base_data parameter to get_credentials_search_paths to control whether base and data directories are included in credentials search. Use include_base_data=False in auth status to limit search scope to config-adjacent paths only. Remove legacy layout support from get_data_dir to always use the data subdirectory. Improve Windows debug logging to iterate through multiple candidate directories rather than checking a single location. * fix(config): use platformdirs for windows data directory in legacy mode * fix(config): include base data directory in credential search paths Remove explicit include_base_data=False to enable credential discovery in base/data directories, fixing path resolution on Windows where platformdirs provides separate data directories. Updates get_data_dir documentation for Windows legacy mode behavior and removes --logfile from Docker CMD to use default logging config. * fix(config): use structured logging and deduplicate debug output Switch from basic logging to structured logging using log_utils to maintain consistency across the codebase. Prevent duplicate directory debug logs by tracking seen paths in load_credentials. Also correct wording in Docker volume mount documentation. * refactor(db): extract legacy database migration helpers Move `_active_mtime` and `_migrate_legacy_db_if_needed` from nested functions inside `get_db_path()` to the module level to improve code organization and readability. Add comprehensive developer documentation (`DATA_LAYOUT_MIGRATION.md`) explaining the migration strategy between legacy and new filesystem layouts, including current behavior, future cleanup plans, and opt-in instructions. * fix(config): add fallback paths for credential saving Refactor save_credentials to try multiple candidate locations when persisting credentials. When no explicit path is provided, the function now prefers the config directory before falling back to base and data directories. If a write fails, the function attempts alternative paths instead of raising immediately. This improves reliability on Windows and restricted environments where the primary credentials location may not be writable. * docs(data-layout): document credential saving and known rough edges Add documentation explaining the conservative credential saving strategy prioritizing config directory and base_dir paths, and list known rough edges including non-uniform layout and pending Docker/Windows consolidation. * fix(log-utils): resolve circular imports during startup Lazy-load the config module when resolving log directory to prevent circular import issues during application initialization. Move the import of `get_log_dir` from module level to inside the function and add explicit handling for when config is not yet available in _should_log_to_file() to avoid early initialization cycles. * fix(config): normalize Windows paths and add fallback Replace manual path stripping with os.path.normpath() for proper Windows path normalization. Refactor save_credentials to include base directory as a fallback option and deduplicate error handling logic. Fix logger initialization during unit tests to prevent circular imports. * test: fix credential tests and use lazy logging format Fix makedirs assertions and config_path state isolation in credential saving tests. Update production logging calls to use %-style lazy formatting for deferred string evaluation. * 📝 Add docstrings to `win-fix-1` (#430) Docstrings generation was requested by @jeremiah-k. * https://github.com/jeremiah-k/meshtastic-matrix-relay/pull/429#issuecomment-3830181695 The following files were modified: * `src/mmrelay/config.py` * `src/mmrelay/db_utils.py` * `src/mmrelay/log_utils.py` * `src/mmrelay/main.py` * `src/mmrelay/plugin_loader.py` * `tests/test_matrix_utils_auth.py` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * test(config): fix mock side effect for lazy logging format Update the logger.debug mock in save_credentials test to properly handle messages passed with separate formatting arguments. This ensures the test correctly captures the formatted output when verifying the lazy logging implementation. * docs(docker): update migration docs for additional legacy paths * test: add edge case tests for config, db, and plugin loader Add comprehensive test coverage for edge cases in configuration handling, database utilities, and plugin loader modules. Tests cover Windows-specific path handling, legacy database migrations, credentials management, and directory resolution for both new and legacy layout configurations. * fix: add db migration rollback and credential error handling Add atomic rollback mechanism for database file migration when sidecar files fail to move, preventing partial migration states. Introduce CredentialsPathError exception for credential path failures and improve error logging with lazy formatting and Windows-specific guidance. * fix: Windows path compatibility in config and CLI Use ntpath.join for Windows-specific path construction when directory overrides are active. Refactor CLI directory override handling into _apply_dir_overrides() to ensure consistent application across entry points. Fix plugin directory resolution for non-standard root paths. Remove redundant directory existence check in credential loading. * fix(db): return db path from migration function and fix plugin loader The `_migrate_legacy_db_if_needed` function now returns a string indicating which database path should be used (either the default path on success, or the legacy path on failure), instead of returning None. This allows callers to know the actual database path being used without recalculating it. Additionally, the plugin loader is fixed to handle empty roots list by checking if roots exists before accessing roots[0], preventing an IndexError. Test files are cleaned up to remove unused variables and properly name unused mock parameters with underscore prefixes. * test(db): add edge case tests for db migration and path selection * test(db): add rollback error handling tests for legacy db migration * fix(db): handle partial rollback during database migration When database migration fails after moving the main database but before completing sidecar file migration, the system now selects the most recently modified database file instead of always falling back to the legacy path. This prevents data loss when a partial migration occurs. Also fixes CLI argument ordering in Windows installer script for proper authentication command execution. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> |
||
|---|---|---|
| .devcontainer | ||
| .github | ||
| .trunk | ||
| deploy/k8s | ||
| docs | ||
| scripts | ||
| src/mmrelay | ||
| tests | ||
| .coderabbit.yml | ||
| .coveragerc | ||
| .dockerignore | ||
| .gitignore | ||
| AGENTS.md | ||
| codecov.yml | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| MANIFEST.in | ||
| mypy.ini | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| requirements-e2e.txt | ||
| requirements.txt | ||
| setup.py | ||
MMRelay
(Meshtastic <=> Matrix Relay)
A powerful and easy-to-use relay between Meshtastic devices and Matrix chat rooms, allowing seamless communication across platforms. This opens the door for bridging Meshtastic devices to many other platforms.
Features
- Bidirectional message relay between Meshtastic devices and Matrix chat rooms, capable of supporting multiple meshnets
- Supports serial, network, and BLE (now too!) connections for Meshtastic devices
- Custom fields are embedded in Matrix messages for relaying messages between multiple meshnets
- Truncates long messages to fit within Meshtastic's payload size
- SQLite database to store node information for improved functionality
- Customizable logging level for easy debugging
- Configurable through a simple YAML file
- Supports mapping multiple rooms and channels 1:1
- Relays messages to/from an MQTT broker, if configured in the Meshtastic firmware
- ✨️ Bidirectional replies and reactions support ✨️
- ✨️ Native Docker support ✨️
- 🔐 Matrix End-to-End Encryption (E2EE) support 🔐 NEW in v1.2!
MMRelay v1.2 introduces Matrix End-to-End Encryption support for secure communication in encrypted rooms. Messages are automatically encrypted/decrypted when communicating with encrypted Matrix rooms, with simple setup using mmrelay auth login or automatic credentials creation from config.yaml.
Documentation
MMRelay supports multiple deployment methods including pipx, Docker, and Kubernetes. For complete setup instructions and all deployment options, see:
- Installation Instructions - Setup and configuration guide
- Docker Guide - Docker deployment methods
- Kubernetes Guide - Kubernetes deployment guide
- What's New in v1.2 - New features and improvements
- E2EE Setup Guide - Matrix End-to-End Encryption configuration
Plugins
MMRelay supports plugins for extending its functionality, enabling customization and enhancement of the relay to suit specific needs.
Core Plugins
Generate a map of your nodes:
Produce high-level details about your mesh:
See the full list of core plugins.
Community & Custom Plugins
MMRelay's plugin system allows you to extend functionality in two ways:
- Custom Plugins: Create personal plugins for your own use, stored in
~/.mmrelay/plugins/custom/ - Community Plugins: Share your creations with others or use plugins developed by the community
Check the Community Plugins Development Guide in our wiki to get started.
✨️ Visit the Community Plugins List!
Install a Community Plugin
Add the repository under the community-plugins section in config.yaml:
community-plugins:
example-plugin:
active: true
repository: https://github.com/jeremiah-k/mmr-plugin-template.git
tag: main
Plugin System
Plugins make it easy to extend functionality without modifying the core program. MMRelay features a powerful plugin system with standardized locations:
- Core Plugins: Pre-installed with the package
- Custom Plugins: Your own plugins in
~/.mmrelay/plugins/custom/ - Community Plugins: Third-party plugins in
~/.mmrelay/plugins/community/
Getting Started with Matrix
See our Wiki page Getting Started With Matrix & MMRelay.
Already on Matrix?
Join us!
- Our project's room: #mmrelay:matrix.org
- Part of the Meshnet Club Matrix space: #meshnetclub:matrix.org
- Public Relay Room: #mmrelay-relay-room:matrix.org - Where we bridge multiple meshnets. Feel free to join us, with or without a relay!

