feat: add ability to put the themes folder on different paths

This commit is contained in:
neon_arch 2023-05-24 17:37:41 +03:00
parent 707bf153cd
commit 29456650f1
4 changed files with 48 additions and 4 deletions

View file

@ -8,6 +8,7 @@ use crate::{
cache::cacher::RedisCache,
config_parser::parser::Config,
search_results_handler::{aggregation_models::SearchResults, aggregator::aggregate},
theme_handler::theme_path_handler::handle_different_theme_path,
};
use actix_web::{get, web, HttpRequest, HttpResponse};
use handlebars::Handlebars;
@ -146,7 +147,8 @@ pub async fn search(
/// Handles the route of robots.txt page of the `websurfx` meta search engine website.
#[get("/robots.txt")]
pub async fn robots_data(_req: HttpRequest) -> Result<HttpResponse, Box<dyn std::error::Error>> {
let page_content: String = read_to_string("./public/robots.txt")?;
let page_content: String =
read_to_string(format!("{}/robots.txt", handle_different_theme_path()?))?;
Ok(HttpResponse::Ok()
.content_type("text/plain; charset=ascii")
.body(page_content))