diff options
Diffstat (limited to 'kittybox-rs/templates/src/indieauth.rs')
-rw-r--r-- | kittybox-rs/templates/src/indieauth.rs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/kittybox-rs/templates/src/indieauth.rs b/kittybox-rs/templates/src/indieauth.rs index e901d7b..908cd2c 100644 --- a/kittybox-rs/templates/src/indieauth.rs +++ b/kittybox-rs/templates/src/indieauth.rs @@ -5,7 +5,7 @@ markup::define! { AuthorizationRequestPage( request: AuthorizationRequest, credentials: Vec<EnrolledCredential>, - app: serde_json::Value, + app: Option<serde_json::Value>, user: serde_json::Value ) { script[type="module"] { @@ -31,12 +31,27 @@ document.getElementById("indieauth_page").addEventListener("submit", submit_hand } p."mini-h-card" { - @if let Some(icon) = app["properties"]["logo"][0].as_str() { + @if let Some(icon) = app + .as_ref() + .and_then(|app| app["properties"]["logo"][0].as_str()) + { img.app_icon[src=icon]; + } else if let Some(icon) = app + .as_ref() + .and_then(|app| app["properties"]["logo"][0].as_object()) + { + img.app_icon[src=icon["src"].as_str().unwrap(), alt=icon["alt"].as_str().unwrap()]; } span { - a[href=app["properties"]["url"][0].as_str().unwrap()] { - @app["properties"]["name"][0].as_str().unwrap() + a[href=app + .as_ref() + .and_then(|app| app["properties"]["url"][0].as_str()) + .unwrap_or_else(|| request.client_id.as_str()) + ] { + @app + .as_ref() + .and_then(|app| app["properties"]["name"][0].as_str()) + .unwrap_or_else(|| request.client_id.as_str()) } " wants to confirm your identity." } |