fix image search still being accessible when disabled
This commit is contained in:
parent
2285ee611a
commit
85f438ef65
@ -8,6 +8,7 @@ use std::{
|
|||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use eyre::bail;
|
||||||
use futures::future::join_all;
|
use futures::future::join_all;
|
||||||
use maud::PreEscaped;
|
use maud::PreEscaped;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
@ -536,10 +537,13 @@ pub async fn search(
|
|||||||
SearchTab::All => {
|
SearchTab::All => {
|
||||||
make_requests(query, progress_tx, start_time, &send_engine_progress_update).await?
|
make_requests(query, progress_tx, start_time, &send_engine_progress_update).await?
|
||||||
}
|
}
|
||||||
SearchTab::Images => {
|
SearchTab::Images if query.config.image_search.enabled.unwrap() => {
|
||||||
make_image_requests(query, progress_tx, start_time, &send_engine_progress_update)
|
make_image_requests(query, progress_tx, start_time, &send_engine_progress_update)
|
||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
|
_ => {
|
||||||
|
bail!("unknown tab");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -13,8 +13,9 @@ pub async fn route(
|
|||||||
Query(params): Query<HashMap<String, String>>,
|
Query(params): Query<HashMap<String, String>>,
|
||||||
State(config): State<Arc<Config>>,
|
State(config): State<Arc<Config>>,
|
||||||
) -> Response {
|
) -> Response {
|
||||||
let proxy_config = &config.image_search.proxy;
|
let image_search_config = &config.image_search;
|
||||||
if !proxy_config.enabled.unwrap() {
|
let proxy_config = &image_search_config.proxy;
|
||||||
|
if !image_search_config.enabled.unwrap() || !proxy_config.enabled.unwrap() {
|
||||||
return (StatusCode::FORBIDDEN, "Image proxy is disabled").into_response();
|
return (StatusCode::FORBIDDEN, "Image proxy is disabled").into_response();
|
||||||
};
|
};
|
||||||
let url = params.get("url").cloned().unwrap_or_default();
|
let url = params.get("url").cloned().unwrap_or_default();
|
||||||
|
Loading…
Reference in New Issue
Block a user