feat: complete TASK-WP0-06 public cache

This commit is contained in:
suyx
2026-07-27 23:05:23 +08:00
parent e12a83d6d3
commit 2dd6f5c2c2
11 changed files with 775 additions and 2 deletions
+2
View File
@@ -223,7 +223,9 @@ export async function createApp(options: CreateAppOptions = {}) {
: undefined;
if (!resource) return reply.code(404).send();
reply.type(resource.mimeType);
reply.header("Cache-Control", "public, max-age=31536000, immutable");
reply.header("Content-Disposition", "inline");
reply.header("ETag", `"sha256-${resource.sha256}"`);
return resource.bytes;
},
);
+2
View File
@@ -89,6 +89,7 @@ export interface PublicAssetPayload {
bytes: Buffer;
mimeType: string;
resourceVersion: string;
sha256: string;
}
export interface PublicAssetResolver {
@@ -333,6 +334,7 @@ export function createPublicAssetResolver(input: {
bytes,
mimeType: entry.mimeType,
resourceVersion: entry.resourceVersion,
sha256,
};
},
};