From 3b843c39d39f0b8bcc6870a88ec9250c569c13f0 Mon Sep 17 00:00:00 2001 From: Ou Date: Sun, 1 Dec 2024 13:01:58 +0800 Subject: [PATCH] feat(source): add linux.do --- public/icons/linuxdo.png | Bin 0 -> 890 bytes scripts/favicon.ts | 6 +--- server/glob.d.ts | 1 + server/sources/linuxdo.ts | 61 ++++++++++++++++++++++++++++++++++++++ shared/pinyin.json | 4 ++- shared/sources.ts | 18 +++++++++++ 6 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 public/icons/linuxdo.png create mode 100644 server/sources/linuxdo.ts diff --git a/public/icons/linuxdo.png b/public/icons/linuxdo.png new file mode 100644 index 0000000000000000000000000000000000000000..838c74e9c5c417190ebb202bfe5628bff8c9f4a1 GIT binary patch literal 890 zcmV-=1BLvFP)-JD>Mwv0f%%s%dGHFWfozobPw$%-jOz#{FC7I7vEV6^q2;Rtc-L@B8Ia zsU*aj7<=SIYGQbu#5oDx?yS45l7LoLRx~^NP*YPk)!#p4H7LZI7<=T9OAWQIXI%}@ zv9q2Jfjn85Nl%WkwY#u)Z!8Kb`^zp@G}f6J(9K; z7gOr(?H9&V7r<^kX$ zBgPoW@bG9|B9|I!@xY4@-YyFrc|LSW;`H=w3Jj}2roSGhT)#H+BkSwQmK>}83l~7k-`)2RBB1EV8X5)wM-^Mf>oP3JG<1; z(b-Vpi8l;bFl+BX5R{TzTU(rAe{F3|tE*|H(~T9Lc*B4Nv(|v;c`6o*k`$`>pAZ&I z*e0LP$E^qi*=$y)Ay_bB(?H_z!nabh6=5Z4AbogIJ|(!zN*fp40+kJmR;u+4wEhva z{v~YvF^pF)yddvobt=j`UqpNz+JN#uit_dqTB*qjVZr?KyI{AR{JyiPz0H)r`{kW> zKfi5?thZ$>`LJNt8pu`Do&T1Ro*U_f)napmKY|4lw)rZ>SY)O7!p0M6!4&o8g7o@a zLxm^aFkr!iZM^;3pJYs8+h4ycJv9f_CeAiQc;SgR3|I&@3+}%CS71*)xj+g&Tt950 zQ(A7fCT;%=rG{EO@WK;s7%r0r5P?|rg$#yC^w;l*k?ECDbsFt;!^x$FT0HQ=6K|Jw zqye-eb^M+Lqbh7HNH2}_%=p$U)be>%rxH{2853iV9CE3l77x7ebQ#As5bZ7}&D-Om z;>Sna6^#T+TH}-{b9b(Yu}2QM)KH5@)cdauxX%aWLUm`Qq#d93J}t>#zo+v1Yl=2N zj6HJ5rH0z5XI%{-ub?v=lgJ~A+i@nmeWfj=3<$9%#vVCt4IW { + const res = await myFetch("https://linux.do/top/daily.json") + return res.topic_list.topics + .filter(k => k.visible && !k.archived && !k.pinned) + .map(k => ({ + id: k.id, + title: k.title, + url: `https://linux.do/t/topic/${k.id}`, + })) +}) + +const latest = defineSource(async () => { + const res = await myFetch("https://linux.do/latest.json?order=created") + return res.topic_list.topics + .filter(k => k.visible && !k.archived && !k.pinned) + .map(k => ({ + id: k.id, + title: k.title, + pubDate: new Date(k.created_at).valueOf(), + url: `https://linux.do/t/topic/${k.id}`, + })) +}) + +export default defineSource({ + "linuxdo": latest, + "linuxdo-latest": latest, + "linuxdo-hot": hot, +}) diff --git a/shared/pinyin.json b/shared/pinyin.json index 5683474..3c3c750 100644 --- a/shared/pinyin.json +++ b/shared/pinyin.json @@ -27,5 +27,7 @@ "bilibili-hot-search": "bilibili-resou", "kaopu": "kaopuxinwen", "jin10": "jinshishuju", - "baidu": "baiduresou" + "baidu": "baiduresou", + "linuxdo-latest": "Linux DO-zuixin", + "linuxdo-hot": "Linux DO-remen" } diff --git a/shared/sources.ts b/shared/sources.ts index d32d5dd..ea8b6f9 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -282,6 +282,24 @@ export const originSources = { type: "hottest", home: "https://www.baidu.com", }, + "linuxdo": { + name: "LINUX DO", + column: "tech", + color: "slate", + home: "https://linux.do/", + sub: { + latest: { + title: "最新", + home: "https://linux.do/latest", + }, + hot: { + title: "今日最热", + type: "hottest", + interval: Time.Common, + home: "https://linux.do/hot", + }, + }, + }, } as const satisfies Record export const sources = genSources()