Skip to content

Add support for adding contacts using the CLI, including remotely#933

Open
ianmcorvidae wants to merge 3 commits into
meshtastic:masterfrom
ianmcorvidae:shared-contact
Open

Add support for adding contacts using the CLI, including remotely#933
ianmcorvidae wants to merge 3 commits into
meshtastic:masterfrom
ianmcorvidae:shared-contact

Conversation

@ianmcorvidae

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a CLI workflow for sharing and importing “contact” (node/user) information via a shareable URL/QR, enabling users to add contacts to the NodeDB locally or via remote admin actions.

Changes:

  • Add Node.getContactURL() and Node.addContactURL() for generating/parsing shareable contact URLs backed by admin_pb2.SharedContact.
  • Extend the CLI with --contact-qr (generate + print QR/URL) and --add-contact (import from URL), supporting remote destinations via --dest.
  • Add unit tests covering CLI argument plumbing and a protobuf URL encode/decode roundtrip.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
meshtastic/node.py Implements contact URL generation/parsing and sends AdminMessage.add_contact.
meshtastic/__main__.py Adds CLI flags and wiring to call the new Node APIs (local or remote).
meshtastic/tests/test_node.py Adds a protobuf-level contact URL encode/decode roundtrip test.
meshtastic/tests/test_main.py Adds CLI tests for --add-contact and --contact-qr argument handling.

Comment thread meshtastic/node.py Outdated
Comment thread meshtastic/tests/test_node.py Outdated
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.67%. Comparing base (e4f0fb2) to head (9d44509).

Files with missing lines Patch % Lines
meshtastic/node.py 3.84% 50 Missing ⚠️
meshtastic/__main__.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #933      +/-   ##
==========================================
- Coverage   63.24%   62.67%   -0.57%     
==========================================
  Files          25       25              
  Lines        4527     4595      +68     
==========================================
+ Hits         2863     2880      +17     
- Misses       1664     1715      +51     
Flag Coverage Δ
unittests 62.67% <25.00%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread meshtastic/node.py
Comment on lines +397 to +398
if u.get("macaddr"):
contact.user.macaddr = base64.b64decode(u["macaddr"])
Comment thread meshtastic/node.py
Comment on lines +501 to +503
decodedURL = base64.urlsafe_b64decode(b64)
contact = admin_pb2.SharedContact()
contact.ParseFromString(decodedURL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants