This commit is contained in:
Mateusz Gruszczyński
2026-09-07 11:38:55 +02:00
parent 749172e527
commit 0cb09769fd
17 changed files with 83 additions and 44 deletions
+13 -1
View File
@@ -38,6 +38,10 @@ async fn index(State(state): State<AppState>, headers: HeaderMap) -> Response {
"__GREE_THEME_INIT_ASSET__",
&format!("{base}{THEME_INIT_ASSET_PATH}"),
)
.replace(
"__GREE_LANG_INIT_ASSET__",
&format!("{base}{LANG_INIT_ASSET_PATH}"),
)
.replace(
"__GREE_STYLES_ASSET__",
&format!("{base}{STYLES_CSS_ASSET_PATH}"),
@@ -95,6 +99,13 @@ async fn theme_init_js() -> Response {
"public, max-age=31536000, immutable",
)
}
async fn lang_init_js() -> Response {
static_response(
LANG_INIT_JS,
"application/javascript; charset=utf-8",
"public, max-age=31536000, immutable",
)
}
async fn styles_css() -> Response {
static_response(
STYLES_CSS,
@@ -114,6 +125,7 @@ async fn service_worker() -> Response {
.replace("__GREE_ASSET_CACHE__", ASSET_BUILD_ID)
.replace("__GREE_APP_ASSET__", APP_JS_ASSET_PATH)
.replace("__GREE_THEME_INIT_ASSET__", THEME_INIT_ASSET_PATH)
.replace("__GREE_LANG_INIT_ASSET__", LANG_INIT_ASSET_PATH)
.replace("__GREE_STYLES_ASSET__", STYLES_CSS_ASSET_PATH);
owned_response(body, "application/javascript; charset=utf-8", "no-cache")
}
@@ -133,7 +145,7 @@ async fn language_file(Path(file): Path<String>) -> Response {
.iter()
.find(|(language, _)| *language == code)
{
return static_response(*body, "application/json; charset=utf-8", "no-cache");
return static_response(*body, "application/json; charset=utf-8", "public, max-age=31536000, immutable");
}
let mut response = Response::new(Body::from("Language not found"));
*response.status_mut() = StatusCode::NOT_FOUND;