chore: change avatar to webp format for speeding.
This commit is contained in:
parent
e6d0b7ffdb
commit
08c5501e11
@ -182,6 +182,9 @@ You should host it on your own machine.
|
||||
|
||||
## Short-Term TODO Checklist
|
||||
|
||||
- [ ] Add clickable toc support for post.
|
||||
- [ ] Add last modified time component for post.
|
||||
- [ ] Add light box for images.
|
||||
- [ ] Move comments into the new Astro content layer.
|
||||
- [ ] Check article grammar errors by using ChatGPT. Remain **42** posts.
|
||||
- [ ] Add music to the articles. Remain **42** posts.
|
||||
|
@ -187,7 +187,7 @@ const options: z.input<typeof Options> = {
|
||||
size: 10,
|
||||
avatar: {
|
||||
mirror: 'https://weavatar.com/avatar',
|
||||
size: 80,
|
||||
size: 120,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -3227,9 +3227,9 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@shikijs/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-BZcr6FCmPfP6TXaekvujZcnkFmJHZ/Yglu97r/9VjzVndQA56/F4WjUKtJRQUnK59Wi7p/UTAOekMfCJv7jnYg==",
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.10.1.tgz",
|
||||
"integrity": "sha512-qdiJS5a/QGCff7VUFIqd0hDdWly9rDp8lhVmXVrS11aazX8LOTRLHAXkkEeONNsS43EcCd7gax9LLoOz4vlFQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@smithy/abort-controller": {
|
||||
@ -9381,12 +9381,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/shiki": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.10.0.tgz",
|
||||
"integrity": "sha512-YD2sXQ+TMD/F9BimV9Jn0wj35pqOvywvOG/3PB6hGHyGKlM7TJ9tyJ02jOb2kF8F0HfJwKNYrh3sW7jEcuRlXA==",
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.10.1.tgz",
|
||||
"integrity": "sha512-uafV7WCgN4YYrccH6yxpnps6k38sSTlFRrwc4jycWmhWxJIm9dPrk+XkY1hZ2t0I7jmacMNb15Lf2fspa/Y3lg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@shikijs/core": "1.10.0"
|
||||
"@shikijs/core": "1.10.1"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
|
@ -18,7 +18,7 @@ const { comment, depth, pending } = Astro.props;
|
||||
<div class="comment-avatar flex-avatar">
|
||||
<img
|
||||
alt={comment.nick}
|
||||
src={urlJoin(import.meta.env.SITE, 'avatar', `${comment.user_id}.png`)}
|
||||
src={urlJoin(import.meta.env.SITE, 'avatar', `${comment.user_id}.webp`)}
|
||||
class="avatar avatar-40 photo"
|
||||
height="40"
|
||||
width="40"
|
||||
|
@ -18,7 +18,7 @@ const avatarImage = async (
|
||||
const defaultAvatarLink = defaultAvatar();
|
||||
const link = urlJoin(
|
||||
options.settings.comments.avatar.mirror,
|
||||
`${hash}.png?s=${options.settings.comments.avatar.size}&d=${defaultAvatarLink}`,
|
||||
`${hash}?s=${options.settings.comments.avatar.size}&d=${defaultAvatarLink}`,
|
||||
);
|
||||
|
||||
const resp = await fetch(link, { redirect: 'manual', headers: { Referer: options.website } });
|
||||
@ -28,7 +28,7 @@ const avatarImage = async (
|
||||
|
||||
return new Response(Buffer.from(await resp.arrayBuffer()), {
|
||||
headers: {
|
||||
'Content-Type': 'image/png',
|
||||
'Content-Type': 'image/webp',
|
||||
'Cache-control': 'max-age=604800',
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue
Block a user