This commit is contained in:
1 parent
5c993bb6cc
commit
2820894e1c
3 files changed
+8
-7
No files matched your search
+2
-2
@@ -3,7 +3,7 @@ import { verifyAccessJwt } from '$lib/server/access';
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
|
||||
function unauthorized(): Response {
|
||||
return new Response('Unauthorized - Access credential verification failed', {
|
||||
return new Response('身份验证失败:Access 凭证校验未通过', {
|
||||
status: 401,
|
||||
headers: {
|
||||
'Cache-Control': 'no-store',
|
||||
@@ -13,7 +13,7 @@ function unauthorized(): Response {
|
||||
}
|
||||
|
||||
function accessNotConfigured(): Response {
|
||||
return new Response('Admin authentication is not configured', {
|
||||
return new Response('后台认证尚未配置', {
|
||||
status: 503,
|
||||
headers: {
|
||||
'Cache-Control': 'no-store',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { error } from '@sveltejs/kit';
|
||||
export const load: PageServerLoad = async ({ platform }) => {
|
||||
const db = platform?.env?.DB;
|
||||
if (!db) {
|
||||
throw error(500, 'Database connection not found');
|
||||
throw error(500, '数据库未连接');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -43,6 +43,6 @@ export const load: PageServerLoad = async ({ platform }) => {
|
||||
};
|
||||
} catch (err: unknown) {
|
||||
console.error('Error fetching archives:', err);
|
||||
throw error(500, 'Failed to fetch archives');
|
||||
throw error(500, '读取列表失败');
|
||||
}
|
||||
};
|
||||
@@ -17,9 +17,10 @@ interface PostRow {
|
||||
series_weight: number | null;
|
||||
}
|
||||
|
||||
export const load: PageServerLoad = async ({ platform, params }) => {
|
||||
export const load: PageServerLoad = async ({ platform, params, parent }) => {
|
||||
const db = platform?.env?.DB;
|
||||
const { slug } = params;
|
||||
const { aliases } = await parent();
|
||||
|
||||
if (!db) {
|
||||
const dummyMarkdown = `
|
||||
@@ -82,7 +83,7 @@ export const load: PageServerLoad = async ({ platform, params }) => {
|
||||
.first<PostRow>();
|
||||
|
||||
if (!post) {
|
||||
error(404, 'Post not found');
|
||||
error(404, `该${aliases?.post || '文章'}不存在`);
|
||||
}
|
||||
|
||||
const tagsQuery = await db
|
||||
@@ -137,6 +138,6 @@ export const load: PageServerLoad = async ({ platform, params }) => {
|
||||
} catch (err: unknown) {
|
||||
if (isHttpError(err, 404)) throw err;
|
||||
console.error('Error fetching post:', err);
|
||||
error(500, 'Internal Server Error');
|
||||
error(500, '读取详情失败');
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user