2023-09-05 09:33:46 +00:00
|
|
|
use actix_web::{guard, web};
|
2023-07-28 14:39:38 +00:00
|
|
|
use lemmy_api::{
|
2024-01-03 18:39:21 +00:00
|
|
|
comment::{
|
|
|
|
distinguish::distinguish_comment,
|
|
|
|
like::like_comment,
|
|
|
|
list_comment_likes::list_comment_likes,
|
|
|
|
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,
|
2023-09-05 09:33:46 +00:00
|
|
|
transfer::transfer_community,
|
2023-08-02 16:52:41 +00:00
|
|
|
},
|
2023-09-05 09:33:46 +00:00
|
|
|
local_user::{
|
|
|
|
add_admin::add_admin,
|
|
|
|
ban_person::ban_from_site,
|
|
|
|
block::block_person,
|
|
|
|
change_password::change_password,
|
|
|
|
change_password_after_reset::change_password_after_reset,
|
2023-09-20 14:49:54 +00:00
|
|
|
generate_totp_secret::generate_totp_secret,
|
2023-09-05 09:33:46 +00:00
|
|
|
get_captcha::get_captcha,
|
|
|
|
list_banned::list_banned_users,
|
2023-10-09 10:46:12 +00:00
|
|
|
list_logins::list_logins,
|
2024-03-26 16:06:11 +00:00
|
|
|
list_media::list_media,
|
2023-09-05 09:33:46 +00:00
|
|
|
login::login,
|
2023-10-09 10:46:12 +00:00
|
|
|
logout::logout,
|
2023-09-05 09:33:46 +00:00
|
|
|
notifications::{
|
|
|
|
list_mentions::list_mentions,
|
|
|
|
list_replies::list_replies,
|
|
|
|
mark_all_read::mark_all_notifications_read,
|
|
|
|
mark_mention_read::mark_person_mention_as_read,
|
|
|
|
mark_reply_read::mark_reply_as_read,
|
|
|
|
unread_count::unread_count,
|
|
|
|
},
|
|
|
|
report_count::report_count,
|
|
|
|
reset_password::reset_password,
|
|
|
|
save_settings::save_user_settings,
|
2023-09-20 14:49:54 +00:00
|
|
|
update_totp::update_totp,
|
2023-10-17 15:25:48 +00:00
|
|
|
validate_auth::validate_auth,
|
2023-09-05 09:33:46 +00:00
|
|
|
verify_email::verify_email,
|
2022-11-19 04:33:54 +00:00
|
|
|
},
|
2023-09-05 09:33:46 +00:00
|
|
|
post::{
|
|
|
|
feature::feature_post,
|
|
|
|
get_link_metadata::get_link_metadata,
|
2024-02-29 15:42:34 +00:00
|
|
|
hide::hide_post,
|
2023-09-05 09:33:46 +00:00
|
|
|
like::like_post,
|
2024-01-03 18:39:21 +00:00
|
|
|
list_post_likes::list_post_likes,
|
2023-09-05 09:33:46 +00:00
|
|
|
lock::lock_post,
|
|
|
|
mark_read::mark_post_as_read,
|
|
|
|
save::save_post,
|
|
|
|
},
|
|
|
|
post_report::{
|
|
|
|
create::create_post_report,
|
|
|
|
list::list_post_reports,
|
|
|
|
resolve::resolve_post_report,
|
|
|
|
},
|
|
|
|
private_message::mark_read::mark_pm_as_read,
|
|
|
|
private_message_report::{
|
|
|
|
create::create_pm_report,
|
|
|
|
list::list_pm_reports,
|
|
|
|
resolve::resolve_pm_report,
|
2022-11-19 04:33:54 +00:00
|
|
|
},
|
|
|
|
site::{
|
2023-09-20 09:56:13 +00:00
|
|
|
block::block_instance,
|
2023-09-05 09:33:46 +00:00
|
|
|
federated_instances::get_federated_instances,
|
|
|
|
leave_admin::leave_admin,
|
2024-03-26 16:06:11 +00:00
|
|
|
list_all_media::list_all_media,
|
2023-09-05 09:33:46 +00:00
|
|
|
mod_log::get_mod_log,
|
|
|
|
purge::{
|
|
|
|
comment::purge_comment,
|
|
|
|
community::purge_community,
|
|
|
|
person::purge_person,
|
|
|
|
post::purge_post,
|
|
|
|
},
|
|
|
|
registration_applications::{
|
|
|
|
approve::approve_registration_application,
|
2024-07-23 23:01:24 +00:00
|
|
|
get::get_registration_application,
|
2023-09-05 09:33:46 +00:00
|
|
|
list::list_registration_applications,
|
|
|
|
unread_count::get_unread_registration_application_count,
|
|
|
|
},
|
2022-11-19 04:33:54 +00:00
|
|
|
},
|
2023-09-05 09:33:46 +00:00
|
|
|
sitemap::get_sitemap,
|
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,
|
2024-09-19 09:15:04 +00:00
|
|
|
list::list_custom_emojis,
|
2023-08-02 16:52:41 +00:00
|
|
|
update::update_custom_emoji,
|
|
|
|
},
|
2024-09-18 12:52:33 +00:00
|
|
|
oauth_provider::{
|
|
|
|
create::create_oauth_provider,
|
|
|
|
delete::delete_oauth_provider,
|
|
|
|
update::update_oauth_provider,
|
|
|
|
},
|
2023-08-02 16:52:41 +00:00
|
|
|
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},
|
2024-09-19 09:15:04 +00:00
|
|
|
tagline::{
|
|
|
|
create::create_tagline,
|
|
|
|
delete::delete_tagline,
|
|
|
|
list::list_taglines,
|
|
|
|
update::update_tagline,
|
|
|
|
},
|
2024-09-18 12:52:33 +00:00
|
|
|
user::{
|
|
|
|
create::{authenticate_with_oauth, register},
|
|
|
|
delete::delete_account,
|
|
|
|
},
|
2023-07-28 14:39:38 +00:00
|
|
|
};
|
2023-09-05 09:33:46 +00:00
|
|
|
use lemmy_apub::api::{
|
|
|
|
list_comments::list_comments,
|
|
|
|
list_posts::list_posts,
|
|
|
|
read_community::get_community,
|
|
|
|
read_person::read_person,
|
|
|
|
resolve_object::resolve_object,
|
|
|
|
search::search,
|
2023-10-11 14:47:22 +00:00
|
|
|
user_settings_backup::{export_settings, import_settings},
|
2023-07-03 09:01:41 +00:00
|
|
|
};
|
2024-01-25 14:22:11 +00:00
|
|
|
use lemmy_routes::images::image_proxy;
|
2023-09-05 09:33:46 +00:00
|
|
|
use lemmy_utils::rate_limit::RateLimitCell;
|
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")
|
2024-01-25 14:22:11 +00:00
|
|
|
.route("/image_proxy", web::get().to(image_proxy))
|
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))
|
2023-09-20 09:56:13 +00:00
|
|
|
.route("", web::put().to(update_site))
|
|
|
|
.route("/block", web::post().to(block_instance)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::resource("/modlog")
|
|
|
|
.wrap(rate_limit.message())
|
2023-09-05 09:33:46 +00:00
|
|
|
.route(web::get().to(get_mod_log)),
|
2020-04-20 03:59:07 +00:00
|
|
|
)
|
|
|
|
.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))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/transfer", web::post().to(transfer_community))
|
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())
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("", web::get().to(get_federated_instances)),
|
2023-04-16 21:00:31 +00:00
|
|
|
)
|
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))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/mark_as_read", web::post().to(mark_post_as_read))
|
2024-02-29 15:42:34 +00:00
|
|
|
.route("/hide", web::post().to(hide_post))
|
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))
|
2024-01-03 18:39:21 +00:00
|
|
|
.route("/like/list", web::get().to(list_post_likes))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/save", web::put().to(save_post))
|
2023-08-02 16:52:41 +00:00
|
|
|
.route("/report", web::post().to(create_post_report))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/report/resolve", web::put().to(resolve_post_report))
|
|
|
|
.route("/report/list", web::get().to(list_post_reports))
|
|
|
|
.route("/site_metadata", web::get().to(get_link_metadata)),
|
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))
|
2024-01-03 18:39:21 +00:00
|
|
|
.route("/like/list", web::get().to(list_comment_likes))
|
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))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/mark_as_read", web::post().to(mark_pm_as_read))
|
|
|
|
.route("/report", web::post().to(create_pm_report))
|
|
|
|
.route("/report/resolve", web::put().to(resolve_pm_report))
|
|
|
|
.route("/report/list", web::get().to(list_pm_reports)),
|
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
|
2024-05-15 02:43:43 +00:00
|
|
|
// Handle /user/register separately to add the register() rate limiter
|
2020-04-20 03:59:07 +00:00
|
|
|
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
|
|
|
)
|
2024-05-15 02:43:43 +00:00
|
|
|
// User
|
|
|
|
.service(
|
|
|
|
// Handle /user/login separately to add the register() rate limiter
|
|
|
|
// TODO: pretty annoying way to apply rate limits for register and login, we should
|
2024-05-23 12:46:26 +00:00
|
|
|
// group them under a common path so that rate limit is only applied once (eg under
|
|
|
|
// /account).
|
2024-05-15 02:43:43 +00:00
|
|
|
web::resource("/user/login")
|
|
|
|
.guard(guard::Post())
|
|
|
|
.wrap(rate_limit.register())
|
|
|
|
.route(web::post().to(login)),
|
|
|
|
)
|
2024-05-21 18:46:49 +00:00
|
|
|
.service(
|
|
|
|
web::resource("/user/password_reset")
|
|
|
|
.wrap(rate_limit.register())
|
|
|
|
.route(web::post().to(reset_password)),
|
|
|
|
)
|
2023-06-27 10:38:53 +00:00
|
|
|
.service(
|
|
|
|
// Handle captcha separately
|
|
|
|
web::resource("/user/get_captcha")
|
|
|
|
.wrap(rate_limit.post())
|
2023-09-05 09:33:46 +00:00
|
|
|
.route(web::get().to(get_captcha)),
|
2023-06-27 10:38:53 +00:00
|
|
|
)
|
2023-11-13 13:08:07 +00:00
|
|
|
.service(
|
|
|
|
web::resource("/user/export_settings")
|
|
|
|
.wrap(rate_limit.import_user_settings())
|
|
|
|
.route(web::get().to(export_settings)),
|
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::resource("/user/import_settings")
|
|
|
|
.wrap(rate_limit.import_user_settings())
|
|
|
|
.route(web::post().to(import_settings)),
|
|
|
|
)
|
2024-03-26 16:06:11 +00:00
|
|
|
// TODO, all the current account related actions under /user need to get moved here eventually
|
|
|
|
.service(
|
|
|
|
web::scope("/account")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route("/list_media", web::get().to(list_media)),
|
|
|
|
)
|
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))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/mention", web::get().to(list_mentions))
|
2020-07-20 14:56:40 +00:00
|
|
|
.route(
|
|
|
|
"/mention/mark_as_read",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::post().to(mark_person_mention_as_read),
|
2020-07-20 14:56:40 +00:00
|
|
|
)
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/replies", web::get().to(list_replies))
|
2020-04-20 03:59:07 +00:00
|
|
|
// 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))
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/banned", web::get().to(list_banned_users))
|
|
|
|
.route("/block", web::post().to(block_person))
|
2023-10-20 00:16:12 +00:00
|
|
|
// TODO Account actions. I don't like that they're in /user maybe /accounts
|
2023-10-09 10:46:12 +00:00
|
|
|
.route("/logout", web::post().to(logout))
|
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_change",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::post().to(change_password_after_reset),
|
2020-04-20 04:47:20 +00:00
|
|
|
)
|
2023-10-20 00:16:12 +00:00
|
|
|
// TODO 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",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::post().to(mark_all_notifications_read),
|
2020-10-25 02:59:13 +00:00
|
|
|
)
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/save_user_settings", web::put().to(save_user_settings))
|
|
|
|
.route("/change_password", web::put().to(change_password))
|
|
|
|
.route("/report_count", web::get().to(report_count))
|
|
|
|
.route("/unread_count", web::get().to(unread_count))
|
|
|
|
.route("/verify_email", web::post().to(verify_email))
|
2023-09-20 14:49:54 +00:00
|
|
|
.route("/leave_admin", web::post().to(leave_admin))
|
|
|
|
.route("/totp/generate", web::post().to(generate_totp_secret))
|
2023-10-09 10:46:12 +00:00
|
|
|
.route("/totp/update", web::post().to(update_totp))
|
2023-10-17 15:25:48 +00:00
|
|
|
.route("/list_logins", web::get().to(list_logins))
|
|
|
|
.route("/validate_auth", web::get().to(validate_auth)),
|
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())
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/add", web::post().to(add_admin))
|
2021-12-15 19:49:59 +00:00
|
|
|
.route(
|
|
|
|
"/registration_application/count",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::get().to(get_unread_registration_application_count),
|
2021-12-15 19:49:59 +00:00
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/registration_application/list",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::get().to(list_registration_applications),
|
2021-12-15 19:49:59 +00:00
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/registration_application/approve",
|
2023-09-05 09:33:46 +00:00
|
|
|
web::put().to(approve_registration_application),
|
2023-06-21 20:32:06 +00:00
|
|
|
)
|
2024-07-23 23:01:24 +00:00
|
|
|
.route(
|
|
|
|
"/registration_application",
|
|
|
|
web::get().to(get_registration_application),
|
|
|
|
)
|
2024-03-26 16:06:11 +00:00
|
|
|
.route("/list_all_media", web::get().to(list_all_media))
|
2023-06-21 20:32:06 +00:00
|
|
|
.service(
|
|
|
|
web::scope("/purge")
|
2023-09-05 09:33:46 +00:00
|
|
|
.route("/person", web::post().to(purge_person))
|
|
|
|
.route("/community", web::post().to(purge_community))
|
|
|
|
.route("/post", web::post().to(purge_post))
|
|
|
|
.route("/comment", web::post().to(purge_comment)),
|
2024-09-19 09:15:04 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/tagline")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route("", web::post().to(create_tagline))
|
|
|
|
.route("", web::put().to(update_tagline))
|
|
|
|
.route("/delete", web::post().to(delete_tagline))
|
|
|
|
.route("/list", web::get().to(list_taglines)),
|
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))
|
2024-09-19 09:15:04 +00:00
|
|
|
.route("/delete", web::post().to(delete_custom_emoji))
|
|
|
|
.route("/list", web::get().to(list_custom_emojis)),
|
2024-09-18 12:52:33 +00:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/oauth_provider")
|
|
|
|
.wrap(rate_limit.message())
|
|
|
|
.route("", web::post().to(create_oauth_provider))
|
|
|
|
.route("", web::put().to(update_oauth_provider))
|
|
|
|
.route("/delete", web::post().to(delete_oauth_provider)),
|
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/oauth")
|
|
|
|
.wrap(rate_limit.register())
|
|
|
|
.route("/authenticate", web::post().to(authenticate_with_oauth)),
|
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
|
|
|
}
|