Reimplement compose and add tiling windows
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import re
|
||||
|
||||
from core.models import ChatTaskSource, TaskProject
|
||||
from core.tasks.codex_support import channel_variants
|
||||
|
||||
SAFE_TASK_FLAGS_DEFAULTS = {
|
||||
"derive_enabled": True,
|
||||
@@ -28,6 +27,33 @@ SIGNAL_PHONE_RE = re.compile(r"^\+\d+$")
|
||||
SIGNAL_INTERNAL_ID_RE = re.compile(r"^[A-Za-z0-9+/=]+$")
|
||||
|
||||
|
||||
def channel_variants(service: str, channel: str) -> list[str]:
|
||||
value = str(channel or "").strip()
|
||||
if not value:
|
||||
return []
|
||||
variants = [value]
|
||||
service_key = str(service or "").strip().lower()
|
||||
if service_key == "whatsapp":
|
||||
bare = value.split("@", 1)[0].strip()
|
||||
if bare and bare not in variants:
|
||||
variants.append(bare)
|
||||
direct = f"{bare}@s.whatsapp.net" if bare else ""
|
||||
if direct and direct not in variants:
|
||||
variants.append(direct)
|
||||
group = f"{bare}@g.us" if bare else ""
|
||||
if group and group not in variants:
|
||||
variants.append(group)
|
||||
if service_key == "signal":
|
||||
digits = re.sub(r"[^0-9]", "", value)
|
||||
if digits and digits not in variants:
|
||||
variants.append(digits)
|
||||
if digits:
|
||||
plus = f"+{digits}"
|
||||
if plus not in variants:
|
||||
variants.append(plus)
|
||||
return variants
|
||||
|
||||
|
||||
def _normalize_whatsapp_identifier(identifier: str) -> str:
|
||||
value = str(identifier or "").strip()
|
||||
if not value:
|
||||
|
||||
Reference in New Issue
Block a user