diff options
author | Vika <vika@fireburn.ru> | 2025-04-20 08:25:57 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-04-20 10:01:01 +0300 |
commit | 3207c8ea57eac714417494e06ce0f82864b7ff1e (patch) | |
tree | 70cfde719dd596dbe05d38276526e763d55eac1d /src/indieauth | |
parent | b3288627d171fff9a289a56a4ae27307985f9f96 (diff) | |
download | kittybox-3207c8ea57eac714417494e06ce0f82864b7ff1e.tar.zst |
WIP: Theme support
Kittybox can now ship with several different stylesheets, provided by the renderer. Unknown stylesheets fall back to the default one, which is the same Kittybox has shipped since its inception. There's also a settings field for custom CSS, but it's not exposed anywhere yet. Change-Id: I2850dace5c40f9fed04b4651c551a861df5b83d3
Diffstat (limited to 'src/indieauth')
-rw-r--r-- | src/indieauth/mod.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/indieauth/mod.rs b/src/indieauth/mod.rs index 5cdbf05..af49a7f 100644 --- a/src/indieauth/mod.rs +++ b/src/indieauth/mod.rs @@ -1,4 +1,4 @@ -use crate::database::Storage; +use crate::database::{settings::Setting, Storage}; use axum::{ extract::{Form, FromRef, Json, Query, State}, http::StatusCode, @@ -13,6 +13,7 @@ use axum_extra::{ headers::{authorization::Bearer, Authorization, ContentType, HeaderMapExt}, TypedHeader, }; +use futures::FutureExt; use kittybox_indieauth::{ AuthorizationRequest, AuthorizationResponse, ClientMetadata, Error, ErrorKind, GrantRequest, GrantResponse, GrantType, IntrospectionEndpointAuthMethod, Metadata, PKCEMethod, Profile, @@ -319,12 +320,20 @@ async fn authorization_endpoint_get<A: AuthBackend, D: Storage + 'static>( { request.scope.replace(Scopes::new(vec![Scope::Profile])); } + let (blog_name, theme, channels) = tokio::join!( + db.get_setting::<crate::database::settings::SiteName>(&me) + .map(Result::unwrap_or_default), + db.get_setting::<crate::database::settings::Theme>(&me) + .map(Result::unwrap_or_default), + db.get_channels(&me).map(|i| i.unwrap_or_default()) + ); Html( kittybox_frontend_renderer::Template { title: "Confirm sign-in via IndieAuth", - blog_name: "Kittybox", - feeds: vec![], + blog_name: &blog_name.as_ref(), + feeds: channels, + theme: theme.into_inner(), user: None, content: kittybox_frontend_renderer::AuthorizationRequestPage { request, |