2022-11-19 04:33:54 +00:00
|
|
|
use actix_web::{guard, web, Error, HttpResponse, Result};
|
2023-07-28 14:39:38 +00:00
|
|
|
use lemmy_api::{
|
2023-08-01 13:53:36 +00:00
|
|
|
comment::{distinguish::distinguish_comment, like::like_comment, save::save_comment},
|
2023-08-02 16:52:41 +00:00
|
|
|
comment_report::{
|
|
|
|
create::create_comment_report,
|
|
|
|
list::list_comment_reports,
|
|
|
|
resolve::resolve_comment_report,
|
|
|
|
},
|
|
|
|
community::{
|
|
|
|
add_mod::add_mod_to_community,
|
|
|
|
ban::ban_from_community,
|
|
|
|
block::block_community,
|
|
|
|
follow::follow_community,
|
|
|
|
hide::hide_community,
|
|
|
|
},
|
|
|
|
local_user::{ban_person::ban_from_site, notifications::mark_reply_read::mark_reply_as_read},
|
|
|
|
post::{feature::feature_post, like::like_post, lock::lock_post},
|
|
|
|
post_report::create::create_post_report,
|
2023-08-22 14:30:15 +00:00
|
|
|
sitemap::get_sitemap,
|
2023-07-28 14:39:38 +00:00
|
|
|
Perform,
|
|
|
|
};
|
2022-09-19 22:58:42 +00:00
|
|
|
use lemmy_api_common::{
|
2023-08-02 16:52:41 +00:00
|
|
|
community::TransferCommunity,
|
2022-11-28 14:29:33 +00:00
|
|
|
context::LemmyContext,
|
2022-11-19 04:33:54 +00:00
|
|
|
person::{
|
|
|
|
AddAdmin,
|
|
|
|
BlockPerson,
|
|
|
|
ChangePassword,
|
|
|
|
GetBannedPersons,
|
2023-06-27 10:38:53 +00:00
|
|
|
GetCaptcha,
|
2022-11-19 04:33:54 +00:00
|
|
|
GetPersonMentions,
|
|
|
|
GetReplies,
|
|
|
|
GetReportCount,
|
|
|
|
GetUnreadCount,
|
|
|
|
Login,
|
|
|
|
MarkAllAsRead,
|
|
|
|
MarkPersonMentionAsRead,
|
|
|
|
PasswordChangeAfterReset,
|
|
|
|
PasswordReset,
|
|
|
|
SaveUserSettings,
|
|
|
|
VerifyEmail,
|
|
|
|
},
|
2023-08-02 16:52:41 +00:00
|
|
|
post::{GetSiteMetadata, ListPostReports, MarkPostAsRead, ResolvePostReport, SavePost},
|
2022-11-19 04:33:54 +00:00
|
|
|
private_message::{
|
|
|
|
CreatePrivateMessageReport,
|
|
|
|
ListPrivateMessageReports,
|
|
|
|
MarkPrivateMessageAsRead,
|
|
|
|
ResolvePrivateMessageReport,
|
|
|
|
},
|
|
|
|
site::{
|
|
|
|
ApproveRegistrationApplication,
|
2023-04-16 21:00:31 +00:00
|
|
|
GetFederatedInstances,
|
2022-11-19 04:33:54 +00:00
|
|
|
GetModlog,
|
|
|
|
GetUnreadRegistrationApplicationCount,
|
|
|
|
LeaveAdmin,
|
|
|
|
ListRegistrationApplications,
|
|
|
|
PurgeComment,
|
|
|
|
PurgeCommunity,
|
|
|
|
PurgePerson,
|
|
|
|
PurgePost,
|
|
|
|
},
|
2022-09-19 22:58:42 +00:00
|
|
|
};
|
2023-07-28 14:39:38 +00:00
|
|
|
use lemmy_api_crud::{
|
2023-08-01 13:53:36 +00:00
|
|
|
comment::{
|
|
|
|
create::create_comment,
|
|
|
|
delete::delete_comment,
|
|
|
|
read::get_comment,
|
|
|
|
remove::remove_comment,
|
|
|
|
update::update_comment,
|
|
|
|
},
|
2023-08-02 16:52:41 +00:00
|
|
|
community::{
|
|
|
|
create::create_community,
|
|
|
|
delete::delete_community,
|
|
|
|
list::list_communities,
|
|
|
|
remove::remove_community,
|
|
|
|
update::update_community,
|
|
|
|
},
|
|
|
|
custom_emoji::{
|
|
|
|
create::create_custom_emoji,
|
|
|
|
delete::delete_custom_emoji,
|
|
|
|
update::update_custom_emoji,
|
|
|
|
},
|
|
|
|
post::{
|
|
|
|
create::create_post,
|
|
|
|
delete::delete_post,
|
|
|
|
read::get_post,
|
|
|
|
remove::remove_post,
|
|
|
|
update::update_post,
|
|
|
|
},
|
|
|
|
private_message::{
|
|
|
|
create::create_private_message,
|
|
|
|
delete::delete_private_message,
|
|
|
|
read::get_private_message,
|
|
|
|
update::update_private_message,
|
|
|
|
},
|
2023-07-28 14:39:38 +00:00
|
|
|
site::{create::create_site, read::get_site, update::update_site},
|
2023-08-02 16:52:41 +00:00
|
|
|
user::{create::register, delete::delete_account},
|
2023-07-28 14:39:38 +00:00
|
|
|
};
|
2023-07-03 09:01:41 +00:00
|
|
|
use lemmy_apub::{
|
|
|
|
api::{
|
|
|
|
list_comments::list_comments,
|
|
|
|
list_posts::list_posts,
|
2023-07-28 14:39:38 +00:00
|
|
|
read_community::get_community,
|
2023-07-03 09:01:41 +00:00
|
|
|
read_person::read_person,
|
|
|
|
resolve_object::resolve_object,
|
|
|
|
search::search,
|
|
|
|
},
|
|
|
|
SendActivity,
|
|
|
|
};
|
2023-07-10 10:27:49 +00:00
|
|
|
use lemmy_utils::{rate_limit::RateLimitCell, spawn_try_task, SYNCHRONOUS_FEDERATION};
|
2020-09-03 19:45:12 +00:00
|
|
|
use serde::Deserialize;
|
2020-01-15 15:37:25 +00:00
|
|
|
|
2022-11-16 19:06:22 +00:00
|
|
|
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimitCell) {
|
2020-04-20 03:59:07 +00:00
|
|
|
cfg.service(
|
2021-03-29 15:26:15 +00:00
|
|
|
web::scope("/api/v3")
|
2020-04-20 03:59:07 +00:00
|
|
|
// Site
|
|
|
|
.service(
|
|
|
|
web::scope("/site")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("", web::get().to(get_site))
|
2020-04-20 03:59:07 +00:00
|
|
|
// Admin Actions
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("", web::post().to(create_site))
|
|
|
|
.route("", web::put().to(update_site)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::resource("/modlog")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route(web::get().to(route_get::<GetModlog>)),
|
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::resource("/search")
|
2022-03-29 15:46:03 +00:00
|
|
|
.wrap(rate_limit.search())
|
2023-07-03 09:01:41 +00:00
|
|
|
.route(web::get().to(search)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
2021-07-20 07:00:20 +00:00
|
|
|
.service(
|
|
|
|
web::resource("/resolve_object")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-03 09:01:41 +00:00
|
|
|
.route(web::get().to(resolve_object)),
|
2021-07-20 07:00:20 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
// Community
|
2020-04-20 17:31:22 +00:00
|
|
|
.service(
|
|
|
|
web::resource("/community")
|
|
|
|
.guard(guard::Post())
|
2020-04-20 18:05:07 +00:00
|
|
|
.wrap(rate_limit.register())
|
2023-08-02 16:52:41 +00:00
|
|
|
.route(web::post().to(create_community)),
|
2020-04-20 17:31:22 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
.service(
|
|
|
|
web::scope("/community")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("", web::get().to(get_community))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("", web::put().to(update_community))
|
|
|
|
.route("/hide", web::put().to(hide_community))
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("/list", web::get().to(list_communities))
|
2023-08-02 09:32:16 +00:00
|
|
|
.route("/follow", web::post().to(follow_community))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/block", web::post().to(block_community))
|
|
|
|
.route("/delete", web::post().to(delete_community))
|
2020-04-20 03:59:07 +00:00
|
|
|
// Mod Actions
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/remove", web::post().to(remove_community))
|
2020-04-20 03:59:07 +00:00
|
|
|
.route("/transfer", web::post().to(route_post::<TransferCommunity>))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/ban_user", web::post().to(ban_from_community))
|
|
|
|
.route("/mod", web::post().to(add_mod_to_community)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
2023-04-16 21:00:31 +00:00
|
|
|
.service(
|
|
|
|
web::scope("/federated_instances")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route("", web::get().to(route_get::<GetFederatedInstances>)),
|
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
// Post
|
|
|
|
.service(
|
|
|
|
// Handle POST to /post separately to add the post() rate limitter
|
|
|
|
web::resource("/post")
|
|
|
|
.guard(guard::Post())
|
|
|
|
.wrap(rate_limit.post())
|
2023-07-19 13:49:41 +00:00
|
|
|
.route(web::post().to(create_post)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/post")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("", web::get().to(get_post))
|
2023-08-01 13:53:36 +00:00
|
|
|
.route("", web::put().to(update_post))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/delete", web::post().to(delete_post))
|
|
|
|
.route("/remove", web::post().to(remove_post))
|
2021-11-23 14:15:43 +00:00
|
|
|
.route(
|
|
|
|
"/mark_as_read",
|
|
|
|
web::post().to(route_post::<MarkPostAsRead>),
|
|
|
|
)
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/lock", web::post().to(lock_post))
|
|
|
|
.route("/feature", web::post().to(feature_post))
|
2023-07-03 09:01:41 +00:00
|
|
|
.route("/list", web::get().to(list_posts))
|
2023-08-01 13:53:36 +00:00
|
|
|
.route("/like", web::post().to(like_post))
|
2020-09-15 19:26:47 +00:00
|
|
|
.route("/save", web::put().to(route_post::<SavePost>))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/report", web::post().to(create_post_report))
|
2020-11-04 02:15:11 +00:00
|
|
|
.route(
|
|
|
|
"/report/resolve",
|
|
|
|
web::put().to(route_post::<ResolvePostReport>),
|
|
|
|
)
|
2021-08-19 14:12:49 +00:00
|
|
|
.route("/report/list", web::get().to(route_get::<ListPostReports>))
|
|
|
|
.route(
|
|
|
|
"/site_metadata",
|
|
|
|
web::get().to(route_get::<GetSiteMetadata>),
|
|
|
|
),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
// Comment
|
2021-11-11 20:40:25 +00:00
|
|
|
.service(
|
|
|
|
// Handle POST to /comment separately to add the comment() rate limitter
|
|
|
|
web::resource("/comment")
|
|
|
|
.guard(guard::Post())
|
|
|
|
.wrap(rate_limit.comment())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route(web::post().to(create_comment)),
|
2021-11-11 20:40:25 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
.service(
|
2020-10-25 02:59:13 +00:00
|
|
|
web::scope("/comment")
|
2020-04-20 03:59:07 +00:00
|
|
|
.wrap(rate_limit.message())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("", web::get().to(get_comment))
|
2023-08-01 13:53:36 +00:00
|
|
|
.route("", web::put().to(update_comment))
|
|
|
|
.route("/delete", web::post().to(delete_comment))
|
|
|
|
.route("/remove", web::post().to(remove_comment))
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("/mark_as_read", web::post().to(mark_reply_as_read))
|
|
|
|
.route("/distinguish", web::post().to(distinguish_comment))
|
2023-08-01 13:53:36 +00:00
|
|
|
.route("/like", web::post().to(like_comment))
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("/save", web::put().to(save_comment))
|
2023-07-03 09:01:41 +00:00
|
|
|
.route("/list", web::get().to(list_comments))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/report", web::post().to(create_comment_report))
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("/report/resolve", web::put().to(resolve_comment_report))
|
|
|
|
.route("/report/list", web::get().to(list_comment_reports)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
2020-05-06 02:06:24 +00:00
|
|
|
// Private Message
|
|
|
|
.service(
|
|
|
|
web::scope("/private_message")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-28 14:39:38 +00:00
|
|
|
.route("/list", web::get().to(get_private_message))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("", web::post().to(create_private_message))
|
|
|
|
.route("", web::put().to(update_private_message))
|
|
|
|
.route("/delete", web::post().to(delete_private_message))
|
2020-07-20 04:29:44 +00:00
|
|
|
.route(
|
|
|
|
"/mark_as_read",
|
|
|
|
web::post().to(route_post::<MarkPrivateMessageAsRead>),
|
2022-09-19 22:58:42 +00:00
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/report",
|
|
|
|
web::post().to(route_post::<CreatePrivateMessageReport>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/report/resolve",
|
|
|
|
web::put().to(route_post::<ResolvePrivateMessageReport>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/report/list",
|
|
|
|
web::get().to(route_get::<ListPrivateMessageReports>),
|
2020-07-20 04:29:44 +00:00
|
|
|
),
|
2020-05-06 02:06:24 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
// User
|
|
|
|
.service(
|
|
|
|
// Account action, I don't like that it's in /user maybe /accounts
|
|
|
|
// Handle /user/register separately to add the register() rate limitter
|
|
|
|
web::resource("/user/register")
|
|
|
|
.guard(guard::Post())
|
|
|
|
.wrap(rate_limit.register())
|
2023-08-02 16:52:41 +00:00
|
|
|
.route(web::post().to(register)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
2023-06-27 10:38:53 +00:00
|
|
|
.service(
|
|
|
|
// Handle captcha separately
|
|
|
|
web::resource("/user/get_captcha")
|
|
|
|
.wrap(rate_limit.post())
|
|
|
|
.route(web::get().to(route_get::<GetCaptcha>)),
|
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
// User actions
|
|
|
|
.service(
|
|
|
|
web::scope("/user")
|
|
|
|
.wrap(rate_limit.message())
|
2023-07-03 09:01:41 +00:00
|
|
|
.route("", web::get().to(read_person))
|
2021-03-10 22:33:55 +00:00
|
|
|
.route("/mention", web::get().to(route_get::<GetPersonMentions>))
|
2020-07-20 14:56:40 +00:00
|
|
|
.route(
|
|
|
|
"/mention/mark_as_read",
|
2021-03-10 22:33:55 +00:00
|
|
|
web::post().to(route_post::<MarkPersonMentionAsRead>),
|
2020-07-20 14:56:40 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
.route("/replies", web::get().to(route_get::<GetReplies>))
|
|
|
|
// Admin action. I don't like that it's in /user
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/ban", web::post().to(ban_from_site))
|
2021-11-19 20:56:41 +00:00
|
|
|
.route("/banned", web::get().to(route_get::<GetBannedPersons>))
|
2021-08-19 20:54:15 +00:00
|
|
|
.route("/block", web::post().to(route_post::<BlockPerson>))
|
2020-04-20 03:59:07 +00:00
|
|
|
// Account actions. I don't like that they're in /user maybe /accounts
|
|
|
|
.route("/login", web::post().to(route_post::<Login>))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/delete_account", web::post().to(delete_account))
|
2020-04-20 04:47:20 +00:00
|
|
|
.route(
|
|
|
|
"/password_reset",
|
|
|
|
web::post().to(route_post::<PasswordReset>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/password_change",
|
2022-04-13 18:12:25 +00:00
|
|
|
web::post().to(route_post::<PasswordChangeAfterReset>),
|
2020-04-20 04:47:20 +00:00
|
|
|
)
|
2020-04-20 03:59:07 +00:00
|
|
|
// mark_all_as_read feels off being in this section as well
|
2020-04-20 04:47:20 +00:00
|
|
|
.route(
|
|
|
|
"/mark_all_as_read",
|
|
|
|
web::post().to(route_post::<MarkAllAsRead>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/save_user_settings",
|
|
|
|
web::put().to(route_post::<SaveUserSettings>),
|
2020-10-25 02:59:13 +00:00
|
|
|
)
|
2021-04-01 21:39:01 +00:00
|
|
|
.route(
|
|
|
|
"/change_password",
|
|
|
|
web::put().to(route_post::<ChangePassword>),
|
|
|
|
)
|
2021-10-16 10:43:41 +00:00
|
|
|
.route("/report_count", web::get().to(route_get::<GetReportCount>))
|
2021-12-15 19:49:59 +00:00
|
|
|
.route("/unread_count", web::get().to(route_get::<GetUnreadCount>))
|
2022-01-26 17:57:16 +00:00
|
|
|
.route("/verify_email", web::post().to(route_post::<VerifyEmail>))
|
|
|
|
.route("/leave_admin", web::post().to(route_post::<LeaveAdmin>)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
// Admin Actions
|
|
|
|
.service(
|
2021-12-15 19:49:59 +00:00
|
|
|
web::scope("/admin")
|
2020-04-20 03:59:07 +00:00
|
|
|
.wrap(rate_limit.message())
|
2021-12-15 19:49:59 +00:00
|
|
|
.route("/add", web::post().to(route_post::<AddAdmin>))
|
|
|
|
.route(
|
|
|
|
"/registration_application/count",
|
|
|
|
web::get().to(route_get::<GetUnreadRegistrationApplicationCount>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/registration_application/list",
|
|
|
|
web::get().to(route_get::<ListRegistrationApplications>),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/registration_application/approve",
|
|
|
|
web::put().to(route_post::<ApproveRegistrationApplication>),
|
2023-06-21 20:32:06 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/purge")
|
|
|
|
.route("/person", web::post().to(route_post::<PurgePerson>))
|
|
|
|
.route("/community", web::post().to(route_post::<PurgeCommunity>))
|
|
|
|
.route("/post", web::post().to(route_post::<PurgePost>))
|
|
|
|
.route("/comment", web::post().to(route_post::<PurgeComment>)),
|
2021-12-15 19:49:59 +00:00
|
|
|
),
|
2022-06-13 19:15:04 +00:00
|
|
|
)
|
2023-03-20 21:32:31 +00:00
|
|
|
.service(
|
|
|
|
web::scope("/custom_emoji")
|
|
|
|
.wrap(rate_limit.message())
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("", web::post().to(create_custom_emoji))
|
|
|
|
.route("", web::put().to(update_custom_emoji))
|
|
|
|
.route("/delete", web::post().to(delete_custom_emoji)),
|
2020-04-20 03:59:07 +00:00
|
|
|
),
|
|
|
|
);
|
2023-08-22 14:30:15 +00:00
|
|
|
cfg.service(
|
|
|
|
web::scope("/sitemap.xml")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route("", web::get().to(get_sitemap)),
|
|
|
|
);
|
2020-01-15 15:37:25 +00:00
|
|
|
}
|
|
|
|
|
2022-11-28 14:29:33 +00:00
|
|
|
async fn perform<'a, Data>(
|
|
|
|
data: Data,
|
2020-08-18 13:43:50 +00:00
|
|
|
context: web::Data<LemmyContext>,
|
2023-03-21 15:03:05 +00:00
|
|
|
apub_data: activitypub_federation::config::Data<LemmyContext>,
|
2020-04-19 22:08:25 +00:00
|
|
|
) -> Result<HttpResponse, Error>
|
2020-01-15 15:37:25 +00:00
|
|
|
where
|
2022-11-28 14:29:33 +00:00
|
|
|
Data: Perform
|
|
|
|
+ SendActivity<Response = <Data as Perform>::Response>
|
|
|
|
+ Clone
|
|
|
|
+ Deserialize<'a>
|
|
|
|
+ Send
|
|
|
|
+ 'static,
|
2020-01-15 15:37:25 +00:00
|
|
|
{
|
2023-06-06 16:27:22 +00:00
|
|
|
let res = data.perform(&context).await?;
|
2023-07-10 10:27:49 +00:00
|
|
|
let res_clone = res.clone();
|
|
|
|
let fed_task = async move { SendActivity::send_activity(&data, &res_clone, &apub_data).await };
|
|
|
|
if *SYNCHRONOUS_FEDERATION {
|
|
|
|
fed_task.await?;
|
|
|
|
} else {
|
|
|
|
spawn_try_task(fed_task);
|
|
|
|
}
|
|
|
|
Ok(HttpResponse::Ok().json(&res))
|
2020-01-15 15:37:25 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
async fn route_get<'a, Data>(
|
2020-01-23 14:22:17 +00:00
|
|
|
data: web::Query<Data>,
|
2020-08-18 13:43:50 +00:00
|
|
|
context: web::Data<LemmyContext>,
|
2023-03-21 15:03:05 +00:00
|
|
|
apub_data: activitypub_federation::config::Data<LemmyContext>,
|
2020-01-23 14:22:17 +00:00
|
|
|
) -> Result<HttpResponse, Error>
|
|
|
|
where
|
2022-11-28 14:29:33 +00:00
|
|
|
Data: Perform
|
|
|
|
+ SendActivity<Response = <Data as Perform>::Response>
|
|
|
|
+ Clone
|
|
|
|
+ Deserialize<'a>
|
|
|
|
+ Send
|
|
|
|
+ 'static,
|
2020-01-23 14:22:17 +00:00
|
|
|
{
|
2023-03-21 15:03:05 +00:00
|
|
|
perform::<Data>(data.0, context, apub_data).await
|
2020-01-23 14:22:17 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
async fn route_post<'a, Data>(
|
2020-01-23 14:22:17 +00:00
|
|
|
data: web::Json<Data>,
|
2020-08-18 13:43:50 +00:00
|
|
|
context: web::Data<LemmyContext>,
|
2023-03-21 15:03:05 +00:00
|
|
|
apub_data: activitypub_federation::config::Data<LemmyContext>,
|
2020-01-23 14:22:17 +00:00
|
|
|
) -> Result<HttpResponse, Error>
|
2020-01-15 15:37:25 +00:00
|
|
|
where
|
2022-11-28 14:29:33 +00:00
|
|
|
Data: Perform
|
|
|
|
+ SendActivity<Response = <Data as Perform>::Response>
|
|
|
|
+ Clone
|
|
|
|
+ Deserialize<'a>
|
|
|
|
+ Send
|
|
|
|
+ 'static,
|
2020-01-15 15:37:25 +00:00
|
|
|
{
|
2023-03-21 15:03:05 +00:00
|
|
|
perform::<Data>(data.0, context, apub_data).await
|
2020-01-15 15:37:25 +00:00
|
|
|
}
|