Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd81a360

Browse files
authored
Made search collection name use the cms hash (#1333)
1 parent35d12bf commitd81a360

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

‎pgml-dashboard/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ yaml-rust = "0.4"
5252
zoomies = {git="https://github.com/HyperparamAI/zoomies.git",branch="master" }
5353
ws = {package ="rocket_ws",git ="https://github.com/SergioBenitez/Rocket" }
5454
futures ="0.3.29"
55+
56+
[build-dependencies]
57+
glob ="*"

‎pgml-dashboard/build.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
use glob::glob;
2+
use std::collections::BTreeSet;
13
use std::fs::read_to_string;
4+
use std::hash::Hasher;
5+
use std::path::PathBuf;
26
use std::process::Command;
37

48
fnmain(){
@@ -27,9 +31,11 @@ fn main() {
2731

2832
let css_version =read_to_string("static/css/.pgml-bundle").expect("failed to read .pgml-bundle");
2933
let css_version = css_version.trim();
34+
println!("cargo:rustc-env=CSS_VERSION={css_version}");
3035

3136
let js_version =read_to_string("static/js/.pgml-bundle").expect("failed to read .pgml-bundle");
3237
let js_version = js_version.trim();
38+
println!("cargo:rustc-env=JS_VERSION={js_version}");
3339

3440
let status =Command::new("cp")
3541
.arg("static/js/main.js")
@@ -41,6 +47,15 @@ fn main() {
4147
panic!("failed to bundle main.js");
4248
}
4349

44-
println!("cargo:rustc-env=CSS_VERSION={css_version}");
45-
println!("cargo:rustc-env=JS_VERSION={js_version}");
50+
let files_paths =glob("./../pgml-cms/**/*.md")
51+
.expect("Failed to read pgml-cms directory")
52+
.map(|p| p.unwrap())
53+
.collect::<BTreeSet<PathBuf>>();
54+
letmut hasher = std::hash::DefaultHasher::new();
55+
for pathin files_paths{
56+
let contents =read_to_string(path.clone()).expect("Error reading file");
57+
hasher.write(&contents.into_bytes());
58+
}
59+
let cms_hash = hasher.finish();
60+
println!("cargo:rustc-env=CMS_HASH={cms_hash}");
4661
}

‎pgml-dashboard/src/utils/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ pub struct SiteSearch {
12391239
implSiteSearch{
12401240
pubasyncfnnew() -> anyhow::Result<Self>{
12411241
let collection = pgml::Collection::new(
1242-
"hypercloud-site-search-c-2",
1242+
env!("CMS_HASH"),
12431243
Some(
12441244
std::env::var("SITE_SEARCH_DATABASE_URL")
12451245
.context("Please set the `SITE_SEARCH_DATABASE_URL` environment variable")?,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp