Serve static files
This commit is contained in:
		
							parent
							
								
									ee7dfee3ef
								
							
						
					
					
						commit
						d3319493d9
					
				| @ -58,6 +58,8 @@ fn init_pool() -> PgPool { | ||||
| fn main() { | ||||
|     rocket::ignite() | ||||
|         .mount("/", routes![ | ||||
|             routes::static_files, | ||||
| 
 | ||||
|             routes::well_known::host_meta, | ||||
|             routes::well_known::webfinger, | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,6 @@ | ||||
| use rocket::response::NamedFile; | ||||
| use std::path::{Path, PathBuf}; | ||||
| 
 | ||||
| pub mod blogs; | ||||
| pub mod comments; | ||||
| pub mod instance; | ||||
| @ -6,3 +9,8 @@ pub mod posts; | ||||
| pub mod session; | ||||
| pub mod user; | ||||
| pub mod well_known; | ||||
| 
 | ||||
| #[get("/static/<file..>")] | ||||
| fn static_files(file: PathBuf) -> Option<NamedFile> { | ||||
|     NamedFile::open(Path::new("static/").join(file)).ok() | ||||
| } | ||||
|  | ||||
							
								
								
									
										4
									
								
								static/main.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								static/main.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| html { | ||||
|     margin: 0px; | ||||
|     padding: 0px; | ||||
| } | ||||
| @ -3,6 +3,7 @@ | ||||
|     <head> | ||||
|         <meta charset="utf-8"> | ||||
|         <title>{% block title %}{% endblock title %} ⋅ Plume</title> | ||||
|         <link rel="stylesheet" href="/static/main.css"> | ||||
|     </head> | ||||
|     <body> | ||||
|         {% block content %} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user