| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -19,7 +19,7 @@ use once_cell::sync::Lazy; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use rand::Rng; | 
					 | 
					 | 
					 | 
					use rand::Rng; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use tera::Tera; | 
					 | 
					 | 
					 | 
					use tera::Tera; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use yopa::{Storage}; | 
					 | 
					 | 
					 | 
					use yopa::Storage; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::tera_ext::TeraExt; | 
					 | 
					 | 
					 | 
					use crate::tera_ext::TeraExt; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -102,7 +102,7 @@ pub(crate) static TERA: Lazy<Tera> = Lazy::new(|| { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					type YopaStoreWrapper = web::Data<tokio::sync::RwLock<yopa::Storage>>; | 
					 | 
					 | 
					 | 
					type YopaStoreWrapper = web::Data<tokio::sync::RwLock<yopa::Storage>>; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const DEF_ADDRESS : &str = "127.0.0.1:8080"; | 
					 | 
					 | 
					 | 
					const DEF_ADDRESS: &str = "127.0.0.1:8080"; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#[actix_web::main] | 
					 | 
					 | 
					 | 
					#[actix_web::main] | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					async fn main() -> std::io::Result<()> { | 
					 | 
					 | 
					 | 
					async fn main() -> std::io::Result<()> { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -145,7 +145,9 @@ async fn main() -> std::io::Result<()> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // Ensure the lazy ref is initialized early (to catch template bugs ASAP)
 | 
					 | 
					 | 
					 | 
					    // Ensure the lazy ref is initialized early (to catch template bugs ASAP)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let _ = TERA.deref(); | 
					 | 
					 | 
					 | 
					    let _ = TERA.deref(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let file = matches.value_of("file").unwrap_or("yopa-store.dat"); | 
					 | 
					 | 
					 | 
					    let json = matches.is_present("json"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    let file = matches.value_of("file").unwrap_or(if json { "yopa-store.json" } else { "yopa-store.dat" }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let file_path = if file.starts_with('/') { | 
					 | 
					 | 
					 | 
					    let file_path = if file.starts_with('/') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        std::env::current_dir()?.join(file) | 
					 | 
					 | 
					 | 
					        std::env::current_dir()?.join(file) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -155,7 +157,7 @@ async fn main() -> std::io::Result<()> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    debug!("Using database file: {}", file_path.display()); | 
					 | 
					 | 
					 | 
					    debug!("Using database file: {}", file_path.display()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let mut store = if matches.is_present("json") { | 
					 | 
					 | 
					 | 
					    let mut store = if json { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Storage::new_json(file_path) | 
					 | 
					 | 
					 | 
					        Storage::new_json(file_path) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Storage::new_bincode(file_path) | 
					 | 
					 | 
					 | 
					        Storage::new_bincode(file_path) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |