forge
Explore
Log in

Don't you dare go Hollow

im-web: cached family probes, refusal i18n, soft-nav // guard, escape fixes

Browse files at this commit

c097a7cbfa306379c152582f8acb4a64794355d4Ahmet Kaan GümüşParent: 3bc2d00
- health.rs: shared LazyLock reqwest client + 30s TTL probe cache; no more
  per-render Client::new + inline 2s sibling stalls on every page
- pages.rs/i18n.rs: 'unavailable' error arm (En+Tr) for photo store failures
- layout.rs: soft-nav rejects protocol-relative // hrefs (foreign-HTML swap hole)
- escape(): map ' -> '; drop redundant manual escape at view! text sinks
  (pages.rs:837,1110; admin.rs:209) that double-escaped
- directory/oidc/photo: handler unwraps mapped to error paths
- people.rs: single avatar fetch; admin placeholders via t();
  sessions created_at formatted like seen
crates/im-web/src/admin.rsmodified+23 -15
@@ -15,7 +15,7 @@ use topcoat::router::response::{IntoResponse, Response};
1515 use topcoat::router::{HeaderValue, StatusCode, header, route};
1616 use topcoat::view::{Child, ViewExt, view};
1717
18-use crate::health::{Probe, probe_healthz};
18+use crate::health::{Probe, probe_family};
1919 use crate::i18n::{self, Key, lang_of, t};
2020 use crate::layout::shell;
2121 use crate::mailer;
@@ -48,6 +48,7 @@ fn escape(raw: &str) -> String {
4848 .replace('<', "&lt;")
4949 .replace('>', "&gt;")
5050 .replace('"', "&quot;")
51+ .replace('\'', "&#39;")
5152 }
5253
5354 /// One row action as a two-step disclosure — iz's `confirm-details` idiom:
@@ -205,7 +206,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
205206 _ => None,
206207 };
207208
208- let my_email = escape(&me.email);
209+ let my_email = me.email.clone();
209210 let stage = view! {
210211 cx =>
211212 <main class="admin-shell">
@@ -256,6 +257,12 @@ fn sessions_row(
256257 "[year]-[month]-[day] [hour]:[minute]"
257258 ))
258259 .unwrap_or_else(|_| seen_at.date().to_string());
260+ let created = session
261+ .created_at
262+ .format(&time::macros::format_description!(
263+ "[year]-[month]-[day] [hour]:[minute]"
264+ ))
265+ .unwrap_or_else(|_| session.created_at.date().to_string());
259266 rows.push_str(&format!(
260267 concat!(
261268 r#"<tr><td title="{}">{}</td>"#,
@@ -283,7 +290,7 @@ fn sessions_row(
283290 .as_deref()
284291 .map(escape)
285292 .unwrap_or_else(|| "—".to_string()),
286- session.created_at.date(),
293+ created,
287294 seen,
288295 escape(&session.token_hash),
289296 t(lang, Key::RevokeButton),
@@ -640,13 +647,13 @@ async fn services_section(
640647 <form method="post" action="/admin/services_add" class="admin-invite">
641648 <input class="auth-input auth-input-mono" type="text" name="key" placeholder="in" aria-label="{key_label}" required>
642649 <input class="auth-input" type="text" name="name" placeholder="{name_label}" aria-label="{name_label}" required>
643- <input class="auth-input auth-input-mono" type="text" name="url" placeholder="https://in.dizey.sh" aria-label="{url_label}" required>
650+ <input class="auth-input auth-input-mono" type="text" name="url" placeholder="{url_placeholder}" aria-label="{url_label}" required>
644651 <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{add}</span></button>
645652 </form>
646653 <div class="muted">{client_add_label}</div>
647654 <form method="post" action="/admin/clients_add" class="admin-invite">
648655 <input class="auth-input" type="text" name="name" placeholder="drive" aria-label="{name_label}" required>
649- <input class="auth-input auth-input-mono" type="text" name="redirect_uris" placeholder="http://127.0.0.1:9000/callback https://drive.dizey.sh/callback" aria-label="{uris_label}" required>
656+ <input class="auth-input auth-input-mono" type="text" name="redirect_uris" placeholder="{uris_placeholder}" aria-label="{uris_label}" required>
650657 <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{client_add}</span></button>
651658 </form>
652659 </div>"#,
@@ -654,8 +661,10 @@ async fn services_section(
654661 key_label = t(lang, Key::ServiceKeyLabel),
655662 name_label = t(lang, Key::NameCol),
656663 url_label = t(lang, Key::AddressLabel),
664+ url_placeholder = t(lang, Key::ServiceUrlPlaceholder),
657665 id_label = t(lang, Key::ClientIdLabel),
658666 uris_label = t(lang, Key::RedirectUrisLabel),
667+ uris_placeholder = t(lang, Key::RedirectUrisPlaceholder),
659668 registered_label = t(lang, Key::RegisteredCol),
660669 service_add_label = t(lang, Key::ServiceAdd),
661670 add = t(lang, Key::ServiceAdd),
@@ -1443,22 +1452,21 @@ async fn logs_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Erro
14431452 /// way it refreshes every other section.
14441453 async fn health_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Error> {
14451454 let services = im_core::services::list(&app(cx).store).await?;
1446- // Every probe at once: a family member that is down costs its two
1447- // seconds, not two seconds each.
1448- let http = reqwest::Client::new();
1449- let mut probes = Vec::new();
1450- for service in &services {
1451- let http = http.clone();
1452- let url = format!("{}/healthz", service.url.trim_end_matches('/'));
1453- probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await }));
1454- }
1455+ // One shared reading: this table and the chrome's flyout share the
1456+ // cached probe round, so a family member that is down costs its two
1457+ // seconds once per window, not once per page view.
1458+ let urls = services
1459+ .iter()
1460+ .map(|service| format!("{}/healthz", service.url.trim_end_matches('/')))
1461+ .collect::<Vec<_>>();
1462+ let probes = probe_family(&urls).await;
14551463
14561464 let mut rows = String::new();
14571465 for (service, probe) in services.iter().zip(probes) {
14581466 let key = escape(&service.key);
14591467 let name = escape(&service.name);
14601468 let url = escape(&service.url);
1461- let state = match probe.await.unwrap_or(Probe::Down) {
1469+ let state = match probe {
14621470 Probe::Up { body, ms } => format!(
14631471 r#"<span class="health-dot health-on"></span>{} <span class="muted">· {ms} ms</span>"#,
14641472 escape(&body)
crates/im-web/src/directory.rsmodified+16 -6
@@ -68,7 +68,8 @@ async fn directory(cx: &Cx) -> topcoat::Result<topcoat::router::response::Respon
6868 .filter(|user| !user.disabled)
6969 .map(|user| DirectoryMember::of(&user))
7070 .collect();
71- Json(serde_json::to_value(members).unwrap()).into_response(cx)
71+ let members = serde_json::to_value(members)?;
72+ Json(members).into_response(cx)
7273 }
7374 /// `GET /directory/live`: the roster's change feed, as server-sent events.
7475 /// The same Basic pair `/directory` takes is the only credential. The
@@ -144,10 +145,15 @@ async fn directory_live(cx: &Cx) -> topcoat::Result<topcoat::router::response::R
144145 }
145146 Ok(Some(Ok(server::LiveEvent::Profile(member)))) => member,
146147 };
148+ // A member that will not serialize cannot happen — plain
149+ // fields all the way down — but a stream cannot panic on
150+ // the impossible: ending is the honest answer, and the
151+ // client heals the gap the way it heals any disconnect.
152+ let Ok(json) = serde_json::to_string(&member) else {
153+ return None;
154+ };
147155 return Some((
148- Ok(Event::new()
149- .event("profile")
150- .data(serde_json::to_string(&member).expect("member JSON"))),
156+ Ok(Event::new().event("profile").data(json)),
151157 (rx, deadline, stopping, first),
152158 ));
153159 }
@@ -177,7 +183,8 @@ async fn family(cx: &Cx) -> topcoat::Result<topcoat::router::response::Response>
177183 }
178184 let store = server::app(cx).store.clone();
179185 let services = im_core::services::list(&store).await?;
180- Json(serde_json::to_value(services).unwrap()).into_response(cx)
186+ let services = serde_json::to_value(services)?;
187+ Json(services).into_response(cx)
181188 }
182189
183190 /// The body a sibling posts to keep its own row: its wordmark key, the
@@ -216,7 +223,10 @@ async fn family_register(
216223 )
217224 .await
218225 {
219- Ok(service) => Json(serde_json::to_value(service).unwrap()).into_response(cx),
226+ Ok(service) => {
227+ let service = serde_json::to_value(&service)?;
228+ Json(service).into_response(cx)
229+ }
220230 Err(im_core::store::StoreError::Conflict(_)) => (
221231 StatusCode::CONFLICT,
222232 Json(serde_json::json!({ "error": "owned" })),
crates/im-web/src/health.rsmodified+68 -0
@@ -3,11 +3,19 @@
33 //! `GET {url}/healthz` where it stands — no credentials, two seconds to
44 //! answer — and the callers fan the probes out concurrently, so a family
55 //! member that is down costs its two seconds, not two seconds each.
6+//! [`probe_family`] sits over that with the two things a per-render probe
7+//! used to pay again and again: one shared client, and a short-lived
8+//! cache so a burst of renders reuses the last reading instead of
9+//! re-stalling on a down sibling.
10+
11+use std::sync::{LazyLock, Mutex};
12+use std::time::{Duration, Instant};
613
714 /// One `/healthz` reading. `Up` carries the body — the deploy contract's
815 /// `ok <build sha>` — and the answer's latency; everything else, refused
916 /// or wrong status or a body that does not begin ok or the two-second
1017 /// ceiling, is `Down`.
18+#[derive(Clone)]
1119 pub(crate) enum Probe {
1220 Up { body: String, ms: u128 },
1321 Down,
@@ -37,3 +45,63 @@ pub(crate) async fn probe_healthz(http: &reqwest::Client, url: &str) -> Probe {
3745 Probe::Down
3846 }
3947 }
48+
49+/// How long one family reading stands in for fresh probes. Long enough
50+/// that paging the panel does not re-stall on a dark sibling, short
51+/// enough that a service coming back is noticed within half a minute.
52+const CACHE_TTL: Duration = Duration::from_secs(30);
53+
54+/// The probe client every reader shares: one connection pool built once
55+/// per process, not a fresh client — and fresh sockets — per render.
56+static HTTP: LazyLock<reqwest::Client> = LazyLock::new(reqwest::Client::new);
57+
58+/// The last family reading: when it was taken, and what each probed
59+/// `/healthz` answered, keyed by URL.
60+static CACHE: LazyLock<Mutex<(Instant, Vec<(String, Probe)>)>> =
61+ LazyLock::new(|| Mutex::new((Instant::now(), Vec::new())));
62+
63+/// One reading per URL, in order. A reading younger than [`CACHE_TTL`]
64+/// that already covers every URL asked is reused whole — the chrome and
65+/// the panel can share a render without doubling the probes, and a down
66+/// sibling's two-second ceiling is paid once per window, not once per
67+/// page view. Otherwise every URL is probed at once and the reading is
68+/// remembered. A family that gained or lost a row reads fresh; a lost
69+/// probe task reads `Down`, and the next window re-probes.
70+pub(crate) async fn probe_family(urls: &[String]) -> Vec<Probe> {
71+ if let Some(cached) = fresh(urls) {
72+ return cached;
73+ }
74+ let probes: Vec<_> = urls
75+ .iter()
76+ .map(|url| {
77+ let url = url.clone();
78+ tokio::spawn(async move { probe_healthz(&HTTP, &url).await })
79+ })
80+ .collect();
81+ let mut readings: Vec<(String, Probe)> = Vec::with_capacity(urls.len());
82+ for (url, probe) in urls.iter().zip(probes) {
83+ readings.push((url.clone(), probe.await.unwrap_or(Probe::Down)));
84+ }
85+ if let Ok(mut slot) = CACHE.lock() {
86+ *slot = (Instant::now(), readings.clone());
87+ }
88+ readings.into_iter().map(|(_, probe)| probe).collect()
89+}
90+
91+/// The cached reading, when it is young enough to stand and covers every
92+/// URL asked. A poisoned cache is a miss — the next round re-probes.
93+fn fresh(urls: &[String]) -> Option<Vec<Probe>> {
94+ let cache = CACHE.lock().ok()?;
95+ let (at, readings) = &*cache;
96+ if at.elapsed() >= CACHE_TTL {
97+ return None;
98+ }
99+ urls.iter()
100+ .map(|url| {
101+ readings
102+ .iter()
103+ .find(|(seen, _)| seen == url)
104+ .map(|(_, probe)| probe.clone())
105+ })
106+ .collect()
107+}
crates/im-web/src/i18n.rsmodified+13 -0
@@ -63,6 +63,7 @@ pub enum Key {
6363 ErrPhotoTooBig,
6464 ErrNotAnImage,
6565 ErrNoFile,
66+ ErrUnavailable,
6667 ErrResetInvalid,
6768 ErrSessionUnknown,
6869 ErrBadTheme,
@@ -144,6 +145,7 @@ pub enum Key {
144145 ServicesTitle,
145146 ServiceKeyLabel,
146147 ServiceAdd,
148+ ServiceUrlPlaceholder,
147149 ServiceKept,
148150 ServiceMoveUp,
149151 ServiceMoveDown,
@@ -251,6 +253,7 @@ pub enum Key {
251253 RedirectUrisLabel,
252254 RegisteredCol,
253255 ClientAdd,
256+ RedirectUrisPlaceholder,
254257 RotateWord,
255258 RevokeWord,
256259 ConfirmRotate,
@@ -377,6 +380,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
377380 (ErrNotAnImage, Tr) => "Bu dosya bir görsel değil.",
378381 (ErrNoFile, En) => "Choose an image first.",
379382 (ErrNoFile, Tr) => "Önce bir görsel seç.",
383+ (ErrUnavailable, En) => "That could not be saved right now — try again.",
384+ (ErrUnavailable, Tr) => "Bu şu anda kaydedilemedi — yeniden dene.",
380385 (ErrResetInvalid, En) => "This reset link is not valid — ask for a fresh one.",
381386 (ErrResetInvalid, Tr) => "Bu sıfırlama bağlantısı geçerli değil — yenisini iste.",
382387 (ErrSessionUnknown, En) => "That session is already gone.",
@@ -524,6 +529,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
524529 (ServiceKeyLabel, Tr) => "Anahtar",
525530 (ServiceAdd, En) => "Add service",
526531 (ServiceAdd, Tr) => "Hizmet ekle",
532+ (ServiceUrlPlaceholder, En) => "https://in.dizey.sh",
533+ (ServiceUrlPlaceholder, Tr) => "https://in.dizey.sh",
527534 (ServiceKept, En) => "kept by the app",
528535 (ServiceKept, Tr) => "uygulaması koruyor",
529536 (ServiceMoveUp, En) => "Move up",
@@ -749,6 +756,12 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
749756 (RegisteredCol, Tr) => "Kayıt",
750757 (ClientAdd, En) => "Register client",
751758 (ClientAdd, Tr) => "İstemci kaydet",
759+ (RedirectUrisPlaceholder, En) => {
760+ "http://127.0.0.1:9000/callback https://drive.dizey.sh/callback"
761+ }
762+ (RedirectUrisPlaceholder, Tr) => {
763+ "http://127.0.0.1:9000/callback https://drive.dizey.sh/callback"
764+ }
752765 (RotateWord, En) => "Rotate",
753766 (RotateWord, Tr) => "Yenile",
754767 (RevokeWord, En) => "Revoke",
crates/im-web/src/layout.rsmodified+17 -16
@@ -7,7 +7,7 @@ use topcoat::asset::{Asset, asset};
77 use topcoat::context::Cx;
88 use topcoat::view::{BoxView, Child, View, ViewExt, view};
99
10-use crate::health::{Probe, probe_healthz};
10+use crate::health::{Probe, probe_family};
1111 use crate::i18n::{Key, Lang, lang_of, t};
1212 use crate::server;
1313
@@ -44,20 +44,19 @@ pub async fn family_wordmark(cx: &Cx) -> Result<BoxView<'_>> {
4444 if siblings.is_empty() {
4545 return wordmark(cx).await.map(ViewExt::boxed);
4646 }
47- // Every probe at once: a family member that is down costs its two
48- // seconds, not two seconds each.
49- let http = reqwest::Client::new();
50- let mut probes = Vec::new();
51- for service in &siblings {
52- let http = http.clone();
53- let url = format!("{}/healthz", service.url.trim_end_matches('/'));
54- probes.push(tokio::spawn(async move { probe_healthz(&http, &url).await }));
55- }
56- let mut rows = Vec::new();
57- for (service, probe) in siblings.iter().zip(probes) {
58- let probe = probe.await.unwrap_or(Probe::Down);
59- rows.push((service.key.as_str(), service.url.as_str(), probe));
60- }
47+ // One shared reading: a render inside the cache window reuses the
48+ // last probe round, so a family member that is down costs its two
49+ // seconds once per window, not once per page view.
50+ let urls = siblings
51+ .iter()
52+ .map(|service| format!("{}/healthz", service.url.trim_end_matches('/')))
53+ .collect::<Vec<_>>();
54+ let probes = probe_family(&urls).await;
55+ let rows = siblings
56+ .iter()
57+ .zip(probes)
58+ .map(|(service, probe)| (service.key.as_str(), service.url.as_str(), probe))
59+ .collect::<Vec<_>>();
6160 let marks = trio_marks(rows);
6261 Ok(view! {
6362 cx =>
@@ -366,7 +365,9 @@ pub async fn soft_nav_script(cx: &Cx) -> Result<impl View + '_> {
366365 var a = e.target.closest ? e.target.closest('a') : null;
367366 if (!a || a.target || a.hasAttribute('download') || a.hasAttribute('data-hard')) { return; }
368367 var href = a.getAttribute('href') || '';
369- if (href.indexOf('/') !== 0) { return; }
368+ // Same-app paths only: `//host` is protocol-relative — another origin —
369+ // and goes the browser's own way.
370+ if (href.indexOf('/') !== 0 || href.indexOf('//') === 0) { return; }
370371 e.preventDefault();
371372 go(href, true, true);
372373 }, true);
crates/im-web/src/oidc.rsmodified+4 -2
@@ -150,9 +150,10 @@ async fn authorize(cx: &Cx) -> Result<Response> {
150150 let Some(user) = user else {
151151 let back = format!("/authorize?{query}");
152152 let location = format!("/login?back={}", urlencode(&back));
153+ let location = HeaderValue::from_str(&location)?;
153154 return (
154155 StatusCode::SEE_OTHER,
155- [(header::LOCATION, HeaderValue::from_str(&location).unwrap())],
156+ [(header::LOCATION, location)],
156157 )
157158 .into_response(cx);
158159 };
@@ -172,9 +173,10 @@ async fn authorize(cx: &Cx) -> Result<Response> {
172173 if let Some(state) = state {
173174 location.push_str(&format!("&state={state}"));
174175 }
176+ let location = HeaderValue::from_str(&location)?;
175177 (
176178 StatusCode::SEE_OTHER,
177- [(header::LOCATION, HeaderValue::from_str(&location).unwrap())],
179+ [(header::LOCATION, location)],
178180 )
179181 .into_response(cx)
180182 }
crates/im-web/src/pages.rsmodified+4 -2
@@ -40,6 +40,7 @@ pub fn error_text(code: &str, lang: Lang) -> &'static str {
4040 "photo_too_big" => t(lang, Key::ErrPhotoTooBig),
4141 "not_an_image" => t(lang, Key::ErrNotAnImage),
4242 "no_file" => t(lang, Key::ErrNoFile),
43+ "unavailable" => t(lang, Key::ErrUnavailable),
4344 "session_unknown" => t(lang, Key::ErrSessionUnknown),
4445 "bad_theme" => t(lang, Key::ErrBadTheme),
4546 "bad_ui" => t(lang, Key::ErrBadUi),
@@ -485,6 +486,7 @@ pub(crate) fn escape(raw: &str) -> String {
485486 .replace('<', "&lt;")
486487 .replace('>', "&gt;")
487488 .replace('"', "&quot;")
489+ .replace('\'', "&#39;")
488490 }
489491
490492 /// What the agent string means to a person — "Chrome on Linux", not the raw
@@ -832,7 +834,7 @@ async fn signed_in<'a>(cx: &'a Cx, user: im_core::model::User) -> Result<BoxView
832834 <div class="auth-title">(t(lang, Key::EmailCardTitle))</div>
833835 if let Some(pending) = pending_email.as_deref() {
834836 <div class="auth-sub">
835- (crate::i18n::email_pending_line(lang, &escape(pending)))
837+ (crate::i18n::email_pending_line(lang, pending))
836838 </div>
837839 }
838840 if let Some(links) = query_value(&query, "links") {
@@ -1105,7 +1107,7 @@ async fn email_change_page(cx: &Cx) -> Result<Response> {
11051107 <div class="auth-head">
11061108 <div class="auth-title">(t(lang, Key::EmailConfirmTitle))</div>
11071109 <div class="auth-sub">
1108- (crate::i18n::email_confirm_sub(lang, &escape(&new_email)))
1110+ (crate::i18n::email_confirm_sub(lang, &new_email))
11091111 </div>
11101112 </div>
11111113 <form method="post" action="/email" data-hard="">
crates/im-web/src/people.rsmodified+3 -4
@@ -38,8 +38,7 @@ async fn people_page(cx: &Cx) -> Result<impl View + '_> {
3838 // The stage template moves every value it mentions, so the account's
3939 // template data is staged here as owned values first; the markup below
4040 // never names `person` itself.
41- let face_button = avatar(cx, &person).await?.first().await?;
42- let face_plain = avatar(cx, &person).await?.first().await?;
41+ let face = avatar(cx, &person).await?.first().await?;
4342 let display_name = person.name.clone();
4443 let email_shown = person.email.clone();
4544 let has_photo = person.has_photo;
@@ -57,10 +56,10 @@ async fn people_page(cx: &Cx) -> Result<impl View + '_> {
5756 // The face opens the viewer here too — same as
5857 // the landing, same as iz's person page.
5958 <button class="avatar-view" type="button" aria-label=(t(lang, Key::ViewPhotoAria))>
60- (face_button)
59+ (face)
6160 </button>
6261 } else {
63- (face_plain)
62+ (face)
6463 }
6564 <div class="profile-heading">
6665 <div class="auth-title">(display_name)</div>
crates/im-web/src/photo.rsmodified+7 -7
@@ -115,23 +115,23 @@ fn bytes_response(
115115 content_type: &str,
116116 cache: &'static str,
117117 version: u64,
118-) -> (StatusCode, HeaderMap, Vec<u8>) {
118+) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
119119 let etag = format!("\"p{version}\"");
120120 let mut headers = HeaderMap::new();
121- headers.insert(header::ETAG, HeaderValue::from_str(&etag).unwrap());
121+ headers.insert(header::ETAG, HeaderValue::from_str(&etag)?);
122122 headers.insert(header::CACHE_CONTROL, HeaderValue::from_static(cache));
123123 let if_none_match = request_headers(cx)
124124 .get(header::IF_NONE_MATCH)
125125 .and_then(|v| v.to_str().ok());
126126 if if_none_match == Some(etag.as_str()) {
127- return (StatusCode::NOT_MODIFIED, headers, Vec::new());
127+ return Ok((StatusCode::NOT_MODIFIED, headers, Vec::new()));
128128 }
129129 headers.insert(
130130 header::CONTENT_TYPE,
131131 HeaderValue::from_str(content_type)
132132 .unwrap_or(HeaderValue::from_static("application/octet-stream")),
133133 );
134- (StatusCode::OK, headers, bytes)
134+ Ok((StatusCode::OK, headers, bytes))
135135 }
136136
137137 /// The default face, as an image: the name's first letter on a quiet tile —
@@ -203,7 +203,7 @@ async fn serve(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
203203 } else {
204204 "private, no-cache"
205205 };
206- return Ok(bytes_response(cx, bytes, &mime, cache, version));
206+ return bytes_response(cx, bytes, &mime, cache, version);
207207 }
208208 let initial = user
209209 .as_ref()
@@ -211,13 +211,13 @@ async fn serve(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
211211 .unwrap_or('?')
212212 .to_uppercase()
213213 .to_string();
214- Ok(bytes_response(
214+ bytes_response(
215215 cx,
216216 default_avatar(&initial),
217217 "image/svg+xml",
218218 "private, no-cache",
219219 version,
220- ))
220+ )
221221 }
222222
223223 #[cfg(test)]