Compare commits

..

13 Commits

Author SHA1 Message Date
pdxlocations
74d19c5ca7 clean-up 2025-05-18 12:17:27 -07:00
pdxlocations
33f7db4cb9 Merge branch 'main' into refactor-chat-ui 2025-05-18 08:34:01 -07:00
pdxlocations
06d151e991 hack fix 2025-05-18 08:21:53 -07:00
pdxlocations
50efa50923 working changes 2025-05-17 23:27:19 -07:00
pdxlocations
cef86ab185 I think it works! 2025-05-17 23:14:37 -07:00
pdxlocations
3d305a22b9 closer changes 2025-05-17 22:33:44 -07:00
pdxlocations
6d45788a5b mostly working changes 2025-04-28 22:20:00 -07:00
pdxlocations
e0e09aeccf so close 2025-04-20 22:04:41 -07:00
pdxlocations
bfb7ed0278 more almost working changes 2025-04-20 20:59:10 -07:00
pdxlocations
b7a275f725 Almost working changes 2025-04-19 23:12:59 -07:00
pdxlocations
587d79cb93 move lock to app state 2025-04-19 21:22:47 -07:00
pdxlocations
eb79675be0 convert globals to dataclass 2025-04-19 21:17:19 -07:00
pdxlocations
61e1799199 init 2025-04-19 21:13:46 -07:00
3 changed files with 3 additions and 46 deletions

View File

@@ -1,8 +1,4 @@
import logging
import os
import platform
import shutil
import subprocess
import time
from datetime import datetime
from typing import Any, Dict
@@ -26,41 +22,6 @@ import contact.ui.default_config as config
from contact.utilities.singleton import ui_state, interface_state, app_state
def play_sound():
try:
system = platform.system()
if system == "Darwin": # macOS
sound_path = "/System/Library/Sounds/Ping.aiff"
if os.path.exists(sound_path):
subprocess.run(["afplay", sound_path], check=True)
return
else:
print(f"[WARN] macOS sound file not found: {sound_path}")
elif system == "Linux":
sound_path = "/usr/share/sounds/freedesktop/stereo/complete.oga"
if os.path.exists(sound_path):
if shutil.which("paplay"):
subprocess.run(["paplay", sound_path], check=True)
return
elif shutil.which("aplay"):
subprocess.run(["aplay", sound_path], check=True)
return
else:
print("[WARN] No sound player found (paplay/aplay)")
else:
print(f"[WARN] Linux sound file not found: {sound_path}")
except subprocess.CalledProcessError as e:
print(f"[ERROR] Sound playback failed: {e}")
except Exception as e:
print(f"[ERROR] Unexpected error: {e}")
# Final fallback: terminal beep
print("\a")
def on_receive(packet: Dict[str, Any], interface: Any) -> None:
"""
Handles an incoming packet from a Meshtastic interface.
@@ -92,8 +53,6 @@ def on_receive(packet: Dict[str, Any], interface: Any) -> None:
maybe_store_nodeinfo_in_db(packet)
elif packet["decoded"]["portnum"] == "TEXT_MESSAGE_APP":
play_sound()
message_bytes = packet["decoded"]["payload"]
message_string = message_bytes.decode("utf-8")

View File

@@ -104,13 +104,11 @@ def get_admin_key_input(current_value: List[bytes]) -> Optional[List[str]]:
return [base64.b64encode(b).decode() for b in byte_strings]
def is_valid_base64(s):
"""Check if a string is valid Base64 or blank."""
if s == "":
return True
"""Check if a string is valid Base64."""
try:
decoded = base64.b64decode(s, validate=True)
return len(decoded) == 32 # Ensure it's exactly 32 bytes
except (binascii.Error, ValueError):
except binascii.Error:
return False
cvalue = to_base64(current_value) # Convert current values to Base64

View File

@@ -1,6 +1,6 @@
[project]
name = "contact"
version = "1.3.10"
version = "1.3.8"
description = "This Python curses client for Meshtastic is a terminal-based client designed to manage device settings, enable mesh chat communication, and handle configuration backups and restores."
authors = [
{name = "Ben Lipsey",email = "ben@pdxlocations.com"}