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},
|
||||
};
|
||||
|
||||
use eyre::bail;
|
||||
use futures::future::join_all;
|
||||
use maud::PreEscaped;
|
||||
use once_cell::sync::Lazy;
|
||||
@ -536,10 +537,13 @@ pub async fn search(
|
||||
SearchTab::All => {
|
||||
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)
|
||||
.await?
|
||||
}
|
||||
_ => {
|
||||
bail!("unknown tab");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -13,8 +13,9 @@ pub async fn route(
|
||||
Query(params): Query<HashMap<String, String>>,
|
||||
State(config): State<Arc<Config>>,
|
||||
) -> Response {
|
||||
let proxy_config = &config.image_search.proxy;
|
||||
if !proxy_config.enabled.unwrap() {
|
||||
let image_search_config = &config.image_search;
|
||||
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();
|
||||
};
|
||||
let url = params.get("url").cloned().unwrap_or_default();
|
||||
|
Loading…
Reference in New Issue
Block a user