mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 11:26:29 +03:00
feat: cache tile.openstreetmap.org tiles for 7 days
This commit is contained in:
@@ -108,6 +108,13 @@ fn http_url_cache_timestamps(url: &str, mimetype: Option<&str>) -> (i64, i64) {
|
||||
let stale = if url.ends_with(".xdc") {
|
||||
// WebXDCs are never stale, they just expire.
|
||||
expires
|
||||
} else if url.starts_with("https://tile.openstreetmap.org/")
|
||||
|| url.starts_with("https://vector.openstreetmap.org/")
|
||||
{
|
||||
// Policy at <https://operations.osmfoundation.org/policies/tiles/>
|
||||
// requires that we cache tiles for at least 7 days.
|
||||
// Do not revalidate earlier than that.
|
||||
now + 3600 * 24 * 7
|
||||
} else if mimetype.is_some_and(|s| s.starts_with("image/")) {
|
||||
// Cache images for 1 day.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user