Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apps/desktop/src-tauri/src/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,23 @@ async fn spa_fallback(uri: Uri) -> Response {
.first_or_octet_stream()
.as_ref()
.to_string();
([(header::CONTENT_TYPE, mime)], asset.data.into_owned()).into_response()
let cache = if served.starts_with("assets/") {
// Vite content-hashes everything under assets/ — cacheable forever.
"public, max-age=31536000, immutable"
} else {
// index.html + unhashed public files (maps, fonts, manifest): always
// revalidate, so a self-updated exe serves its fresh frontend instead
// of a browser-cached copy of the previous version.
"no-cache"
};
(
[
(header::CONTENT_TYPE, mime),
(header::CACHE_CONTROL, cache.to_string()),
],
asset.data.into_owned(),
)
.into_response()
}

#[cfg(debug_assertions)]
Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"fullscreen": false,
"alwaysOnTop": false,
"transparent": true,
"shadow": false
"shadow": false,
"additionalBrowserArgs": "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection --disable-http-cache"
}
],
"security": {
Expand Down