diff --git a/lib/routes/theinitium/app.ts b/lib/routes/theinitium/app.ts index fbf38a24dc1d4e..114667ab641d5c 100644 --- a/lib/routes/theinitium/app.ts +++ b/lib/routes/theinitium/app.ts @@ -1,7 +1,7 @@ import { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; -import { load } from 'cheerio'; +import { load, type CheerioAPI, type Element } from 'cheerio'; import { art } from '@/utils/render'; import path from 'node:path'; import { config } from '@/config'; @@ -52,38 +52,52 @@ Category 栏目: | 播客 | article_audio_sc | article_audio_tc |`, }; +const resolveRelativeLink = ($: CheerioAPI, elem: Element, attr: string, baseUrl?: string) => { + // code from @/middleware/paratmeter.ts + const $elem = $(elem); + + if (baseUrl) { + try { + const oldAttr = $elem.attr(attr); + if (oldAttr) { + // e.g. should leave