From ac3c1d41b26b36ed4025551370fb77275a9c56d3 Mon Sep 17 00:00:00 2001 From: BlockListed <44610569+BlockListed@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:09:21 +0200 Subject: [PATCH] make web support hostinfo --- src/api/web.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/api/web.rs b/src/api/web.rs index d81bf9dc..5f4c961d 100644 --- a/src/api/web.rs +++ b/src/api/web.rs @@ -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)> { +fn app_id(host_info: HostInfo) -> Cached<(ContentType, 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. - 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( (