diff --git a/public/icons/kaopu.png b/public/icons/kaopu.png new file mode 100644 index 0000000..c3ef438 Binary files /dev/null and b/public/icons/kaopu.png differ diff --git a/server/glob.d.ts b/server/glob.d.ts index 9e966db..19904b2 100644 --- a/server/glob.d.ts +++ b/server/glob.d.ts @@ -12,6 +12,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' { export const github: typeof import('./sources/github') export const hackernews: typeof import('./sources/hackernews') export const ithome: typeof import('./sources/ithome') + export const kaopu: typeof import('./sources/kaopu') export const producthunt: typeof import('./sources/producthunt') export const solidot: typeof import('./sources/solidot') export const sputniknewscn: typeof import('./sources/sputniknewscn') diff --git a/server/sources/kaopu.ts b/server/sources/kaopu.ts new file mode 100644 index 0000000..1032bd1 --- /dev/null +++ b/server/sources/kaopu.ts @@ -0,0 +1,27 @@ +type Res = { + description: string + link: string + // Date + pubDate: string + publisher: string + title: string +}[] +export default defineSource(async () => { + const url = "https://kaopucdn.azureedge.net/jsondata/news_list_beta_hans_0.json" + const res: Res = await $fetch(url) + return res + .slice(0, 30) + .map((k) => { + return { + id: k.link, + title: k.title, + pubDate: k.pubDate, + extra: { + hover: k.description, + info: k.publisher, + }, + url: k.link, + } + }) +}, +) diff --git a/shared/metadata.ts b/shared/metadata.ts index 897e68f..7b70226 100644 --- a/shared/metadata.ts +++ b/shared/metadata.ts @@ -7,11 +7,11 @@ export const columnIds = ["focus", "realtime", "hottest", "china", "world", "tec const originMetadata: Metadata = { china: { name: "国内", - sources: ["zhihu", "thepaper"], + sources: ["zhihu", "thepaper", "douyin", "bilibili-hot-search", "weibo", "toutiao", "tieba"], }, world: { name: "国际", - sources: ["zaobao", "cankaoxiaoxi"], + sources: ["zaobao", "cankaoxiaoxi", "kaopu"], }, tech: { name: "科技", diff --git a/shared/sources.ts b/shared/sources.ts index 8ae2b6f..6d1b797 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -225,6 +225,11 @@ export const originSources = { }, }, }, + "kaopu": { + name: "靠谱新闻", + color: "gray", + home: "https://kaopu.news/", + }, } as const satisfies Record export const sources = genSources() diff --git a/src/components/column/card.tsx b/src/components/column/card.tsx index 1aa717a..0967973 100644 --- a/src/components/column/card.tsx +++ b/src/components/column/card.tsx @@ -143,7 +143,7 @@ function NewsCard({ id, inView, handleListeners }: NewsCardProps) { defer >
- {data?.items?.length && (sources[id].type === "hottest" ? : )} + {!!data?.items?.length && (sources[id].type === "hottest" ? : )}