diff --git a/pgml-dashboard/Cargo.toml b/pgml-dashboard/Cargo.toml index 19231db8b..71dbbcf4b 100644 --- a/pgml-dashboard/Cargo.toml +++ b/pgml-dashboard/Cargo.toml @@ -52,3 +52,6 @@ yaml-rust = "0.4" zoomies = { git="https://github.com/HyperparamAI/zoomies.git", branch="master" } ws = { package = "rocket_ws", git = "https://github.com/SergioBenitez/Rocket" } futures = "0.3.29" + +[build-dependencies] +glob = "*" diff --git a/pgml-dashboard/build.rs b/pgml-dashboard/build.rs index 89143fd57..5be0e7afa 100644 --- a/pgml-dashboard/build.rs +++ b/pgml-dashboard/build.rs @@ -1,4 +1,8 @@ +use glob::glob; +use std::collections::BTreeSet; use std::fs::read_to_string; +use std::hash::Hasher; +use std::path::PathBuf; use std::process::Command; fn main() { @@ -27,9 +31,11 @@ fn main() { let css_version = read_to_string("static/css/.pgml-bundle").expect("failed to read .pgml-bundle"); let css_version = css_version.trim(); + println!("cargo:rustc-env=CSS_VERSION={css_version}"); let js_version = read_to_string("static/js/.pgml-bundle").expect("failed to read .pgml-bundle"); let js_version = js_version.trim(); + println!("cargo:rustc-env=JS_VERSION={js_version}"); let status = Command::new("cp") .arg("static/js/main.js") @@ -41,6 +47,15 @@ fn main() { panic!("failed to bundle main.js"); } - println!("cargo:rustc-env=CSS_VERSION={css_version}"); - println!("cargo:rustc-env=JS_VERSION={js_version}"); + let files_paths = glob("./../pgml-cms/**/*.md") + .expect("Failed to read pgml-cms directory") + .map(|p| p.unwrap()) + .collect::>(); + let mut hasher = std::hash::DefaultHasher::new(); + for path in files_paths { + let contents = read_to_string(path.clone()).expect("Error reading file"); + hasher.write(&contents.into_bytes()); + } + let cms_hash = hasher.finish(); + println!("cargo:rustc-env=CMS_HASH={cms_hash}"); } diff --git a/pgml-dashboard/src/utils/markdown.rs b/pgml-dashboard/src/utils/markdown.rs index 55c42b9b1..2d4deea6a 100644 --- a/pgml-dashboard/src/utils/markdown.rs +++ b/pgml-dashboard/src/utils/markdown.rs @@ -1239,7 +1239,7 @@ pub struct SiteSearch { impl SiteSearch { pub async fn new() -> anyhow::Result { let collection = pgml::Collection::new( - "hypercloud-site-search-c-2", + env!("CMS_HASH"), Some( std::env::var("SITE_SEARCH_DATABASE_URL") .context("Please set the `SITE_SEARCH_DATABASE_URL` environment variable")?, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy