mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-06-01 16:10:49 +00:00
make web support hostinfo
This commit is contained in:
parent
12c0005e7f
commit
ac3c1d41b2
|
@ -5,7 +5,7 @@ use serde_json::Value;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{core::now, ApiResult, EmptyResult},
|
api::{core::now, ApiResult, EmptyResult},
|
||||||
auth::{decode_file_download, BaseURL},
|
auth::{decode_file_download, HostInfo},
|
||||||
config::extract_url_host,
|
config::extract_url_host,
|
||||||
error::Error,
|
error::Error,
|
||||||
util::{Cached, SafeString},
|
util::{Cached, SafeString},
|
||||||
|
@ -63,14 +63,12 @@ fn web_index_head() -> EmptyResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/app-id.json")]
|
#[get("/app-id.json")]
|
||||||
fn app_id(base_url: BaseURL) -> Cached<(ContentType, Json<Value>)> {
|
fn app_id(host_info: HostInfo) -> Cached<(ContentType, Json<Value>)> {
|
||||||
let content_type = ContentType::new("application", "fido.trusted-apps+json");
|
let content_type = ContentType::new("application", "fido.trusted-apps+json");
|
||||||
|
|
||||||
// TODO_MAYBE: add an extractor for getting the origin, so we only have to do 1 lookup.
|
// TODO_MAYBE: add an extractor for getting the origin, so we only have to do 1 lookup.
|
||||||
let origin = CONFIG.domain_origin(&extract_url_host(&base_url.base_url))
|
// Also I'm not sure if we shouldn't return all origins.
|
||||||
// This should never fail, because every host with a domain entry
|
let origin = host_info.origin;
|
||||||
// should have a origin entry.
|
|
||||||
.expect("Configured domain has no origin entry");
|
|
||||||
|
|
||||||
Cached::long(
|
Cached::long(
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user