diff options
author | Vika <vika@fireburn.ru> | 2024-07-09 22:43:21 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-07-09 22:44:01 +0300 |
commit | 2e9c292bb989ffff2c99aa2a6062962c913b3586 (patch) | |
tree | 9c148d9e8fcbd7756ab8d27ae110075beea8e615 /src/micropub | |
parent | 644e19aa08b2629d4b69281e14d702f0b9673687 (diff) | |
download | kittybox-2e9c292bb989ffff2c99aa2a6062962c913b3586.tar.zst |
database: use Url to represent user authorities
This makes the interface more consistent and resistant to misuse.
Diffstat (limited to 'src/micropub')
-rw-r--r-- | src/micropub/mod.rs | 6 | ||||
-rw-r--r-- | src/micropub/util.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/micropub/mod.rs b/src/micropub/mod.rs index 8f7ff90..74f53a0 100644 --- a/src/micropub/mod.rs +++ b/src/micropub/mod.rs @@ -292,7 +292,7 @@ pub(crate) async fn _post<D: 'static + Storage>( ); // Save the post tracing::debug!("Saving post to database..."); - db.put_post(&mf2, &user_domain).await?; + db.put_post(&mf2, &user.me).await?; let mut channels = mf2["properties"]["channel"] .as_array() @@ -579,7 +579,7 @@ pub(crate) async fn query<D: Storage, A: AuthBackend>( ); match query.q { QueryType::Config => { - let channels: Vec<MicropubChannel> = match db.get_channels(&user_domain).await { + let channels: Vec<MicropubChannel> = match db.get_channels(&user.me).await { Ok(chans) => chans, Err(err) => { return MicropubError::new( @@ -636,7 +636,7 @@ pub(crate) async fn query<D: Storage, A: AuthBackend>( } } } - QueryType::Channel => match db.get_channels(&user_domain).await { + QueryType::Channel => match db.get_channels(&user.me).await { Ok(chans) => axum::response::Json(json!({ "channels": chans })).into_response(), Err(err) => MicropubError::new( ErrorType::InternalServerError, diff --git a/src/micropub/util.rs b/src/micropub/util.rs index b6a045d..0633ce9 100644 --- a/src/micropub/util.rs +++ b/src/micropub/util.rs @@ -212,7 +212,7 @@ pub(crate) async fn create_feed( }), user, ); - storage.put_post(&feed, user.me.as_str()).await?; + storage.put_post(&feed, &user.me).await?; storage.add_to_feed(channel, uid).await } |