Services and clients merge into one admin section
Browse files at this commitb163bda9de2cab7fb5e8cd5c366d79802717a10cParent: 1abf2418 changed files +324 -138
- crates/im-core/src/services.rs +37 -13
- crates/im-core/src/store.rs +11 -8
- crates/im-web/assets/main.css +13 -3
- crates/im-web/src/admin.rs +210 -107
- crates/im-web/src/directory.rs +49 -1
- crates/im-web/src/i18n.rs +0 -6
- crates/im-web/src/main.rs +3 -0
- style/main.scss +1 -0
crates/im-core/src/services.rsmodified+37 -13
| @@ -29,6 +29,14 @@ pub struct Service { | |||
| 29 | /// three public fields the siblings mirror, and nothing more. | 29 | /// three public fields the siblings mirror, and nothing more. |
| 30 | #[serde(skip)] | 30 | #[serde(skip)] |
| 31 | pub owner: Option<String>, | 31 | pub owner: Option<String>, |
| 32 | + /// The relying-party credential this row answers for — the client id | ||
| 33 | + /// `POST /family/register` authenticated, stamped on every register, | ||
| 34 | + /// insert and refresh alike. im's own row stays `None`: the IdP is not | ||
| 35 | + /// its own client. This is the panel's join key between the wordmark | ||
| 36 | + /// and its Rotate/Revoke controls; a row the seed or the panel made | ||
| 37 | + /// carries `None` until its app registers. | ||
| 38 | + #[serde(skip)] | ||
| 39 | + pub client_id: Option<String>, | ||
| 32 | } | 40 | } |
| 33 | 41 | ||
| 34 | /// The owner im writes on its own row, registered from `issuer` on every | 42 | /// The owner im writes on its own row, registered from `issuer` on every |
| @@ -84,7 +92,7 @@ pub async fn list(store: &Store) -> Result<Vec<Service>> { | |||
| 84 | let conn = store.conn.lock().await; | 92 | let conn = store.conn.lock().await; |
| 85 | let mut rows = conn | 93 | let mut rows = conn |
| 86 | .query( | 94 | .query( |
| 87 | - "SELECT key, name, url, owner FROM services ORDER BY position, key", | 95 | + "SELECT key, name, url, owner, client_id FROM services ORDER BY position, key", |
| 88 | (), | 96 | (), |
| 89 | ) | 97 | ) |
| 90 | .await | 98 | .await |
| @@ -96,6 +104,7 @@ pub async fn list(store: &Store) -> Result<Vec<Service>> { | |||
| 96 | name: store::text(&row, 1)?, | 104 | name: store::text(&row, 1)?, |
| 97 | url: store::text(&row, 2)?, | 105 | url: store::text(&row, 2)?, |
| 98 | owner: store::opt_text(&row, 3)?, | 106 | owner: store::opt_text(&row, 3)?, |
| 107 | + client_id: store::opt_text(&row, 4)?, | ||
| 99 | }); | 108 | }); |
| 100 | } | 109 | } |
| 101 | Ok(services) | 110 | Ok(services) |
| @@ -281,6 +290,7 @@ pub async fn register( | |||
| 281 | name: &str, | 290 | name: &str, |
| 282 | url: &str, | 291 | url: &str, |
| 283 | owner: &str, | 292 | owner: &str, |
| 293 | + client_id: Option<&str>, | ||
| 284 | ) -> Result<Service> { | 294 | ) -> Result<Service> { |
| 285 | validate(key, name, url).map_err(StoreError::Invalid)?; | 295 | validate(key, name, url).map_err(StoreError::Invalid)?; |
| 286 | let url = url.trim_end_matches('/').to_string(); | 296 | let url = url.trim_end_matches('/').to_string(); |
| @@ -292,11 +302,12 @@ pub async fn register( | |||
| 292 | } | 302 | } |
| 293 | Some(_) => { | 303 | Some(_) => { |
| 294 | // Claiming an unowned row or refreshing our own: the address is | 304 | // Claiming an unowned row or refreshing our own: the address is |
| 295 | - // the app's to say, the name stays whatever is stored. | 305 | + // the app's to say, the name stays whatever is stored, and the |
| 306 | + // credential stamp follows the caller on every register. | ||
| 296 | let conn = store.conn.lock().await; | 307 | let conn = store.conn.lock().await; |
| 297 | conn.execute( | 308 | conn.execute( |
| 298 | - "UPDATE services SET url = ?2, owner = ?3 WHERE key = ?1", | 309 | + "UPDATE services SET url = ?2, owner = ?3, client_id = ?4 WHERE key = ?1", |
| 299 | - turso::params![key, url.as_str(), owner], | 310 | + turso::params![key, url.as_str(), owner, client_id], |
| 300 | ) | 311 | ) |
| 301 | .await | 312 | .await |
| 302 | .map_err(backend)?; | 313 | .map_err(backend)?; |
| @@ -304,9 +315,9 @@ pub async fn register( | |||
| 304 | None => { | 315 | None => { |
| 305 | let conn = store.conn.lock().await; | 316 | let conn = store.conn.lock().await; |
| 306 | conn.execute( | 317 | conn.execute( |
| 307 | - "INSERT INTO services (key, name, url, position, owner) \ | 318 | + "INSERT INTO services (key, name, url, position, owner, client_id) \ |
| 308 | - VALUES (?1, ?2, ?3, (SELECT COALESCE(MAX(position), -1) + 1 FROM services), ?4)", | 319 | + VALUES (?1, ?2, ?3, (SELECT COALESCE(MAX(position), -1) + 1 FROM services), ?4, ?5)", |
| 309 | - turso::params![key, name.trim(), url.as_str(), owner], | 320 | + turso::params![key, name.trim(), url.as_str(), owner, client_id], |
| 310 | ) | 321 | ) |
| 311 | .await | 322 | .await |
| 312 | .map_err(backend)?; | 323 | .map_err(backend)?; |
| @@ -364,6 +375,7 @@ mod tests { | |||
| 364 | name: name.to_string(), | 375 | name: name.to_string(), |
| 365 | url: url.to_string(), | 376 | url: url.to_string(), |
| 366 | owner: None, | 377 | owner: None, |
| 378 | + client_id: None, | ||
| 367 | } | 379 | } |
| 368 | } | 380 | } |
| 369 | 381 | ||
| @@ -519,6 +531,7 @@ mod tests { | |||
| 519 | "Account", | 531 | "Account", |
| 520 | "http://127.0.0.1:7650/", | 532 | "http://127.0.0.1:7650/", |
| 521 | SELF_OWNER, | 533 | SELF_OWNER, |
| 534 | + None, | ||
| 522 | ) | 535 | ) |
| 523 | .await | 536 | .await |
| 524 | .unwrap(); | 537 | .unwrap(); |
| @@ -527,25 +540,36 @@ mod tests { | |||
| 527 | "the slash is normalized off" | 540 | "the slash is normalized off" |
| 528 | ); | 541 | ); |
| 529 | assert_eq!(row.owner.as_deref(), Some(SELF_OWNER)); | 542 | assert_eq!(row.owner.as_deref(), Some(SELF_OWNER)); |
| 543 | + assert_eq!(row.client_id, None, "im is not its own client"); | ||
| 530 | 544 | ||
| 531 | // A seeded row belongs to nobody; the app that names it claims it, | 545 | // A seeded row belongs to nobody; the app that names it claims it, |
| 532 | // keeping the name the seed (or a later rename) gave it. | 546 | // keeping the name the seed (or a later rename) gave it. |
| 533 | add(&store, &service("in", "Dosyalar", "http://127.0.0.1:7655")) | 547 | add(&store, &service("in", "Dosyalar", "http://127.0.0.1:7655")) |
| 534 | .await | 548 | .await |
| 535 | .unwrap(); | 549 | .unwrap(); |
| 536 | - let row = register(&store, "in", "Files", "https://in.example", "in-client") | 550 | + let row = register(&store, "in", "Files", "https://in.example", "in-client", Some("in-client")) |
| 537 | .await | 551 | .await |
| 538 | .unwrap(); | 552 | .unwrap(); |
| 539 | assert_eq!(row.name, "Dosyalar", "the name stays the admin's"); | 553 | assert_eq!(row.name, "Dosyalar", "the name stays the admin's"); |
| 540 | assert_eq!(row.url, "https://in.example"); | 554 | assert_eq!(row.url, "https://in.example"); |
| 541 | assert_eq!(row.owner.as_deref(), Some("in-client")); | 555 | assert_eq!(row.owner.as_deref(), Some("in-client")); |
| 556 | + assert_eq!( | ||
| 557 | + row.client_id.as_deref(), | ||
| 558 | + Some("in-client"), | ||
| 559 | + "the claim stamps the credential" | ||
| 560 | + ); | ||
| 542 | 561 | ||
| 543 | // The same app's next boot moves the address only. | 562 | // The same app's next boot moves the address only. |
| 544 | - let row = register(&store, "in", "Whatever", "https://in.dizey.sh", "in-client") | 563 | + let row = register(&store, "in", "Whatever", "https://in.dizey.sh", "in-client", Some("in-client")) |
| 545 | .await | 564 | .await |
| 546 | .unwrap(); | 565 | .unwrap(); |
| 547 | assert_eq!(row.name, "Dosyalar"); | 566 | assert_eq!(row.name, "Dosyalar"); |
| 548 | assert_eq!(row.url, "https://in.dizey.sh"); | 567 | assert_eq!(row.url, "https://in.dizey.sh"); |
| 568 | + assert_eq!( | ||
| 569 | + row.client_id.as_deref(), | ||
| 570 | + Some("in-client"), | ||
| 571 | + "the refresh keeps the stamp current" | ||
| 572 | + ); | ||
| 549 | // And no row was duplicated by any of it. | 573 | // And no row was duplicated by any of it. |
| 550 | assert_eq!(keys(&store).await, vec!["im".to_string(), "in".to_string()]); | 574 | assert_eq!(keys(&store).await, vec!["im".to_string(), "in".to_string()]); |
| 551 | } | 575 | } |
| @@ -553,11 +577,11 @@ mod tests { | |||
| 553 | #[tokio::test] | 577 | #[tokio::test] |
| 554 | async fn a_key_another_app_keeps_is_a_conflict_and_the_row_is_untouched() { | 578 | async fn a_key_another_app_keeps_is_a_conflict_and_the_row_is_untouched() { |
| 555 | let store = store().await; | 579 | let store = store().await; |
| 556 | - register(&store, "in", "Files", "https://in.example", "in-client") | 580 | + register(&store, "in", "Files", "https://in.example", "in-client", Some("in-client")) |
| 557 | .await | 581 | .await |
| 558 | .unwrap(); | 582 | .unwrap(); |
| 559 | assert!(matches!( | 583 | assert!(matches!( |
| 560 | - register(&store, "in", "Files", "https://evil.example", "iz-client").await, | 584 | + register(&store, "in", "Files", "https://evil.example", "iz-client", None).await, |
| 561 | Err(StoreError::Conflict(_)) | 585 | Err(StoreError::Conflict(_)) |
| 562 | )); | 586 | )); |
| 563 | assert_eq!(list(&store).await.unwrap()[0].url, "https://in.example"); | 587 | assert_eq!(list(&store).await.unwrap()[0].url, "https://in.example"); |
| @@ -566,7 +590,7 @@ mod tests { | |||
| 566 | #[tokio::test] | 590 | #[tokio::test] |
| 567 | async fn the_panel_cannot_remove_an_owned_row_or_move_its_address() { | 591 | async fn the_panel_cannot_remove_an_owned_row_or_move_its_address() { |
| 568 | let store = store().await; | 592 | let store = store().await; |
| 569 | - register(&store, "in", "Files", "https://in.example", "in-client") | 593 | + register(&store, "in", "Files", "https://in.example", "in-client", Some("in-client")) |
| 570 | .await | 594 | .await |
| 571 | .unwrap(); | 595 | .unwrap(); |
| 572 | assert!(matches!( | 596 | assert!(matches!( |
| @@ -595,7 +619,7 @@ mod tests { | |||
| 595 | #[tokio::test] | 619 | #[tokio::test] |
| 596 | async fn the_family_json_never_carries_the_owner() { | 620 | async fn the_family_json_never_carries_the_owner() { |
| 597 | let store = store().await; | 621 | let store = store().await; |
| 598 | - register(&store, "im", "Account", "http://127.0.0.1:7650", SELF_OWNER) | 622 | + register(&store, "im", "Account", "http://127.0.0.1:7650", SELF_OWNER, None) |
| 599 | .await | 623 | .await |
| 600 | .unwrap(); | 624 | .unwrap(); |
| 601 | let json = serde_json::to_value(list(&store).await.unwrap()).unwrap(); | 625 | let json = serde_json::to_value(list(&store).await.unwrap()).unwrap(); |
crates/im-core/src/store.rsmodified+11 -8
| @@ -153,7 +153,8 @@ CREATE TABLE IF NOT EXISTS services ( | |||
| 153 | name TEXT NOT NULL, | 153 | name TEXT NOT NULL, |
| 154 | url TEXT NOT NULL, | 154 | url TEXT NOT NULL, |
| 155 | position INTEGER NOT NULL, | 155 | position INTEGER NOT NULL, |
| 156 | - owner TEXT | 156 | + owner TEXT, |
| 157 | + client_id TEXT | ||
| 157 | ); | 158 | ); |
| 158 | "; | 159 | "; |
| 159 | 160 | ||
| @@ -261,13 +262,15 @@ impl Store { | |||
| 261 | .await | 262 | .await |
| 262 | .map_err(backend)?; | 263 | .map_err(backend)?; |
| 263 | } | 264 | } |
| 264 | - // What a session remembers about its browser: the listing shows | 265 | + // The family rows' client linkage (the merge of the panel's |
| 265 | - // these, so old databases grow them the same guarded way. | 266 | + // services and clients sections): a `POST /family/register` |
| 266 | - // The app that keeps a service row: `im` for this app's own | 267 | + // stamps the authenticated client's id beside its row, so the |
| 267 | - // entry, a client id for a sibling that registers itself, NULL | 268 | + // panel can show the wordmark and its credential as one thing. |
| 268 | - // for the config seed's and the panel's own rows. | 269 | + // ALTER over the owner precedent: databases born before the |
| 269 | - if !has_column(&conn, "services", "owner").await? { | 270 | + // column get it here, and every existing row reads NULL until |
| 270 | - conn.execute("ALTER TABLE services ADD COLUMN owner TEXT", ()) | 271 | + // its app re-registers. |
| 272 | + if !has_column(&conn, "services", "client_id").await? { | ||
| 273 | + conn.execute("ALTER TABLE services ADD COLUMN client_id TEXT", ()) | ||
| 271 | .await | 274 | .await |
| 272 | .map_err(backend)?; | 275 | .map_err(backend)?; |
| 273 | } | 276 | } |
crates/im-web/assets/main.cssmodified+13 -3
| @@ -984,6 +984,13 @@ body:has(.log-list) .admin-card:has(.log-list) { | |||
| 984 | border-top: 1px solid var(--border-soft); | 984 | border-top: 1px solid var(--border-soft); |
| 985 | vertical-align: middle; | 985 | vertical-align: middle; |
| 986 | } | 986 | } |
| 987 | +.admin-table td.mono { | ||
| 988 | + overflow-wrap: anywhere; | ||
| 989 | +} | ||
| 990 | + | ||
| 991 | +.admin-clients td.muted { | ||
| 992 | + white-space: nowrap; | ||
| 993 | +} | ||
| 987 | 994 | ||
| 988 | .mono { | 995 | .mono { |
| 989 | font-family: var(--font-mono); | 996 | font-family: var(--font-mono); |
| @@ -995,6 +1002,7 @@ body:has(.log-list) .admin-card:has(.log-list) { | |||
| 995 | 1002 | ||
| 996 | .actions { | 1003 | .actions { |
| 997 | display: flex; | 1004 | display: flex; |
| 1005 | + flex-wrap: wrap; | ||
| 998 | gap: 8px; | 1006 | gap: 8px; |
| 999 | justify-content: flex-end; | 1007 | justify-content: flex-end; |
| 1000 | } | 1008 | } |
| @@ -1129,15 +1137,17 @@ body:has(.log-list) .admin-card:has(.log-list) { | |||
| 1129 | } | 1137 | } |
| 1130 | 1138 | ||
| 1131 | .admin-confirm-pop { | 1139 | .admin-confirm-pop { |
| 1132 | - position: absolute; | 1140 | + position: fixed; |
| 1133 | - right: 0; | 1141 | + top: 50%; |
| 1134 | - top: calc(100% + 6px); | 1142 | + left: 50%; |
| 1143 | + transform: translate(-50%, -50%); | ||
| 1135 | z-index: 30; | 1144 | z-index: 30; |
| 1136 | width: 240px; | 1145 | width: 240px; |
| 1137 | padding: 12px; | 1146 | padding: 12px; |
| 1138 | background: var(--surface); | 1147 | background: var(--surface); |
| 1139 | border: 1px solid var(--border-strong); | 1148 | border: 1px solid var(--border-strong); |
| 1140 | border-radius: var(--radius); | 1149 | border-radius: var(--radius); |
| 1150 | + box-shadow: var(--shadow-2); | ||
| 1141 | display: flex; | 1151 | display: flex; |
| 1142 | flex-direction: column; | 1152 | flex-direction: column; |
| 1143 | gap: 8px; | 1153 | gap: 8px; |
crates/im-web/src/admin.rsmodified+210 -107
| @@ -132,7 +132,6 @@ async fn admin_page(cx: &Cx) -> Result<Response> { | |||
| 132 | [ | 132 | [ |
| 133 | ("users", t(lang, Key::NavUsers)), | 133 | ("users", t(lang, Key::NavUsers)), |
| 134 | ("services", t(lang, Key::NavServices)), | 134 | ("services", t(lang, Key::NavServices)), |
| 135 | - ("clients", t(lang, Key::NavClients)), | ||
| 136 | ("message", t(lang, Key::NavMessage)), | 135 | ("message", t(lang, Key::NavMessage)), |
| 137 | ("settings", t(lang, Key::NavSettings)), | 136 | ("settings", t(lang, Key::NavSettings)), |
| 138 | ("logs", t(lang, Key::NavLogs)), | 137 | ("logs", t(lang, Key::NavLogs)), |
| @@ -152,8 +151,9 @@ async fn admin_page(cx: &Cx) -> Result<Response> { | |||
| 152 | "message" => message_section(cx, lang).await?, | 151 | "message" => message_section(cx, lang).await?, |
| 153 | "settings" => settings_section(cx, lang).await?, | 152 | "settings" => settings_section(cx, lang).await?, |
| 154 | "logs" => logs_section(cx, lang).await?, | 153 | "logs" => logs_section(cx, lang).await?, |
| 155 | - "services" => services_section(cx, lang).await?, | 154 | + // `section=clients` lands here too — the sections are one table |
| 156 | - "clients" => clients_section(cx, shown, lang).await?, | 155 | + // now, and the old address keeps working. |
| 156 | + "services" | "clients" => services_section(cx, shown, lang).await?, | ||
| 157 | _ => users_section(cx, &me, invited.as_deref(), lang).await?, | 157 | _ => users_section(cx, &me, invited.as_deref(), lang).await?, |
| 158 | }; | 158 | }; |
| 159 | 159 | ||
| @@ -438,13 +438,26 @@ async fn users_section( | |||
| 438 | )) | 438 | )) |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | -/// The family registry: the wordmarks every topbar's trio and the landing's | 441 | +/// The family registry, wordmarks and credentials as one table. Every |
| 442 | -/// services home render, and `/family` serves. One table in the panel's own | 442 | +/// service row carries its client half beside it — client id, redirect |
| 443 | -/// skins — edit and remove as the two-step disclosures, the up/down pair as | 443 | +/// URIs, registered date, Rotate/Revoke — joined by the client id its |
| 444 | -/// plain row buttons — and the add line under it wearing the invite form's | 444 | +/// `POST /family/register` authenticated; a client with no service row (a |
| 445 | -/// skin. | 445 | +/// test or stray credential) renders as a credential-only row, and a row |
| 446 | -async fn services_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Error> { | 446 | +/// with no client yet shows the dash. The wordmark controls stay the |
| 447 | +/// panel's on rows no app keeps, and the two add lines — a service, a | ||
| 448 | +/// client — sit under the table. | ||
| 449 | +async fn services_section( | ||
| 450 | + cx: &Cx, | ||
| 451 | + shown: Option<(String, String)>, | ||
| 452 | + lang: i18n::Lang, | ||
| 453 | +) -> Result<String, topcoat::Error> { | ||
| 447 | let services = im_core::services::list(&app(cx).store).await?; | 454 | let services = im_core::services::list(&app(cx).store).await?; |
| 455 | + let clients = im_core::oidc::list_clients(&app(cx).store).await?; | ||
| 456 | + // The join: a service row's client id names the client whose wordmark | ||
| 457 | + // half and credential half render as one. | ||
| 458 | + let linked = |id: Option<&String>| { | ||
| 459 | + id.and_then(|cid| clients.iter().find(|client| &client.client_id.to_string() == cid)) | ||
| 460 | + }; | ||
| 448 | let mut rows = String::new(); | 461 | let mut rows = String::new(); |
| 449 | for service in &services { | 462 | for service in &services { |
| 450 | let key = escape(&service.key); | 463 | let key = escape(&service.key); |
| @@ -508,34 +521,141 @@ async fn services_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat:: | |||
| 508 | t(lang, Key::ConfirmRemove), | 521 | t(lang, Key::ConfirmRemove), |
| 509 | ) | 522 | ) |
| 510 | }; | 523 | }; |
| 524 | + let (client_cell, uris_cell, registered_cell, client_actions) = | ||
| 525 | + match linked(service.client_id.as_ref()) { | ||
| 526 | + Some(client) => { | ||
| 527 | + let id = escape(&client.client_id.to_string()); | ||
| 528 | + let uris = client | ||
| 529 | + .redirect_uris | ||
| 530 | + .iter() | ||
| 531 | + .map(|uri| escape(uri)) | ||
| 532 | + .collect::<Vec<_>>() | ||
| 533 | + .join("<br>"); | ||
| 534 | + let registered = client | ||
| 535 | + .created_at | ||
| 536 | + .format(&time::macros::format_description!( | ||
| 537 | + "[year]-[month]-[day]" | ||
| 538 | + )) | ||
| 539 | + .unwrap_or_default(); | ||
| 540 | + let controls = client_controls( | ||
| 541 | + &id, | ||
| 542 | + &escape(&client.name), | ||
| 543 | + lang, | ||
| 544 | + ); | ||
| 545 | + (id, uris, registered, controls) | ||
| 546 | + } | ||
| 547 | + None => ("—".to_string(), "—".to_string(), "—".to_string(), String::new()), | ||
| 548 | + }; | ||
| 511 | rows.push_str(&format!( | 549 | rows.push_str(&format!( |
| 512 | - r#"<tr><td class="mono">{key}</td><td>{name}</td><td class="mono">{url}</td><td class="actions">{edit}{up}{down}{remove}</td></tr>"#, | 550 | + r#"<tr><td class="mono">{key}</td><td>{name}</td><td class="mono">{url}</td><td class="mono">{client_cell}</td><td class="mono">{uris_cell}</td><td class="muted">{registered_cell}</td><td class="actions">{edit}{up}{down}{remove}{client_actions}</td></tr>"#, |
| 513 | )); | 551 | )); |
| 514 | } | 552 | } |
| 553 | + // Clients no service row answers for — the CLI's or the panel's test | ||
| 554 | + // credentials — still sit in the table, their credential half alone. | ||
| 555 | + for client in &clients { | ||
| 556 | + let id = client.client_id.to_string(); | ||
| 557 | + if services | ||
| 558 | + .iter() | ||
| 559 | + .any(|service| service.client_id.as_deref() == Some(id.as_str())) | ||
| 560 | + { | ||
| 561 | + continue; | ||
| 562 | + } | ||
| 563 | + let name = escape(&client.name); | ||
| 564 | + let uris = client | ||
| 565 | + .redirect_uris | ||
| 566 | + .iter() | ||
| 567 | + .map(|uri| escape(uri)) | ||
| 568 | + .collect::<Vec<_>>() | ||
| 569 | + .join("<br>"); | ||
| 570 | + let registered = client | ||
| 571 | + .created_at | ||
| 572 | + .format(&time::macros::format_description!("[year]-[month]-[day]")) | ||
| 573 | + .unwrap_or_default(); | ||
| 574 | + let controls = client_controls(&id, &name, lang); | ||
| 575 | + rows.push_str(&format!( | ||
| 576 | + r#"<tr><td class="muted">—</td><td>{name}</td><td class="muted">—</td><td class="mono">{}</td><td class="mono">{uris}</td><td class="muted">{registered}</td><td class="actions">{controls}</td></tr>"#, | ||
| 577 | + escape(&id), | ||
| 578 | + )); | ||
| 579 | + } | ||
| 580 | + // The show-once banner: the note says what to do with it, the value is | ||
| 581 | + // click-to-copy, and the shelf behind it has already handed it over. | ||
| 582 | + let shown_html = shown | ||
| 583 | + .map(|(client_id, secret)| { | ||
| 584 | + format!( | ||
| 585 | + r#"<div class="auth-note">{note}<div class="admin-copy-row"><div class="muted">{id_label}: <span class="mono">{client_id}</span></div><div class="auth-secret admin-copy-value">{secret}</div><button class="admin-action admin-copy" type="button" data-copied-label="{copied}">{copy}</button></div></div>"#, | ||
| 586 | + note = t(lang, Key::SecretShownNote), | ||
| 587 | + id_label = t(lang, Key::ClientIdLabel), | ||
| 588 | + client_id = escape(&client_id), | ||
| 589 | + secret = escape(&secret), | ||
| 590 | + copied = t(lang, Key::CopiedWord), | ||
| 591 | + copy = t(lang, Key::CopyWord), | ||
| 592 | + ) | ||
| 593 | + }) | ||
| 594 | + .unwrap_or_default(); | ||
| 515 | Ok(format!( | 595 | Ok(format!( |
| 516 | r#"<div class="admin-card"> | 596 | r#"<div class="admin-card"> |
| 517 | <div class="auth-title">{title}</div> | 597 | <div class="auth-title">{title}</div> |
| 598 | + {shown_html} | ||
| 518 | <div class="admin-table-wrap"> | 599 | <div class="admin-table-wrap"> |
| 519 | - <table class="admin-table"> | 600 | + <table class="admin-table admin-clients"> |
| 520 | - <thead><tr><th>{key_label}</th><th>{name_label}</th><th>{url_label}</th><th></th></tr></thead> | 601 | + <thead><tr><th>{key_label}</th><th>{name_label}</th><th>{url_label}</th><th>{id_label}</th><th>{uris_label}</th><th>{registered_label}</th><th></th></tr></thead> |
| 521 | <tbody>{rows}</tbody> | 602 | <tbody>{rows}</tbody> |
| 522 | </table> | 603 | </table> |
| 523 | </div> | 604 | </div> |
| 605 | + <div class="muted">{service_add_label}</div> | ||
| 524 | <form method="post" action="/admin/services_add" class="admin-invite"> | 606 | <form method="post" action="/admin/services_add" class="admin-invite"> |
| 525 | <input class="auth-input auth-input-mono" type="text" name="key" placeholder="in" aria-label="{key_label}" required> | 607 | <input class="auth-input auth-input-mono" type="text" name="key" placeholder="in" aria-label="{key_label}" required> |
| 526 | <input class="auth-input" type="text" name="name" placeholder="{name_label}" aria-label="{name_label}" required> | 608 | <input class="auth-input" type="text" name="name" placeholder="{name_label}" aria-label="{name_label}" required> |
| 527 | <input class="auth-input auth-input-mono" type="text" name="url" placeholder="https://in.dizey.sh" aria-label="{url_label}" required> | 609 | <input class="auth-input auth-input-mono" type="text" name="url" placeholder="https://in.dizey.sh" aria-label="{url_label}" required> |
| 528 | <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{add}</span></button> | 610 | <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{add}</span></button> |
| 529 | </form> | 611 | </form> |
| 612 | + <div class="muted">{client_add_label}</div> | ||
| 613 | + <form method="post" action="/admin/clients_add" class="admin-invite"> | ||
| 614 | + <input class="auth-input" type="text" name="name" placeholder="drive" aria-label="{name_label}" required> | ||
| 615 | + <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> | ||
| 616 | + <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{client_add}</span></button> | ||
| 617 | + </form> | ||
| 530 | </div>"#, | 618 | </div>"#, |
| 531 | title = t(lang, Key::ServicesTitle), | 619 | title = t(lang, Key::ServicesTitle), |
| 532 | key_label = t(lang, Key::ServiceKeyLabel), | 620 | key_label = t(lang, Key::ServiceKeyLabel), |
| 533 | name_label = t(lang, Key::NameCol), | 621 | name_label = t(lang, Key::NameCol), |
| 534 | url_label = t(lang, Key::AddressLabel), | 622 | url_label = t(lang, Key::AddressLabel), |
| 623 | + id_label = t(lang, Key::ClientIdLabel), | ||
| 624 | + uris_label = t(lang, Key::RedirectUrisLabel), | ||
| 625 | + registered_label = t(lang, Key::RegisteredCol), | ||
| 626 | + service_add_label = t(lang, Key::ServiceAdd), | ||
| 535 | add = t(lang, Key::ServiceAdd), | 627 | add = t(lang, Key::ServiceAdd), |
| 628 | + client_add_label = t(lang, Key::ClientAdd), | ||
| 629 | + client_add = t(lang, Key::ClientAdd), | ||
| 536 | )) | 630 | )) |
| 537 | } | 631 | } |
| 538 | 632 | ||
| 633 | +/// A client's Rotate/Revoke pair, as the two-step disclosures — the same | ||
| 634 | +/// controls on a linked service row and on a credential-only row. | ||
| 635 | +fn client_controls(client_id: &str, name_html: &str, lang: i18n::Lang) -> String { | ||
| 636 | + let rotate = confirm_action( | ||
| 637 | + "client", | ||
| 638 | + client_id, | ||
| 639 | + "/admin/clients_rotate", | ||
| 640 | + t(lang, Key::RotateWord), | ||
| 641 | + "", | ||
| 642 | + &i18n::rotate_client_title(lang, name_html), | ||
| 643 | + t(lang, Key::RotateCost), | ||
| 644 | + t(lang, Key::ConfirmRotate), | ||
| 645 | + ); | ||
| 646 | + let revoke_action = confirm_action( | ||
| 647 | + "client", | ||
| 648 | + client_id, | ||
| 649 | + "/admin/clients_revoke", | ||
| 650 | + t(lang, Key::RevokeWord), | ||
| 651 | + " admin-danger", | ||
| 652 | + &i18n::revoke_client_title(lang, name_html), | ||
| 653 | + t(lang, Key::RevokeCost), | ||
| 654 | + t(lang, Key::ConfirmRevoke), | ||
| 655 | + ); | ||
| 656 | + format!("{rotate}{revoke_action}") | ||
| 657 | +} | ||
| 658 | + | ||
| 539 | /// One user of the services forms: key, name, address. The add form fills | 659 | /// One user of the services forms: key, name, address. The add form fills |
| 540 | /// all three; the edit form carries the key in its hidden field. | 660 | /// all three; the edit form carries the key in its hidden field. |
| 541 | #[derive(Deserialize)] | 661 | #[derive(Deserialize)] |
| @@ -558,6 +678,7 @@ async fn services_add(cx: &Cx, Form(input): Form<ServiceForm>) -> Result<Respons | |||
| 558 | name: input.name, | 678 | name: input.name, |
| 559 | url: input.url, | 679 | url: input.url, |
| 560 | owner: None, | 680 | owner: None, |
| 681 | + client_id: None, | ||
| 561 | }, | 682 | }, |
| 562 | ) | 683 | ) |
| 563 | .await; | 684 | .await; |
| @@ -633,99 +754,6 @@ async fn service_outcome( | |||
| 633 | } | 754 | } |
| 634 | } | 755 | } |
| 635 | 756 | ||
| 636 | -/// The relying parties: every client the family's apps sign in with. One | ||
| 637 | -/// table in the panel's own skins — rotate and revoke as the two-step | ||
| 638 | -/// disclosures — and the add line under it wearing the invite form's skin. | ||
| 639 | -/// A create or rotate answers a 303 whose `shown` ticket picks the fresh | ||
| 640 | -/// secret off the shelf for exactly one render; the page never learns a | ||
| 641 | -/// secret twice. | ||
| 642 | -async fn clients_section( | ||
| 643 | - cx: &Cx, | ||
| 644 | - shown: Option<(String, String)>, | ||
| 645 | - lang: i18n::Lang, | ||
| 646 | -) -> Result<String, topcoat::Error> { | ||
| 647 | - let clients = im_core::oidc::list_clients(&app(cx).store).await?; | ||
| 648 | - let mut rows = String::new(); | ||
| 649 | - for client in &clients { | ||
| 650 | - let id = escape(&client.client_id.to_string()); | ||
| 651 | - let name = escape(&client.name); | ||
| 652 | - let uris = client | ||
| 653 | - .redirect_uris | ||
| 654 | - .iter() | ||
| 655 | - .map(|uri| escape(uri)) | ||
| 656 | - .collect::<Vec<_>>() | ||
| 657 | - .join("<br>"); | ||
| 658 | - let registered = client | ||
| 659 | - .created_at | ||
| 660 | - .format(&time::macros::format_description!("[year]-[month]-[day]")) | ||
| 661 | - .unwrap_or_default(); | ||
| 662 | - // Rotation kills the old pair the moment the new one exists, so it | ||
| 663 | - // says what it costs before it does it — like every destructive row | ||
| 664 | - // action here. | ||
| 665 | - let rotate = confirm_action( | ||
| 666 | - "client", | ||
| 667 | - &id, | ||
| 668 | - "/admin/clients_rotate", | ||
| 669 | - t(lang, Key::RotateWord), | ||
| 670 | - "", | ||
| 671 | - &i18n::rotate_client_title(lang, &name), | ||
| 672 | - t(lang, Key::RotateCost), | ||
| 673 | - t(lang, Key::ConfirmRotate), | ||
| 674 | - ); | ||
| 675 | - let revoke_action = confirm_action( | ||
| 676 | - "client", | ||
| 677 | - &id, | ||
| 678 | - "/admin/clients_revoke", | ||
| 679 | - t(lang, Key::RevokeWord), | ||
| 680 | - " admin-danger", | ||
| 681 | - &i18n::revoke_client_title(lang, &name), | ||
| 682 | - t(lang, Key::RevokeCost), | ||
| 683 | - t(lang, Key::ConfirmRevoke), | ||
| 684 | - ); | ||
| 685 | - rows.push_str(&format!( | ||
| 686 | - r#"<tr><td>{name}</td><td class="mono">{id}</td><td class="mono">{uris}</td><td class="muted">{registered}</td><td class="actions">{rotate}{revoke_action}</td></tr>"#, | ||
| 687 | - )); | ||
| 688 | - } | ||
| 689 | - // The show-once banner: the note says what to do with it, the value is | ||
| 690 | - // click-to-copy, and the shelf behind it has already handed it over. | ||
| 691 | - let shown_html = shown | ||
| 692 | - .map(|(client_id, secret)| { | ||
| 693 | - format!( | ||
| 694 | - r#"<div class="auth-note">{note}<div class="admin-copy-row"><div class="muted">{id_label}: <span class="mono">{client_id}</span></div><div class="auth-secret admin-copy-value">{secret}</div><button class="admin-action admin-copy" type="button" data-copied-label="{copied}">{copy}</button></div></div>"#, | ||
| 695 | - note = t(lang, Key::SecretShownNote), | ||
| 696 | - id_label = t(lang, Key::ClientIdLabel), | ||
| 697 | - client_id = escape(&client_id), | ||
| 698 | - secret = escape(&secret), | ||
| 699 | - copied = t(lang, Key::CopiedWord), | ||
| 700 | - copy = t(lang, Key::CopyWord), | ||
| 701 | - ) | ||
| 702 | - }) | ||
| 703 | - .unwrap_or_default(); | ||
| 704 | - Ok(format!( | ||
| 705 | - r#"<div class="admin-card"> | ||
| 706 | - <div class="auth-title">{title}</div> | ||
| 707 | - {shown_html} | ||
| 708 | - <div class="admin-table-wrap"> | ||
| 709 | - <table class="admin-table admin-clients"> | ||
| 710 | - <thead><tr><th>{name_label}</th><th>{id_label}</th><th>{uris_label}</th><th>{registered_label}</th><th></th></tr></thead> | ||
| 711 | - <tbody>{rows}</tbody> | ||
| 712 | - </table> | ||
| 713 | - </div> | ||
| 714 | - <form method="post" action="/admin/clients_add" class="admin-invite"> | ||
| 715 | - <input class="auth-input" type="text" name="name" placeholder="drive" aria-label="{name_label}" required> | ||
| 716 | - <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> | ||
| 717 | - <button class="auth-submit admin-invite-go" type="submit"><span class="auth-submit-text">{add}</span></button> | ||
| 718 | - </form> | ||
| 719 | -</div>"#, | ||
| 720 | - title = t(lang, Key::ClientsTitle), | ||
| 721 | - name_label = t(lang, Key::NameCol), | ||
| 722 | - id_label = t(lang, Key::ClientIdLabel), | ||
| 723 | - uris_label = t(lang, Key::RedirectUrisLabel), | ||
| 724 | - registered_label = t(lang, Key::RegisteredCol), | ||
| 725 | - add = t(lang, Key::ClientAdd), | ||
| 726 | - )) | ||
| 727 | -} | ||
| 728 | - | ||
| 729 | /// One user of the clients forms: the name, and one or more redirect URIs | 757 | /// One user of the clients forms: the name, and one or more redirect URIs |
| 730 | /// — whitespace- or comma-separated, as loose as the CLI's argument list, | 758 | /// — whitespace- or comma-separated, as loose as the CLI's argument list, |
| 731 | /// because a family dev's `http://127.0.0.1` redirect is a legitimate row. | 759 | /// because a family dev's `http://127.0.0.1` redirect is a legitimate row. |
| @@ -1916,8 +1944,12 @@ mod tests { | |||
| 1916 | assert!(location.starts_with("/admin?section=clients&shown=")); | 1944 | assert!(location.starts_with("/admin?section=clients&shown=")); |
| 1917 | let ticket = location.trim_start_matches("/admin?section=clients&shown="); | 1945 | let ticket = location.trim_start_matches("/admin?section=clients&shown="); |
| 1918 | let (id, secret) = server::take_shown_secret(ticket).expect("the one showing"); | 1946 | let (id, secret) = server::take_shown_secret(ticket).expect("the one showing"); |
| 1919 | - let row = list_clients(&setup.store).await.unwrap(); | 1947 | + let stored = list_clients(&setup.store).await.unwrap(); |
| 1920 | - assert_eq!(id, row[0].client_id.to_string()); | 1948 | + let row = stored |
| 1949 | + .iter() | ||
| 1950 | + .find(|client| client.name == name) | ||
| 1951 | + .expect("the fresh row"); | ||
| 1952 | + assert_eq!(id, row.client_id.to_string()); | ||
| 1921 | (id, secret) | 1953 | (id, secret) |
| 1922 | } | 1954 | } |
| 1923 | 1955 | ||
| @@ -2182,4 +2214,75 @@ mod tests { | |||
| 2182 | .await; | 2214 | .await; |
| 2183 | assert!(!forged.contains("<div class=\"auth-secret")); | 2215 | assert!(!forged.contains("<div class=\"auth-secret")); |
| 2184 | } | 2216 | } |
| 2217 | + | ||
| 2218 | + #[tokio::test] | ||
| 2219 | + async fn merged_section_renders_linked_unlinked_and_bare_rows() { | ||
| 2220 | + let setup = setup().await; | ||
| 2221 | + | ||
| 2222 | + // A client registered through the panel, then the service row its | ||
| 2223 | + // app writes with that pair: the two halves link. | ||
| 2224 | + let (id, _secret) = create_via_panel(&setup, "drive").await; | ||
| 2225 | + im_core::services::register( | ||
| 2226 | + &setup.store, | ||
| 2227 | + "drive", | ||
| 2228 | + "Drive", | ||
| 2229 | + "https://drive.dizey.sh", | ||
| 2230 | + &id, | ||
| 2231 | + Some(&id), | ||
| 2232 | + ) | ||
| 2233 | + .await | ||
| 2234 | + .unwrap(); | ||
| 2235 | + // A second client no service row answers for, and a service row | ||
| 2236 | + // with no client yet. | ||
| 2237 | + create_via_panel(&setup, "stray").await; | ||
| 2238 | + im_core::services::add( | ||
| 2239 | + &setup.store, | ||
| 2240 | + &im_core::services::Service { | ||
| 2241 | + key: "wiki".into(), | ||
| 2242 | + name: "Wiki".into(), | ||
| 2243 | + url: "https://wiki.dizey.sh".into(), | ||
| 2244 | + owner: None, | ||
| 2245 | + client_id: None, | ||
| 2246 | + }, | ||
| 2247 | + ) | ||
| 2248 | + .await | ||
| 2249 | + .unwrap(); | ||
| 2250 | + | ||
| 2251 | + // Rendering needs the built asset bundle; without it the render | ||
| 2252 | + // assertions stay skipped (the routes themselves are covered). | ||
| 2253 | + if !setup.assets { | ||
| 2254 | + return; | ||
| 2255 | + } | ||
| 2256 | + let (status, _, body) = get_full( | ||
| 2257 | + &setup.router, | ||
| 2258 | + "/admin?section=services", | ||
| 2259 | + Some(&setup.admin_cookie), | ||
| 2260 | + ) | ||
| 2261 | + .await; | ||
| 2262 | + assert_eq!(status, StatusCode::OK); | ||
| 2263 | + | ||
| 2264 | + // The linked row: wordmark half and credential half, one row. | ||
| 2265 | + assert!(body.contains(">Drive</td>"), "the service name renders"); | ||
| 2266 | + assert!(body.contains(&id), "the linked client id renders"); | ||
| 2267 | + assert!(body.contains("https://drive.dizey.sh"), "the url renders"); | ||
| 2268 | + assert!(body.contains("http://127.0.0.1:9000/callback"), "uris render"); | ||
| 2269 | + // The credential-only row: the stray client's name, no key or url. | ||
| 2270 | + assert!(body.contains(">stray</td>"), "the stray client renders"); | ||
| 2271 | + // The bare service row and the unlinked client carry the dash. | ||
| 2272 | + assert!(body.contains(">Wiki</td>"), "the bare service renders"); | ||
| 2273 | + assert!( | ||
| 2274 | + body.contains("<td class=\"muted\">—</td>"), | ||
| 2275 | + "client-less halves read as the dash" | ||
| 2276 | + ); | ||
| 2277 | + | ||
| 2278 | + // The old address lands on the merged section too. | ||
| 2279 | + let (status, _, alias) = get_full( | ||
| 2280 | + &setup.router, | ||
| 2281 | + "/admin?section=clients", | ||
| 2282 | + Some(&setup.admin_cookie), | ||
| 2283 | + ) | ||
| 2284 | + .await; | ||
| 2285 | + assert_eq!(status, StatusCode::OK); | ||
| 2286 | + assert_eq!(alias.contains(">Drive</td>"), body.contains(">Drive</td>")); | ||
| 2287 | + } | ||
| 2185 | } | 2288 | } |
crates/im-web/src/directory.rsmodified+49 -1
| @@ -201,7 +201,15 @@ async fn family_register( | |||
| 201 | .into_response(cx); | 201 | .into_response(cx); |
| 202 | }; | 202 | }; |
| 203 | let store = server::app(cx).store.clone(); | 203 | let store = server::app(cx).store.clone(); |
| 204 | - match im_core::services::register(&store, &input.key, &input.name, &input.url, &client_id).await | 204 | + match im_core::services::register( |
| 205 | + &store, | ||
| 206 | + &input.key, | ||
| 207 | + &input.name, | ||
| 208 | + &input.url, | ||
| 209 | + &client_id, | ||
| 210 | + Some(&client_id), | ||
| 211 | + ) | ||
| 212 | + .await | ||
| 205 | { | 213 | { |
| 206 | Ok(service) => Json(serde_json::to_value(service).unwrap()).into_response(cx), | 214 | Ok(service) => Json(serde_json::to_value(service).unwrap()).into_response(cx), |
| 207 | Err(im_core::store::StoreError::Conflict(_)) => ( | 215 | Err(im_core::store::StoreError::Conflict(_)) => ( |
| @@ -396,6 +404,7 @@ mod tests { | |||
| 396 | name: service.name.clone(), | 404 | name: service.name.clone(), |
| 397 | url: service.url.clone(), | 405 | url: service.url.clone(), |
| 398 | owner: None, | 406 | owner: None, |
| 407 | + client_id: None, | ||
| 399 | }) | 408 | }) |
| 400 | .collect() | 409 | .collect() |
| 401 | } | 410 | } |
| @@ -853,6 +862,7 @@ mod tests { | |||
| 853 | name: "Files".into(), | 862 | name: "Files".into(), |
| 854 | url: "http://127.0.0.1:7655".into(), | 863 | url: "http://127.0.0.1:7655".into(), |
| 855 | owner: None, | 864 | owner: None, |
| 865 | + client_id: None, | ||
| 856 | }]; | 866 | }]; |
| 857 | assert!(!im_core::services::seed_from(&store, &reseed).await.unwrap()); | 867 | assert!(!im_core::services::seed_from(&store, &reseed).await.unwrap()); |
| 858 | let (_, body) = get_family(&router, Some(basic(&client_id, &secret))).await; | 868 | let (_, body) = get_family(&router, Some(basic(&client_id, &secret))).await; |
| @@ -1051,6 +1061,44 @@ mod tests { | |||
| 1051 | ); | 1061 | ); |
| 1052 | } | 1062 | } |
| 1053 | 1063 | ||
| 1064 | + #[tokio::test] | ||
| 1065 | + async fn family_register_stamps_the_authenticated_client_on_its_row() { | ||
| 1066 | + let Setup { | ||
| 1067 | + router, | ||
| 1068 | + client_id, | ||
| 1069 | + secret, | ||
| 1070 | + store, | ||
| 1071 | + .. | ||
| 1072 | + } = setup().await; | ||
| 1073 | + | ||
| 1074 | + // First register: the row is appended with the caller's stamp. | ||
| 1075 | + let (status, _) = post_register( | ||
| 1076 | + &router, | ||
| 1077 | + Some(basic(&client_id, &secret)), | ||
| 1078 | + serde_json::json!({"key": "drive", "name": "Drive", "url": "https://drive.dizey.sh"}), | ||
| 1079 | + ) | ||
| 1080 | + .await; | ||
| 1081 | + assert_eq!(status, StatusCode::OK); | ||
| 1082 | + let rows = im_core::services::list(&store).await.unwrap(); | ||
| 1083 | + let row = rows.iter().find(|s| s.key == "drive").unwrap(); | ||
| 1084 | + assert_eq!(row.client_id.as_deref(), Some(client_id.as_str())); | ||
| 1085 | + | ||
| 1086 | + // The next boot's register refreshes the row and keeps the stamp | ||
| 1087 | + // current — one row, still the caller's. | ||
| 1088 | + let (status, _) = post_register( | ||
| 1089 | + &router, | ||
| 1090 | + Some(basic(&client_id, &secret)), | ||
| 1091 | + serde_json::json!({"key": "drive", "name": "Drive", "url": "https://drive2.dizey.sh"}), | ||
| 1092 | + ) | ||
| 1093 | + .await; | ||
| 1094 | + assert_eq!(status, StatusCode::OK); | ||
| 1095 | + let rows = im_core::services::list(&store).await.unwrap(); | ||
| 1096 | + assert_eq!(rows.iter().filter(|s| s.key == "drive").count(), 1); | ||
| 1097 | + let row = rows.iter().find(|s| s.key == "drive").unwrap(); | ||
| 1098 | + assert_eq!(row.url, "https://drive2.dizey.sh"); | ||
| 1099 | + assert_eq!(row.client_id.as_deref(), Some(client_id.as_str())); | ||
| 1100 | + } | ||
| 1101 | + | ||
| 1054 | #[tokio::test] | 1102 | #[tokio::test] |
| 1055 | async fn the_landing_lists_connected_apps_and_an_empty_note_without_them() { | 1103 | async fn the_landing_lists_connected_apps_and_an_empty_note_without_them() { |
| 1056 | let Setup { | 1104 | let Setup { |
crates/im-web/src/i18n.rsmodified+0 -6
| @@ -243,8 +243,6 @@ pub enum Key { | |||
| 243 | InviteButton, | 243 | InviteButton, |
| 244 | 244 | ||
| 245 | // Admin clients section: the family's relying parties. | 245 | // Admin clients section: the family's relying parties. |
| 246 | - NavClients, | ||
| 247 | - ClientsTitle, | ||
| 248 | RedirectUrisLabel, | 246 | RedirectUrisLabel, |
| 249 | RegisteredCol, | 247 | RegisteredCol, |
| 250 | ClientAdd, | 248 | ClientAdd, |
| @@ -726,10 +724,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str { | |||
| 726 | (InviteButton, En) => "Invite", | 724 | (InviteButton, En) => "Invite", |
| 727 | (InviteButton, Tr) => "Davet et", | 725 | (InviteButton, Tr) => "Davet et", |
| 728 | 726 | ||
| 729 | - (NavClients, En) => "Clients", | ||
| 730 | - (NavClients, Tr) => "İstemciler", | ||
| 731 | - (ClientsTitle, En) => "Clients", | ||
| 732 | - (ClientsTitle, Tr) => "İstemciler", | ||
| 733 | (RedirectUrisLabel, En) => "Redirect URIs", | 727 | (RedirectUrisLabel, En) => "Redirect URIs", |
| 734 | (RedirectUrisLabel, Tr) => "Yönlendirme adresleri", | 728 | (RedirectUrisLabel, Tr) => "Yönlendirme adresleri", |
| 735 | (RegisteredCol, En) => "Registered", | 729 | (RegisteredCol, En) => "Registered", |
crates/im-web/src/main.rsmodified+3 -0
| @@ -173,6 +173,7 @@ async fn seed_services(store: &Store, config: &Config) { | |||
| 173 | name: service.name.clone(), | 173 | name: service.name.clone(), |
| 174 | url: service.url.clone(), | 174 | url: service.url.clone(), |
| 175 | owner: None, | 175 | owner: None, |
| 176 | + client_id: None, | ||
| 176 | }) | 177 | }) |
| 177 | .collect(); | 178 | .collect(); |
| 178 | match im_core::services::seed_from(store, &seed).await { | 179 | match im_core::services::seed_from(store, &seed).await { |
| @@ -198,6 +199,8 @@ async fn register_self(store: &Store, config: &Config) { | |||
| 198 | "Account", | 199 | "Account", |
| 199 | &config.issuer, | 200 | &config.issuer, |
| 200 | im_core::services::SELF_OWNER, | 201 | im_core::services::SELF_OWNER, |
| 202 | + // im is nobody's client: its own row carries no credential stamp. | ||
| 203 | + None, | ||
| 201 | ) | 204 | ) |
| 202 | .await | 205 | .await |
| 203 | { | 206 | { |
style/main.scssmodified+1 -0
| @@ -1041,6 +1041,7 @@ body:has(.log-list) { | |||
| 1041 | 1041 | ||
| 1042 | .actions { | 1042 | .actions { |
| 1043 | display: flex; | 1043 | display: flex; |
| 1044 | + flex-wrap: wrap; | ||
| 1044 | gap: 8px; | 1045 | gap: 8px; |
| 1045 | justify-content: flex-end; | 1046 | justify-content: flex-end; |
| 1046 | 1047 | ||