From a624c5017ac734ac3b1bd3ba54d8528f0a7e05f4 Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Sun, 7 Apr 2024 14:25:58 +0200 Subject: [PATCH] progress --- Cargo.lock | 3 --- crates/kitsune-service/Cargo.toml | 1 - kitsune/Cargo.toml | 2 -- .../http/handler/mastodon/api/v1/accounts/follow.rs | 6 ++---- .../http/handler/mastodon/api/v1/accounts/lookup.rs | 3 ++- .../src/http/handler/mastodon/api/v1/accounts/mod.rs | 3 ++- .../handler/mastodon/api/v1/accounts/relationships.rs | 6 ++---- .../http/handler/mastodon/api/v1/accounts/statuses.rs | 2 +- .../http/handler/mastodon/api/v1/accounts/unfollow.rs | 6 ++---- .../mastodon/api/v1/accounts/update_credentials.rs | 10 ++++------ .../mastodon/api/v1/accounts/verify_credentials.rs | 6 ++---- kitsune/src/http/handler/mastodon/api/v1/apps.rs | 2 +- .../src/http/handler/mastodon/api/v1/custom_emojis.rs | 7 ++----- .../handler/mastodon/api/v1/follow_requests/accept.rs | 6 ++---- .../handler/mastodon/api/v1/follow_requests/mod.rs | 2 +- .../handler/mastodon/api/v1/follow_requests/reject.rs | 6 ++---- kitsune/src/http/handler/mastodon/api/v1/instance.rs | 3 ++- kitsune/src/http/handler/mastodon/api/v1/media.rs | 2 +- .../handler/mastodon/api/v1/notifications/clear.rs | 6 ++---- .../handler/mastodon/api/v1/notifications/dismiss.rs | 6 ++---- .../http/handler/mastodon/api/v1/notifications/mod.rs | 2 +- .../http/handler/mastodon/api/v1/statuses/context.rs | 6 ++---- .../http/handler/mastodon/api/v1/statuses/favourite.rs | 6 ++---- .../handler/mastodon/api/v1/statuses/favourited_by.rs | 2 +- .../src/http/handler/mastodon/api/v1/statuses/mod.rs | 2 +- .../http/handler/mastodon/api/v1/statuses/reblog.rs | 6 ++---- .../handler/mastodon/api/v1/statuses/reblogged_by.rs | 2 +- .../http/handler/mastodon/api/v1/statuses/source.rs | 6 ++---- .../handler/mastodon/api/v1/statuses/unfavourite.rs | 6 ++---- .../http/handler/mastodon/api/v1/statuses/unreblog.rs | 6 ++---- .../src/http/handler/mastodon/api/v1/timelines/home.rs | 2 +- .../http/handler/mastodon/api/v1/timelines/public.rs | 2 +- kitsune/src/http/handler/mastodon/api/v2/search.rs | 2 +- kitsune/src/http/handler/oauth/authorize.rs | 3 +-- kitsune/src/oauth2/endpoint.rs | 4 ++-- kitsune/src/oauth2/issuer.rs | 2 +- kitsune/src/oauth2/mod.rs | 2 +- 37 files changed, 56 insertions(+), 93 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e3850909..4605316ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3554,7 +3554,6 @@ dependencies = [ "clap", "color-eyre", "cursiv", - "der", "diesel", "diesel-async", "fs_extra", @@ -3612,7 +3611,6 @@ dependencies = [ "speedy-uuid", "strum", "tempfile", - "thiserror", "time", "tokio", "tokio-util", @@ -4114,7 +4112,6 @@ dependencies = [ "rsa", "rusty-s3", "serde", - "simd-json", "smol_str", "speedy-uuid", "tempfile", diff --git a/crates/kitsune-service/Cargo.toml b/crates/kitsune-service/Cargo.toml index 7e912ac29..9543b8f1f 100644 --- a/crates/kitsune-service/Cargo.toml +++ b/crates/kitsune-service/Cargo.toml @@ -55,7 +55,6 @@ redis = { version = "0.25.3", default-features = false, features = [ rsa = "0.9.6" rusty-s3 = { version = "0.5.0", default-features = false } serde = "1.0.197" -simd-json = "0.13.9" smol_str = "0.2.1" speedy-uuid = { path = "../../lib/speedy-uuid" } tokio = { version = "1.37.0", features = ["macros", "sync"] } diff --git a/kitsune/Cargo.toml b/kitsune/Cargo.toml index f3c02bc05..9b48313dc 100644 --- a/kitsune/Cargo.toml +++ b/kitsune/Cargo.toml @@ -36,7 +36,6 @@ chrono = { version = "0.4.37", default-features = false } clap = { version = "4.5.4", features = ["derive", "wrap_help"] } color-eyre = "0.6.3" cursiv = { path = "../lib/cursiv", features = ["axum"] } -der = { version = "0.7.9", features = ["std"] } diesel = "2.1.5" diesel-async = "0.4.1" futures-util = "0.3.30" @@ -88,7 +87,6 @@ simdutf8 = { version = "0.1.4", features = ["aarch64_neon"] } speedy-uuid = { path = "../lib/speedy-uuid" } strum = { version = "0.26.2", features = ["derive", "phf"] } tempfile = "3.10.1" -thiserror = "1.0.58" time = "0.3.34" tokio = { version = "1.37.0", features = ["full"] } tokio-util = { version = "0.7.10", features = ["compat"] } diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs index dc72dbafc..f4f959797 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs @@ -1,13 +1,11 @@ -use crate::{ - error::Result, - http::extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, Follow}; use kitsune_type::mastodon::relationship::Relationship; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs index 35c8d3556..95cffe6b8 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs @@ -1,10 +1,11 @@ -use crate::{error::Result, http::extractor::MastodonAuthExtractor}; +use crate::http::extractor::MastodonAuthExtractor; use axum::{ debug_handler, extract::{Query, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, GetUser}; use kitsune_type::mastodon::Account; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs index 6ec8ee48b..0eb1101c5 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs @@ -1,9 +1,10 @@ -use crate::{error::Result, state::Zustand}; +use crate::state::Zustand; use axum::{ extract::{Path, State}, routing, Json, Router, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::AccountService; use kitsune_type::mastodon; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs index b0f4ac7bb..30fa92cf5 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs @@ -1,13 +1,11 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{debug_handler, extract::State, Json}; use axum_extra::extract::Query; use diesel::{ExpressionMethods, QueryDsl, SelectableHelper}; use diesel_async::RunQueryDsl; use futures_util::StreamExt; use kitsune_db::{model::account::Account, schema::accounts, with_connection, PgPool}; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_type::mastodon::relationship::Relationship; use serde::Deserialize; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs index 2b7367ae8..a9802bb8f 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::{AuthExtractor, MastodonAuthExtractor}, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -11,6 +10,7 @@ use axum::{ Json, }; use futures_util::{FutureExt, TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, GetPosts}; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/unfollow.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/unfollow.rs index 65a4a0719..60536239b 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/unfollow.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/unfollow.rs @@ -1,13 +1,11 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, Unfollow}; use kitsune_type::mastodon::relationship::Relationship; diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs index e632512c2..688cf62ac 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs @@ -1,15 +1,13 @@ -use crate::{ - error::Result, - http::{ - extractor::{AuthExtractor, MastodonAuthExtractor}, - util::buffer_multipart_to_tempfile, - }, +use crate::http::{ + extractor::{AuthExtractor, MastodonAuthExtractor}, + util::buffer_multipart_to_tempfile, }; use axum::{ extract::{Multipart, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::{ account::{AccountService, Update}, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs index d64645700..1e967beaa 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs @@ -1,8 +1,6 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{extract::State, Json}; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_type::mastodon::Account; diff --git a/kitsune/src/http/handler/mastodon/api/v1/apps.rs b/kitsune/src/http/handler/mastodon/api/v1/apps.rs index 9fcc1c9f3..15e9f4541 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/apps.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/apps.rs @@ -1,10 +1,10 @@ use crate::state::Zustand; use crate::{ - error::Result, http::extractor::AgnosticForm, oauth2::{CreateApp, OAuth2Service}, }; use axum::{extract::State, routing, Json, Router}; +use kitsune_error::Result; use kitsune_type::mastodon::App; use serde::Deserialize; use utoipa::ToSchema; diff --git a/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs b/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs index 29f0d9825..d9ef601d4 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs @@ -1,10 +1,7 @@ -use crate::{ - error::{Error, Result}, - http::extractor::MastodonAuthExtractor, - state::Zustand, -}; +use crate::{http::extractor::MastodonAuthExtractor, state::Zustand}; use axum::{debug_handler, extract::State, routing, Json, Router}; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::custom_emoji::{CustomEmojiService, GetEmojiList}; use kitsune_type::mastodon::CustomEmoji; diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs index 34883d808..4d7f3448f 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs @@ -1,13 +1,11 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, FollowRequest}; use kitsune_type::mastodon::relationship::Relationship; diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs index 630a8bc8a..91519fce5 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::{AuthExtractor, MastodonAuthExtractor}, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -14,6 +13,7 @@ use axum::{ }; use axum_extra::extract::Query; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, GetFollowRequests}; use kitsune_type::mastodon::Account; diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs index 18b278964..7dcdc39e6 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs @@ -1,13 +1,11 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; use kitsune_core::error::HttpError; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, FollowRequest}; use kitsune_type::mastodon::relationship::Relationship; diff --git a/kitsune/src/http/handler/mastodon/api/v1/instance.rs b/kitsune/src/http/handler/mastodon/api/v1/instance.rs index a37cda014..b7d15fdd0 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/instance.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/instance.rs @@ -1,6 +1,7 @@ -use crate::{error::Result, state::Zustand}; +use crate::state::Zustand; use axum::{extract::State, routing, Json, Router}; use kitsune_core::consts::VERSION; +use kitsune_error::Result; use kitsune_service::instance::InstanceService; use kitsune_type::mastodon::{ instance::{Stats, Urls}, diff --git a/kitsune/src/http/handler/mastodon/api/v1/media.rs b/kitsune/src/http/handler/mastodon/api/v1/media.rs index 8ac45f6d2..bbf97e53b 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/media.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/media.rs @@ -1,5 +1,4 @@ use crate::{ - error::{Error, Result}, http::{ extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}, util::buffer_multipart_to_tempfile, @@ -13,6 +12,7 @@ use axum::{ }; use futures_util::TryFutureExt; use kitsune_core::error::HttpError; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::attachment::{AttachmentService, Update, Upload}; use kitsune_type::mastodon::MediaAttachment; diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs index 14508732e..6d94a1d95 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs @@ -1,9 +1,7 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{debug_handler, extract::State}; use http::StatusCode; +use kitsune_error::Result; use kitsune_service::notification::NotificationService; #[debug_handler(state = crate::state::Zustand)] diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs index 62df5931e..6bb537041 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs @@ -1,12 +1,10 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, }; use http::StatusCode; +use kitsune_error::Result; use kitsune_service::notification::NotificationService; use speedy_uuid::Uuid; diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs index 9536042b7..8ba36e3b5 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::{AuthExtractor, MastodonAuthExtractor}, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -15,6 +14,7 @@ use axum::{ use axum_extra::extract::Query; use futures_util::{TryFutureExt, TryStreamExt}; use kitsune_core::error::HttpError; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::notification::{GetNotifications, NotificationService}; use kitsune_type::mastodon::{notification::NotificationType, Notification}; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs index 215c0f39f..9df69d470 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs @@ -1,13 +1,11 @@ -use crate::{ - error::{Error, Result}, - http::extractor::MastodonAuthExtractor, -}; +use crate::http::extractor::MastodonAuthExtractor; use axum::{ debug_handler, extract::{Path, State}, Json, }; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::PostService; use kitsune_type::mastodon::status::Context; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs index 5b7b566a7..ab3b9c848 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs @@ -1,12 +1,10 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::PostService; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs index 26ffef46b..e0f43048b 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::MastodonAuthExtractor, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -13,6 +12,7 @@ use axum::{ }; use axum_extra::extract::Query; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::{GetAccountsInteractingWithPost, PostService}; use kitsune_type::mastodon::Account; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs index 1c7cccfbf..af5f28e25 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs @@ -1,5 +1,4 @@ use crate::{ - error::Result, http::extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}, state::Zustand, }; @@ -9,6 +8,7 @@ use axum::{ routing, Json, Router, }; use http::StatusCode; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::{CreatePost, DeletePost, PostService, UpdatePost}; use kitsune_type::mastodon::{status::Visibility, Status}; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs index 200ff9654..fc3d49253 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs @@ -1,12 +1,10 @@ -use crate::{ - error::Result, - http::extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AgnosticForm, AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::{PostService, RepostPost}; use kitsune_type::mastodon::{status::Visibility, Status}; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs index 0b176d7d4..da0682df2 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::MastodonAuthExtractor, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -13,6 +12,7 @@ use axum::{ }; use axum_extra::extract::Query; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::{GetAccountsInteractingWithPost, PostService}; use kitsune_type::mastodon::Account; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs index f5576c163..b56e05bed 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs @@ -1,11 +1,9 @@ -use crate::{ - error::Result, - http::extractor::{Json, MastodonAuthExtractor}, -}; +use crate::http::extractor::{Json, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, }; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::PostService; use kitsune_type::mastodon::status::StatusSource; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs index f2448fc9b..a7f0ba012 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs @@ -1,12 +1,10 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::PostService; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs index 623860b0e..6bab52630 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs @@ -1,12 +1,10 @@ -use crate::{ - error::Result, - http::extractor::{AuthExtractor, MastodonAuthExtractor}, -}; +use crate::http::extractor::{AuthExtractor, MastodonAuthExtractor}; use axum::{ debug_handler, extract::{Path, State}, Json, }; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_service::post::{PostService, UnrepostPost}; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs b/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs index ac2b69b40..8f5545364 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::{AuthExtractor, MastodonAuthExtractor}, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -11,6 +10,7 @@ use axum::{ Json, }; use futures_util::{TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::timeline::{GetHome, TimelineService}; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs b/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs index bf2f289e5..f203a2ef2 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::{Error, Result}, http::{ extractor::{AuthExtractor, MastodonAuthExtractor}, pagination::{LinkHeader, PaginatedJsonResponse}, @@ -11,6 +10,7 @@ use axum::{ Json, }; use futures_util::{FutureExt, TryFutureExt, TryStreamExt}; +use kitsune_error::{Error, Result}; use kitsune_mastodon::MastodonMapper; use kitsune_service::timeline::{GetPublic, TimelineService}; use kitsune_type::mastodon::Status; diff --git a/kitsune/src/http/handler/mastodon/api/v2/search.rs b/kitsune/src/http/handler/mastodon/api/v2/search.rs index d783e50f7..681595e68 100644 --- a/kitsune/src/http/handler/mastodon/api/v2/search.rs +++ b/kitsune/src/http/handler/mastodon/api/v2/search.rs @@ -1,6 +1,5 @@ use crate::{ consts::default_limit, - error::Result, http::extractor::{AuthExtractor, MastodonAuthExtractor}, state::Zustand, }; @@ -8,6 +7,7 @@ use axum::{debug_handler, extract::State, routing, Json, Router}; use axum_extra::{either::Either, extract::Query}; use http::StatusCode; use kitsune_core::consts::API_MAX_LIMIT; +use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_search::SearchIndex; use kitsune_service::search::{Search, SearchResult, SearchService}; diff --git a/kitsune/src/http/handler/oauth/authorize.rs b/kitsune/src/http/handler/oauth/authorize.rs index cc0da0c49..88879aabd 100644 --- a/kitsune/src/http/handler/oauth/authorize.rs +++ b/kitsune/src/http/handler/oauth/authorize.rs @@ -18,8 +18,7 @@ use axum_flash::{Flash, IncomingFlashes}; use cursiv::CsrfHandle; use diesel::{ExpressionMethods, OptionalExtension, QueryDsl}; use diesel_async::RunQueryDsl; -use kitsune_db::with_connection; -use kitsune_db::{model::user::User, schema::users, PgPool}; +use kitsune_db::{model::user::User, schema::users, with_connection, PgPool}; use kitsune_error::{Error, Result}; use oxide_auth_async::endpoint::authorization::AuthorizationFlow; use oxide_auth_axum::{OAuthRequest, OAuthResponse}; diff --git a/kitsune/src/oauth2/endpoint.rs b/kitsune/src/oauth2/endpoint.rs index f1a5b8b8a..d9d212761 100644 --- a/kitsune/src/oauth2/endpoint.rs +++ b/kitsune/src/oauth2/endpoint.rs @@ -1,7 +1,6 @@ use super::{ authorizer::OAuthAuthorizer, issuer::OAuthIssuer, registrar::OAuthRegistrar, OAuthScope, }; -use crate::error::OAuth2Error; use kitsune_db::PgPool; use oxide_auth::endpoint::{OAuthError, OwnerConsent, Scope, Scopes, Solicitation, WebRequest}; use oxide_auth_async::{ @@ -65,7 +64,7 @@ impl Endpoint for OAuthEndpoint where S: OwnerSolicitor + Send, { - type Error = OAuth2Error; + type Error = kitsune_error::Error; fn registrar(&self) -> Option<&(dyn Registrar + Sync)> { Some(&self.registrar) @@ -116,6 +115,7 @@ where _req: &mut T, _solicitation: Solicitation<'_>, ) -> OwnerConsent { + error!("called the \"vacant\" owner solicitor. this is most likely a bug!"); OwnerConsent::Denied } } diff --git a/kitsune/src/oauth2/issuer.rs b/kitsune/src/oauth2/issuer.rs index 4074a675b..68b9ea849 100644 --- a/kitsune/src/oauth2/issuer.rs +++ b/kitsune/src/oauth2/issuer.rs @@ -1,5 +1,4 @@ use super::{chrono_to_timestamp, timestamp_to_chrono}; -use crate::error::Error; use async_trait::async_trait; use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, SelectableHelper}; use diesel_async::RunQueryDsl; @@ -9,6 +8,7 @@ use kitsune_db::{ schema::{oauth2_access_tokens, oauth2_applications, oauth2_refresh_tokens}, with_connection, with_transaction, PgPool, }; +use kitsune_error::Error; use kitsune_util::generate_secret; use oxide_auth::primitives::{ grant::{Extensions, Grant}, diff --git a/kitsune/src/oauth2/mod.rs b/kitsune/src/oauth2/mod.rs index f171ecb3c..b195e223d 100644 --- a/kitsune/src/oauth2/mod.rs +++ b/kitsune/src/oauth2/mod.rs @@ -1,4 +1,3 @@ -use crate::error::{Error, Result}; use askama::Template; use askama_axum::IntoResponse; use axum::response::{Redirect, Response}; @@ -10,6 +9,7 @@ use kitsune_db::{ schema::{oauth2_applications, oauth2_authorization_codes}, with_connection, PgPool, }; +use kitsune_error::{Error, Result}; use kitsune_url::UrlService; use kitsune_util::generate_secret; use oxide_auth::endpoint::Scope;