about summary refs log tree commit diff
path: root/templates/src/indieauth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'templates/src/indieauth.rs')
-rw-r--r--templates/src/indieauth.rs31
1 files changed, 9 insertions, 22 deletions
diff --git a/templates/src/indieauth.rs b/templates/src/indieauth.rs
index 155b580..5f92196 100644
--- a/templates/src/indieauth.rs
+++ b/templates/src/indieauth.rs
@@ -1,11 +1,13 @@
-use kittybox_indieauth::{AuthorizationRequest, Scope};
+use kittybox_indieauth::{AuthorizationRequest, ClientMetadata, Scope};
 use kittybox_util::auth::EnrolledCredential;
 
+const INDIEAUTH_SPEC: &str = "https://indieauth.spec.indieweb.org/20240711/#authorization-request";
+
 markup::define! {
     AuthorizationRequestPage(
         request: AuthorizationRequest,
         credentials: Vec<EnrolledCredential>,
-        app: Option<serde_json::Value>,
+        app: ClientMetadata,
         user: serde_json::Value
     ) {
         script[type="module"] {
@@ -37,27 +39,12 @@ document.getElementById("indieauth_page").addEventListener("submit", submit_hand
                     }
 
                     p."mini-h-card" {
-                        @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()];
+                        @if let Some(icon) = app.logo_uri.as_ref() {
+                            img.app_icon[src=icon.as_str()];
                         }
                         span {
-                            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())
+                            a[href=app.client_uri.as_str()] {
+                                @app.client_name.as_deref().unwrap_or_else(|| request.client_id.as_str())
                             }
                             " wants to confirm your identity."
                         }
@@ -152,7 +139,7 @@ document.getElementById("indieauth_page").addEventListener("submit", submit_hand
 
                     p {
                         "More info about meanings of these fields can be found in "
-                            a[href="https://indieauth.spec.indieweb.org/20220212/#authorization-request"] {
+                            a[href=INDIEAUTH_SPEC] {
                                 "the IndieAuth specification"
                             } ", which this webpage uses."
                     }