Hero becomes a content-owned module; site asset proxy; gesture growth fix
Test / test (push) Successful in 24s
Test / test (push) Successful in 24s
site.yaml's hero is now plain | module, where module names a JavaScript file the content repo ships (mount(container) -> handle with stop()). Portal serves content assets same-origin at /site/<path> (Gitea raw sends no CORS headers), starts the module at HTML parse time, adopts it on hydration, mounts fresh via the inline script's __mountHero on client-side navigation, and stops it on leave. The YES canvas (yes.js) and the gesture hero mode leave the engine - uhhm/questions ships YES as its hero.js, redoal/questions ships a sine-swings band. Gesture form canvas no longer balloons after a stroke: the wrap's aspect-ratio reservation is scoped to :empty (pre-mount) so it can't turn echo-strip height into width inside the flex field. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
307fd7e753
commit
1afd34c22e
+6
-16
@@ -29,6 +29,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
.unwrap_or_else(|_| "https://project.uhhm.no/uhhm/questions".to_string());
|
||||
let content_branch = std::env::var("CONTENT_BRANCH").unwrap_or_else(|_| "main".to_string());
|
||||
let gitea_base = content::gitea_api_base(&content_repo)?;
|
||||
let content_raw_base = content::gitea_raw_base(&content_repo)?;
|
||||
let aggregates = content::load_aggregates_from_gitea(&content_repo, &content_branch).await?;
|
||||
let questions = content::load_questions_from_gitea(&content_repo, &content_branch, "questions").await?;
|
||||
content::validate_questions(&questions, &aggregates)?;
|
||||
@@ -67,7 +68,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
tokio::spawn(content::watch_for_reload(
|
||||
nats.clone(),
|
||||
content_repo,
|
||||
content_branch,
|
||||
content_branch.clone(),
|
||||
"questions".to_string(),
|
||||
questions.clone(),
|
||||
aggregates.clone(),
|
||||
@@ -82,6 +83,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
aggregates,
|
||||
site,
|
||||
gitea_base,
|
||||
content_raw_base,
|
||||
content_branch: content_branch.clone(),
|
||||
oidc: oidc_state,
|
||||
garage,
|
||||
};
|
||||
@@ -129,10 +132,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
let favicon_dark_path = format!("{}/favicon-dark.svg", leptos_options.site_root);
|
||||
let wordmark_path = format!("{}/wordmark.svg", leptos_options.site_root);
|
||||
let swiper_path = format!("{}/swiper-element-bundle.min.js", leptos_options.site_root);
|
||||
// yes.js sits in public/ (not a wasm-bindgen snippet) so the
|
||||
// hero's inline early-mount script and the wasm binding can share
|
||||
// one stable URL - see `mod yes` in app.rs.
|
||||
let yes_path = format!("{}/yes.js", leptos_options.site_root);
|
||||
let fonts_dir = format!("{}/fonts", leptos_options.site_root);
|
||||
|
||||
let app = Router::new()
|
||||
@@ -142,6 +141,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
.route("/api/{*fn_name}", any(server_fn_handler))
|
||||
.route("/upload", post(upload::upload))
|
||||
.route("/gitea-repo", get(content::gitea_repo_handler))
|
||||
// Content-shipped assets (hero module etc.), same-origin.
|
||||
.route("/site/{*path}", get(content::site_asset_handler))
|
||||
.route("/automation/kv/{bucket}", get(content::automation_kv_handler))
|
||||
// no-cache = "revalidate before reuse", not "don't cache":
|
||||
// pkg files keep the same names across releases (portal.js,
|
||||
@@ -167,17 +168,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
"/swiper-element-bundle.min.js",
|
||||
ServeFile::new(swiper_path),
|
||||
)
|
||||
// Same skew concern as /pkg: the wasm's raw_module import and
|
||||
// the hero's inline script both load this by fixed name.
|
||||
.route_service(
|
||||
"/yes.js",
|
||||
tower::ServiceBuilder::new()
|
||||
.layer(tower_http::set_header::SetResponseHeaderLayer::overriding(
|
||||
axum::http::header::CACHE_CONTROL,
|
||||
axum::http::HeaderValue::from_static("no-cache"),
|
||||
))
|
||||
.service(ServeFile::new(yes_path)),
|
||||
)
|
||||
.leptos_routes_with_context(
|
||||
&state,
|
||||
routes,
|
||||
|
||||
Reference in New Issue
Block a user