mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-08 12:04:10 +00: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:
parent
912901780e
commit
47a116bbee
5 changed files with 19 additions and 15 deletions
|
@ -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 })
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue