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:
Ursprung
17923c3fd0
Commit
0ebd877fb8
1 geänderte Dateien mit 6 neuen und 5 gelöschten Zeilen
|
@ -12,6 +12,7 @@ use rocket::{
|
|||
Catcher, Route,
|
||||
};
|
||||
|
||||
use crate::auth::BaseURL;
|
||||
use crate::{
|
||||
api::{
|
||||
core::{log_event, two_factor},
|
||||
|
@ -98,7 +99,7 @@ const BASE_TEMPLATE: &str = "admin/base";
|
|||
const ACTING_ADMIN_USER: &str = "vaultwarden-admin-00000-000000000000";
|
||||
|
||||
fn admin_path() -> String {
|
||||
format!("{}{}", CONFIG.domain_path(), ADMIN_PATH)
|
||||
format!("{}", ADMIN_PATH)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -123,8 +124,8 @@ impl<'r> FromRequest<'r> for IpHeader {
|
|||
}
|
||||
}
|
||||
|
||||
fn admin_url() -> String {
|
||||
format!("{}{}", CONFIG.domain_origin(), admin_path())
|
||||
fn admin_url(base_url: &str) -> String {
|
||||
format!("{}{}", base_url, admin_path())
|
||||
}
|
||||
|
||||
#[derive(Responder)]
|
||||
|
@ -668,7 +669,7 @@ async fn get_ntp_time(has_http_access: bool) -> String {
|
|||
}
|
||||
|
||||
#[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 std::net::ToSocketAddrs;
|
||||
|
||||
|
@ -724,7 +725,7 @@ async fn diagnostics(_token: AdminToken, ip_header: IpHeader, mut conn: DbConn)
|
|||
"uses_proxy": uses_proxy,
|
||||
"db_type": *DB_TYPE,
|
||||
"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(", "),
|
||||
"host_arch": std::env::consts::ARCH,
|
||||
"host_os": std::env::consts::OS,
|
||||
|
|
Laden …
In neuem Issue referenzieren