diff --git a/package.json b/package.json index ed4d86f..1d56f6c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dev": "cross-env NODE_ENV=development tsx watch --no-cache src/index.ts", "dev:cache": "cross-env NODE_ENV=development tsx watch src/index.ts", "build": "tsc --project tsconfig.json", - "start": "cross-env NODE_ENV=development tsx dist/index.js" + "start": "cross-env NODE_ENV=development tsx dist/src/index.js" }, "type": "module", "dependencies": { diff --git a/src/registry.ts b/src/registry.ts index b7a8932..135de94 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -119,7 +119,7 @@ app.get("/all", (c) => if (excludeRoutes.includes(path)) { return { name: path, - path: null, + path: undefined, message: "该接口暂时下线", }; } diff --git a/src/routes/bilibili.ts b/src/routes/bilibili.ts index d0a54b9..18e9d7c 100644 --- a/src/routes/bilibili.ts +++ b/src/routes/bilibili.ts @@ -97,7 +97,7 @@ const getList = async (options: Options, noCache: boolean): Promise => { data: list.map((v: RouterType["csdn"]) => ({ id: v.productId, title: v.articleTitle, - cover: v.picList?.[0] || null, - desc: null, + cover: v.picList?.[0] || undefined, + desc: undefined, author: v.nickName, timestamp: getTime(v.period), hot: Number(v.hotRankScore), diff --git a/src/routes/douyin.ts b/src/routes/douyin.ts index 60a2864..b35dd02 100644 --- a/src/routes/douyin.ts +++ b/src/routes/douyin.ts @@ -30,7 +30,7 @@ const getDyCookies = async () => { return cookieData; } catch (error) { console.error("获取抖音 Cookie 出错" + error); - return null; + return undefined; } }; diff --git a/src/routes/genshin.ts b/src/routes/genshin.ts index 4a2d3b8..36d7750 100644 --- a/src/routes/genshin.ts +++ b/src/routes/genshin.ts @@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => { title: data.subject, desc: data.content, cover: data.cover || data?.images?.[0], - author: v.user?.nickname || null, + author: v.user?.nickname || undefined, timestamp: getTime(data.created_at), hot: data.view_status, url: `https://www.miyoushe.com/ys/article/${data.post_id}`, diff --git a/src/routes/history.ts b/src/routes/history.ts index dc17c4e..5e6263b 100644 --- a/src/routes/history.ts +++ b/src/routes/history.ts @@ -44,11 +44,11 @@ const getList = async (options: Options, noCache: boolean) => { data: list.map((v: RouterType["history"], index: number) => ({ id: index, title: load(v.title).text().trim(), - cover: v.cover ? v.pic_share : null, + cover: v.cover ? v.pic_share : undefined, desc: load(v.desc).text().trim(), year: v.year, - timestamp: null, - hot: null, + timestamp: undefined, + hot: undefined, url: v.link, mobileUrl: v.link, })), diff --git a/src/routes/honkai.ts b/src/routes/honkai.ts index 80518b1..c0a2572 100644 --- a/src/routes/honkai.ts +++ b/src/routes/honkai.ts @@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => { title: data.subject, desc: data.content, cover: data.cover || data?.images?.[0], - author: v.user?.nickname || null, + author: v.user?.nickname || undefined, timestamp: getTime(data.created_at), hot: data.view_status, url: `https://www.miyoushe.com/bh3/article/${data.post_id}`, diff --git a/src/routes/hupu.ts b/src/routes/hupu.ts index fc1c333..7727309 100644 --- a/src/routes/hupu.ts +++ b/src/routes/hupu.ts @@ -43,7 +43,7 @@ const getList = async (options: Options, noCache: boolean) => { title: v.title, author: v.username, hot: v.replies, - timestamp: null, + timestamp: undefined, url: `https://bbs.hupu.com/${v.tid}.html`, mobileUrl: v.url, })), diff --git a/src/routes/huxiu.ts b/src/routes/huxiu.ts index ad2991d..9a6a9bf 100644 --- a/src/routes/huxiu.ts +++ b/src/routes/huxiu.ts @@ -46,7 +46,7 @@ const getList = async (noCache: boolean) => { desc: titleProcessing(v.content).intro, author: v.user_info.username, timestamp: getTime(v.publish_time), - hot: null, + hot: undefined, url: v.url || `https://www.huxiu.com/moment/${v.object_id}.html`, mobileUrl: v.url || `https://m.huxiu.com/moment/${v.object_id}.html`, })), diff --git a/src/routes/ithome-xijiayi.ts b/src/routes/ithome-xijiayi.ts index 24590a9..d960112 100644 --- a/src/routes/ithome-xijiayi.ts +++ b/src/routes/ithome-xijiayi.ts @@ -38,7 +38,7 @@ const getList = async (noCache: boolean) => { const href = dom.find("a").attr("href"); const time = dom.find("span.time").text().trim(); const match = time.match(/'([^']+)'/); - const dateTime = match ? match[1] : null; + const dateTime = match ? match[1] : undefined; return { id: href ? Number(replaceLink(href, true)) : 100000, title: dom.find(".newsbody h2").text().trim(), diff --git a/src/routes/miyoushe.ts b/src/routes/miyoushe.ts index 8a3684d..e601eb2 100644 --- a/src/routes/miyoushe.ts +++ b/src/routes/miyoushe.ts @@ -64,7 +64,7 @@ const getList = async (options: Options, noCache: boolean): Promise { title: v.title, cover: v.imgsrc, author: v.source, - hot: null, + hot: undefined, timestamp: getTime(v.ptime), url: `https://www.163.com/dy/article/${v.docid}.html`, mobileUrl: `https://m.163.com/dy/article/${v.docid}.html`, diff --git a/src/routes/sina-news.ts b/src/routes/sina-news.ts index f1e5d7a..6734fa8 100644 --- a/src/routes/sina-news.ts +++ b/src/routes/sina-news.ts @@ -127,7 +127,7 @@ const getList = async (options: Options, noCache: boolean) => { data: list.map((v: RouterType["sina-news"]) => ({ id: v.id, title: v.title, - author: v.media || null, + author: v.media || undefined, hot: parseFloat(v.top_num.replace(/,/g, "")), timestamp: getTime(v.create_date + " " + v.create_time), url: v.url, diff --git a/src/routes/sina.ts b/src/routes/sina.ts index 2f08654..24edb95 100644 --- a/src/routes/sina.ts +++ b/src/routes/sina.ts @@ -50,9 +50,9 @@ const getList = async (options: Options, noCache: boolean) => { return { id: base.base.uniqueId, title: info.title, - desc: null, - author: null, - timestamp: null, + desc: undefined, + author: undefined, + timestamp: undefined, hot: parseChineseNumber(info.hotValue), url: base.base.url, mobileUrl: base.base.url, diff --git a/src/routes/starrail.ts b/src/routes/starrail.ts index fb0d7ea..160953c 100644 --- a/src/routes/starrail.ts +++ b/src/routes/starrail.ts @@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => { title: data.subject, desc: data.content, cover: data.cover || data?.images?.[0], - author: v.user?.nickname || null, + author: v.user?.nickname || undefined, timestamp: getTime(data.created_at), hot: data.view_status, url: `https://www.miyoushe.com/sr/article/${data.post_id}`, diff --git a/src/routes/v2ex.ts b/src/routes/v2ex.ts index e0f875b..c67b6c6 100644 --- a/src/routes/v2ex.ts +++ b/src/routes/v2ex.ts @@ -40,7 +40,7 @@ const getList = async (options: Options, noCache: boolean) => { title: v.title, desc: v.content, author: v.member.username, - timestamp: null, + timestamp: undefined, hot: v.replies, url: v.url, mobileUrl: v.url, diff --git a/src/routes/weatheralarm.ts b/src/routes/weatheralarm.ts index f480c98..caf7e96 100644 --- a/src/routes/weatheralarm.ts +++ b/src/routes/weatheralarm.ts @@ -40,7 +40,7 @@ const getList = async (options: Options, noCache: boolean) => { desc: v.issuetime + " " + v.title, cover: v.pic, timestamp: getTime(v.issuetime), - hot: null, + hot: undefined, url: `http://nmc.cn${v.url}`, mobileUrl: `http://nmc.cn${v.url}`, })), diff --git a/src/routes/zhihu-daily.ts b/src/routes/zhihu-daily.ts index 779ef6a..e64311b 100644 --- a/src/routes/zhihu-daily.ts +++ b/src/routes/zhihu-daily.ts @@ -35,10 +35,10 @@ const getList = async (noCache: boolean) => { data: list.map((v: RouterType["zhihu-daily"]) => ({ id: v.id, title: v.title, - cover: v.images?.[0] ?? null, + cover: v.images?.[0] ?? undefined, author: v.hint, - hot: null, - timestamp: null, + hot: undefined, + timestamp: undefined, url: v.url, mobileUrl: v.url, })), diff --git a/src/utils/getTime.ts b/src/utils/getTime.ts index 3290c09..d6ff25f 100644 --- a/src/utils/getTime.ts +++ b/src/utils/getTime.ts @@ -112,7 +112,7 @@ export const getTime = (timeInput: string | number): number | undefined => { "YYYY-MM-DD", ]; - let parsedDate: dayjs.Dayjs | null = null; + let parsedDate: dayjs.Dayjs | undefined = undefined; for (const pattern of formatPatterns) { parsedDate = dayjs(standardizedInput, pattern, true); if (parsedDate.isValid()) { diff --git a/src/utils/getToken/weread.ts b/src/utils/getToken/weread.ts index 7a8a28d..504f758 100644 --- a/src/utils/getToken/weread.ts +++ b/src/utils/getToken/weread.ts @@ -61,7 +61,7 @@ const getWereadID = (bookId: string) => { return strSub; } catch (error) { console.error("处理微信读书 ID 时出现错误:" + error); - return null; + return undefined; } };