mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 21:42:34 +00:00
Rename Context to CalDavContext
This commit is contained in:
@@ -15,7 +15,7 @@ pub mod namespace;
|
|||||||
mod propfind;
|
mod propfind;
|
||||||
pub mod routes;
|
pub mod routes;
|
||||||
|
|
||||||
pub struct Context<C: CalendarStore> {
|
pub struct CalDavContext<C: CalendarStore> {
|
||||||
pub prefix: String,
|
pub prefix: String,
|
||||||
pub store: Arc<RwLock<C>>,
|
pub store: Arc<RwLock<C>>,
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ pub fn configure_dav<C: CalendarStore>(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cfg.app_data(Data::new(Context { prefix, store }))
|
cfg.app_data(Data::new(CalDavContext { prefix, store }))
|
||||||
.service(
|
.service(
|
||||||
web::resource("{path:.*}")
|
web::resource("{path:.*}")
|
||||||
// Without the guard this service would handle all requests
|
// Without the guard this service would handle all requests
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use crate::propfind::{
|
|||||||
generate_multistatus, parse_propfind, write_invalid_props_response, write_propstat_response,
|
generate_multistatus, parse_propfind, write_invalid_props_response, write_propstat_response,
|
||||||
write_resourcetype,
|
write_resourcetype,
|
||||||
};
|
};
|
||||||
use crate::{Context, Error};
|
use crate::{CalDavContext, Error};
|
||||||
use actix_web::http::header::ContentType;
|
use actix_web::http::header::ContentType;
|
||||||
use actix_web::http::StatusCode;
|
use actix_web::http::StatusCode;
|
||||||
use actix_web::web::{Data, Path};
|
use actix_web::web::{Data, Path};
|
||||||
@@ -70,7 +70,7 @@ async fn handle_report_calendar_query(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn route_report_calendar<C: CalendarStore>(
|
pub async fn route_report_calendar<C: CalendarStore>(
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
body: String,
|
body: String,
|
||||||
path: Path<(String, String)>,
|
path: Path<(String, String)>,
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
@@ -172,7 +172,7 @@ pub async fn route_propfind_calendar<C: CalendarStore>(
|
|||||||
body: String,
|
body: String,
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
auth: BasicAuth,
|
auth: BasicAuth,
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let (_principal, cid) = path.into_inner();
|
let (_principal, cid) = path.into_inner();
|
||||||
let calendar = context
|
let calendar = context
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use crate::{Context, Error};
|
use crate::{CalDavContext, Error};
|
||||||
use actix_web::web::{Data, Path};
|
use actix_web::web::{Data, Path};
|
||||||
use actix_web::HttpResponse;
|
use actix_web::HttpResponse;
|
||||||
use rustical_store::calendar::CalendarStore;
|
use rustical_store::calendar::CalendarStore;
|
||||||
|
|
||||||
pub async fn delete_event<C: CalendarStore>(
|
pub async fn delete_event<C: CalendarStore>(
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
path: Path<(String, String, String)>,
|
path: Path<(String, String, String)>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let (_principal, mut cid, uid) = path.into_inner();
|
let (_principal, mut cid, uid) = path.into_inner();
|
||||||
@@ -23,7 +23,7 @@ pub async fn delete_event<C: CalendarStore>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_event<C: CalendarStore>(
|
pub async fn get_event<C: CalendarStore>(
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
path: Path<(String, String, String)>,
|
path: Path<(String, String, String)>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let (_principal, mut cid, uid) = path.into_inner();
|
let (_principal, mut cid, uid) = path.into_inner();
|
||||||
@@ -44,7 +44,7 @@ pub async fn get_event<C: CalendarStore>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn put_event<C: CalendarStore>(
|
pub async fn put_event<C: CalendarStore>(
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
path: Path<(String, String, String)>,
|
path: Path<(String, String, String)>,
|
||||||
body: String,
|
body: String,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use crate::{
|
|||||||
generate_multistatus, parse_propfind, write_invalid_props_response,
|
generate_multistatus, parse_propfind, write_invalid_props_response,
|
||||||
write_propstat_response, write_resourcetype,
|
write_propstat_response, write_resourcetype,
|
||||||
},
|
},
|
||||||
Context, Error,
|
CalDavContext, Error,
|
||||||
};
|
};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
http::{header::ContentType, StatusCode},
|
http::{header::ContentType, StatusCode},
|
||||||
@@ -90,7 +90,7 @@ pub async fn route_propfind_principal<C: CalendarStore>(
|
|||||||
body: String,
|
body: String,
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
auth: BasicAuth,
|
auth: BasicAuth,
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
depth: Depth,
|
depth: Depth,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let props = parse_propfind(&body).map_err(|_e| Error::BadRequest)?;
|
let props = parse_propfind(&body).map_err(|_e| Error::BadRequest)?;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use crate::{
|
|||||||
generate_multistatus, parse_propfind, write_invalid_props_response,
|
generate_multistatus, parse_propfind, write_invalid_props_response,
|
||||||
write_propstat_response, write_resourcetype,
|
write_propstat_response, write_resourcetype,
|
||||||
},
|
},
|
||||||
Context, Error,
|
CalDavContext, Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Executes the PROPFIND request and returns a XML string to be written into a <mulstistatus> object.
|
// Executes the PROPFIND request and returns a XML string to be written into a <mulstistatus> object.
|
||||||
@@ -68,7 +68,7 @@ pub async fn route_propfind_root<C: CalendarStore>(
|
|||||||
body: String,
|
body: String,
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
auth: BasicAuth,
|
auth: BasicAuth,
|
||||||
context: Data<Context<C>>,
|
context: Data<CalDavContext<C>>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let props = parse_propfind(&body).map_err(|_e| Error::BadRequest)?;
|
let props = parse_propfind(&body).map_err(|_e| Error::BadRequest)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user