feat(axum): expose hashed runtime asset path

Generate a SHA-256 content hash for the embedded hemx runtime, expose the hashed path from hemx-axum, serve immutable runtime headers, and update examples to load the hemx-owned path instead of fixed /hemx.js URLs.

req: axum_integration/005
This commit is contained in:
slhx agent
2026-06-05 18:25:14 +02:00
parent c56ec39813
commit ce4c2e086d
20 changed files with 204 additions and 36 deletions
+5 -1
View File
@@ -4,7 +4,8 @@ pub mod ui {}
use hemplate::Hemplate;
use hemx::{push, Html, IntoEffect};
use hemx_axum::{
interactions, Form, HandlerErrorContext, HandlerFailure, IntoHandlerFailure, Registry, State,
interactions, runtime_js_path, Form, HandlerErrorContext, HandlerFailure, IntoHandlerFailure,
Registry, State,
};
use std::convert::Infallible;
use std::fmt::Display;
@@ -248,12 +249,14 @@ impl SettingsPage {
#[derive(Hemplate)]
pub struct AppShell {
title: &'static str,
runtime_src: &'static str,
body: Html,
}
pub fn home_page(ctx: &AppContext) -> Html {
hemx::page(&AppShell {
title: "hemx SaaS tutorial",
runtime_src: runtime_js_path(),
body: hemx::page(&Dashboard::from_context(ctx)),
})
}
@@ -261,6 +264,7 @@ pub fn home_page(ctx: &AppContext) -> Html {
pub fn settings_page(ctx: &AppContext) -> Html {
hemx::page(&AppShell {
title: "hemx SaaS tutorial settings",
runtime_src: runtime_js_path(),
body: hemx::page(&Dashboard::settings(ctx)),
})
}