chore: bump the astro to 4.12.3 and fix the action api usage.

This commit is contained in:
Yufan Sheng 2024-07-31 00:17:56 +08:00
parent 1d885e092d
commit 2aa021279f
Signed by: syhily
GPG Key ID: DEB186763C308C31
7 changed files with 207 additions and 731 deletions

905
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
"name": "yufan.me", "name": "yufan.me",
"version": "3.0.0", "version": "3.0.0",
"private": true, "private": true,
"description": "The personal blog for Yufan Sheng",
"keywords": [ "keywords": [
"blog", "blog",
"astro", "astro",
@ -44,30 +45,29 @@
"@astrojs/mdx": "^3.1.3", "@astrojs/mdx": "^3.1.3",
"@astrojs/rss": "^4.0.7", "@astrojs/rss": "^4.0.7",
"@zeabur/astro-adapter": "^1.0.6", "@zeabur/astro-adapter": "^1.0.6",
"astro": "^4.12.2", "astro": "^4.13.1",
"drizzle-orm": "^0.32.1", "drizzle-orm": "^0.32.1",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^3.4.4", "luxon": "^3.5.0",
"marked": "^13.0.3", "marked": "^13.0.3",
"pg": "^8.12.0", "pg": "^8.12.0",
"qrcode-svg": "^1.1.0", "qrcode-svg": "^1.1.0",
"ultrahtml": "^1.5.3" "ultrahtml": "^1.5.3"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.8.3", "@astrojs/check": "^0.9.1",
"@biomejs/biome": "^1.8.3", "@biomejs/biome": "^1.8.3",
"@napi-rs/canvas": "^0.1.53", "@napi-rs/canvas": "^0.1.53",
"@types/lodash": "^4.17.7", "@types/lodash": "^4.17.7",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@types/node": "^22.0.0", "@types/node": "^22.1.0",
"@types/pg": "^8.11.6", "@types/pg": "^8.11.6",
"@types/qrcode-svg": "^1.1.5", "@types/qrcode-svg": "^1.1.5",
"@types/unist": "^3.0.2", "@types/unist": "^3.0.2",
"aplayer": "^1.10.1", "aplayer": "^1.10.1",
"astro-uploader": "^1.1.3", "astro-uploader": "^1.1.3",
"bootstrap": "^5.3.3", "bootstrap": "^5.3.3",
"patch-package": "^8.0.0",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1", "prettier-plugin-astro": "^0.14.1",
"prettier-plugin-astro-organize-imports": "^0.4.9", "prettier-plugin-astro-organize-imports": "^0.4.9",

View File

@ -151,7 +151,7 @@ if (typeof comments !== 'undefined' && comments !== null) {
const email = event.target.value; const email = event.target.value;
if (email !== '' && email.includes('@')) { if (email !== '' && email.includes('@')) {
// Replace the avatar after typing the email. // Replace the avatar after typing the email.
actions.avatar.safe({ email }).then(({ data, error }) => { actions.avatar({ email }).then(({ data, error }) => {
if (error) { if (error) {
return handleActionError(error); return handleActionError(error);
} }
@ -167,7 +167,7 @@ if (typeof comments !== 'undefined' && comments !== null) {
// Loading more comments from server. // Loading more comments from server.
if (event.target === comments.querySelector('#comments-next-button')) { if (event.target === comments.querySelector('#comments-next-button')) {
const { size, offset, key } = event.target.dataset; const { size, offset, key } = event.target.dataset;
const { data, error } = await actions.comments.safe({ offset: Number(offset), page_key: key }); const { data, error } = await actions.comments({ offset: Number(offset), page_key: key });
if (error) { if (error) {
return handleActionError(error); return handleActionError(error);
} }
@ -223,7 +223,7 @@ if (typeof comments !== 'undefined' && comments !== null) {
} }
request.rid = request.rid === undefined ? 0 : Number(request.rid); request.rid = request.rid === undefined ? 0 : Number(request.rid);
const { data, error } = await actions.comment.safe(request); const { data, error } = await actions.comment(request);
if (error) { if (error) {
return handleActionError(error); return handleActionError(error);
@ -279,7 +279,7 @@ const likeButton = document.querySelector('button.post-like');
const increaseLikes = (count, permalink) => { const increaseLikes = (count, permalink) => {
count.textContent = Number.parseInt(count.textContent) + 1; count.textContent = Number.parseInt(count.textContent) + 1;
actions.like.safe({ action: 'increase', key: permalink }).then(({ data, error }) => { actions.like({ action: 'increase', key: permalink }).then(({ data, error }) => {
if (error) { if (error) {
return handleActionError(error); return handleActionError(error);
} }
@ -295,7 +295,7 @@ const decreaseLikes = (count, permalink) => {
return; return;
} }
count.textContent = Number.parseInt(count.textContent) - 1; count.textContent = Number.parseInt(count.textContent) - 1;
actions.like.safe({ action: 'decrease', key: permalink, token }).then(({ data, error }) => { actions.like({ action: 'decrease', key: permalink, token }).then(({ data, error }) => {
if (error) { if (error) {
return handleActionError(error); return handleActionError(error);
} }

View File

@ -4,7 +4,7 @@ import options from '@/options';
import { ARTALK_HOST } from 'astro:env/server'; import { ARTALK_HOST } from 'astro:env/server';
import _ from 'lodash'; import _ from 'lodash';
import { marked } from 'marked'; import { marked } from 'marked';
import * as querystring from 'node:querystring'; import querystring from 'node:querystring';
import { ELEMENT_NODE, transform, walk } from 'ultrahtml'; import { ELEMENT_NODE, transform, walk } from 'ultrahtml';
import sanitize from 'ultrahtml/transformers/sanitize'; import sanitize from 'ultrahtml/transformers/sanitize';

View File

@ -3,7 +3,7 @@ import QRDialog from '@/components/image/QRDialog.astro';
import type { Post } from '@/helpers/schema'; import type { Post } from '@/helpers/schema';
import { urlJoin } from '@/helpers/tools'; import { urlJoin } from '@/helpers/tools';
import options from '@/options'; import options from '@/options';
import * as querystring from 'node:querystring'; import querystring from 'node:querystring';
interface Props { interface Props {
post: Post; post: Post;

View File

@ -1,4 +1,4 @@
import * as schema from '@/helpers/db/schema'; import schema from '@/helpers/db/schema';
import { import {
POSTGRES_DATABASE, POSTGRES_DATABASE,
POSTGRES_HOST, POSTGRES_HOST,

View File

@ -111,3 +111,10 @@ export const atk_comments = pgTable(
}; };
}, },
); );
export default {
atk_pages,
atk_likes,
atk_users,
atk_comments,
};