1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-05-18 23:10:05 +02:00

make web support hostinfo

Dieser Commit ist enthalten in:
BlockListed 2023-09-09 14:09:21 +02:00
Ursprung 12c0005e7f
Commit ac3c1d41b2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 2D204777C477B588

Datei anzeigen

@ -5,7 +5,7 @@ use serde_json::Value;
use crate::{
api::{core::now, ApiResult, EmptyResult},
auth::{decode_file_download, BaseURL},
auth::{decode_file_download, HostInfo},
config::extract_url_host,
error::Error,
util::{Cached, SafeString},
@ -63,14 +63,12 @@ fn web_index_head() -> EmptyResult {
}
#[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");
// 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))
// This should never fail, because every host with a domain entry
// should have a origin entry.
.expect("Configured domain has no origin entry");
// Also I'm not sure if we shouldn't return all origins.
let origin = host_info.origin;
Cached::long(
(