mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-31 02:08:20 +02:00 
			
		
		
		
	Get host from client and put it in the attachments URL (only the web vault works without indicating the host in the URL)
This commit is contained in:
		| @@ -94,6 +94,7 @@ use db::models::{User, Device}; | ||||
|  | ||||
| pub struct Headers { | ||||
|     pub device_type: Option<i32>, | ||||
|     pub host: String, | ||||
|     pub device: Device, | ||||
|     pub user: User, | ||||
| } | ||||
| @@ -111,6 +112,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for Headers { | ||||
|             _ => None // return err_handler!("Device-Type is invalid or missing") | ||||
|         }; | ||||
|  | ||||
|         // Get host | ||||
|         let host = match headers.get_one("Host") { | ||||
|             Some(host) => format!("http://{}", host), // TODO: Check if HTTPS | ||||
|             _ => String::new() // return err_handler!("Host is invalid or missing") | ||||
|         }; | ||||
|  | ||||
|         // Get access_token | ||||
|         let access_token: &str = match request.headers().get_one("Authorization") { | ||||
|             Some(a) => { | ||||
| @@ -156,6 +163,6 @@ impl<'a, 'r> FromRequest<'a, 'r> for Headers { | ||||
|             err_handler!("Invalid security stamp") | ||||
|         } | ||||
|  | ||||
|         Outcome::Success(Headers { device_type, device, user }) | ||||
|         Outcome::Success(Headers { device_type, host, device, user }) | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user