forge
Explore
Log in

Don't you dare go Hollow

a face changed in im is this site's news within a moment: the identity directory moves to im's im-client SDK (pinned f7b2081, oidc half gated off — two route sets in one binary collide), the user row carries photo_version beside the rest of the mirrored identity, /avatar serves any provisioned member and caches by the row's own stamp (?v equal to it is a year of immutable, anything else revalidates, the etag is the version), the topbar's img carries the stamp so a changed photo is a changed URL, a profile topic rides the live channel to every signed-in reader because a coworker's face is nobody's secret, and an identity-sync task keeps the whole of it true — a full roster pass at boot and on every stream end as the healer, the live feed as the fast path, backoff when im is down

Browse files at this commit

8713c4035c59fe1070f34e43539dc279cc9b2e5dAhmet Kaan GümüşParent: e90391d
Cargo.lockmodified+22 -0
@@ -1874,6 +1874,27 @@ dependencies = [
1874 "icu_properties",1874 "icu_properties",
1875 ]1875 ]
1876 1876
1877+[[package]]
1878+name = "im-client"
1879+version = "0.1.0"
1880+source = "git+https://github.com/DizeyLab/im?rev=f7b2081#f7b208171820ca309b10043c6e86de12b81f3826"
1881+dependencies = [
1882+ "base64 0.22.1",
1883+ "chacha20poly1305",
1884+ "rand 0.10.2",
1885+ "reqwest",
1886+ "rsa",
1887+ "serde",
1888+ "serde_json",
1889+ "sha2 0.10.9",
1890+ "sha2 0.11.0",
1891+ "subtle",
1892+ "thiserror",
1893+ "time",
1894+ "tokio",
1895+ "topcoat",
1896+]
1897+
1877 [[package]]1898 [[package]]
1878 name = "image"1899 name = "image"
1879 version = "0.25.10"1900 version = "0.25.10"
@@ -1967,6 +1988,7 @@ dependencies = [
1967 "http",1988 "http",
1968 "http-body",1989 "http-body",
1969 "http-body-util",1990 "http-body-util",
1991+ "im-client",
1970 "in-client",1992 "in-client",
1971 "in-core",1993 "in-core",
1972 "serde",1994 "serde",
Cargo.tomlmodified+6 -0
@@ -11,6 +11,12 @@ repository = "https://github.com/DizeyLab/in"
11 [workspace.dependencies]11 [workspace.dependencies]
12 in-core = { path = "crates/in-core", default-features = false }12 in-core = { path = "crates/in-core", default-features = false }
13 in-client = { path = "crates/in-client" }13 in-client = { path = "crates/in-client" }
14+# The identity-directory SDK, split out of im: the directory list, the
15+# photo proxy and the live change feed, authenticated with the same client
16+# pair the OIDC side already holds. The OIDC half stays gated off — this
17+# app's own `in-client` fork keeps the auth routes, and two route sets in
18+# one binary collide.
19+im-client = { git = "https://github.com/DizeyLab/im", rev = "f7b2081", default-features = false }
14 serde = { version = "1.0.229", features = ["derive"] }20 serde = { version = "1.0.229", features = ["derive"] }
15 serde_json = "1.0.145"21 serde_json = "1.0.145"
16 thiserror = "2.0.20"22 thiserror = "2.0.20"
crates/in-client/src/lib.rsmodified+7 -65
@@ -151,71 +151,6 @@ pub async fn current_user(cx: &Cx) -> Option<User> {
151 }151 }
152 }152 }
153 153
154-/// The person's profile photo from im, if im has one. `None` on 404 and on
155-/// anything else that is not the bytes — a dropped connection, a body that
156-/// will not read, a reply without a mime — because a missing face must never
157-/// fail the page around it: the caller renders its initials instead.
158-///
159-/// Authenticated as the app, not the browser: `Authorization: Basic
160-/// base64(client_id ":" client_secret)` against im's `/photo/{user_id}`,
161-/// the same credentials the introspection round-trip posts with.
162-pub async fn photo_for(cx: &Cx, user_id: &str) -> Option<(Vec<u8>, String)> {
163- let state = client(cx);
164- let reply = state
165- .http
166- .get(format!("{}/photo/{user_id}", state.config.issuer))
167- .basic_auth(&state.config.client_id, Some(&state.config.client_secret))
168- .send()
169- .await
170- .ok()?;
171- if !reply.status().is_success() {
172- return None;
173- }
174- let mime = reply
175- .headers()
176- .get(reqwest::header::CONTENT_TYPE)?
177- .to_str()
178- .ok()?
179- .to_string();
180- let bytes = reply.bytes().await.ok()?.to_vec();
181- Some((bytes, mime))
182-}
183-
184-/// One entry of im's directory: the stable subject, the address, the
185-/// display name, and whether im calls the person an admin — exactly what
186-/// mirroring the directory into local user rows needs.
187-#[derive(Debug, Clone, Deserialize)]
188-pub struct DirectoryMember {
189- pub sub: String,
190- pub email: String,
191- pub name: String,
192- pub admin: bool,
193-}
194-
195-/// im's family phonebook: every person im knows, fetched as the app
196-/// (`Authorization: Basic base64(client_id ":" client_secret)`, the same
197-/// credentials the photo route and the introspection round-trip take) from
198-/// `{issuer}/directory`. Only a registered app gets an answer at all.
199-///
200-/// `None` on anything that is not a readable list — a refused pair, a
201-/// dropped connection, a body that is not the array — because a missed
202-/// beat must never look like an empty directory: the caller keeps the
203-/// rows it has and asks again next time.
204-pub async fn directory(cx: &Cx) -> Option<Vec<DirectoryMember>> {
205- let state = client(cx);
206- let reply = state
207- .http
208- .get(format!("{}/directory", state.config.issuer))
209- .basic_auth(&state.config.client_id, Some(&state.config.client_secret))
210- .send()
211- .await
212- .ok()?;
213- if !reply.status().is_success() {
214- return None;
215- }
216- reply.json().await.ok()
217-}
218-
219 /// One entry of im's family list: the word the switcher renders, the154 /// One entry of im's family list: the word the switcher renders, the
220 /// human label for its title, and the service's base URL — the shape im's155 /// human label for its title, and the service's base URL — the shape im's
221 /// `/family` answers with.156 /// `/family` answers with.
@@ -355,6 +290,9 @@ async fn introspect(state: &InClient, token: &str) -> Introspected {
355 sub: sub.to_string(),290 sub: sub.to_string(),
356 email: email.to_string(),291 email: email.to_string(),
357 name: name.to_string(),292 name: name.to_string(),
293+ // Additive on im's answer: an im predating the field reads as
294+ // "no photo stamp known", which only softens caching.
295+ photo_version: answer["photo_version"].as_u64().unwrap_or(0),
358 },296 },
359 exp,297 exp,
360 )298 )
@@ -366,6 +304,10 @@ pub struct User {
366 pub sub: String,304 pub sub: String,
367 pub email: String,305 pub email: String,
368 pub name: String,306 pub name: String,
307+ /// How many times the person's photo has changed in im — the `?v=` the
308+ /// app's avatar route caches by. Mirrored out of introspection; `0`
309+ /// reads as "no stamp known".
310+ pub photo_version: u64,
369 }311 }
370 312
371 // ---------------------------------------------------------------------------313 // ---------------------------------------------------------------------------
crates/in-core/migrations/0006_photo_version.sqladded+12 -0
@@ -0,0 +1,12 @@
1+-- The stamp that lets a proxied face be cached hard and still arrive fresh.
2+--
3+-- `user.photo_version` counts how many times the person's photo has changed
4+-- in im — the identity directory's word, mirrored here by the same passes
5+-- that mirror email, name and admin. The avatar route turns it into the
6+-- `ETag` and the `/avatar/{id}?v=` stamp, so a changed photo is a changed
7+-- URL and a browser never pins an old face behind a year of `immutable`.
8+-- `0` is "no photo known"; the DEFAULT is the backfill, SQLite filling every
9+-- existing row with it as the column is added. Databases already carrying
10+-- the column never see this file applied piecemeal — they reach the declared
11+-- shape through `in reconcile`, whose copy map backfills the same value.
12+ALTER TABLE user ADD COLUMN photo_version INTEGER NOT NULL DEFAULT 0;
crates/in-core/src/live.rsmodified+8 -1
@@ -24,6 +24,11 @@ pub enum Topic {
24 Trash(String),24 Trash(String),
25 /// Shares: links created or revoked, per-person grants added or removed.25 /// Shares: links created or revoked, per-person grants added or removed.
26 Shares(String),26 Shares(String),
27+ /// A member's identity as im tells it — address, display name, admin
28+ /// flag, photo version. Not per-user data: a person's face renders in
29+ /// every signed-in topbar, so every reader may hear that some member
30+ /// moved and re-fetch through the ordinary gated route.
31+ Profile(String),
27 /// Users, quotas, disablements — the admin's surface.32 /// Users, quotas, disablements — the admin's surface.
28 Admin(String),33 Admin(String),
29 }34 }
@@ -36,6 +41,7 @@ impl Topic {
36 Topic::Library(_) => "library",41 Topic::Library(_) => "library",
37 Topic::Trash(_) => "trash",42 Topic::Trash(_) => "trash",
38 Topic::Shares(_) => "shares",43 Topic::Shares(_) => "shares",
44+ Topic::Profile(_) => "profile",
39 Topic::Admin(_) => "admin",45 Topic::Admin(_) => "admin",
40 }46 }
41 }47 }
@@ -44,7 +50,8 @@ impl Topic {
44 /// is its own id — or, for [`Topic::Admin`], when it is an admin.50 /// is its own id — or, for [`Topic::Admin`], when it is an admin.
45 pub fn id(&self) -> &str {51 pub fn id(&self) -> &str {
46 match self {52 match self {
47- Topic::Library(id) | Topic::Trash(id) | Topic::Shares(id) | Topic::Admin(id) => id,53+ Topic::Library(id) | Topic::Trash(id) | Topic::Shares(id) | Topic::Profile(id)
54+ | Topic::Admin(id) => id,
48 }55 }
49 }56 }
50 }57 }
crates/in-core/src/store/mod.rsmodified+15 -2
@@ -88,6 +88,11 @@ pub struct User {
88 pub email: String,88 pub email: String,
89 pub display_name: String,89 pub display_name: String,
90 pub admin: bool,90 pub admin: bool,
91+ /// How many times the person's photo has changed in im — the stamp the
92+ /// avatar route turns into its `ETag` and `?v=`. Mirrored from the
93+ /// identity directory by the same passes that mirror address and name;
94+ /// `0` reads as "no photo known".
95+ pub photo_version: u64,
91 pub disabled: bool,96 pub disabled: bool,
92 /// The person's ceiling, in bytes. Set at provisioning, changed by an97 /// The person's ceiling, in bytes. Set at provisioning, changed by an
93 /// admin afterwards.98 /// admin afterwards.
@@ -375,14 +380,22 @@ pub trait Store: 'static + Send + Sync {
375 /// Every account, oldest first — the admin's settings screen.380 /// Every account, oldest first — the admin's settings screen.
376 async fn users(&self) -> Result<Vec<User>>;381 async fn users(&self) -> Result<Vec<User>>;
377 382
378- /// JIT upsert on OIDC login: unknown sub inserts (first user ever gets383+ /// JIT upsert on OIDC login and on every identity-directory sight:
384+ /// unknown sub inserts (first-ever row with no provider word gets
379 /// admin=1, quota = default_quota_bytes), known sub refreshes385 /// admin=1, quota = default_quota_bytes), known sub refreshes
380- /// email/display_name and stamps last_seen_at. Returns the row.386+ /// email/display_name/photo_version and stamps last_seen_at. `admin`
387+ /// is the provider's word when the caller carries one — `Some` from the
388+ /// directory and its stream, `None` from a claims-only introspection —
389+ /// and absent it, the row's flag stands. A change to any mirrored
390+ /// field announces [`Topic::Profile`](crate::live::Topic); a fresh row
391+ /// also announces [`Topic::Admin`](crate::live::Topic). Returns the row.
381 async fn provision_user(392 async fn provision_user(
382 &self,393 &self,
383 sub: &str,394 sub: &str,
384 email: &str,395 email: &str,
385 display_name: &str,396 display_name: &str,
397+ admin: Option<bool>,
398+ photo_version: u64,
386 default_quota_bytes: u64,399 default_quota_bytes: u64,
387 ) -> Result<User>;400 ) -> Result<User>;
388 401
crates/in-core/src/store/reconcile.rsmodified+9 -1
@@ -204,7 +204,7 @@ struct TableMap {
204 204
205 /// Builds the explicit column map. Unchanged tables map every column to its205 /// Builds the explicit column map. Unchanged tables map every column to its
206 /// old self; the user table carries the migration-specific expressions for206 /// old self; the user table carries the migration-specific expressions for
207-/// `ui`, `theme` and `language`, and the file table one for207+/// `ui`, `theme`, `language` and `photo_version`, and the file table one for
208 /// `download_count`: a database old enough to predate a column starts on the208 /// `download_count`: a database old enough to predate a column starts on the
209 /// schema's own default rather than on an empty string, which no writer209 /// schema's own default rather than on an empty string, which no writer
210 /// would ever store and no reader would ever honour. The share-link table210 /// would ever store and no reader would ever honour. The share-link table
@@ -218,6 +218,7 @@ fn build_maps(
218 old_has_language: bool,218 old_has_language: bool,
219 old_has_download_count: bool,219 old_has_download_count: bool,
220 old_has_password_hash: bool,220 old_has_password_hash: bool,
221+ old_has_photo_version: bool,
221 ) -> Vec<TableMap> {222 ) -> Vec<TableMap> {
222 vec![223 vec![
223 TableMap {224 TableMap {
@@ -249,6 +250,11 @@ fn build_maps(
249 } else {250 } else {
250 ("language", "'en'".into())251 ("language", "'en'".into())
251 });252 });
253+ columns.push(if old_has_photo_version {
254+ ("photo_version", "old.photo_version".into())
255+ } else {
256+ ("photo_version", "0".into())
257+ });
252 columns258 columns
253 },259 },
254 },260 },
@@ -424,12 +430,14 @@ async fn copy_data(old_conn: &Connection, new_conn: &Connection, path: &str) ->
424 let old_has_language = old_has_column(old_conn, "user", "language").await?;430 let old_has_language = old_has_column(old_conn, "user", "language").await?;
425 let old_has_download_count = old_has_column(old_conn, "file", "download_count").await?;431 let old_has_download_count = old_has_column(old_conn, "file", "download_count").await?;
426 let old_has_password_hash = old_has_column(old_conn, "share_link", "password_hash").await?;432 let old_has_password_hash = old_has_column(old_conn, "share_link", "password_hash").await?;
433+ let old_has_photo_version = old_has_column(old_conn, "user", "photo_version").await?;
427 let maps = build_maps(434 let maps = build_maps(
428 old_has_ui,435 old_has_ui,
429 old_has_theme,436 old_has_theme,
430 old_has_language,437 old_has_language,
431 old_has_download_count,438 old_has_download_count,
432 old_has_password_hash,439 old_has_password_hash,
440+ old_has_photo_version,
433 );441 );
434 validate_maps(new_conn, &maps).await?;442 validate_maps(new_conn, &maps).await?;
435 443
crates/in-core/src/store/schema.rsmodified+1 -0
@@ -19,6 +19,7 @@ pub(crate) const MIGRATIONS: &[&str] = &[
19 include_str!("../../migrations/0003_preferences.sql"),19 include_str!("../../migrations/0003_preferences.sql"),
20 include_str!("../../migrations/0004_downloads_settings.sql"),20 include_str!("../../migrations/0004_downloads_settings.sql"),
21 include_str!("../../migrations/0005_link_password.sql"),21 include_str!("../../migrations/0005_link_password.sql"),
22+ include_str!("../../migrations/0006_photo_version.sql"),
22 ];23 ];
23 24
24 /// The whole declared schema — every migration applied in order — as one25 /// The whole declared schema — every migration applied in order — as one
crates/in-core/src/store/turso_store.rsmodified+50 -45
@@ -36,7 +36,7 @@ const UPLOADS_DIR: &str = "uploads";
36 /// row wears `failed` rather than pinning memory the size of the file.36 /// row wears `failed` rather than pinning memory the size of the file.
37 const THUMB_SOURCE_CAP: u64 = 64 * 1024 * 1024;37 const THUMB_SOURCE_CAP: u64 = 64 * 1024 * 1024;
38 38
39-const USER_COLUMNS: &str = "id, oidc_sub, email, display_name, admin, disabled, quota_bytes, used_bytes, ui, created_at, last_seen_at, theme, language";39+const USER_COLUMNS: &str = "id, oidc_sub, email, display_name, admin, disabled, quota_bytes, used_bytes, ui, created_at, last_seen_at, theme, language, photo_version";
40 const FOLDER_COLUMNS: &str = "id, owner_id, parent_id, name, created_at, deleted_at";40 const FOLDER_COLUMNS: &str = "id, owner_id, parent_id, name, created_at, deleted_at";
41 const FILE_COLUMNS: &str = "id, owner_id, folder_id, name, mime, size_bytes, thumb_state, created_at, updated_at, deleted_at, download_count";41 const FILE_COLUMNS: &str = "id, owner_id, folder_id, name, mime, size_bytes, thumb_state, created_at, updated_at, deleted_at, download_count";
42 const LINK_COLUMNS: &str = "id, token_hash, kind, target_id, created_by, can_download, created_at, expires_at, revoked_at, password_hash";42 const LINK_COLUMNS: &str = "id, token_hash, kind, target_id, created_by, can_download, created_at, expires_at, revoked_at, password_hash";
@@ -962,6 +962,7 @@ fn user_from(row: &Row) -> Result<User> {
962 language: text(row, 12)?,962 language: text(row, 12)?,
963 created_at: parse_stamp(&text(row, 9)?)?,963 created_at: parse_stamp(&text(row, 9)?)?,
964 last_seen_at: opt_stamp(row, 10)?,964 last_seen_at: opt_stamp(row, 10)?,
965+ photo_version: row.get::<i64>(13).map_err(backend)?.max(0) as u64,
965 })966 })
966 }967 }
967 968
@@ -1081,6 +1082,8 @@ impl Store for TursoStore {
1081 sub: &str,1082 sub: &str,
1082 email: &str,1083 email: &str,
1083 display_name: &str,1084 display_name: &str,
1085+ admin: Option<bool>,
1086+ photo_version: u64,
1084 default_quota_bytes: u64,1087 default_quota_bytes: u64,
1085 ) -> Result<User> {1088 ) -> Result<User> {
1086 let email = fold_email(email);1089 let email = fold_email(email);
@@ -1095,15 +1098,25 @@ impl Store for TursoStore {
1095 let sql = format!("SELECT {USER_COLUMNS} FROM user WHERE oidc_sub = ?1");1098 let sql = format!("SELECT {USER_COLUMNS} FROM user WHERE oidc_sub = ?1");
1096 let mut rows = tx.query(&sql, params![sub]).await.map_err(backend)?;1099 let mut rows = tx.query(&sql, params![sub]).await.map_err(backend)?;
1097 if let Some(row) = rows.next().await.map_err(backend)? {1100 if let Some(row) = rows.next().await.map_err(backend)? {
1098- let user = user_from(&row)?;1101+ let known = user_from(&row)?;
1099 drop(rows);1102 drop(rows);
1100- // A returning person: the provider may have a new address or a1103+ // A returning person: the row follows the provider — address,
1101- // new name for them, and the row follows the provider — but the1104+ // name, photo stamp, and the admin flag when this sight carries
1102- // admin flag and the quota are ours, and this write touches1105+ // the directory's word on it. The quota is ours and this write
1103- // neither.1106+ // touches neither it nor a flag nobody spoke about.
1107+ let admin_changed = admin.is_some_and(|flag| flag != known.admin);
1104 tx.execute(1108 tx.execute(
1105- "UPDATE user SET email = ?1, display_name = ?2, last_seen_at = ?3 WHERE id = ?4",1109+ "UPDATE user SET email = ?1, display_name = ?2, photo_version = ?3, \
1106- params![email, display_name, now_text()?, user.id],1110+ admin = CASE WHEN ?4 IS NULL THEN admin ELSE ?4 END, last_seen_at = ?5 \
1111+ WHERE id = ?6",
1112+ params![
1113+ email,
1114+ display_name,
1115+ photo_version as i64,
1116+ admin.map(|flag| if flag { 1 } else { 0 }),
1117+ now_text()?,
1118+ known.id
1119+ ],
1107 )1120 )
1108 .await1121 .await
1109 .map_err(backend)?;1122 .map_err(backend)?;
@@ -1116,6 +1129,16 @@ impl Store for TursoStore {
1116 let user = user_from(&row)?;1129 let user = user_from(&row)?;
1117 drop(back);1130 drop(back);
1118 tx.commit().await.map_err(backend)?;1131 tx.commit().await.map_err(backend)?;
1132+ // A mirrored field moved: every signed-in topbar may want the
1133+ // new face or name. A mere last-seen stamp announces nothing —
1134+ // a quiet return is not news.
1135+ if user.email != known.email
1136+ || user.display_name != known.display_name
1137+ || user.photo_version != known.photo_version
1138+ || admin_changed
1139+ {
1140+ self.announce([Topic::Profile(user.id.clone())]);
1141+ }
1119 return Ok(user);1142 return Ok(user);
1120 }1143 }
1121 drop(rows);1144 drop(rows);
@@ -1128,16 +1151,19 @@ impl Store for TursoStore {
1128 None => 0,1151 None => 0,
1129 };1152 };
1130 drop(count);1153 drop(count);
1131- // The first account ever provisioned is the admin: there is no one1154+ // The provider's word on the person is the admin flag when it has
1132- // else to make one, and a deployment with no admin is a deployment1155+ // one; a sight with no directory behind it falls back to the
1133- // nobody can administer.1156+ // bootstrap rule — the first account ever provisioned is the admin,
1134- let admin = n == 0;1157+ // because a deployment with no admin is a deployment nobody can
1158+ // administer.
1159+ let admin = admin.unwrap_or(n == 0);
1135 let id = Ulid::new().to_string();1160 let id = Ulid::new().to_string();
1136 let now = now_text()?;1161 let now = now_text()?;
1137 tx.execute(1162 tx.execute(
1138 "INSERT INTO user (id, oidc_sub, email, display_name, admin, disabled, \1163 "INSERT INTO user (id, oidc_sub, email, display_name, admin, disabled, \
1139- quota_bytes, used_bytes, ui, theme, language, created_at, last_seen_at) \1164+ quota_bytes, used_bytes, ui, theme, language, created_at, last_seen_at, \
1140- VALUES (?1, ?2, ?3, ?4, ?5, 0, ?6, 0, 'instrument', 'dark', 'en', ?7, ?7)",1165+ photo_version) \
1166+ VALUES (?1, ?2, ?3, ?4, ?5, 0, ?6, 0, 'instrument', 'dark', 'en', ?7, ?7, ?8)",
1141 params![1167 params![
1142 id.clone(),1168 id.clone(),
1143 sub,1169 sub,
@@ -1145,7 +1171,8 @@ impl Store for TursoStore {
1145 display_name,1171 display_name,
1146 if admin { 1 } else { 0 },1172 if admin { 1 } else { 0 },
1147 default_quota_bytes as i64,1173 default_quota_bytes as i64,
1148- now1174+ now,
1175+ photo_version as i64
1149 ],1176 ],
1150 )1177 )
1151 .await1178 .await
@@ -1165,10 +1192,12 @@ impl Store for TursoStore {
1165 let user = user_from(&row)?;1192 let user = user_from(&row)?;
1166 drop(back);1193 drop(back);
1167 tx.commit().await.map_err(backend)?;1194 tx.commit().await.map_err(backend)?;
1168- self.announce([Topic::Admin(user.id.clone())]);1195+ self.announce([
1196+ Topic::Admin(user.id.clone()),
1197+ Topic::Profile(user.id.clone()),
1198+ ]);
1169 Ok(user)1199 Ok(user)
1170 }1200 }
1171-
1172 async fn set_user_quota(&self, user_id: &str, quota_bytes: u64) -> Result<()> {1201 async fn set_user_quota(&self, user_id: &str, quota_bytes: u64) -> Result<()> {
1173 let conn = self.conn.lock().await;1202 let conn = self.conn.lock().await;
1174 let n = conn1203 let n = conn
@@ -3600,13 +3629,7 @@ mod tests {
3600 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))3629 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))
3601 .await3630 .await
3602 .unwrap();3631 .unwrap();
3603- let user = store3632+ let user = store.provision_user("sub-alice", "alice@example.com", "Alice", None, 0, 1024 * 1024 * 1024)
3604- .provision_user(
3605- "sub-alice",
3606- "alice@example.com",
3607- "Alice",
3608- 1024 * 1024 * 1024,
3609- )
3610 .await3633 .await
3611 .unwrap();3634 .unwrap();
3612 3635
@@ -3703,13 +3726,7 @@ mod tests {
3703 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))3726 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))
3704 .await3727 .await
3705 .unwrap();3728 .unwrap();
3706- let user = store3729+ let user = store.provision_user("sub-alice", "alice@example.com", "Alice", None, 0, 1024 * 1024 * 1024)
3707- .provision_user(
3708- "sub-alice",
3709- "alice@example.com",
3710- "Alice",
3711- 1024 * 1024 * 1024,
3712- )
3713 .await3730 .await
3714 .unwrap();3731 .unwrap();
3715 let file = store3732 let file = store
@@ -3745,13 +3762,7 @@ mod tests {
3745 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))3762 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))
3746 .await3763 .await
3747 .unwrap();3764 .unwrap();
3748- let user = store3765+ let user = store.provision_user("sub-alice", "alice@example.com", "Alice", None, 0, 1024 * 1024 * 1024)
3749- .provision_user(
3750- "sub-alice",
3751- "alice@example.com",
3752- "Alice",
3753- 1024 * 1024 * 1024,
3754- )
3755 .await3766 .await
3756 .unwrap();3767 .unwrap();
3757 let root = store.create_folder(&user.id, None, "root").await.unwrap();3768 let root = store.create_folder(&user.id, None, "root").await.unwrap();
@@ -3816,13 +3827,7 @@ mod tests {
3816 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))3827 let store = TursoStore::open(dir.path().join("in.db").to_str().unwrap(), Some(&storage))
3817 .await3828 .await
3818 .unwrap();3829 .unwrap();
3819- let user = store3830+ let user = store.provision_user("sub-alice", "alice@example.com", "Alice", None, 0, 1024 * 1024 * 1024)
3820- .provision_user(
3821- "sub-alice",
3822- "alice@example.com",
3823- "Alice",
3824- 1024 * 1024 * 1024,
3825- )
3826 .await3831 .await
3827 .unwrap();3832 .unwrap();
3828 let session = store3833 let session = store
crates/in-core/tests/store.rsmodified+7 -12
@@ -71,15 +71,13 @@ impl Drop for Scratch {
71 }71 }
72 72
73 async fn alice(store: &TursoStore) -> User {73 async fn alice(store: &TursoStore) -> User {
74- store74+ store.provision_user("sub-alice", "alice@example.com", "Alice", None, 0, 1024 * 1024 * 1024)
75- .provision_user("sub-alice", "alice@example.com", "Alice", 1024 * 1024 * 1024)
76 .await75 .await
77 .unwrap()76 .unwrap()
78 }77 }
79 78
80 async fn bob(store: &TursoStore) -> User {79 async fn bob(store: &TursoStore) -> User {
81- store80+ store.provision_user("sub-bob", "bob@example.com", "Bob", None, 0, 1024 * 1024 * 1024)
82- .provision_user("sub-bob", "bob@example.com", "Bob", 1024 * 1024 * 1024)
83 .await81 .await
84 .unwrap()82 .unwrap()
85 }83 }
@@ -140,8 +138,7 @@ async fn the_first_user_is_admin_and_sign_ins_refresh_the_row() {
140 // A returning person keeps their id, admin flag and quota; the provider's138 // A returning person keeps their id, admin flag and quota; the provider's
141 // new address and name win, and the sighting is stamped.139 // new address and name win, and the sighting is stamped.
142 let again = scratch140 let again = scratch
143- .store141+ .store.provision_user("sub-alice", "alice@new.com", "Alice New", None, 0, 1)
144- .provision_user("sub-alice", "alice@new.com", "Alice New", 1)
145 .await142 .await
146 .unwrap();143 .unwrap();
147 assert_eq!(again.id, first.id);144 assert_eq!(again.id, first.id);
@@ -928,8 +925,7 @@ async fn per_person_shares_gate_visibility() {
928 let user = alice(&scratch.store).await;925 let user = alice(&scratch.store).await;
929 let friend = bob(&scratch.store).await;926 let friend = bob(&scratch.store).await;
930 let stranger = scratch927 let stranger = scratch
931- .store928+ .store.provision_user("sub-caro", "caro@example.com", "Caro", None, 0, 1024)
932- .provision_user("sub-caro", "caro@example.com", "Caro", 1024)
933 .await929 .await
934 .unwrap();930 .unwrap();
935 let file = scratch.store.insert_file(&user.id, None, "shared", b"data").await.unwrap();931 let file = scratch.store.insert_file(&user.id, None, "shared", b"data").await.unwrap();
@@ -1288,8 +1284,7 @@ async fn the_sweep_waits_for_a_writer_instead_of_deleting_its_file() {
1288 async fn email_lookup_folds_case() {1284 async fn email_lookup_folds_case() {
1289 let scratch = Scratch::open().await;1285 let scratch = Scratch::open().await;
1290 let user = scratch1286 let user = scratch
1291- .store1287+ .store.provision_user("sub-mixed", "Mixed@Example.COM", "Mixed", None, 0, 1024)
1292- .provision_user("sub-mixed", "Mixed@Example.COM", "Mixed", 1024)
1293 .await1288 .await
1294 .unwrap();1289 .unwrap();
1295 // Stored folded, found however it is asked.1290 // Stored folded, found however it is asked.
@@ -1526,7 +1521,7 @@ async fn add_share_user_needs_the_owner() {
1526 let scratch = Scratch::open().await;1521 let scratch = Scratch::open().await;
1527 let user = alice(&scratch.store).await;1522 let user = alice(&scratch.store).await;
1528 let friend = bob(&scratch.store).await;1523 let friend = bob(&scratch.store).await;
1529- let stranger = scratch.store.provision_user("sub-caro", "caro@example.com", "Caro", 1024).await.unwrap();1524+ let stranger = scratch.store.provision_user("sub-caro", "caro@example.com", "Caro", None, 0, 1024).await.unwrap();
1530 let file = scratch.store.insert_file(&user.id, None, "mine", b"data").await.unwrap();1525 let file = scratch.store.insert_file(&user.id, None, "mine", b"data").await.unwrap();
1531 // A stranger naming someone else's file is refused — and names no grant.1526 // A stranger naming someone else's file is refused — and names no grant.
1532 assert!(matches!(1527 assert!(matches!(
@@ -1549,7 +1544,7 @@ async fn shares_for_target_lists_grants_for_the_owner() {
1549 let scratch = Scratch::open().await;1544 let scratch = Scratch::open().await;
1550 let user = alice(&scratch.store).await;1545 let user = alice(&scratch.store).await;
1551 let friend = bob(&scratch.store).await;1546 let friend = bob(&scratch.store).await;
1552- let stranger = scratch.store.provision_user("sub-caro", "caro@example.com", "Caro", 1024).await.unwrap();1547+ let stranger = scratch.store.provision_user("sub-caro", "caro@example.com", "Caro", None, 0, 1024).await.unwrap();
1553 let file = scratch.store.insert_file(&user.id, None, "mine", b"data").await.unwrap();1548 let file = scratch.store.insert_file(&user.id, None, "mine", b"data").await.unwrap();
1554 // No grants yet.1549 // No grants yet.
1555 assert!(scratch.store.shares_for_target(&user.id, ShareKind::File, &file.id).await.unwrap().is_empty());1550 assert!(scratch.store.shares_for_target(&user.id, ShareKind::File, &file.id).await.unwrap().is_empty());
crates/in-web/Cargo.tomlmodified+1 -0
@@ -21,6 +21,7 @@ topcoat = { version = "0.6.2", default-features = false, features = [
21 ] }21 ] }
22 in-core = { workspace = true, features = ["server"] }22 in-core = { workspace = true, features = ["server"] }
23 in-client.workspace = true23 in-client.workspace = true
24+im-client.workspace = true
24 serde.workspace = true25 serde.workspace = true
25 serde_json.workspace = true26 serde_json.workspace = true
26 time.workspace = true27 time.workspace = true
crates/in-web/src/avatar.rsmodified+58 -33
@@ -1,15 +1,25 @@
1-//! The signed-in person's face, proxied from im.1+//! Every provisioned member's face, proxied from im.
2 //!2 //!
3-//! `GET /avatar/{user_id}` answers with im's photo bytes for the caller's own3+//! `GET /avatar/{user_id}` answers with im's photo bytes for any member of
4-//! id — anything else (another id, no photo, im unreachable) is the same 404,4+//! the workspace — one's own id or a coworker's: a person's face renders in
5-//! and a browser without a session is refused outright. Served with the same5+//! every signed-in topbar, so the gate is the session, not the id. im is
6-//! fnv1a ETag + immutable cache as im's own photo route, so the topbar's6+//! asked with the app's own credentials and always answers an image (a
7-//! `<img>` revalidates rather than refetches.7+//! member with no photo gets the default tile), so the only failures left
8+//! are im unreachable and an id no row names — the same empty answer a
9+//! browser without a photo shows initials for. A browser without a session
10+//! is refused outright.
11+//!
12+//! Caching is versioned, not content-hashed: the `ETag` is the row's
13+//! `photo_version` — im's own stamp, mirrored by the directory passes — and
14+//! a request whose `?v=` already matches the row is stamped
15+//! `private, max-age=31536000, immutable`, so a changed photo is a changed
16+//! URL and no browser pins an old face behind a year of cache. Any other
17+//! spelling of the address revalidates with `private, no-cache`.
8 18
9 use topcoat::context::Cx;19 use topcoat::context::Cx;
10-use topcoat::router::request::headers as request_headers;20+use topcoat::router::request::{headers as request_headers, uri};
11 use topcoat::router::{HeaderMap, HeaderValue, StatusCode, header, path_param, route};21 use topcoat::router::{HeaderMap, HeaderValue, StatusCode, header, path_param, route};
12-use crate::server::require_user;22+use crate::server::{app, require_user};
13 23
14 path_param!(user_id);24 path_param!(user_id);
15 25
@@ -17,53 +27,68 @@ fn not_found() -> (StatusCode, HeaderMap, Vec<u8>) {
17 (StatusCode::NOT_FOUND, HeaderMap::new(), Vec::new())27 (StatusCode::NOT_FOUND, HeaderMap::new(), Vec::new())
18 }28 }
19 29
20-/// `GET /avatar/{user_id}`: im's photo for the caller, or the same not-found30+/// The `?v=` the request carries, if it carries one.
21-/// a stranger would see — never a `403`, which would confirm the id belongs31+fn stamped_version(cx: &Cx) -> Option<&str> {
22-/// to somebody else's account.32+ uri(cx).query()?.split('&').find_map(|pair| {
33+ let (name, value) = pair.split_once('=')?;
34+ (name == "v").then_some(value)
35+ })
36+}
37+
38+/// `GET /avatar/{user_id}`: im's photo for any provisioned member, or the
39+/// same not-found an unknown id gets — never a `403`, which would confirm
40+/// which ids exist. `?v=` equal to the row's `photo_version` is answered
41+/// from a year of `immutable`; anything else revalidates.
23 #[route(GET "/avatar/{user_id}")]42 #[route(GET "/avatar/{user_id}")]
24 async fn avatar(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {43 async fn avatar(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
25 let target: &str = path_param::<UserId>(cx);44 let target: &str = path_param::<UserId>(cx);
26 45
27- let user = match require_user(cx).await {46+ // The gate is the session: any signed-in browser may fetch any
28- Ok(user) => user,47+ // provisioned member's face, so the identity itself is not needed here.
48+ if require_user(cx).await.is_err() {
29 // An `<img>` has no page to carry a refusal on; 401 names the fix49 // An `<img>` has no page to carry a refusal on; 401 names the fix
30 // the way the live channel's does.50 // the way the live channel's does.
31- Err(_) => return Ok((StatusCode::UNAUTHORIZED, HeaderMap::new(), Vec::new())),51+ return Ok((StatusCode::UNAUTHORIZED, HeaderMap::new(), Vec::new()));
32- };
33- // v1: one's own face only — anyone else's id reads exactly like no
34- // photo, so one account's face can never be probed through another's.
35- if target != user.id {
36- return Ok(not_found());
37 }52 }
38- let Some((bytes, mime)) = in_client::photo_for(cx, &user.oidc_sub).await else {53+ // The row, not the caller's session, decides the stamp: any provisioned
54+ // member's face is served, keyed by their own photo version. A store
55+ // error folds into the same not-found as an unknown id — an `<img>` has
56+ // no better way to say either.
57+ let Ok(Some(row)) = app(cx).store.user(target).await else {
39 return Ok(not_found());58 return Ok(not_found());
40 };59 };
41 60
42- let etag = format!("\"{:x}\"", crate::files::fnv1a(&bytes));61+ let etag = format!("\"p{}\"", row.photo_version);
62+ let fresh = stamped_version(cx) == Some(row.photo_version.to_string().as_str());
43 let mut headers = HeaderMap::new();63 let mut headers = HeaderMap::new();
44 headers.insert(64 headers.insert(
45 header::ETAG,65 header::ETAG,
46- HeaderValue::from_str(&etag).unwrap_or(HeaderValue::from_static("\"0\"")),66+ HeaderValue::from_str(&etag).unwrap_or(HeaderValue::from_static("\"p0\"")),
47 );67 );
48- // The bytes are im's to version and this URL carries no stamp of its
49- // own, so a changed photo may take up to a year to show — the price of
50- // proxying without a stamp channel, and the same trade the thumbnail
51- // route already makes. `private` because the route is gated and a shared
52- // proxy must not answer a stranger from another account's entry.
53 headers.insert(68 headers.insert(
54 header::CACHE_CONTROL,69 header::CACHE_CONTROL,
55- HeaderValue::from_static("private, max-age=31536000, immutable"),70+ HeaderValue::from_static(if fresh {
56- );71+ "private, max-age=31536000, immutable"
57- headers.insert(72+ } else {
58- header::CONTENT_TYPE,73+ "private, no-cache"
59- HeaderValue::from_str(&mime).unwrap_or(HeaderValue::from_static("application/octet-stream")),74+ }),
60 );75 );
61-76+ // The stamp the browser holds is the row's own word: a match means the
77+ // bytes behind it cannot have changed without the version moving, so im
78+ // is not asked at all.
62 let if_none_match = request_headers(cx)79 let if_none_match = request_headers(cx)
63 .get(header::IF_NONE_MATCH)80 .get(header::IF_NONE_MATCH)
64 .and_then(|value| value.to_str().ok());81 .and_then(|value| value.to_str().ok());
65 if if_none_match == Some(etag.as_str()) {82 if if_none_match == Some(etag.as_str()) {
66 return Ok((StatusCode::NOT_MODIFIED, headers, Vec::new()));83 return Ok((StatusCode::NOT_MODIFIED, headers, Vec::new()));
67 }84 }
85+
86+ let Ok((bytes, mime)) = app(cx).directory.photo(&row.oidc_sub).await else {
87+ return Ok(not_found());
88+ };
89+ headers.insert(
90+ header::CONTENT_TYPE,
91+ HeaderValue::from_str(&mime).unwrap_or(HeaderValue::from_static("application/octet-stream")),
92+ );
68 Ok((StatusCode::OK, headers, bytes))93 Ok((StatusCode::OK, headers, bytes))
69 }94 }
crates/in-web/src/layout.rsmodified+2 -1
@@ -90,7 +90,7 @@ pub(crate) async fn avatar(cx: &Cx, user: &User, extra: &str) -> Result {
90 let class = format!("avatar avatar-tone-{tone} {extra}");90 let class = format!("avatar avatar-tone-{tone} {extra}");
91 let name = user.display_name.clone();91 let name = user.display_name.clone();
92 let initials = initials_of(&user.display_name);92 let initials = initials_of(&user.display_name);
93- let src = format!("/avatar/{}", user.id);93+ let src = format!("/avatar/{}?v={}", user.id, user.photo_version);
94 view! {94 view! {
95 cx =>95 cx =>
96 <span class="avatar-stack">96 <span class="avatar-stack">
@@ -896,6 +896,7 @@ pub async fn live_script(cx: &Cx) -> Result {
896 } \896 } \
897 function wanted(topic) { \897 function wanted(topic) { \
898 if (topic === 'resync') { return true; } \898 if (topic === 'resync') { return true; } \
899+ if (topic === 'profile') { return true; } \
899 var path = window.location.pathname; \900 var path = window.location.pathname; \
900 if (path.indexOf('/settings') === 0) { return topic === 'admin'; } \901 if (path.indexOf('/settings') === 0) { return topic === 'admin'; } \
901 if (path.indexOf('/shared') === 0) { return topic === 'shares'; } \902 if (path.indexOf('/shared') === 0) { return topic === 'shares'; } \
crates/in-web/src/live.rsmodified+28 -0
@@ -57,6 +57,12 @@ fn may_hear(topic: &Topic, me: &str, admin: bool) -> bool {
57 if topic.id() == me {57 if topic.id() == me {
58 return true;58 return true;
59 }59 }
60+ // A member's profile is not per-user data: every signed-in topbar
61+ // renders coworkers' faces and names, so every reader may hear that
62+ // some member moved and re-fetch through the ordinary gated route.
63+ if matches!(topic, Topic::Profile(_)) {
64+ return true;
65+ }
60 matches!(topic, Topic::Admin(_)) && admin66 matches!(topic, Topic::Admin(_)) && admin
61 }67 }
62 68
@@ -157,3 +163,25 @@ async fn live(cx: &Cx) -> topcoat::Result<Response> {
157 .keep_alive(KeepAlive::new())163 .keep_alive(KeepAlive::new())
158 .into_response(cx)164 .into_response(cx)
159 }165 }
166+
167+#[cfg(test)]
168+mod tests {
169+ use super::*;
170+ use crate::live::Topic;
171+
172+ #[test]
173+ fn a_profile_change_is_heard_by_every_signed_in_reader() {
174+ // A coworker's face renders in every topbar, so a member's profile
175+ // move is not per-user data: the reader it names and a stranger and
176+ // an admin all hear it. What nobody hears is another person's drive.
177+ let moved = Topic::Profile("member-id".to_string());
178+ assert!(may_hear(&moved, "member-id", false));
179+ assert!(may_hear(&moved, "someone-else", false));
180+ assert!(may_hear(&moved, "someone-else", true));
181+ assert!(!may_hear(
182+ &Topic::Library("member-id".to_string()),
183+ "someone-else",
184+ false
185+ ));
186+ }
187+}
crates/in-web/src/main.rsmodified+88 -0
@@ -213,6 +213,17 @@ async fn main() {
213 logout_back: config.public_origin(),213 logout_back: config.public_origin(),
214 };214 };
215 215
216+ // The same client pair, pointed at im's identity directory: the roster
217+ // the mirror below files, the photo bytes the avatar route proxies, and
218+ // the live feed that makes both arrive without waiting for a beat.
219+ let directory = im_client::directory::DirectoryClient::new(
220+ config.oidc.issuer.clone(),
221+ config.oidc.client_id.clone(),
222+ config.oidc.client_secret.clone(),
223+ );
224+ let default_quota_bytes = config.default_quota_bytes;
225+ tokio::spawn(identity_sync(store.clone(), directory.clone(), default_quota_bytes));
226+
216 // The suite the switcher's wordmarks link to is im's to keep: im's227 // The suite the switcher's wordmarks link to is im's to keep: im's
217 // admin panel owns the list and `/family` serves it to registered228 // admin panel owns the list and `/family` serves it to registered
218 // apps. This mirror is refreshed on the beat, first pass right away so229 // apps. This mirror is refreshed on the beat, first pass right away so
@@ -260,6 +271,7 @@ async fn main() {
260 config,271 config,
261 shutdown: in_web::live::Shutdown(stopping),272 shutdown: in_web::live::Shutdown(stopping),
262 link_key: cookie_key,273 link_key: cookie_key,
274+ directory,
263 })275 })
264 .app_context(in_client::LogoutBack(Arc::new(|cx: &Cx| {276 .app_context(in_client::LogoutBack(Arc::new(|cx: &Cx| {
265 Box::pin(async move { Some(in_web::server::share_origin(cx).await) })277 Box::pin(async move { Some(in_web::server::share_origin(cx).await) })
@@ -337,6 +349,82 @@ async fn shutdown_signal() {
337 }349 }
338 }350 }
339 351
352+/// The longest wait a run of directory failures earns before trying again.
353+const IDENTITY_BACKOFF_CAP: std::time::Duration = std::time::Duration::from_secs(30);
354+
355+/// Mirrors one member's identity into the local row: the JIT upsert that
356+/// keeps address, name, admin flag and photo stamp following im. The store
357+/// announces a `profile` change itself when a mirrored field moved, so the
358+/// only job left here is the write and its one log line when it fails.
359+async fn mirror_member(
360+ store: &Arc<dyn in_core::store::Store>,
361+ member: &im_client::directory::DirectoryMember,
362+ default_quota_bytes: u64,
363+) {
364+ if let Err(problem) = store
365+ .provision_user(
366+ &member.sub,
367+ &member.email,
368+ &member.name,
369+ Some(member.admin),
370+ member.photo_version,
371+ default_quota_bytes,
372+ )
373+ .await
374+ {
375+ eprintln!("in: directory mirror of {}: {problem}", member.sub);
376+ }
377+}
378+
379+/// Keeps the local user rows a live mirror of im's identity directory.
380+///
381+/// The shape is one pass, one stream, repeat: a full `/directory` pass
382+/// files (or heals) every member row, then `/directory/live` carries each
383+/// change as it happens. When the stream ends — im restarting, or its
384+/// window closing — the loop simply runs the full pass again: a lagged
385+/// reader hears silence, not partial frames, so the re-list is what catches
386+/// it up, and the redial is the fast path again. A pass that fails backs
387+/// off a second, then doubles to the cap, resetting on the next answer.
388+/// Runs the whole life of the process; nothing here is worth keeping alive
389+/// past shutdown.
390+async fn identity_sync(
391+ store: Arc<dyn in_core::store::Store>,
392+ client: im_client::directory::DirectoryClient,
393+ default_quota_bytes: u64,
394+) {
395+ let mut backoff = std::time::Duration::from_secs(1);
396+ loop {
397+ match client.directory().await {
398+ Ok(members) => {
399+ backoff = std::time::Duration::from_secs(1);
400+ for member in &members {
401+ mirror_member(&store, member, default_quota_bytes).await;
402+ }
403+ match client.open_stream().await {
404+ Ok(mut stream) => {
405+ while let Some(event) = stream.next().await {
406+ match event {
407+ Ok(im_client::directory::DirectoryEvent::Profile(member)) => {
408+ mirror_member(&store, &member, default_quota_bytes).await;
409+ }
410+ // A network failure ends the stream; the full
411+ // pass below re-lists before the redial.
412+ Err(problem) => {
413+ eprintln!("in: directory stream failed: {problem}");
414+ break;
415+ }
416+ }
417+ }
418+ }
419+ Err(problem) => eprintln!("in: directory stream refused: {problem}"),
420+ }
421+ }
422+ Err(problem) => eprintln!("in: directory pass failed: {problem}"),
423+ }
424+ tokio::time::sleep(backoff).await;
425+ backoff = (backoff * 2).min(IDENTITY_BACKOFF_CAP);
426+ }
427+}
340 /// How often the suite list is re-fetched from im. Short enough that a428 /// How often the suite list is re-fetched from im. Short enough that a
341 /// service the admin adds over there shows up here before anyone goes429 /// service the admin adds over there shows up here before anyone goes
342 /// looking for its wordmark, long enough that the two are not talking430 /// looking for its wordmark, long enough that the two are not talking
crates/in-web/src/server.rsmodified+6 -0
@@ -41,6 +41,10 @@ pub struct App {
41 /// database copy without the key file carries links that open but can41 /// database copy without the key file carries links that open but can
42 /// no longer be re-viewed.42 /// no longer be re-viewed.
43 pub link_key: in_core::store::secret::Key,43 pub link_key: in_core::store::secret::Key,
44+ /// im's identity directory — the roster, the photo bytes and the live
45+ /// change feed — authenticated with the same client pair the OIDC side
46+ /// holds. Built once at boot; cheap to clone.
47+ pub directory: im_client::directory::DirectoryClient,
44 }48 }
45 49
46 /// The application context this request runs under.50 /// The application context this request runs under.
@@ -173,6 +177,8 @@ pub async fn current_user(cx: &Cx) -> Result<Option<User>, StoreError> {
173 &claims.sub,177 &claims.sub,
174 &claims.email,178 &claims.email,
175 &claims.name,179 &claims.name,
180+ None,
181+ claims.photo_version,
176 app.config.default_quota_bytes,182 app.config.default_quota_bytes,
177 )183 )
178 .await?;184 .await?;