feat: enable the calendar and fix rss style issue.

This commit is contained in:
Yufan Sheng 2025-01-03 11:17:51 +08:00
parent 6abd5b35c8
commit b8a06dc1d2
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B
4 changed files with 87 additions and 84 deletions

View File

@ -188,7 +188,7 @@ const options: z.input<typeof Options> = {
post: 5, post: 5,
comment: 5, comment: 5,
tag: 10, tag: 10,
calendar: false, calendar: true,
}, },
comments: { comments: {
enable: true, enable: true,

140
package-lock.json generated
View File

@ -11,14 +11,14 @@
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.0.3", "@astrojs/mdx": "^4.0.3",
"@astrojs/node": "^9.0.0", "@astrojs/node": "^9.0.0",
"@astrojs/rss": "^4.0.10", "@astrojs/rss": "^4.0.11",
"astro": "^5.1.1", "astro": "^5.1.2",
"drizzle-orm": "^0.38.3", "drizzle-orm": "^0.38.3",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"marked": "^15.0.4", "marked": "^15.0.5",
"pg": "^8.13.1", "pg": "^8.13.1",
"pinyin-pro": "^3.26.0", "pinyin-pro": "^3.26.0",
"qrcode-svg": "^1.1.0", "qrcode-svg": "^1.1.0",
@ -29,10 +29,10 @@
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@biomejs/biome": "^1.9.4", "@biomejs/biome": "^1.9.4",
"@napi-rs/canvas": "^0.1.65", "@napi-rs/canvas": "^0.1.65",
"@shikijs/transformers": "^1.24.4", "@shikijs/transformers": "^1.25.1",
"@types/lodash": "^4.17.13", "@types/lodash": "^4.17.13",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@types/node": "^22.10.2", "@types/node": "^22.10.4",
"@types/pg": "^8.11.10", "@types/pg": "^8.11.10",
"@types/qrcode-svg": "^1.1.5", "@types/qrcode-svg": "^1.1.5",
"@types/unist": "^3.0.3", "@types/unist": "^3.0.3",
@ -211,9 +211,9 @@
} }
}, },
"node_modules/@astrojs/rss": { "node_modules/@astrojs/rss": {
"version": "4.0.10", "version": "4.0.11",
"resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.10.tgz", "resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.11.tgz",
"integrity": "sha512-2gFdHM763uUAySkdwPYrpi6dppOBJr9ddg5VbkKXctWze8d1JHgIBBY78zWIYs7KBJT58zxadsObVAVt55RDaw==", "integrity": "sha512-3e3H8i6kc97KGnn9iaZBJpIkdoQi8MmR5zH5R+dWsfCM44lLTszOqy1OBfGGxDt56mpQkYVtZJWoxMyWuUZBfw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-xml-parser": "^4.5.0", "fast-xml-parser": "^4.5.0",
@ -2030,54 +2030,72 @@
] ]
}, },
"node_modules/@shikijs/core": { "node_modules/@shikijs/core": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.24.4.tgz", "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.25.1.tgz",
"integrity": "sha512-jjLsld+xEEGYlxAXDyGwWsKJ1sw5Pc1pnp4ai2ORpjx2UX08YYTC0NNqQYO1PaghYaR+PvgMOGuvzw2he9sk0Q==", "integrity": "sha512-0j5k3ZkLTQViOuNzPVyWGoW1zgH3kiFdUT/JOCkTm7TU74mz+dF+NID+YoiCBzHQxgsDpcGYPjKDJRcuVLSt4A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/engine-javascript": "1.24.4", "@shikijs/engine-javascript": "1.25.1",
"@shikijs/engine-oniguruma": "1.24.4", "@shikijs/engine-oniguruma": "1.25.1",
"@shikijs/types": "1.24.4", "@shikijs/types": "1.25.1",
"@shikijs/vscode-textmate": "^9.3.1", "@shikijs/vscode-textmate": "^9.3.1",
"@types/hast": "^3.0.4", "@types/hast": "^3.0.4",
"hast-util-to-html": "^9.0.4" "hast-util-to-html": "^9.0.4"
} }
}, },
"node_modules/@shikijs/engine-javascript": { "node_modules/@shikijs/engine-javascript": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.24.4.tgz", "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.25.1.tgz",
"integrity": "sha512-TClaQOLvo9WEMJv6GoUsykQ6QdynuKszuORFWCke8qvi6PeLm7FcD9+7y45UenysxEWYpDL5KJaVXTngTE+2BA==", "integrity": "sha512-zQ7UWKnRCfD/Q1M+XOSyjsbhpE0qv8LUnmn82HYCeOsgAHgUZGEDIQ63bbuK3kU5sQg+2CtI+dPfOqD/mjSY9w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/types": "1.24.4", "@shikijs/types": "1.25.1",
"@shikijs/vscode-textmate": "^9.3.1", "@shikijs/vscode-textmate": "^9.3.1",
"oniguruma-to-es": "0.8.1" "oniguruma-to-es": "0.10.0"
} }
}, },
"node_modules/@shikijs/engine-oniguruma": { "node_modules/@shikijs/engine-oniguruma": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.4.tgz", "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.25.1.tgz",
"integrity": "sha512-Do2ry6flp2HWdvpj2XOwwa0ljZBRy15HKZITzPcNIBOGSeprnA8gOooA/bLsSPuy8aJBa+Q/r34dMmC3KNL/zw==", "integrity": "sha512-iKPMh3H+0USHtWfZ1irfMTH6tGmIUFSnqt3E2K8BgI1VEsqiPh0RYkG2WTwzNiM1/WHN4FzYx/nrKR7PDHiRyw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/types": "1.24.4", "@shikijs/types": "1.25.1",
"@shikijs/vscode-textmate": "^9.3.1" "@shikijs/vscode-textmate": "^9.3.1"
} }
}, },
"node_modules/@shikijs/langs": {
"version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.25.1.tgz",
"integrity": "sha512-hdYjq9aRJplAzGe2qF51PR9IDgEoyGb4IkXvr3Ts6lEdg4Z8M/kdknKRo2EIuv3IR/aKkJXTlBQRM+wr3t20Ew==",
"license": "MIT",
"dependencies": {
"@shikijs/types": "1.25.1"
}
},
"node_modules/@shikijs/themes": {
"version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.25.1.tgz",
"integrity": "sha512-JO0lDn4LgGqg5QKvgich5ScUmC2okK+LxM9a3iLUH7YMeI2c8UGXThuJv6sZduS7pdJbYQHPrvWq9t/V4GhpbQ==",
"license": "MIT",
"dependencies": {
"@shikijs/types": "1.25.1"
}
},
"node_modules/@shikijs/transformers": { "node_modules/@shikijs/transformers": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-1.24.4.tgz", "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-1.25.1.tgz",
"integrity": "sha512-0jq5p9WLB7ToM/O7RWfxuIwirTJbIQsUR06jxdG3h3CEuO5m7ik8GnDsxwHhyIEfgJSZczSnVUZWFrNKy5It6g==", "integrity": "sha512-uIwVJk9NnoHtEyF0zeL6kDygNh1FDkFXJvKOGieiilS1qa8KHtOwG2hGYOLkFjd2FRMhZSJKjOC94PCzY5xR+w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"shiki": "1.24.4" "shiki": "1.25.1"
} }
}, },
"node_modules/@shikijs/types": { "node_modules/@shikijs/types": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.4.tgz", "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.25.1.tgz",
"integrity": "sha512-0r0XU7Eaow0PuDxuWC1bVqmWCgm3XqizIaT7SM42K03vc69LGooT0U8ccSR44xP/hGlNx4FKhtYpV+BU6aaKAA==", "integrity": "sha512-dceqFUoO95eY4tpOj3OGq8wE8EgJ4ey6Me1HQEu5UbwIYszFndEll/bjlB8Kp9wl4fx3uM7n4+y9XCYuDBmcXA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/vscode-textmate": "^9.3.1", "@shikijs/vscode-textmate": "^9.3.1",
@ -2183,9 +2201,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.10.2", "version": "22.10.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.4.tgz",
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "integrity": "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug==",
"devOptional": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -2505,9 +2523,9 @@
} }
}, },
"node_modules/astro": { "node_modules/astro": {
"version": "5.1.1", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/astro/-/astro-5.1.1.tgz", "resolved": "https://registry.npmjs.org/astro/-/astro-5.1.2.tgz",
"integrity": "sha512-prpWC2PRs4P3FKQg6gZaU+VNMqbZi5pDvORGB2nrjfRjkrvF6/l4BqhvkJ6YQ0Ohm5rIMVz8ljgaRI77mLHbwg==", "integrity": "sha512-+U5lXPEJZ6cQx0botGbPhzN6XGWRgDtXgy/RUkpTmUj18LW6pbzYo0O0k3hFWOazlI039bZ+4P2e/oSNlKzm0Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/compiler": "^2.10.3", "@astrojs/compiler": "^2.10.3",
@ -4579,9 +4597,9 @@
} }
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "15.0.4", "version": "15.0.5",
"resolved": "https://registry.npmjs.org/marked/-/marked-15.0.4.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.5.tgz",
"integrity": "sha512-TCHvDqmb3ZJ4PWG7VEGVgtefA5/euFmsIhxtD0XsBxI39gUSKL81mIRFdt0AiNQozUahd4ke98ZdirExd/vSEw==", "integrity": "sha512-xN+kSuqHjxWg+Q47yhhZMUP+kO1qHobvXkkm6FX+7N6lDvanLDd8H7AQ0jWDDyq+fDt/cSrJaBGyWYHXy0KQWA==",
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"
@ -5833,14 +5851,14 @@
} }
}, },
"node_modules/oniguruma-to-es": { "node_modules/oniguruma-to-es": {
"version": "0.8.1", "version": "0.10.0",
"resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.8.1.tgz", "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.10.0.tgz",
"integrity": "sha512-dekySTEvCxCj0IgKcA2uUCO/e4ArsqpucDPcX26w9ajx+DvMWLc5eZeJaRQkd7oC/+rwif5gnT900tA34uN9Zw==", "integrity": "sha512-zapyOUOCJxt+xhiNRPPMtfJkHGsZ98HHB9qJEkdT8BGytO/+kpe4m1Ngf0MzbzTmhacn11w9yGeDP6tzDhnCdg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"emoji-regex-xs": "^1.0.0", "emoji-regex-xs": "^1.0.0",
"regex": "^5.0.2", "regex": "^5.1.1",
"regex-recursion": "^5.0.0" "regex-recursion": "^5.1.1"
} }
}, },
"node_modules/opendal": { "node_modules/opendal": {
@ -5921,9 +5939,9 @@
} }
}, },
"node_modules/p-timeout": { "node_modules/p-timeout": {
"version": "6.1.3", "version": "6.1.4",
"resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.3.tgz", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz",
"integrity": "sha512-UJUyfKbwvr/uZSV6btANfb+0t/mOhKV/KXcCUTp8FcQI+v/0d+wXqH4htrW0E4rR6WiEO/EPvUFiV9D5OI4vlw==", "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14.16" "node": ">=14.16"
@ -7171,15 +7189,17 @@
} }
}, },
"node_modules/shiki": { "node_modules/shiki": {
"version": "1.24.4", "version": "1.25.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.24.4.tgz", "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.25.1.tgz",
"integrity": "sha512-aVGSFAOAr1v26Hh/+GBIsRVDWJ583XYV7CuNURKRWh9gpGv4OdbisZGq96B9arMYTZhTQkmRF5BrShOSTvNqhw==", "integrity": "sha512-/1boRvNYwRW3GLG9Y6dXdnZ/Ha+J5T/5y3hV7TGQUcDSBM185D3FCbXlz2eTGNKG2iWCbWqo+P0yhGKZ4/CUrw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@shikijs/core": "1.24.4", "@shikijs/core": "1.25.1",
"@shikijs/engine-javascript": "1.24.4", "@shikijs/engine-javascript": "1.25.1",
"@shikijs/engine-oniguruma": "1.24.4", "@shikijs/engine-oniguruma": "1.25.1",
"@shikijs/types": "1.24.4", "@shikijs/langs": "1.25.1",
"@shikijs/themes": "1.25.1",
"@shikijs/types": "1.25.1",
"@shikijs/vscode-textmate": "^9.3.1", "@shikijs/vscode-textmate": "^9.3.1",
"@types/hast": "^3.0.4" "@types/hast": "^3.0.4"
} }
@ -7942,9 +7962,9 @@
} }
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "6.0.6", "version": "6.0.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.6.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz",
"integrity": "sha512-NSjmUuckPmDU18bHz7QZ+bTYhRR0iA72cs2QAxCqDpafJ0S6qetco0LB3WW2OxlMHS0JmAv+yZ/R3uPmMyGTjQ==", "integrity": "sha512-RDt8r/7qx9940f8FcOIAH9PTViRrghKaK2K1jY3RaAURrEUbm9Du1mJ72G+jlhtG3WwodnfzY8ORQZbBavZEAQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"esbuild": "^0.24.2", "esbuild": "^0.24.2",
@ -8421,9 +8441,9 @@
} }
}, },
"node_modules/vitefu": { "node_modules/vitefu": {
"version": "1.0.4", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.4.tgz", "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.5.tgz",
"integrity": "sha512-y6zEE3PQf6uu/Mt6DTJ9ih+kyJLr4XcSgHR2zUkM8SWDhuixEJxfJ6CZGMHh1Ec3vPLoEA0IHU5oWzVqw8ulow==", "integrity": "sha512-h4Vflt9gxODPFNGPwp4zAMZRpZR7eslzwH2c5hn5kNZ5rhnKyRJ50U+yGCdc2IRaBs8O4haIgLNGrV5CrpMsCA==",
"license": "MIT", "license": "MIT",
"workspaces": [ "workspaces": [
"tests/deps/*", "tests/deps/*",

View File

@ -44,14 +44,14 @@
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.0.3", "@astrojs/mdx": "^4.0.3",
"@astrojs/node": "^9.0.0", "@astrojs/node": "^9.0.0",
"@astrojs/rss": "^4.0.10", "@astrojs/rss": "^4.0.11",
"astro": "^5.1.1", "astro": "^5.1.2",
"drizzle-orm": "^0.38.3", "drizzle-orm": "^0.38.3",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"marked": "^15.0.4", "marked": "^15.0.5",
"pg": "^8.13.1", "pg": "^8.13.1",
"pinyin-pro": "^3.26.0", "pinyin-pro": "^3.26.0",
"qrcode-svg": "^1.1.0", "qrcode-svg": "^1.1.0",
@ -62,10 +62,10 @@
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@biomejs/biome": "^1.9.4", "@biomejs/biome": "^1.9.4",
"@napi-rs/canvas": "^0.1.65", "@napi-rs/canvas": "^0.1.65",
"@shikijs/transformers": "^1.24.4", "@shikijs/transformers": "^1.25.1",
"@types/lodash": "^4.17.13", "@types/lodash": "^4.17.13",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@types/node": "^22.10.2", "@types/node": "^22.10.4",
"@types/pg": "^8.11.10", "@types/pg": "^8.11.10",
"@types/qrcode-svg": "^1.1.5", "@types/qrcode-svg": "^1.1.5",
"@types/unist": "^3.0.3", "@types/unist": "^3.0.3",

View File

@ -1,27 +1,10 @@
import type { APIRoute } from 'astro'; import type { APIRoute } from 'astro';
import sharp from 'sharp';
const loadCalendarImage = async (year: string, time: string): Promise<Response> => { const loadCalendarImage = async (year: string, time: string): Promise<Response> => {
const link = `https://img.owspace.com/Public/uploads/Download/${year}/${time}.jpg`; const link = `https://img.owspace.com/Public/uploads/Download/${year}/${time}.jpg`;
const response = await fetch(link, { return await fetch(link, {
referrer: '', referrer: '',
}); });
if (!response.ok) {
console.error(`Failed to fetch image ${link}`);
return response;
}
const croppedImage = await sharp(await response.arrayBuffer())
.extract({ width: 1096, height: 1550, left: 90, top: 110 })
.toBuffer();
return new Response(croppedImage, {
headers: {
'Content-Type': 'image/jpeg',
'Cache-Control': 'public, max-age=604800',
},
});
}; };
const timeRegex = /\d{4}/; const timeRegex = /\d{4}/;