tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
caching and stuff
awarm.space
3 months ago
1adc8ef6
a2891ffd
+7
-5
2 changed files
expand all
collapse all
unified
split
app
api
pub_icon
route.ts
components
Blocks
TextBlock
schema.ts
+4
-4
app/api/pub_icon/route.ts
···
104
104
.webp({ quality: 90 })
105
105
.toBuffer();
106
106
107
107
-
// Return with aggressive caching headers
107
107
+
// Return with caching headers
108
108
return new NextResponse(resizedImage, {
109
109
headers: {
110
110
"Content-Type": "image/webp",
111
111
-
// Cache indefinitely on CDN, icons don't change
111
111
+
// Cache for 1 hour, but serve stale for much longer while revalidating
112
112
"Cache-Control":
113
113
-
"public, max-age=31536000, immutable, s-maxage=31536000, stale-while-revalidate=604800",
114
114
-
"CDN-Cache-Control": "s-maxage=31536000, stale-while-revalidate=604800",
113
113
+
"public, max-age=3600, s-maxage=3600, stale-while-revalidate=2592000",
114
114
+
"CDN-Cache-Control": "s-maxage=3600, stale-while-revalidate=2592000",
115
115
},
116
116
});
117
117
} catch (error) {
+3
-1
components/Blocks/TextBlock/schema.ts
···
143
143
src: `/api/pub_icon?at_uri=${encodeURIComponent(node.attrs.atURI)}`,
144
144
class:
145
145
"inline-block w-4 h-4 rounded-full ml-1 align-text-bottom",
146
146
-
alt: "Publication icon",
146
146
+
alt: "",
147
147
+
width: "16",
148
148
+
height: "16",
147
149
loading: "lazy",
148
150
},
149
151
],