Entity images: avatars, guild icons (animated), banners #214
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat-entity-images"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: #197 (which is stacked on #192 and #189). Merge those first; this branch starts from
fix-member-list.Why nothing showed
The client had URL builders for still avatars and guild icons (
fluxer_core::media_urls) and an image cache (fluxer_platform::ImageCache), but nothing connected them: the shell never built anImagesstore,apps/fluxerpassed no loader, and every view drew initials or a bundled default avatar. Nothing was ever requested, which is why the log had no image warnings. The URL shapes were right for a real instance ({media}/avatars/..., withendpoints.media=https://<host>/mediain a real discovery document), but only the still variant existed. Most real avatars carry thea_(animated) marker.What this does
URLs (
fluxer-core,media_urls, ported fromfluxer_app/src/features/user/utils/AvatarUtils.ts), all belowendpoints.media:avatars/{user}/{hash}.webp?size=160a_{hash}.webp?size=160&animated=trueguilds/{guild}/users/{user}/avatars/{hash}.webp?size=160, else the user'sicons/{guild}/{hash}.webp?size=160banners/{guild}/{hash}.webp?size=480icons/{channel}/{hash}.webp?size=160The still variant drops the
a_from the file name. The proxy's default foranimatedis "the hash hasa_" (fluxer_media_proxy/src/server/params.rs:91-95), and it answers animated.webprequests with an animated WebP, or with a GIF for a GIF original (format_policy.rs:8-26). Sizes are the web app's values at device pixel ratio 1 (MediaProxyAssetSizes.ts), snapped to the proxy's ladder within its ranges. A hash that is not one plain path segment gives no URL.Loading (
fluxer-uiimages,fluxer-platformImageCache):ImageLoader::loadnow returnsLoadedImage::{Still, Animated(frames)}.imagecrate, sniffing the bytes rather than trusting the extension.Imageskeeps GPU handles, one per frame, under a 96 MiB budget with LRU by last request.libfluxwebpis not used: the repo does not depend on it.Where they show (sizes and shapes from the original's CSS; citations in
screens/main/media.rsand the views):width / (16/9)high, cropped from the top centre, with the 40 px shade and the header over it (GuildHeader.module.css:48-82).Placeholders, as in the original (
BaseAvatar.module.css:34-54): an avatar is a--background-secondary-altdisc while it loads and after a failure. The original keeps the skeleton and does not swap in the default avatar. Users without an avatar get the bundled default.When animations play (the original's rule,
useShouldAnimate.ts:45-49; avatars and icons have no setting):gif_auto_play, default on) is on, otherwise on hover.Hover is cleared when the window loses focus (
useHover.ts). A hovered animation starts at its first frame. The shell subscribes towindow::frames()only while a loaded animation is on screen.Parity: added
accessibility-gif-autoplay(Accessibility → Animation, planned, owner 7). The banner already honours the server's value; the toggle itself is sub-project 7's.UserSettings::gif_auto_play()was added influxer-proto, with the fixture field.Devserver:
GET /media/{path}serves the proxy's image paths with pictures drawn in code (crates/fluxer-devserver/src/images.rs): small, license-clean, nothing downloaded. Ana_hash asked for withanimated=truegets a 4-frame animated WebP, written by hand because theimagecrate cannot encode one. The fixtures now give the signed-in user an animated avatar, ada a still one, the "Forked" guild an animated icon and a banner, and the second guild a still icon. All hashes are synthetic.Dependencies
No new crates. Workspace crates gained edges:
fluxer-devserver→image(already a workspace dependency).fluxer-platform→fluxer-devserver, andfluxer-ui→fluxer-devserver(the generator, for tests).Goldens changed (reference renderer: lavapipe, Ubuntu 22.04)
All of these now show the generated pictures where they used to show initials or default avatars. The user area shows the 32 px avatar instead of a status dot. The selected guild shows its banner.
main-general.png: rail icons, banner, message, member list and user area avatars.sidebar_voice.png,voice_panel_connected.png,voice_panel_failed.png: the same screen, plus voice participant avatars.call_view_4.png,call_view_compact.png: tile and compact avatars, rail, banner, member list.soundboard_popout.png,participant_menu.png: the call screen under the popout or menu.incoming_call.png: the caller's avatar, over the main screen.Unchanged:
login.png,settings-appearance.png,settings_voice.png.Tests
fluxer-core/tests/media_urls.rs: every builder against the fixture discovery document (shaped like a real instance's), still and animated variants, member-avatar fallback, banner and group DM sizes, hostile hashes.fluxer-platform/tests/images.rs:.webpname decodes, with 0 ms delays raised to 100 ms;fluxer-uiimagesunit tests: the byte budget evicts the least recently requested image; frame timing and looping; degenerate animations.fluxer-ui/tests/media.rs:apps/fluxer/tests/images.rs(end to end): the runtime logs in to the devserver; the avatar and the animated guild icon are fetched by the realImageCachefrom the devserver's/media/...paths and reach what the main screen draws, and the icon is a real animation.cargo xtask ciis green. The screenshot tests pass on lavapipe in the Ubuntu 22.04 image.Not verifiable without the real server
Look at these first on fluxer.forked.io:
guilds/{g}/users/{u}/avatars/....No real image was fetched while building this.
Follow-ups
#207 group DM avatar cluster · #208 banner collapse on scroll, 30 vh cap, detached mode · #209 retrying failed loads · #210 role icons · #211 typing bar, reply preview and autocomplete avatars · #212 user and member banners, guild splash (profile and invite screens) · #213 reduced motion, data saver, and HiDPI request sizes
🤖 Generated with Claude Code
The server deduplicates users in READY: guilds[].members[].user is {"id"} only and the full users are in the top-level `users` list (session_ready_collect.erl). fluxer-proto required a full user on every member, so a real READY failed to parse as a whole and the client showed no guilds, no DMs and "Unknown User". - fluxer-proto: `UserRef` (full user or `{"id"}` reference) for GuildMember::user, Presence::user (the offline PRESENCE_UPDATE sent when a friend/group-DM subscription is dropped) and GUILD_MEMBER_REMOVE's user (always a reference). `ReadyPayload::resolve_users()` fills the references from `users` and `user`. - Every list of ReadyPayload / GuildReadyData is read leniently: a malformed entry is dropped with a warning instead of losing the session; a malformed guild object leaves `properties: None`. Adds `tracing` to fluxer-proto for that warning. - fluxer-core: members and presences that are references add nothing to the user cache; names come from READY.users, unknown users show as Unknown User. - fixtures/gateway/ready.json now has the real structure (member user references, `users` with every member, relationships without `user`, empty guild presences, sessions/version/...), with the same fake identities. The devserver resolves it before indexing message authors. - tests/replay.rs in fluxer-core: with FLUXER_REPLAY_DIR set, replays a --record recording through the parsers and the store and reports mismatches by key path and redacted error only; skipped otherwise. - Regression tests: references resolved via `users`, an unknown member user id kept, malformed members/channels/users/guilds dropped without failing READY, references in GUILD_MEMBER_REMOVE and PRESENCE_UPDATE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>The real server sends only the user's own member in READY and no guild presences; the other members arrive in GUILD_MEMBER_LIST_UPDATE after an op 14 (LAZY_REQUEST) subscription, which the client never sent. - fluxer-proto: LazyRequest/GuildSubscription/MemberListRange, the GUILD_MEMBER_LIST_UPDATE and GUILD_SYNC dispatches, with a fixture. - fluxer-core: MemberLists sends {active, sync} on guild select and the shown channel's member list ranges, again after every reconnect; keeps the server list and feeds member_list, users and presences from it; falls back to READY's members when no answer comes. GUILD_CREATE and GUILD_SYNC add their partial members instead of replacing them. - fluxer-ui: group headers show the server's count. - fluxer-devserver: READY and GUILD_CREATE carry only the signed-in member; op 14 is answered with a server-shaped member list, and presence changes resend it. New end-to-end test. Follow-ups: #195 (scroll ranges past 1,000 rows), #196 (PASSIVE_UPDATES). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>