chore: change avatar to webp format for speeding.
This commit is contained in:
parent
da5e4b7392
commit
f24e166cee
@ -182,6 +182,9 @@ You should host it on your own machine.
|
|||||||
|
|
||||||
## Short-Term TODO Checklist
|
## 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.
|
- [ ] Move comments into the new Astro content layer.
|
||||||
- [ ] Check article grammar errors by using ChatGPT. Remain **42** posts.
|
- [ ] Check article grammar errors by using ChatGPT. Remain **42** posts.
|
||||||
- [ ] Add music to the articles. Remain **42** posts.
|
- [ ] Add music to the articles. Remain **42** posts.
|
||||||
|
@ -187,7 +187,7 @@ const options: z.input<typeof Options> = {
|
|||||||
size: 10,
|
size: 10,
|
||||||
avatar: {
|
avatar: {
|
||||||
mirror: 'https://weavatar.com/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": {
|
"node_modules/@shikijs/core": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.10.1.tgz",
|
||||||
"integrity": "sha512-BZcr6FCmPfP6TXaekvujZcnkFmJHZ/Yglu97r/9VjzVndQA56/F4WjUKtJRQUnK59Wi7p/UTAOekMfCJv7jnYg==",
|
"integrity": "sha512-qdiJS5a/QGCff7VUFIqd0hDdWly9rDp8lhVmXVrS11aazX8LOTRLHAXkkEeONNsS43EcCd7gax9LLoOz4vlFQA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@smithy/abort-controller": {
|
"node_modules/@smithy/abort-controller": {
|
||||||
@ -9381,12 +9381,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/shiki": {
|
"node_modules/shiki": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.10.1.tgz",
|
||||||
"integrity": "sha512-YD2sXQ+TMD/F9BimV9Jn0wj35pqOvywvOG/3PB6hGHyGKlM7TJ9tyJ02jOb2kF8F0HfJwKNYrh3sW7jEcuRlXA==",
|
"integrity": "sha512-uafV7WCgN4YYrccH6yxpnps6k38sSTlFRrwc4jycWmhWxJIm9dPrk+XkY1hZ2t0I7jmacMNb15Lf2fspa/Y3lg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@shikijs/core": "1.10.0"
|
"@shikijs/core": "1.10.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/signal-exit": {
|
"node_modules/signal-exit": {
|
||||||
|
@ -18,7 +18,7 @@ const { comment, depth, pending } = Astro.props;
|
|||||||
<div class="comment-avatar flex-avatar">
|
<div class="comment-avatar flex-avatar">
|
||||||
<img
|
<img
|
||||||
alt={comment.nick}
|
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"
|
class="avatar avatar-40 photo"
|
||||||
height="40"
|
height="40"
|
||||||
width="40"
|
width="40"
|
||||||
|
@ -18,7 +18,7 @@ const avatarImage = async (
|
|||||||
const defaultAvatarLink = defaultAvatar();
|
const defaultAvatarLink = defaultAvatar();
|
||||||
const link = urlJoin(
|
const link = urlJoin(
|
||||||
options.settings.comments.avatar.mirror,
|
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 } });
|
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()), {
|
return new Response(Buffer.from(await resp.arrayBuffer()), {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'image/png',
|
'Content-Type': 'image/webp',
|
||||||
'Cache-control': 'max-age=604800',
|
'Cache-control': 'max-age=604800',
|
||||||
},
|
},
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user