Compare commits

..

No commits in common. "2aead46b51b47e02e7dc1b20fd80045c72c37c5b" and "28772fcd9f99eb385c27cef71e4f4ed7354ab7cd" have entirely different histories.

5 changed files with 13 additions and 22 deletions

View File

@ -2,11 +2,6 @@
「中V档案馆」是一个旨在收录与展示「中文歌声合成作品」及有关信息的网站。
## 新闻 - 测试版本上线
目前中V档案馆上线了用于测试的前端网页和API接口它们分别位于[projectcvsa.com](https://projectcvsa.com)和[api.projectcvsa.com](https://api.projectcvsa.com)。
API调用方法请参见[接口文档](https://docs.projectcvsa.com/api-doc/)。
## 创建背景与关联工作
纵观整个互联网对于「中文歌声合成」或「中文虚拟歌手」常简称为中V或VC相关信息进行较为系统、全面地整理收集的主要有以下几个网站
@ -36,7 +31,7 @@ API调用方法请参见[接口文档](https://docs.projectcvsa.com/api-doc/)。
## 技术架构
参见[CVSA文档](https://docs.projectcvsa.com/)。
参见[CVSA文档](https://cvsa.gitbook.io/)。
## 开放许可

View File

@ -17,4 +17,4 @@ export default {
fetch,
} satisfies Deno.ServeDefaultExport;
export const VERSION = "0.2.4";
export const VERSION = "0.2.0";

View File

@ -6,19 +6,18 @@ import type { VideoSnapshotType } from "@core/db/schema.d.ts";
import { boolean, mixed, number, object, ValidationError } from "yup";
const SnapshotQueryParamsSchema = object({
ps: number().integer().optional().positive(),
pn: number().integer().optional().positive(),
offset: number().integer().optional().positive(),
ps: number().optional().positive(),
pn: number().optional().positive(),
offset: number().optional().positive(),
reverse: boolean().optional(),
});
const idSchema = mixed().test(
"is-valid-id",
'id must be a string starting with "av" followed by digits, or "BV" followed by 10 alphanumeric characters, or a positive integer',
async (value) => {
if (value && await number().integer().isValid(value)) {
const v = parseInt(value as string);
return Number.isInteger(v) && v > 0;
(value) => {
if (typeof value === "number") {
return Number.isInteger(value) && value > 0;
}
if (typeof value === "string") {
@ -43,13 +42,10 @@ export const getSnapshotsHanlder = createHandlers(async (c: ContextType) => {
try {
const idParam = await idSchema.validate(c.req.param("id"));
let videoId: string | number = idParam as string;
if (videoId.startsWith("av")) {
videoId = parseInt(videoId.slice(2));
let videoId: number | string = idParam as string | number;
if (typeof videoId === "string" && videoId.startsWith("av")) {
videoId = videoId.slice(2);
}
else if (await number().isValid(videoId)) {
videoId = parseInt(videoId);
}
const queryParams = await SnapshotQueryParamsSchema.validate(c.req.query());
const { ps, pn, offset, reverse = false } = queryParams;

View File

@ -1 +1 @@
export const VERSION = "1.2.7";
export const VERSION = "1.2.6";

View File

@ -7,7 +7,7 @@ import "../styles/global.css";
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>中V档案馆</title>
<title>CVSA 前端</title>
</head>
<body class="dark:bg-zinc-900 dark:text-zinc-100">
<slot />