mirror of
https://github.com/v0l/route96.git
synced 2025-06-22 13:38:07 +00:00
fix: add user agent to mirror request
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
@ -6,6 +6,7 @@ use crate::settings::Settings;
|
|||||||
use log::error;
|
use log::error;
|
||||||
use nostr::prelude::hex;
|
use nostr::prelude::hex;
|
||||||
use nostr::{Alphabet, JsonUtil, SingleLetterTag, TagKind};
|
use nostr::{Alphabet, JsonUtil, SingleLetterTag, TagKind};
|
||||||
|
use reqwest::Client;
|
||||||
use rocket::data::ByteUnit;
|
use rocket::data::ByteUnit;
|
||||||
use rocket::futures::StreamExt;
|
use rocket::futures::StreamExt;
|
||||||
use rocket::http::{Header, Status};
|
use rocket::http::{Header, Status};
|
||||||
@ -243,8 +244,13 @@ async fn mirror(
|
|||||||
.and_then(|mut c| c.next_back())
|
.and_then(|mut c| c.next_back())
|
||||||
.and_then(|s| s.split(".").next());
|
.and_then(|s| s.split(".").next());
|
||||||
|
|
||||||
|
let client = Client::builder()
|
||||||
|
.user_agent(format!("route96 ({})", settings.public_url))
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
// download file
|
// download file
|
||||||
let rsp = match reqwest::get(url.clone()).await {
|
let rsp = match client.get(url.clone()).send().await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error downloading file: {}", e);
|
error!("Error downloading file: {}", e);
|
||||||
return BlossomResponse::error("Failed to mirror file");
|
return BlossomResponse::error("Failed to mirror file");
|
||||||
|
Reference in New Issue
Block a user