mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 17:36:30 +03:00
Allow Delta Chat core to work with chatmail servers running on underscore-prefixed domains (e.g. _alice.localchat) which use self-signed TLS certificates. This is mirroring related work on chatmail relays: https://github.com/chatmail/relay/pull/855 Underscore domains with self-signed TLS certs can be used by LXC test containers where obtaining real certificates is not practical. When the domain starts with '_', certificate verification is automatically relaxed for IMAP/SMTP connections, dcaccount QR code handling, and iroh relay endpoints. The Python test suite is adapted to also work against such underscore-domain servers, including cross-core tests with older Delta Chat versions. Note: this PR does not support HTTPS requests with underscore domains. They are not currently needed for working with LXC test containers. 14 files changed, +102/-31 lines (excluding Cargo.lock). Cargo.lock: +606/-11 lines from enabling iroh features needed for connecting to iroh relay endpoint on underscore domains. The added dependencies are unfortunate but best considered when finally upgrading to iroh 1.0 (tm).
53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
def test_webxdc(acfactory, data) -> None:
|
|
alice, bob = acfactory.get_online_accounts(2)
|
|
|
|
alice_contact_bob = alice.create_contact(bob, "Bob")
|
|
alice_chat_bob = alice_contact_bob.create_chat()
|
|
alice_chat_bob.send_message(text="Let's play chess!", file=data.get_path("webxdc/chess.xdc"))
|
|
|
|
event = bob.wait_for_incoming_msg_event()
|
|
bob_chat_alice = bob.get_chat_by_id(event.chat_id)
|
|
message = bob.get_message_by_id(event.msg_id)
|
|
|
|
webxdc_info = message.get_webxdc_info()
|
|
assert webxdc_info == {
|
|
"document": None,
|
|
"icon": "icon.png",
|
|
"internetAccess": False,
|
|
"name": "Chess Board",
|
|
"sourceCodeUrl": None,
|
|
"summary": None,
|
|
"selfAddr": webxdc_info["selfAddr"],
|
|
"sendUpdateInterval": 1000,
|
|
"sendUpdateMaxSize": 18874368,
|
|
}
|
|
|
|
status_updates = message.get_webxdc_status_updates()
|
|
assert status_updates == []
|
|
|
|
bob_chat_alice.accept()
|
|
message.send_webxdc_status_update({"payload": 42}, "")
|
|
message.send_webxdc_status_update({"payload": "Second update"}, "description")
|
|
|
|
status_updates = message.get_webxdc_status_updates()
|
|
assert status_updates == [
|
|
{"payload": 42, "serial": 1, "max_serial": 2},
|
|
{"payload": "Second update", "serial": 2, "max_serial": 2},
|
|
]
|
|
|
|
status_updates = message.get_webxdc_status_updates(1)
|
|
assert status_updates == [
|
|
{"payload": "Second update", "serial": 2, "max_serial": 2},
|
|
]
|
|
|
|
|
|
def test_webxdc_insert_lots_of_updates(acfactory, data) -> None:
|
|
alice, bob = acfactory.get_online_accounts(2)
|
|
|
|
alice_contact_bob = alice.create_contact(bob, "Bob")
|
|
alice_chat_bob = alice_contact_bob.create_chat()
|
|
message = alice_chat_bob.send_message(text="Let's play chess!", file=data.get_path("webxdc/chess.xdc"))
|
|
|
|
for i in range(2000):
|
|
message.send_webxdc_status_update({"payload": str(i)}, "description")
|