using custom version of actix-codegen and cors for pow routes

This commit is contained in:
realaravinth
2021-05-25 14:34:24 +05:30
parent 0421cb681c
commit 72667bd2e1
26 changed files with 334 additions and 363 deletions

View File

@@ -45,6 +45,7 @@ impl<'a> Default for IndexPage<'a> {
}
}
#[my_codegen::get(path = "crate::PAGES.panel.sitekey.add", wrap = "crate::CheckLogin")]
pub async fn add_sitekey() -> impl Responder {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")

View File

@@ -38,6 +38,7 @@ impl IndexPage {
}
/// render a list of all sitekeys that a user has
#[my_codegen::get(path = "crate::PAGES.panel.sitekey.list", wrap = "crate::CheckLogin")]
pub async fn list_sitekeys(
data: web::Data<Data>,
id: Identity,

View File

@@ -38,27 +38,7 @@ pub mod routes {
}
pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
use crate::define_resource;
use crate::PAGES;
define_resource!(
cfg,
PAGES.panel.sitekey.add,
Methods::ProtectGet,
add::add_sitekey
);
define_resource!(
cfg,
PAGES.panel.sitekey.list,
Methods::ProtectGet,
list::list_sitekeys
);
define_resource!(
cfg,
PAGES.panel.sitekey.view,
Methods::ProtectGet,
view::view_sitekey
);
cfg.service(add::add_sitekey);
cfg.service(list::list_sitekeys);
cfg.service(view::view_sitekey);
}

View File

@@ -55,6 +55,7 @@ impl IndexPage {
}
/// route handler that renders individual views for sitekeys
#[my_codegen::get(path = "crate::PAGES.panel.sitekey.view", wrap = "crate::CheckLogin")]
pub async fn view_sitekey(
path: web::Path<String>,
data: web::Data<Data>,