From e43313210269b8e48fe35b17ac416c9ba88ae4f3 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 18 Aug 2024 00:30:15 +0300 Subject: feat: logins!! yes you can finally sign in this is also supposed to show private posts intended for you! maybe i can also reveal my email to those who sign in! :3 --- templates/src/indieauth.rs | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'templates/src/indieauth.rs') 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, - app: Option, + 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." } -- cgit 1.4.1