diff options
author | Vika <vika@fireburn.ru> | 2022-07-10 14:49:55 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-07-10 14:49:55 +0300 |
commit | 25183f2ed7802375f15cb0069af7bee6dd2c7afd (patch) | |
tree | ff6e67de32864839b58cfcb1be31bfbd52d89e28 /kittybox-rs | |
parent | 1031d495d5b78d9b19dcdc414b6d7b0daf313bb2 (diff) | |
download | kittybox-25183f2ed7802375f15cb0069af7bee6dd2c7afd.tar.zst |
indieauth: rename to tokenauth
This frees up the name for the future in-house IndieAuth implementation and also clarifies the purpose of this module. Its future is uncertain - most probably when the token endpoint gets finished, it will transform into a way to query that token endpoint. But then, the media endpoint also depends on it, so I might have to copy that implementation (that queries an external token endpoint) and make it generic enough so I could both query an external endpoint or use internal data.
Diffstat (limited to 'kittybox-rs')
-rw-r--r-- | kittybox-rs/src/frontend/onboarding.rs | 2 | ||||
-rw-r--r-- | kittybox-rs/src/lib.rs | 2 | ||||
-rw-r--r-- | kittybox-rs/src/main.rs | 2 | ||||
-rw-r--r-- | kittybox-rs/src/media/mod.rs | 2 | ||||
-rw-r--r-- | kittybox-rs/src/micropub/mod.rs | 14 | ||||
-rw-r--r-- | kittybox-rs/src/micropub/util.rs | 2 | ||||
-rw-r--r-- | kittybox-rs/src/tokenauth.rs (renamed from kittybox-rs/src/indieauth.rs) | 0 |
7 files changed, 12 insertions, 12 deletions
diff --git a/kittybox-rs/src/frontend/onboarding.rs b/kittybox-rs/src/frontend/onboarding.rs index 9027201..08a05ee 100644 --- a/kittybox-rs/src/frontend/onboarding.rs +++ b/kittybox-rs/src/frontend/onboarding.rs @@ -56,7 +56,7 @@ async fn onboard<D: Storage + 'static>( // Create a user to pass to the backend // At this point the site belongs to nobody, so it is safe to do let user = - crate::indieauth::User::new(user_uid.as_str(), "https://kittybox.fireburn.ru/", "create"); + crate::tokenauth::User::new(user_uid.as_str(), "https://kittybox.fireburn.ru/", "create"); if data.user["type"][0] != "h-card" || data.first_post["type"][0] != "h-entry" { return Err(FrontendError::with_code( diff --git a/kittybox-rs/src/lib.rs b/kittybox-rs/src/lib.rs index 84e9d60..c1683d9 100644 --- a/kittybox-rs/src/lib.rs +++ b/kittybox-rs/src/lib.rs @@ -4,7 +4,7 @@ /// Database abstraction layer for Kittybox, allowing the CMS to work with any kind of database. pub mod database; pub mod frontend; -pub mod indieauth; +pub mod tokenauth; pub mod media; pub mod micropub; diff --git a/kittybox-rs/src/main.rs b/kittybox-rs/src/main.rs index 6cc8c1d..50c0ca5 100644 --- a/kittybox-rs/src/main.rs +++ b/kittybox-rs/src/main.rs @@ -181,7 +181,7 @@ async fn main() { )) .layer(axum::Extension(database)) .layer(axum::Extension(http)) - .layer(axum::Extension(kittybox::indieauth::TokenEndpoint( + .layer(axum::Extension(kittybox::tokenauth::TokenEndpoint( token_endpoint, ))) .layer(axum::Extension(blobstore)) diff --git a/kittybox-rs/src/media/mod.rs b/kittybox-rs/src/media/mod.rs index 1bf3958..e9e91ac 100644 --- a/kittybox-rs/src/media/mod.rs +++ b/kittybox-rs/src/media/mod.rs @@ -2,7 +2,7 @@ use axum::{ extract::{Extension, Host, multipart::{Multipart, MultipartError}, Path}, response::{IntoResponse, Response}, headers::HeaderValue, }; -use crate::{micropub::{MicropubError, ErrorType}, indieauth::User}; +use crate::{micropub::{MicropubError, ErrorType}, tokenauth::User}; pub mod storage; use storage::{MediaStore, MediaStoreError, Metadata, ErrorKind}; diff --git a/kittybox-rs/src/micropub/mod.rs b/kittybox-rs/src/micropub/mod.rs index 8550849..1fa442a 100644 --- a/kittybox-rs/src/micropub/mod.rs +++ b/kittybox-rs/src/micropub/mod.rs @@ -1,5 +1,5 @@ use crate::database::{MicropubChannel, Storage, StorageError}; -use crate::indieauth::User; +use crate::tokenauth::User; use crate::micropub::util::form_to_mf2_json; use axum::extract::{BodyStream, Query}; use axum::headers::ContentType; @@ -293,7 +293,7 @@ async fn background_processing<D: 'static + Storage>( // TODO actually save the post to the database and schedule post-processing pub(crate) async fn _post<D: 'static + Storage>( - user: crate::indieauth::User, + user: User, uid: String, mf2: serde_json::Value, db: D, @@ -681,7 +681,7 @@ impl MicropubQuery { #[cfg(test)] mod tests { - use crate::{database::Storage, micropub::MicropubError}; + use crate::{database::Storage, micropub::MicropubError, tokenauth::User}; use hyper::body::HttpBody; use serde_json::json; @@ -734,7 +734,7 @@ mod tests { "content": ["Hello world!"] } }); - let user = crate::indieauth::User::new( + let user = User::new( "https://localhost:8080/", "https://kittybox.fireburn.ru/", "profile", @@ -763,7 +763,7 @@ mod tests { "url": ["https://fireburn.ru/posts/hello"] } }); - let user = crate::indieauth::User::new( + let user = User::new( "https://aaronparecki.com/", "https://kittybox.fireburn.ru/", "create update media", @@ -790,7 +790,7 @@ mod tests { "content": ["Hello world!"] } }); - let user = crate::indieauth::User::new( + let user = User::new( "https://localhost:8080/", "https://kittybox.fireburn.ru/", "create", @@ -817,7 +817,7 @@ mod tests { axum::extract::Query(super::MicropubQuery::source( "https://aaronparecki.com/feeds/main", )), - crate::indieauth::User::new( + User::new( "https://fireburn.ru/", "https://quill.p3k.io/", "create update media", diff --git a/kittybox-rs/src/micropub/util.rs b/kittybox-rs/src/micropub/util.rs index 97ec09a..7c6a0b1 100644 --- a/kittybox-rs/src/micropub/util.rs +++ b/kittybox-rs/src/micropub/util.rs @@ -1,5 +1,5 @@ use crate::database::Storage; -use crate::indieauth::User; +use crate::tokenauth::User; use chrono::prelude::*; use core::iter::Iterator; use newbase60::num_to_sxg; diff --git a/kittybox-rs/src/indieauth.rs b/kittybox-rs/src/tokenauth.rs index 103f514..103f514 100644 --- a/kittybox-rs/src/indieauth.rs +++ b/kittybox-rs/src/tokenauth.rs |