chore: change avatar to webp format for speeding.
This commit is contained in:
parent
e6d0b7ffdb
commit
3934e25abc
@ -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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -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