make sends support multi-domain

This commit is contained in:
BlockListed 2023-09-09 14:00:17 +02:00
parent b5dea32ea5
commit 968ed8a453
No known key found for this signature in database
GPG Key ID: 2D204777C477B588
1 changed files with 6 additions and 4 deletions

View File

@ -9,8 +9,10 @@ use rocket::serde::json::Json;
use serde_json::Value;
use crate::{
api::{ApiResult, EmptyResult, JsonResult, JsonUpcase, Notify, UpdateType},
auth::{ClientIp, Headers, Host},
api::{ApiResult, EmptyResult, JsonResult, JsonUpcase, Notify, NumberOrString, UpdateType},
auth::{ClientIp, Headers, HostInfo},
api::{ApiResult, EmptyResult, JsonResult, JsonUpcase, Notify, NumberOrString, UpdateType},
auth::{ClientIp, Headers, HostInfo},
db::{models::*, DbConn, DbPool},
util::{NumberOrString, SafeString},
CONFIG,
@ -462,7 +464,7 @@ async fn post_access_file(
send_id: &str,
file_id: &str,
data: JsonUpcase<SendAccessData>,
host: Host,
host_info: HostInfo,
mut conn: DbConn,
nt: Notify<'_>,
) -> JsonResult {
@ -517,7 +519,7 @@ async fn post_access_file(
Ok(Json(json!({
"Object": "send-fileDownload",
"Id": file_id,
"Url": format!("{}/api/sends/{}/{}?t={}", &host.host, send_id, file_id, token)
"Url": format!("{}/api/sends/{}/{}?t={}", &host_info.base_url, send_id, file_id, token)
})))
}