feat: module toggles in POS config and Instance Manager
- Add GET/PUT /pos/api/config/modules endpoints in POS config_bp.py - Update sidebar.js to filter nav items based on enabled modules - Add Modules section to POS config.html with toggles for WhatsApp, Marketplace, MercadoLibre - Add module load/save logic to POS config.js - Preload modules in app-init.js for sidebar caching - Add tenant module management to Instance Manager - get_tenant_modules / update_tenant_modules in tenant_service.py - GET/PUT /api/tenants/<id>/modules endpoints in tenants_bp.py - Add modules modal to manager index.html - Add module editing UI and logic to manager.js - Add toggle-switch CSS to manager.css
This commit is contained in:
@@ -88,9 +88,19 @@ def process_incoming(webhook_data):
|
||||
key = data.get('key', {})
|
||||
message = data.get('message', {})
|
||||
|
||||
# remoteJid can be phone@s.whatsapp.net or LID@lid
|
||||
# remoteJid can be phone@s.whatsapp.net or LID:instance@lid
|
||||
remote_jid = key.get('remoteJid', '')
|
||||
phone = remote_jid.replace('@s.whatsapp.net', '').replace('@lid', '')
|
||||
# Strip JID suffixes and LID instance suffix (:12)
|
||||
phone = remote_jid.split('@')[0].split(':')[0] if remote_jid else ''
|
||||
|
||||
# DEBUG
|
||||
import json
|
||||
print(f"[WA-DEBUG] key fields: {json.dumps({k: v for k, v in key.items() if k in ('remoteJid', 'senderPn', 'fromMe', 'id')})}")
|
||||
|
||||
# senderPn contains the real phone number when remoteJid is a privacy LID
|
||||
sender_pn = key.get('senderPn', '')
|
||||
if sender_pn:
|
||||
sender_pn = sender_pn.replace('@s.whatsapp.net', '')
|
||||
|
||||
# The bridge now classifies and passes these extra fields. Fall back to
|
||||
# the old parsing if they're missing (older bridge version).
|
||||
@@ -122,6 +132,7 @@ def process_incoming(webhook_data):
|
||||
return {
|
||||
'phone': phone,
|
||||
'jid': remote_jid,
|
||||
'sender_pn': sender_pn,
|
||||
'text': text,
|
||||
'from_me': key.get('fromMe', False),
|
||||
'message_id': key.get('id', ''),
|
||||
|
||||
Reference in New Issue
Block a user