1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-16 04:12:53 +01:00

make admin work with multi-domains

Dieser Commit ist enthalten in:
BlockListed 2023-09-09 10:57:48 +02:00
Ursprung 17923c3fd0
Commit 0ebd877fb8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 2D204777C477B588

Datei anzeigen

@ -12,6 +12,7 @@ use rocket::{
Catcher, Route, Catcher, Route,
}; };
use crate::auth::BaseURL;
use crate::{ use crate::{
api::{ api::{
core::{log_event, two_factor}, core::{log_event, two_factor},
@ -98,7 +99,7 @@ const BASE_TEMPLATE: &str = "admin/base";
const ACTING_ADMIN_USER: &str = "vaultwarden-admin-00000-000000000000"; const ACTING_ADMIN_USER: &str = "vaultwarden-admin-00000-000000000000";
fn admin_path() -> String { fn admin_path() -> String {
format!("{}{}", CONFIG.domain_path(), ADMIN_PATH) format!("{}", ADMIN_PATH)
} }
#[derive(Debug)] #[derive(Debug)]
@ -123,8 +124,8 @@ impl<'r> FromRequest<'r> for IpHeader {
} }
} }
fn admin_url() -> String { fn admin_url(base_url: &str) -> String {
format!("{}{}", CONFIG.domain_origin(), admin_path()) format!("{}{}", base_url, admin_path())
} }
#[derive(Responder)] #[derive(Responder)]
@ -668,7 +669,7 @@ async fn get_ntp_time(has_http_access: bool) -> String {
} }
#[get("/diagnostics")] #[get("/diagnostics")]
async fn diagnostics(_token: AdminToken, ip_header: IpHeader, mut conn: DbConn) -> ApiResult<Html<String>> { async fn diagnostics(_token: AdminToken, ip_header: IpHeader, mut conn: DbConn, base_url: BaseURL) -> ApiResult<Html<String>> {
use chrono::prelude::*; use chrono::prelude::*;
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
@ -724,7 +725,7 @@ async fn diagnostics(_token: AdminToken, ip_header: IpHeader, mut conn: DbConn)
"uses_proxy": uses_proxy, "uses_proxy": uses_proxy,
"db_type": *DB_TYPE, "db_type": *DB_TYPE,
"db_version": get_sql_server_version(&mut conn).await, "db_version": get_sql_server_version(&mut conn).await,
"admin_url": format!("{}/diagnostics", admin_url()), "admin_url": format!("{}/diagnostics", admin_url(&base_url.base_url)),
"overrides": &CONFIG.get_overrides().join(", "), "overrides": &CONFIG.get_overrides().join(", "),
"host_arch": std::env::consts::ARCH, "host_arch": std::env::consts::ARCH,
"host_os": std::env::consts::OS, "host_os": std::env::consts::OS,