chore: add cache to avatar proxy header.

This commit is contained in:
Yufan Sheng 2024-06-26 23:03:03 +08:00
parent 1d336be2fd
commit 815d12e137
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B
3 changed files with 12 additions and 81 deletions

86
package-lock.json generated
View File

@ -12,7 +12,7 @@
"@astrojs/mdx": "^3.1.2", "@astrojs/mdx": "^3.1.2",
"@astrojs/node": "^8.3.2", "@astrojs/node": "^8.3.2",
"@astrojs/rss": "^4.0.7", "@astrojs/rss": "^4.0.7",
"astro": "^4.11.1", "astro": "^4.11.3",
"drizzle-orm": "^0.31.2", "drizzle-orm": "^0.31.2",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
@ -4417,9 +4417,9 @@
} }
}, },
"node_modules/astro": { "node_modules/astro": {
"version": "4.11.1", "version": "4.11.3",
"resolved": "https://registry.npmjs.org/astro/-/astro-4.11.1.tgz", "resolved": "https://registry.npmjs.org/astro/-/astro-4.11.3.tgz",
"integrity": "sha512-6e9/9nafmnxzaLSq2+9VNpi+7j0E4UoK2IJ7gkhyv1wk3XfciA6zHc3ESx7/Sk/rjenz9NSTTzAwcmVzWWHv/g==", "integrity": "sha512-SuZbB/71XVn+WqWNCe7XOfHuqhS+k4gj8+A3wluTZQrORGaHUFRn/f8F9Tu5yESQZB1q8UKhahvHwkTV3AdVsg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/compiler": "^2.8.1", "@astrojs/compiler": "^2.8.1",
@ -4471,7 +4471,6 @@
"preferred-pm": "^3.1.3", "preferred-pm": "^3.1.3",
"prompts": "^2.4.2", "prompts": "^2.4.2",
"rehype": "^13.0.1", "rehype": "^13.0.1",
"resolve": "^1.22.8",
"semver": "^7.6.2", "semver": "^7.6.2",
"shiki": "^1.9.0", "shiki": "^1.9.0",
"string-width": "^7.1.0", "string-width": "^7.1.0",
@ -4707,9 +4706,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001636", "version": "1.0.30001637",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001637.tgz",
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==", "integrity": "sha512-1x0qRI1mD1o9e+7mBI7XtzFAP4XszbHaVWsMiGbSPLYekKTJF7K+FNk6AsXH4sUpc+qrsI3pVgf1Jdl/uGkuSQ==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -5782,15 +5781,6 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/fuse.js": { "node_modules/fuse.js": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz", "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz",
@ -5946,18 +5936,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/hast-util-from-html": { "node_modules/hast-util-from-html": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz", "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz",
@ -6331,21 +6309,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/is-core-module": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
"integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
"license": "MIT",
"dependencies": {
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-decimal": { "node_modules/is-decimal": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",
@ -8252,12 +8215,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"license": "MIT"
},
"node_modules/path-scurry": { "node_modules/path-scurry": {
"version": "1.11.1", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
@ -9035,23 +8992,6 @@
"integrity": "sha512-e+3wwdki9elemYP6AnyG2BK9/Gd7ak46wZN+Z62WwmWfhn2La1XV2rPRRIcar+PhRhfiQDXi29TapGMTIbI3Pg==", "integrity": "sha512-e+3wwdki9elemYP6AnyG2BK9/Gd7ak46wZN+Z62WwmWfhn2La1XV2rPRRIcar+PhRhfiQDXi29TapGMTIbI3Pg==",
"dev": true "dev": true
}, },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
"license": "MIT",
"dependencies": {
"is-core-module": "^2.13.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/restore-cursor": { "node_modules/restore-cursor": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz",
@ -9710,18 +9650,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/to-fast-properties": { "node_modules/to-fast-properties": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",

View File

@ -44,7 +44,7 @@
"@astrojs/mdx": "^3.1.2", "@astrojs/mdx": "^3.1.2",
"@astrojs/node": "^8.3.2", "@astrojs/node": "^8.3.2",
"@astrojs/rss": "^4.0.7", "@astrojs/rss": "^4.0.7",
"astro": "^4.11.1", "astro": "^4.11.3",
"drizzle-orm": "^0.31.2", "drizzle-orm": "^0.31.2",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",

View File

@ -27,7 +27,10 @@ const avatarImage = async (
} }
return new Response(Buffer.from(await resp.arrayBuffer()), { return new Response(Buffer.from(await resp.arrayBuffer()), {
headers: { 'Content-Type': 'image/png' }, headers: {
'Content-Type': 'image/png',
'Cache-control': 'max-age=604800',
},
}); });
}; };