8000 Load sender avatars from GNOME Contacts by Toxblh · Pull Request #8 · hyprlab/hylki · GitHub
[go: up one dir, main page]

Skip to content

Load sender avatars from GNOME Contacts - #8

Closed
Toxblh wants to merge 1 commit into
hyprlab:mainfrom
Toxblh:feat/contact-avatars
Closed

Toxblh wants to merge 1 commit into
hyprlab:mainfrom
Toxblh:feat/contact-avatars

Conversation

@Toxblh
@Toxblh Toxblh commented Aug 6, 2026 •
Copy link
Copy Markdown
Contributor

Summary

  • resolve sender avatars in this order: local EDS/vCard PHOTO → opt-in Gravatar → coloured initials
  • support Nextcloud data-URI PHOTO, standard folded ENCODING=b, grouped properties and safe EDS file:// photos
  • index local/CardDAV photo locations in the background and refresh visible avatars when EDS changes without jumping the message list scroll position
  • try all duplicate contact candidates and preserve cache provenance so disabling Gravatar immediately hides cached Gravatars
  • correlate asynchronous results by sender and EDS generation to prevent wrong/stale avatars
  • coalesce duplicate Gravatar lookups, cap concurrency, apply timeouts/backoff, and cache only definitive 404 misses
  • reject remote vCard PHOTO URLs and SVG; decode/downscale raster photos off the GTK thread and create bounded 160px textures on the main thread

Privacy

  • local contact photos require no additional CardDAV/network request
  • Gravatar remains opt-in and is queried only when no usable local photo exists
  • remote PHOTO URLs are never fetched
  • local file URIs are canonicalized and restricted to EDS address-book directories

Testing

  • cargo check --locked
  • cargo test --locked — 48 passed
  • cargo clippy --all-targets --locked — passes; pre-existing style warnings remain
  • combined GOA + avatar build: 57 passed
  • live EDS/Nextcloud cache indexed 399 sender-photo addresses
  • verified and decoded the local vCard PNG for schavelevoi@basealt.ru
  • multiple independent Codex and Claude review rounds completed and findings addressed

@Toxblh
Toxblh marked this pull request as draft August 6, 2026 11:51
@Toxblh
Toxblh force-pushed the feat/contact-avatars branch from 30a35fc to 058e15b Compare August 6, 2026 14:27
@Toxblh
Toxblh marked this pull request as ready for review August 6, 2026 14:27
@Toxblh
Toxblh force-pushed the feat/contact-avatars branch from 058e15b to e4bf870 Compare August 6, 2026 14:41
hyprlab added a commit that referenced this pull request Aug 26, 2026
The circle beside a message now shows the sender's actual face when
GNOME Contacts has one. A background thread indexes photo locations
from Evolution Data Server's address-book caches (local and CardDAV),
and rows resolve through a personal-first chain: contact photo, then
Gravatar, then the domain's icon, then coloured initials — each tier
consulted only while its switch is on, so turning one off hides its
cached images immediately.

Safety and privacy carry the design: remote vCard PHOTO URLs are never
fetched, file:// photos are confined to EDS's own directories (with
tests covering .. traversal, symlink escapes and lookalike siblings),
only known raster formats reach the decoder — never SVG — and images
are size-capped and downscaled during decode, off the GTK thread. No
Gravatar hash leaves the machine before the local index has had a
chance to answer, and Gravatar now receives a SHA-256 hash rather than
a dictionary-reversible MD5. Photo changes from an EDS sync refresh
visible circles without moving the scroll position.

Adapted from PR #8: the contact index and avatar state machine are
Anton's, unified here with the newer sender-logo tier and reader.

Co-Authored-By: Anton Palgunov <2198153+Toxblh@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hyprlab
hyprlab commented Aug 26, 2026
Copy link
Copy Markdown
Owner

Anton — thank you again. This one ships almost whole: contact photos as sender avatars are in v1.14.4, released today, adapted from this PR and credited to you via Co-Authored-By (your About-window and README entries now cover both contributions).

As with #7, it landed as an adapted commit rather than a merge — two things made a straight merge impossible:

  • Main had grown a competing face pipeline while the PR was open. Since v1.8 the list and reader resolve circles through a Face/find_face chain that also handles opt-in sender domain logos (Inbox Avatars instead of Circles #30), and this PR's avatar.rs rewrite removed the API that pipeline depends on. The landed version unifies the two into one personal-first chain — contact photo → Gravatar → domain logo → initials — driven by your generation-stamped provenance state machine, extended so the logo tier gets the same "switching it off hides cached images immediately" behaviour you built for Gravatar (which fixed a real bug on main).
  • A silent build break: main had also added base64 = "0.22" (OAuth PKCE), and git auto-merges the two Cargo.toml lines into a duplicate key with no conflict marker. The landed version just reuses the existing dependency.

Kept from your PR essentially intact: the EDS photo-location index with the fingerprint-stability rescan, the vCard PHOTO parsing (Nextcloud data-URIs, folded ENCODING=b, grouped properties), the confined file:// reader, never fetching remote PHOTO URLs, the raster-only gate in front of the decoder, decode-time downscaling and pixel caps, Gravatar coalescing/backoff/404-only-miss caching, the never-hash-before-the-local-index-answers ordering (a detail that's easy to get wrong — nicely done), and the sender-address staleness key in the reader.

Changed while landing:

  • Gravatar now gets a SHA-256 hash instead of MD5 (Gravatar accepts it, MD5 of an email is dictionary-reversible; md5 left the dependency tree entirely).
  • The path-confinement check was extracted as confine_to_roots and gained tests — .. traversal, symlink escape, lookalike sibling directories, unresolvable roots, host-bearing file:// URIs. It held up under all of them; the tests just pin it.
  • Kept main's if !avatars guards so nothing is fetched or read for circles that aren't drawn.

Noted for follow-up rather than changed: the 30-second stat-polling watcher (we may move it to EDS D-Bus signals, matching how GOA is watched since v1.14.3), per-lookup SQLite opens, and cache growth over long sessions.

Closing since the feature is on main and shipped in v1.14.4. Between #7 and #8 you've made a real difference to this release cycle — thank you, and you'd be very welcome back.

@hyprlab hyprlab closed this Aug 26, 2026
somepaulo pushed a commit to somepaulo/hylki that referenced this pull request Sep 24, 2026
The circle beside a message now shows the sender's actual face when
GNOME Contacts has one. A background thread indexes photo locations
from Evolution Data Server's address-book caches (local and CardDAV),
and rows resolve through a personal-first chain: contact photo, then
Gravatar, then the domain's icon, then coloured initials — each tier
consulted only while its switch is on, so turning one off hides its
cached images immediately.

Safety and privacy carry the design: remote vCard PHOTO URLs are never
fetched, file:// photos are confined to EDS's own directories (with
tests covering .. traversal, symlink escapes and lookalike siblings),
only known raster formats reach the decoder — never SVG — and images
are size-capped and downscaled during decode, off the GTK thread. No
Gravatar hash leaves the machine before the local index has had a
chance to answer, and Gravatar now receives a SHA-256 hash rather than
a dictionary-reversible MD5. Photo changes from an EDS sync refresh
visible circles without moving the scroll position.

Adapted from PR hyprlab#8: the contact index and avatar state machine are
Anton's, unified here with the newer sender-logo tier and reader.

Co-Authored-By: Anton Palgunov <2198153+Toxblh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0