1
+ use crate :: acme:: ACMEManager ;
1
2
use crate :: config:: get_host_path_from_domain;
2
3
use crate :: file_cache:: { CacheItem , FileCache } ;
3
4
use anyhow:: { anyhow, bail, Context } ;
5
+ use chrono:: { DateTime , Utc } ;
4
6
use dashmap:: DashMap ;
5
7
use lazy_static:: lazy_static;
6
8
use md5:: { Digest , Md5 } ;
@@ -13,11 +15,9 @@ use std::io::{Read, Write};
13
15
use std:: ops:: RangeInclusive ;
14
16
use std:: path:: { Path , PathBuf } ;
15
17
use std:: sync:: Arc ;
16
- use chrono:: { DateTime , Utc } ;
17
18
use tracing:: { debug, info} ;
18
19
use walkdir:: { DirEntry , WalkDir } ;
19
20
use warp:: fs:: sanitize_path;
20
- use crate :: acme:: ACMEManager ;
21
21
22
22
pub ( crate ) const URI_REGEX_STR : & str =
23
23
"[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\ .[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\\ .?" ;
@@ -198,7 +198,7 @@ impl DomainStorage {
198
198
let mut max_version = 0 ;
199
199
let mut uploading_version = None ;
200
200
if !domain_dir. exists ( ) {
201
- return Ok ( ( None , None ) )
201
+ return Ok ( ( None , None ) ) ;
202
202
}
203
203
for version_dir_entry in fs:: read_dir ( domain_dir) ? {
204
204
let version_dir_entry = version_dir_entry?;
@@ -536,18 +536,17 @@ impl DomainStorage {
536
536
}
537
537
}
538
538
pub fn check_if_empty_index ( & self , host : & str , path : & str ) -> bool {
539
- match self . meta
540
- . get ( host) {
541
- Some ( v) => {
542
- match v. value ( ) {
543
- DomainMeta :: OneWeb { .. } => path. is_empty ( ) ,
544
- DomainMeta :: MultipleWeb ( map) => {
545
- if path. len ( ) > 1 {
546
- map. contains_key ( & path[ 1 ..] )
547
- } else {
548
- map. contains_key ( path)
549
- }
550
- }
539
+ match self . meta . get ( host) {
540
+ Some ( v) => match v. value ( ) {
541
+ DomainMeta :: OneWeb { .. } => path. is_empty ( ) ,
542
+ DomainMeta :: MultipleWeb ( map) => {
543
+ let result = if path. len ( ) > 1 {
544
+ map. contains_key ( & path[ 1 ..] )
545
+ } else {
546
+ map. contains_key ( path)
547
+ } ;
548
+ debug ! ( "fuck, {},{}, {}" , path. len( ) , path, result) ;
549
+ result
551
550
}
552
551
} ,
553
552
None => {
@@ -611,7 +610,9 @@ impl DomainStorage {
611
610
"domain:{}, version:{} change to upload status:finish" ,
612
611
domain, version
613
612
) ;
614
- acme_manager. add_new_domain ( get_host_path_from_domain ( & domain) . 0 ) . await ;
613
+ acme_manager
614
+ . add_new_domain ( get_host_path_from_domain ( & domain) . 0 )
615
+ . await ;
615
616
}
616
617
} else if uploading_status == UploadingStatus :: Uploading {
617
618
if self
@@ -757,7 +758,6 @@ pub struct CertInfo {
757
758
pub host : String ,
758
759
}
759
760
760
-
761
761
#[ cfg( test) ]
762
762
mod test {
763
763
use crate :: config:: Config ;
0 commit comments