mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
feat: use cache busting bin and load assets generated by it
This commit is contained in:
31
build.rs
31
build.rs
@@ -14,9 +14,9 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
|
||||
use cache_buster::{BusterBuilder, NoHashCategory};
|
||||
use sqlx::types::time::OffsetDateTime;
|
||||
|
||||
fn main() {
|
||||
@@ -30,33 +30,4 @@ fn main() {
|
||||
|
||||
let now = OffsetDateTime::now_utc().format("%y-%m-%d");
|
||||
println!("cargo:rustc-env=COMPILED_DATE={}", &now);
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
cache_bust();
|
||||
}
|
||||
|
||||
fn cache_bust() {
|
||||
// until APPLICATION_WASM gets added to mime crate
|
||||
// PR: https://github.com/hyperium/mime/pull/138
|
||||
// let types = vec![
|
||||
// mime::IMAGE_PNG,
|
||||
// mime::IMAGE_SVG,
|
||||
// mime::IMAGE_JPEG,
|
||||
// mime::IMAGE_GIF,
|
||||
// mime::APPLICATION_JAVASCRIPT,
|
||||
// mime::TEXT_CSS,
|
||||
// ];
|
||||
|
||||
println!("cargo:rerun-if-changed=static/cache");
|
||||
let no_hash = vec![NoHashCategory::FileExtentions(vec!["wasm"])];
|
||||
|
||||
let config = BusterBuilder::default()
|
||||
.source("./static/cache/")
|
||||
.result("./assets")
|
||||
.no_hash(no_hash)
|
||||
.follow_links(true)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
config.process().unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user