mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-13 19:15:39 +00:00
using custom version of actix-codegen and cors for pow routes
This commit is contained in:
@@ -30,6 +30,7 @@ pub struct AddNotification {
|
||||
}
|
||||
|
||||
/// route handler that adds a notification message
|
||||
#[my_codegen::post(path="crate::V1_API_ROUTES.notifications.add", wrap="crate::CheckLogin")]
|
||||
pub async fn add_notification(
|
||||
payload: web::Json<AddNotification>,
|
||||
data: web::Data<Data>,
|
||||
|
||||
@@ -52,6 +52,7 @@ impl From<Notification> for NotificationResp {
|
||||
}
|
||||
}
|
||||
/// route handler that gets all unread notifications
|
||||
#[my_codegen::get(path="crate::V1_API_ROUTES.notifications.get", wrap="crate::CheckLogin")]
|
||||
pub async fn get_notification(
|
||||
data: web::Data<Data>,
|
||||
id: Identity,
|
||||
|
||||
@@ -38,20 +38,6 @@ pub mod routes {
|
||||
}
|
||||
|
||||
pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
|
||||
use crate::define_resource;
|
||||
use crate::V1_API_ROUTES;
|
||||
|
||||
define_resource!(
|
||||
cfg,
|
||||
V1_API_ROUTES.notifications.add,
|
||||
Methods::ProtectPost,
|
||||
add::add_notification
|
||||
);
|
||||
|
||||
define_resource!(
|
||||
cfg,
|
||||
V1_API_ROUTES.notifications.get,
|
||||
Methods::ProtectGet,
|
||||
get::get_notification
|
||||
);
|
||||
cfg.service(add::add_notification);
|
||||
cfg.service(get::get_notification);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user