mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
feat: support append desc and home in every source
This commit is contained in:
parent
392a24c817
commit
ecc678a2bb
@ -9,8 +9,7 @@ type Res = {
|
||||
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)
|
||||
return res.filter(k => ["财新", "公视"].every(h => k.publisher !== h))
|
||||
.map((k) => {
|
||||
return {
|
||||
id: k.link,
|
||||
|
@ -228,6 +228,7 @@ export const originSources = {
|
||||
"kaopu": {
|
||||
name: "靠谱新闻",
|
||||
color: "gray",
|
||||
desc: "不一定靠谱,多看多思考",
|
||||
home: "https://kaopu.news/",
|
||||
},
|
||||
} as const satisfies Record<string, OriginSource>
|
||||
@ -241,6 +242,8 @@ function genSources() {
|
||||
name: source.name,
|
||||
type: source.type,
|
||||
disable: source.disable,
|
||||
desc: source.desc,
|
||||
home: source.home,
|
||||
color: source.color ?? "primary",
|
||||
interval: source.interval ?? Time.Default,
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ export interface PrimitiveMetadata {
|
||||
export interface OriginSource {
|
||||
name: string
|
||||
title?: string
|
||||
desc?: string
|
||||
/**
|
||||
* 刷新的间隔时间,复用缓存
|
||||
*/
|
||||
@ -45,11 +46,13 @@ export interface OriginSource {
|
||||
* @default false
|
||||
*/
|
||||
disable?: boolean
|
||||
home: string
|
||||
home?: string
|
||||
color?: Color
|
||||
sub?: Record<string, {
|
||||
title: string
|
||||
type?: "hottest" | "realtime"
|
||||
desc?: string
|
||||
home?: string
|
||||
disable?: boolean
|
||||
interval?: number
|
||||
}>
|
||||
@ -60,6 +63,8 @@ export interface Source {
|
||||
title?: string
|
||||
type?: "hottest" | "realtime"
|
||||
color: Color
|
||||
desc?: string
|
||||
home?: string
|
||||
disable?: boolean
|
||||
interval: number
|
||||
redirect?: SourceID
|
||||
|
@ -96,15 +96,20 @@ function NewsCard({ id, inView, handleListeners }: NewsCardProps) {
|
||||
<>
|
||||
<div className={clsx("flex justify-between mx-2 mt-0 mb-2 items-center")}>
|
||||
<div className="flex gap-2 items-center">
|
||||
<span
|
||||
className={clsx("w-8 h-8 rounded-full bg-cover")}
|
||||
<a
|
||||
className={clsx("w-8 h-8 rounded-full bg-cover hover:animate-spin")}
|
||||
href={sources[id].home}
|
||||
title={sources[id].desc}
|
||||
style={{
|
||||
backgroundImage: `url(/icons/${id.split("-")[0]}.png)`,
|
||||
}}
|
||||
/>
|
||||
<span className="flex flex-col">
|
||||
<span className="flex items-center gap-2">
|
||||
<span className="text-xl font-bold">
|
||||
<span
|
||||
className="text-xl font-bold"
|
||||
title={sources[id].desc}
|
||||
>
|
||||
{sources[id].name}
|
||||
</span>
|
||||
{sources[id]?.title && <span className={clsx("text-sm", `color-${sources[id].color} bg-base op-80 bg-op-50! px-1 rounded`)}>{sources[id].title}</span>}
|
||||
|
Loading…
x
Reference in New Issue
Block a user