Refactor device management: add vendor field, enhance admin display, and improve MAC address handling
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m18s

This commit is contained in:
2025-06-01 19:27:04 +05:00
parent e1c862184e
commit 4db9d7fabd
8 changed files with 122 additions and 20 deletions

View File

@ -59,9 +59,13 @@ def send_sms(mobile: str, message: str):
return False
# def escape_markdown_v2(text: str) -> str:
# special_chars = r"\_*[]()~`>#+-=|{}.!"
# return "".join(["\\" + c if c in special_chars else c for c in text])
def escape_markdown_v2(text: str) -> str:
special_chars = r"\~`>#+-=|{}!"
return "".join(["\\" + c if c in special_chars else c for c in text])
def normalize_whitespace(text: str) -> str:
return "\n".join(line.strip() for line in text.strip().splitlines())
def send_telegram_markdown(message: str):
@ -83,3 +87,9 @@ def send_telegram_markdown(message: str):
except requests.RequestException as e:
logger.error(f"Error sending Telegram message: {e}")
return {"error": str(e)}
def send_clean_telegram_markdown(message: str):
text = normalize_whitespace(message)
escaped = escape_markdown_v2(text)
return send_telegram_markdown(escaped)