Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/signal-push.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ def main() -> int:
if body.get("status") == "pending_approval":
print(f"signal-push: send queued for approval (id={body.get('request_id', '?')})")
approval_url = body.get("approval_url", "")
# The gateway returns an absolute URL only when SEND_APPROVAL_BASE_URL
# is set on its side; otherwise it hands back a bare relative path.
# Absolutize it here against SEND_APPROVAL_BASE_URL, falling back to
# CONVERSATION_BASE_URL (present in this container), so the printed
# link is always complete and never has to be assembled by hand.
# Mirrors email_client.approval_url().
if approval_url.startswith("/"):
base = (os.environ.get("SEND_APPROVAL_BASE_URL")
or os.environ.get("CONVERSATION_BASE_URL", "")).rstrip("/")
if base:
approval_url = base + approval_url
if approval_url:
print(f"signal-push: approve or deny at {approval_url}")
note = body.get("note", "")
Expand Down
11 changes: 11 additions & 0 deletions scripts/telegram-push.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ def main() -> int:
if body.get("status") == "pending_approval":
print(f"telegram-push: send queued for approval (id={body.get('request_id', '?')})")
approval_url = body.get("approval_url", "")
# The gateway returns an absolute URL only when SEND_APPROVAL_BASE_URL
# is set on its side; otherwise it hands back a bare relative path.
# Absolutize it here against SEND_APPROVAL_BASE_URL, falling back to
# CONVERSATION_BASE_URL (present in this container), so the printed
# link is always complete and never has to be assembled by hand.
# Mirrors email_client.approval_url().
if approval_url.startswith("/"):
base = (os.environ.get("SEND_APPROVAL_BASE_URL")
or os.environ.get("CONVERSATION_BASE_URL", "")).rstrip("/")
if base:
approval_url = base + approval_url
if approval_url:
print(f"telegram-push: approve or deny at {approval_url}")
note = body.get("note", "")
Expand Down
11 changes: 11 additions & 0 deletions scripts/whatsapp-push.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ def main() -> int:
if body.get("status") == "pending_approval":
print(f"whatsapp-push: send queued for approval (id={body.get('request_id', '?')})")
approval_url = body.get("approval_url", "")
# The gateway returns an absolute URL only when SEND_APPROVAL_BASE_URL
# is set on its side; otherwise it hands back a bare relative path.
# Absolutize it here against SEND_APPROVAL_BASE_URL, falling back to
# CONVERSATION_BASE_URL (present in this container), so the printed
# link is always complete and never has to be assembled by hand.
# Mirrors email_client.approval_url().
if approval_url.startswith("/"):
base = (os.environ.get("SEND_APPROVAL_BASE_URL")
or os.environ.get("CONVERSATION_BASE_URL", "")).rstrip("/")
if base:
approval_url = base + approval_url
if approval_url:
print(f"whatsapp-push: approve or deny at {approval_url}")
note = body.get("note", "")
Expand Down
Loading