Skip to content

Commit 063e4dc

Browse files
committed
merge dev source fixes
2 parents 625bf04 + 69e1b77 commit 063e4dc

16 files changed

Lines changed: 201 additions & 348 deletions

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN pnpm run build
77

88
FROM node:20.12.2-alpine
99
WORKDIR /usr/app
10+
RUN apk add --no-cache curl
1011
COPY --from=builder /usr/src/dist/output ./output
1112
ENV HOST=0.0.0.0 PORT=4444 NODE_ENV=production
1213
EXPOSE $PORT

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"homepage": "https://github.com/ourongxing/newsnow",
1313
"scripts": {
14-
"dev": "npm run presource && vite dev",
14+
"dev": "npm run presource && cross-env NODE_OPTIONS=--use-env-proxy vite dev",
1515
"build": "npm run presource && vite build",
1616
"lint": "eslint",
1717
"presource": "tsx ./scripts/favicon.ts && tsx ./scripts/source.ts",
@@ -116,7 +116,11 @@
116116
"simple-git-hooks",
117117
"unrs-resolver",
118118
"workerd"
119-
]
119+
],
120+
"overrides": {
121+
"vite-plugin-with-nitro>h3": "npm:h3-nightly@1.15.4-20250730-094032-325a62b",
122+
"nitro-go>h3": "npm:h3-nightly@1.15.4-20250730-094032-325a62b"
123+
}
120124
},
121125
"resolutions": {
122126
"cross-spawn": ">=7.0.6",

pnpm-lock.yaml

Lines changed: 16 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/sources/_36kr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const renqi = defineSource(async () => {
7979
})
8080
}
8181
})
82-
return articles
82+
return articles.length ? articles : quick()
8383
})
8484

8585
export default defineSource({

server/sources/cankaoxiaoxi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Res {
1111
}
1212

1313
export default defineSource(async () => {
14-
const res = await Promise.all(["zhongguo", "guandian", "gj"].map(k => myFetch(`https://china.cankaoxiaoxi.com/json/channel/${k}/list.json`) as Promise<Res>))
14+
const res = await Promise.all(["zhongguo", "guandian", "gj"].map(k => myFetch(`http://china.cankaoxiaoxi.com/json/channel/${k}/list.json`) as Promise<Res>))
1515
return res.map(k => k.list).flat().map(k => ({
1616
id: k.data.id,
1717
title: k.data.title,

server/sources/cls/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,16 @@ const hot = defineSource(async () => {
5959
})
6060

6161
const telegraph = defineSource(async () => {
62-
const apiUrl = `https://www.cls.cn/nodeapi/updateTelegraphList`
62+
const apiUrl = `https://www.cls.cn/v1/roll/get_roll_list`
6363
const res: TelegraphRes = await myFetch(apiUrl, {
64-
query: Object.fromEntries(await getSearchParams()),
64+
query: Object.fromEntries(await getSearchParams({
65+
last_time: Math.floor(Date.now() / 1000),
66+
refresh_type: 1,
67+
rn: 30,
68+
})),
69+
headers: {
70+
Referer: "https://www.cls.cn/telegraph",
71+
},
6572
})
6673
return res.data.roll_data.filter(k => !k.is_ad).map((k) => {
6774
return {

server/sources/fastbull.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ const express = defineSource(async () => {
55
const baseURL = "https://www.fastbull.com"
66
const html: any = await myFetch(`${baseURL}/cn/express-news`)
77
const $ = cheerio.load(html)
8-
const $main = $(".news-list")
8+
const $main = $(".content-list.news-list")
99
const news: NewsItem[] = []
1010
$main.each((_, el) => {
11-
const a = $(el).find(".title_name")
12-
const url = a.attr("href")
11+
const $el = $(el)
12+
const a = $el.find(".title_name")
13+
const url = $el.find("[data-href]").attr("data-href") || $el.find("[data-id]").attr("data-id")
1314
const titleText = a.text()
1415
const title = titleText.match(/(.+)/)?.[1] ?? titleText
15-
const date = $(el).attr("data-date")
16+
const date = $el.attr("data-date")
1617
if (url && title && date) {
18+
const pathname = url.startsWith("/") ? url : `/cn/fastshort/${url}`
1719
news.push({
18-
url: baseURL + url,
20+
url: baseURL + pathname,
1921
title: title.length < 4 ? titleText : title,
2022
id: url,
2123
pubDate: Number(date),
2224
})
2325
}
2426
})
25-
return news
27+
return news.sort((a, b) => Number(b.pubDate) - Number(a.pubDate))
2628
})
2729

2830
const news = defineSource(async () => {
@@ -38,14 +40,14 @@ const news = defineSource(async () => {
3840
const date = a.find("[data-date]").attr("data-date")
3941
if (url && title && date) {
4042
news.push({
41-
url: baseURL + url,
43+
url: url.startsWith("http") ? url : baseURL + url,
4244
title,
4345
id: url,
4446
pubDate: Number(date),
4547
})
4648
}
4749
})
48-
return news
50+
return news.sort((a, b) => Number(b.pubDate) - Number(a.pubDate))
4951
})
5052

5153
export default defineSource(

0 commit comments

Comments
 (0)