|
1 |
| - use crate::acme::ACMEManager; |
| 1 | +use crate::acme::ACMEManager; |
2 | 2 | use crate::admin_server::request::{
|
3 | 3 | DeleteDomainVersionOption, DomainWithOptVersionOption, DomainWithVersionOption,
|
4 | 4 | GetDomainOption, GetDomainPositionOption, UpdateUploadingStatusOption, UploadFileOption,
|
@@ -44,19 +44,20 @@ impl AdminServer {
|
44 | 44 |
|
45 | 45 | fn routes(&self) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
|
46 | 46 | self.auth().and(
|
47 |
| - warp::get().and( |
48 |
| - self.get_domain_info() |
49 |
| - .or(self.get_domain_upload_path()) |
50 |
| - .or(self.get_files_metadata()) |
51 |
| - .or(self.get_acme_cert_info()) |
52 |
| - ) |
53 |
| - .or(warp::post().and( |
54 |
| - self.update_domain_version() |
55 |
| - .or(self.reload_server()) |
56 |
| - .or(self.change_upload_status()) |
57 |
| - .or(self.upload_file()) |
58 |
| - .or(self.remove_domain_version()) |
59 |
| - )), |
| 47 | + warp::get() |
| 48 | + .and( |
| 49 | + self.get_domain_info() |
| 50 | + .or(self.get_domain_upload_path()) |
| 51 | + .or(self.get_files_metadata()) |
| 52 | + .or(self.get_acme_cert_info()), |
| 53 | + ) |
| 54 | + .or(warp::post().and( |
| 55 | + self.update_domain_version() |
| 56 | + .or(self.reload_server()) |
| 57 | + .or(self.change_upload_status()) |
| 58 | + .or(self.upload_file()) |
| 59 | + .or(self.remove_domain_version()), |
| 60 | + )), |
60 | 61 | )
|
61 | 62 | }
|
62 | 63 |
|
@@ -130,7 +131,7 @@ impl AdminServer {
|
130 | 131 |
|
131 | 132 | fn change_upload_status(
|
132 | 133 | &self,
|
133 |
| - ) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone { |
| 134 | + ) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone { |
134 | 135 | warp::path!("files" / "upload_status")
|
135 | 136 | .and(with(self.domain_storage.clone()))
|
136 | 137 | .and(with(self.acme_manager.clone()))
|
@@ -182,7 +183,9 @@ impl AdminServer {
|
182 | 183 | .map(service::remove_domain_version)
|
183 | 184 | }
|
184 | 185 |
|
185 |
| - fn get_acme_cert_info(&self) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone { |
| 186 | + fn get_acme_cert_info( |
| 187 | + &self, |
| 188 | + ) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone { |
186 | 189 | warp::path!("cert" / "acme")
|
187 | 190 | .and(with(self.acme_manager.clone()))
|
188 | 191 | .and(warp::query::<GetDomainOption>())
|
@@ -296,7 +299,10 @@ pub mod service {
|
296 | 299 | acme_manager: Arc<ACMEManager>,
|
297 | 300 | param: UpdateUploadingStatusOption,
|
298 | 301 | ) -> Result<Response, Infallible> {
|
299 |
| - let resp = match storage.update_uploading_status(param.domain, param.version, param.status, &acme_manager).await { |
| 302 | + let resp = match storage |
| 303 | + .update_uploading_status(param.domain, param.version, param.status, &acme_manager) |
| 304 | + .await |
| 305 | + { |
300 | 306 | Ok(_) => Response::default(),
|
301 | 307 | Err(e) => {
|
302 | 308 | let mut resp = Response::new(Body::from(e.to_string()));
|
@@ -406,6 +412,25 @@ pub mod service {
|
406 | 412 | };
|
407 | 413 | Ok(resp)
|
408 | 414 | }
|
| 415 | + /* |
| 416 | + pub(super) async fn revoke_version( |
| 417 | + domain_storage: Arc<DomainStorage>, |
| 418 | + query: DomainWithVersionOption, |
| 419 | + ) -> Result<Response, Infallible>{ |
| 420 | + let DomainWithVersionOption { |
| 421 | + domain, version |
| 422 | + } = query; |
| 423 | + let resp = match domain_storage.get_domain_info_by_domain(&domain) { |
| 424 | + Some(info)=> { |
| 425 | + info |
| 426 | + } |
| 427 | + None => { |
| 428 | + not_found() |
| 429 | + } |
| 430 | + }; |
| 431 | + Ok(resp) |
| 432 | + } |
| 433 | + */ |
409 | 434 | }
|
410 | 435 |
|
411 | 436 | pub mod request {
|
|
0 commit comments