Every change is appended to an events table and broadcast to open WebSockets (GET /api/ws); GET /api/events?since= reads the same log as the polling fallback and delta endpoint, so clients can switch transports without losing their place. Inserts are serialised so ids are ordered by commit, cursors older than the 7-day retention reset, and the socket authenticates in-band since browsers can't set headers. New mail notifies when it's unread and still in the inbox after rules; rule actions notify / dont_notify override that, last one applied wins. An account's first sync and UIDVALIDITY re-syncs are backlog and never notify. Thread actions, outbox status, and tag/folder/rule/ account edits emit events too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.8 KiB
TOML
53 lines
1.8 KiB
TOML
[package]
|
|
name = "tern-server"
|
|
version = "0.6.0"
|
|
edition = "2021"
|
|
description = "Tern sync server — the only component that speaks IMAP/SMTP"
|
|
|
|
[dependencies]
|
|
tokio = { version = "1", features = ["full"] }
|
|
axum = { version = "0.7", features = ["macros", "ws"] }
|
|
tower = "0.5"
|
|
tower-http = { version = "0.6", features = ["trace", "cors"] }
|
|
|
|
sqlx = { version = "0.8", features = ["runtime-tokio", "tls-rustls", "postgres", "chrono", "uuid", "migrate"] }
|
|
|
|
async-imap = { version = "0.11", default-features = false, features = ["runtime-tokio"] }
|
|
async-channel = "2" # same major as async-imap uses, for its unsolicited-response channel
|
|
async-native-tls = { version = "0.6", default-features = false, features = ["runtime-tokio"] }
|
|
mail-parser = "0.11"
|
|
mail-send = "0.4"
|
|
# mail-send trusts only its compiled-in webpki-roots; these let SMTP use the
|
|
# OS trust store instead, matching IMAP (native-tls) so a mail server with an
|
|
# internal-CA certificate works for both. default-features = false matters:
|
|
# rustls' defaults pull in aws-lc-rs, which needs cmake/clang to build.
|
|
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
|
|
tokio-rustls = { version = "0.26", default-features = false }
|
|
rustls-native-certs = "0.8"
|
|
regex = "1"
|
|
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
uuid = { version = "1", features = ["v4", "serde"] }
|
|
|
|
argon2 = "0.5"
|
|
rand = "0.8"
|
|
chacha20poly1305 = "0.10"
|
|
base64 = "0.22"
|
|
sha2 = "0.10"
|
|
hex = "0.4"
|
|
|
|
thiserror = "2"
|
|
anyhow = "1"
|
|
dotenvy = "0.15"
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|
|
|
futures = "0.3"
|
|
|
|
[dev-dependencies]
|
|
tokio-test = "0.4"
|
|
# Same version mail-send uses, so tests can construct its reply type.
|
|
smtp-proto = "0.1"
|