From 25f8cd5e6362b8eba587e76862be2693c726420b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 02:55:48 +0000 Subject: [PATCH] style: auto format --- lib/routes/163/news/rank.ts | 2 +- lib/routes/6park/index.ts | 2 +- lib/routes/aqara/post.ts | 2 +- lib/routes/bfl/announcements.ts | 2 +- lib/routes/cool18/index.ts | 2 +- lib/routes/dealstreetasia/home.ts | 2 +- lib/routes/dedao/index.ts | 6 +++--- lib/routes/e-hentai/index.ts | 2 +- lib/routes/epicgames/index.ts | 4 ++-- lib/routes/espn/news.ts | 2 +- lib/routes/fantia/search.ts | 2 +- lib/routes/follow/profile.ts | 2 +- lib/routes/followin/news.ts | 2 +- lib/routes/foresightnews/util.ts | 2 +- lib/routes/gov/beijing/bphc/index.ts | 2 +- lib/routes/gov/ccdi/index.ts | 2 +- lib/routes/gov/general/general.ts | 2 +- lib/routes/hellogithub/report.ts | 2 +- lib/routes/hostmonit/cloudflareyes.ts | 2 +- lib/routes/hypergryph/arknights/announce.ts | 2 +- lib/routes/japanpost/utils.ts | 4 ++-- lib/routes/meteor/index.ts | 2 +- lib/routes/mittrchina/index.ts | 6 +++--- lib/routes/oilchem/index.ts | 2 +- lib/routes/oncc/money18.ts | 2 +- lib/routes/questmobile/report.ts | 2 +- lib/routes/seekingalpha/index.ts | 2 +- lib/routes/sketis/isabelle-dev/blog/index.ts | 2 +- lib/routes/telegram/channel.ts | 2 +- lib/routes/tesla/cx.ts | 2 +- lib/routes/test/index.ts | 2 +- lib/routes/twitter/utils.ts | 12 ++++++------ lib/routes/whu/swrh.ts | 2 +- lib/routes/xiaoyuzhou/pickup.ts | 2 +- 34 files changed, 45 insertions(+), 45 deletions(-) diff --git a/lib/routes/163/news/rank.ts b/lib/routes/163/news/rank.ts index 7c4c95f26..e6210c9ec 100644 --- a/lib/routes/163/news/rank.ts +++ b/lib/routes/163/news/rank.ts @@ -135,7 +135,7 @@ async function handler(ctx) { const $ = load(iconv.decode(response.data, 'gbk')); const list = $('div.tabContents') - .eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : (type === 'click' ? 0 : 2))) + .eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : type === 'click' ? 0 : 2)) .find('table tbody tr td a') .toArray() .map((item) => { diff --git a/lib/routes/6park/index.ts b/lib/routes/6park/index.ts index c71e220d5..f4e2ee217 100644 --- a/lib/routes/6park/index.ts +++ b/lib/routes/6park/index.ts @@ -32,7 +32,7 @@ async function handler(ctx) { const rootUrl = 'https://club.6parkbbs.com'; const indexUrl = `${rootUrl}/${id}/index.php`; - const currentUrl = `${indexUrl}${type === '' || keyword === '' ? '' : (type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&${type}=${keyword}&submit=${type === 'type' ? '查询' : '栏目搜索'}`)}`; + const currentUrl = `${indexUrl}${type === '' || keyword === '' ? '' : type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&${type}=${keyword}&submit=${type === 'type' ? '查询' : '栏目搜索'}`}`; const response = await got({ method: 'get', diff --git a/lib/routes/aqara/post.ts b/lib/routes/aqara/post.ts index 326835cbf..3bbd283fe 100644 --- a/lib/routes/aqara/post.ts +++ b/lib/routes/aqara/post.ts @@ -29,7 +29,7 @@ async function handler(ctx) { if (filterMatches) { const filterRegion = filterMatches[1]; - const filterType = filterMatches[2] === 'tag' ? 'tags' : (filterMatches[2] === 'category' ? 'categories' : filterMatches[2]); + const filterType = filterMatches[2] === 'tag' ? 'tags' : filterMatches[2] === 'category' ? 'categories' : filterMatches[2]; const filterKeyword = decodeURI(filterMatches[3].split('/').pop()); const filterApiUrl = new URL(`${filterRegion}/${apiSlug}/${filterType}?search=${filterKeyword}`, rootUrl).href; diff --git a/lib/routes/bfl/announcements.ts b/lib/routes/bfl/announcements.ts index 8f83db4f2..bc7bb930b 100644 --- a/lib/routes/bfl/announcements.ts +++ b/lib/routes/bfl/announcements.ts @@ -54,7 +54,7 @@ async function handler(): Promise { const $timeElement = $anchor.find('time'); const datetimeAttr = $timeElement.attr('datetime'); const timeText = $timeElement.text().trim(); - const pubDate = datetimeAttr ? parseDate(datetimeAttr) : (timeText ? parseDate(timeText) : undefined); + const pubDate = datetimeAttr ? parseDate(datetimeAttr) : timeText ? parseDate(timeText) : undefined; const summaryDescription = $anchor.find('p[class*="line-clamp-3"]').html()?.trim() || ''; const author = 'Black Forest Labs'; diff --git a/lib/routes/cool18/index.ts b/lib/routes/cool18/index.ts index 65ccb451d..6957c5ee2 100644 --- a/lib/routes/cool18/index.ts +++ b/lib/routes/cool18/index.ts @@ -42,7 +42,7 @@ async function handler(ctx: Context) { const { id = 'bbs4', type = 'home', keyword } = ctx.req.param(); const rootUrl = 'https://www.cool18.com/' + id + '/index.php'; - const params = type === 'home' ? '' : (type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&keywords=${keyword}&submit=查询`); + const params = type === 'home' ? '' : type === 'gold' ? '?app=forum&act=gold' : `?action=search&act=threadsearch&app=forum&keywords=${keyword}&submit=查询`; const currentUrl = rootUrl + params; diff --git a/lib/routes/dealstreetasia/home.ts b/lib/routes/dealstreetasia/home.ts index f48b56eca..e1e740c97 100644 --- a/lib/routes/dealstreetasia/home.ts +++ b/lib/routes/dealstreetasia/home.ts @@ -58,7 +58,7 @@ async function fetchPage() { title: item.post_title || item.title || 'No Title', link: item.post_url || item.link || '', description: item.post_excerpt || item.excerpt || '', - pubDate: item.post_date ? new Date(item.post_date).toUTCString() : (item.date ? new Date(item.date).toUTCString() : ''), + pubDate: item.post_date ? new Date(item.post_date).toUTCString() : item.date ? new Date(item.date).toUTCString() : '', category: item.category_link ? item.category_link.replaceAll(/(<([^>]+)>)/gi, '') : '', // Clean HTML if category_link exists image: item.image_url ? item.image_url.replace(/\?.*$/, '') : '', // Remove query parameters if image_url exists })); diff --git a/lib/routes/dedao/index.ts b/lib/routes/dedao/index.ts index b299dbcdc..dfbc69a3b 100644 --- a/lib/routes/dedao/index.ts +++ b/lib/routes/dedao/index.ts @@ -29,10 +29,10 @@ async function handler(ctx) { const data = JSON.parse(response.data.match(/window.__INITIAL_STATE__= (.*);<\/script>/)[1]); - let items = (category === 'news' ? data.news : (category === 'figure' ? data.figure : data.videoList)).map((item) => ({ + let items = (category === 'news' ? data.news : category === 'figure' ? data.figure : data.videoList).map((item) => ({ title: item.title, pubDate: parseDate(item.online_time), - link: `${rootUrl}/${category === 'news' ? 'article/' : (category === 'figure' ? 'people/' : '')}${item.online_time.split('T')[0].split('-').join('')}/${item.token}`, + link: `${rootUrl}/${category === 'news' ? 'article/' : category === 'figure' ? 'people/' : ''}${item.online_time.split('T')[0].split('-').join('')}/${item.token}`, })); items = await Promise.all( @@ -53,7 +53,7 @@ async function handler(ctx) { ); return { - title: `得到${category === 'video' ? '' : '大事件'} - ${category === 'news' ? '新闻' : (category === 'figure' ? '人物故事' : '视频')}`, + title: `得到${category === 'video' ? '' : '大事件'} - ${category === 'news' ? '新闻' : category === 'figure' ? '人物故事' : '视频'}`, link: rootUrl, item: items, description: data.description, diff --git a/lib/routes/e-hentai/index.ts b/lib/routes/e-hentai/index.ts index 1e29e6513..fb7cf6009 100644 --- a/lib/routes/e-hentai/index.ts +++ b/lib/routes/e-hentai/index.ts @@ -36,7 +36,7 @@ async function handler(ctx) { $('.itd').parent().remove(); let items = $('table.gltc tbody tr') - .slice(1, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) + 1 : (needImages ? 16 : 26)) + .slice(1, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) + 1 : needImages ? 16 : 26) .toArray() .map((item) => { item = $(item); diff --git a/lib/routes/epicgames/index.ts b/lib/routes/epicgames/index.ts index 394bb07b3..af9035631 100644 --- a/lib/routes/epicgames/index.ts +++ b/lib/routes/epicgames/index.ts @@ -78,9 +78,9 @@ async function handler(ctx) { let linkSlug = item.catalogNs.mappings && item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug - : (item.offerMappings && item.offerMappings.length > 0 + : item.offerMappings && item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug - : (item.productSlug ?? item.urlSlug)); + : (item.productSlug ?? item.urlSlug); if (item.offerType === 'ADD_ON') { linkSlug = item.offerMappings[0].pageSlug; } diff --git a/lib/routes/espn/news.ts b/lib/routes/espn/news.ts index 51706facf..7cdf2840c 100644 --- a/lib/routes/espn/news.ts +++ b/lib/routes/espn/news.ts @@ -69,7 +69,7 @@ export const route: Route = { author: itemDetail.byline, pubDate: item.date, // for videos and shortstops, no need to extract full text below - description: itemType === 'Media' ? renderMedia(itemDetail.video[0]) : (itemType === 'Shortstop' ? itemDetail.headline : ''), + description: itemType === 'Media' ? renderMedia(itemDetail.video[0]) : itemType === 'Shortstop' ? itemDetail.headline : '', }; }); diff --git a/lib/routes/fantia/search.ts b/lib/routes/fantia/search.ts index 5e52586cf..88b3847b0 100644 --- a/lib/routes/fantia/search.ts +++ b/lib/routes/fantia/search.ts @@ -151,7 +151,7 @@ async function handler(ctx) { const rootUrl = 'https://fantia.jp'; const apiUrl = `${rootUrl}/api/v1/search/${type}?keyword=${keyword}&peroid=${period}&brand_type=0&category=${caty === 'all' ? '' : caty}&order=${order}${ - rating === 'all' ? '' : (rating === 'general' ? '&rating=general' : '&adult=1') + rating === 'all' ? '' : rating === 'general' ? '&rating=general' : '&adult=1' }&per_page=30`; const response = await got({ method: 'get', diff --git a/lib/routes/follow/profile.ts b/lib/routes/follow/profile.ts index f0c0c3c66..c0e422878 100644 --- a/lib/routes/follow/profile.ts +++ b/lib/routes/follow/profile.ts @@ -36,7 +36,7 @@ async function handler(ctx: Context): Promise { const handleOrId = ctx.req.param('uid'); const host = 'https://api.follow.is'; - const handle = isBizId(handleOrId || '') ? handleOrId : (handleOrId.startsWith('@') ? handleOrId.slice(1) : handleOrId); + const handle = isBizId(handleOrId || '') ? handleOrId : handleOrId.startsWith('@') ? handleOrId.slice(1) : handleOrId; const searchParams = new URLSearchParams({ handle }); diff --git a/lib/routes/followin/news.ts b/lib/routes/followin/news.ts index 9a247c6e8..27b0f004e 100644 --- a/lib/routes/followin/news.ts +++ b/lib/routes/followin/news.ts @@ -49,7 +49,7 @@ async function handler(ctx) { const items = await Promise.all(list.map((item) => parseItem(item, cache.tryGet))); return { - title: `${lang === 'en' ? 'News' : (lang === 'vi' ? 'Bản tin' : '快讯')} - Followin`, + title: `${lang === 'en' ? 'News' : lang === 'vi' ? 'Bản tin' : '快讯'} - Followin`, link: `${baseUrl}/${lang}/news`, image: favicon, language: lang, diff --git a/lib/routes/foresightnews/util.ts b/lib/routes/foresightnews/util.ts index 2f0c70856..eec4ebebf 100644 --- a/lib/routes/foresightnews/util.ts +++ b/lib/routes/foresightnews/util.ts @@ -45,7 +45,7 @@ const processItems = async (apiUrl, limit, ...parameters) => { let items = JSON.parse(String(zlib.inflateSync(Buffer.from(response.data?.list ?? response.data, 'base64')))); items = (items?.list ?? items).slice(0, limit).map((item) => { - const sourceType = item.source_type ?? (item.source_link ? (item.column?.title ? 'article' : 'news') : (item.event_type ? 'event' : constants.defaultType)); + const sourceType = item.source_type ?? (item.source_link ? (item.column?.title ? 'article' : 'news') : item.event_type ? 'event' : constants.defaultType); item = item.source_type ? item[item.source_type] : item; diff --git a/lib/routes/gov/beijing/bphc/index.ts b/lib/routes/gov/beijing/bphc/index.ts index dd0181c06..ca1553cd0 100644 --- a/lib/routes/gov/beijing/bphc/index.ts +++ b/lib/routes/gov/beijing/bphc/index.ts @@ -32,7 +32,7 @@ async function handler(ctx) { const defaultPath = 'announcement'; const pathname = getSubPath(ctx).replaceAll(/(^\/beijing\/bphc|\/$)/g, ''); - const key = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname.slice(0, -1) : pathname); + const key = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname.slice(0, -1) : pathname; const obj = mapping[key]; const currentUrl = `${rootUrl}${obj.list}`; diff --git a/lib/routes/gov/ccdi/index.ts b/lib/routes/gov/ccdi/index.ts index 3046e4c84..7f870aa69 100644 --- a/lib/routes/gov/ccdi/index.ts +++ b/lib/routes/gov/ccdi/index.ts @@ -13,7 +13,7 @@ async function handler(ctx) { const defaultPath = '/yaowenn/'; let pathname = getSubPath(ctx).replaceAll(/(^\/ccdi|\/$)/g, ''); - pathname = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname : pathname + '/'); + pathname = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname : pathname + '/'; const currentUrl = `${rootUrl}${pathname}`; const { list, title } = await parseNewsList(currentUrl, '.list_news_dl2 li', ctx); diff --git a/lib/routes/gov/general/general.ts b/lib/routes/gov/general/general.ts index d0848c0e9..016d21bf7 100644 --- a/lib/routes/gov/general/general.ts +++ b/lib/routes/gov/general/general.ts @@ -101,7 +101,7 @@ const gdgov = async (info, ctx) => { path.splice(0, 2 + pathstartat); let pathname = path.join('/'); - pathname = pathname === '' ? defaultPath : (pathname.endsWith('/') ? pathname : pathname + '/'); + pathname = pathname === '' ? defaultPath : pathname.endsWith('/') ? pathname : pathname + '/'; const currentUrl = `${rootUrl}/${pathname}`; let $ = ''; diff --git a/lib/routes/hellogithub/report.ts b/lib/routes/hellogithub/report.ts index f2949c432..ca315f5ee 100644 --- a/lib/routes/hellogithub/report.ts +++ b/lib/routes/hellogithub/report.ts @@ -25,7 +25,7 @@ export const route: Route = { async function handler(ctx) { let type = ctx.req.param('type') ?? 'tiobe'; - type = type === 'webserver' ? 'netcraft' : (type === 'db' ? 'db-engines' : type); + type = type === 'webserver' ? 'netcraft' : type === 'db' ? 'db-engines' : type; const rootUrl = 'https://hellogithub.com'; const currentUrl = `${rootUrl}/report/${type}`; diff --git a/lib/routes/hostmonit/cloudflareyes.ts b/lib/routes/hostmonit/cloudflareyes.ts index 989dff1cb..3d1fd3113 100644 --- a/lib/routes/hostmonit/cloudflareyes.ts +++ b/lib/routes/hostmonit/cloudflareyes.ts @@ -62,7 +62,7 @@ async function handler(ctx) { const items = response.info.slice(0, limit).map((item) => { const ip = item.ip; const latency = item.latency === undefined ? undefined : `${item.latency}ms`; - const line = item.line === undefined ? undefined : (Object.hasOwn(lines, item.line) ? lines[item.line] : item.line); + const line = item.line === undefined ? undefined : Object.hasOwn(lines, item.line) ? lines[item.line] : item.line; const loss = item.loss === undefined ? undefined : `${item.loss}%`; const node = item.node; const speed = item.speed === undefined ? undefined : `${item.speed} KB/s`; diff --git a/lib/routes/hypergryph/arknights/announce.ts b/lib/routes/hypergryph/arknights/announce.ts index c45360cbb..f034de435 100644 --- a/lib/routes/hypergryph/arknights/announce.ts +++ b/lib/routes/hypergryph/arknights/announce.ts @@ -82,7 +82,7 @@ async function handler(ctx) { ); return { - title: `《明日方舟》${group === 'SYSTEM' ? '系统' : (group === 'ACTIVITY' ? '活动' : '全部')}公告`, + title: `《明日方舟》${group === 'SYSTEM' ? '系统' : group === 'ACTIVITY' ? '活动' : '全部'}公告`, link: 'https://ak.hypergryph.com/', item: items, }; diff --git a/lib/routes/japanpost/utils.ts b/lib/routes/japanpost/utils.ts index 794b764d2..a7261bd1b 100644 --- a/lib/routes/japanpost/utils.ts +++ b/lib/routes/japanpost/utils.ts @@ -57,10 +57,10 @@ const utils = { switch (l) { case 'ja': - customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate : (dayjs(t, formatJaDateTime, true).isValid() ? formatJaDateTime : undefined); + customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate : dayjs(t, formatJaDateTime, true).isValid() ? formatJaDateTime : undefined; break; case 'en': - customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : (dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined); + customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined; break; } diff --git a/lib/routes/meteor/index.ts b/lib/routes/meteor/index.ts index 3c0cc2028..5d83fdd40 100644 --- a/lib/routes/meteor/index.ts +++ b/lib/routes/meteor/index.ts @@ -58,7 +58,7 @@ async function handler(ctx) { return { title: `${board === 'all' ? '全部看板' : boardInfo.title} | Meteor 學生社群`, description: board === 'all' ? null : boardInfo.feedDescription, - image: board === 'all' ? null : (boardInfo.imgUrl === 'not_set' ? null : boardInfo.imgUrl), + image: board === 'all' ? null : boardInfo.imgUrl === 'not_set' ? null : boardInfo.imgUrl, link: `${board === 'all' ? `${baseUrl}/board/all` : boardInfo.link}/new`, item: items, }; diff --git a/lib/routes/mittrchina/index.ts b/lib/routes/mittrchina/index.ts index 38f160911..3c9631f78 100644 --- a/lib/routes/mittrchina/index.ts +++ b/lib/routes/mittrchina/index.ts @@ -80,10 +80,10 @@ async function handler(ctx) { type: article.address.split('.').pop(), }, }) - : (type === 'breaking' + : type === 'breaking' ? article.content - : article.summary), - pubDate: article.start_time ? parseDate(article.start_time, 'X') : (article.push_time ? parseDate(article.push_time, 'X') : undefined), + : article.summary, + pubDate: article.start_time ? parseDate(article.start_time, 'X') : article.push_time ? parseDate(article.push_time, 'X') : undefined, id: article.id, link: `https://www.mittrchina.com/news/detail/${article.id}`, })); diff --git a/lib/routes/oilchem/index.ts b/lib/routes/oilchem/index.ts index 104413d2c..a98e69b83 100644 --- a/lib/routes/oilchem/index.ts +++ b/lib/routes/oilchem/index.ts @@ -39,7 +39,7 @@ async function handler(ctx) { const route = category === '' ? '' : `/${category}${subCategory === '' ? '' : `/${subCategory}`}`; const rootUrl = `https://${type === '' ? 'www' : 'list'}.oilchem.net`; - const currentUrl = `${rootUrl}${type === '' ? '/1/' : (type === 'list' ? route : `/${routes[`/${type}${route}`]}`)}`; + const currentUrl = `${rootUrl}${type === '' ? '/1/' : type === 'list' ? route : `/${routes[`/${type}${route}`]}`}`; const response = await got({ method: 'get', diff --git a/lib/routes/oncc/money18.ts b/lib/routes/oncc/money18.ts index 0894c88f3..fb14a35f6 100644 --- a/lib/routes/oncc/money18.ts +++ b/lib/routes/oncc/money18.ts @@ -54,7 +54,7 @@ async function handler(ctx) { const toApiUrl = (date) => `${rootUrl}/cnt/utf8/content/${date}/articleList/list_${id}_all.js`; - let apiUrl = id === 'ipo' ? ipoApiUrl : (id === 'industry' ? industryApiUrl : toApiUrl(dayjs().format('YYYYMMDD'))), + let apiUrl = id === 'ipo' ? ipoApiUrl : id === 'industry' ? industryApiUrl : toApiUrl(dayjs().format('YYYYMMDD')), hasArticle = false, items = [], i = 0, diff --git a/lib/routes/questmobile/report.ts b/lib/routes/questmobile/report.ts index 17e3d21bc..273d8a209 100644 --- a/lib/routes/questmobile/report.ts +++ b/lib/routes/questmobile/report.ts @@ -173,7 +173,7 @@ async function handler(ctx) { const labels = parseTree(labelTree); const industryObj = industry ? industries.find((i) => i.key === industry || i.value === industry) : undefined; - const labelObj = label ? labels.find((i) => i.key === label || i.value === label) : (industryObj ? undefined : labels.find((i) => i.key === industry || i.value === industry)); + const labelObj = label ? labels.find((i) => i.key === label || i.value === label) : industryObj ? undefined : labels.find((i) => i.key === industry || i.value === industry); const industryId = industryObj?.key ?? -1; const labelId = labelObj?.key ?? -1; diff --git a/lib/routes/seekingalpha/index.ts b/lib/routes/seekingalpha/index.ts index dbc225a09..b76e288e2 100644 --- a/lib/routes/seekingalpha/index.ts +++ b/lib/routes/seekingalpha/index.ts @@ -64,7 +64,7 @@ async function handler(ctx) { 'filter[until]': 0, id: symbol.toLowerCase(), include: 'author,primaryTickers,secondaryTickers,sentiments', - 'page[size]': ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : (category === 'news' ? 40 : 20), + 'page[size]': ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : category === 'news' ? 40 : 20, 'page[number]': 1, }, }); diff --git a/lib/routes/sketis/isabelle-dev/blog/index.ts b/lib/routes/sketis/isabelle-dev/blog/index.ts index f90577f55..f2c39ec19 100644 --- a/lib/routes/sketis/isabelle-dev/blog/index.ts +++ b/lib/routes/sketis/isabelle-dev/blog/index.ts @@ -44,7 +44,7 @@ export const route: Route = { handler: async (ctx) => { const baseUrl = 'https://isabelle-dev.sketis.net'; const { blog } = ctx.req.param(); - const blogName = blog === '1' ? 'News' : (blog === '2' ? 'Release' : 'UNKNOWN'); + const blogName = blog === '1' ? 'News' : blog === '2' ? 'Release' : 'UNKNOWN'; const url = `${baseUrl}/phame/blog/view/${blog}/`; const response = await ofetch(url); const $ = load(response); diff --git a/lib/routes/telegram/channel.ts b/lib/routes/telegram/channel.ts index 0f814c5dd..c41b63884 100644 --- a/lib/routes/telegram/channel.ts +++ b/lib/routes/telegram/channel.ts @@ -515,7 +515,7 @@ async function handler(ctx) { const mapBackground = locationObj.find('.tgme_widget_message_location').css('background-image'); const mapBackgroundUrl = mapBackground && mapBackground.match(/url\('(.*)'\)/); const mapBackgroundUrlSrc = mapBackgroundUrl && mapBackgroundUrl[1]; - const mapImgHtml = mapBackgroundUrlSrc ? `` : (showMediaTagAsEmoji ? mediaTagDict[LOCATION][1] : mediaTagDict[LOCATION][0]); + const mapImgHtml = mapBackgroundUrlSrc ? `` : showMediaTagAsEmoji ? mediaTagDict[LOCATION][1] : mediaTagDict[LOCATION][0]; return locationLink ? `${mapImgHtml}` : mapImgHtml; } else { return ''; diff --git a/lib/routes/tesla/cx.ts b/lib/routes/tesla/cx.ts index 0bd9b293d..e4a9882cd 100644 --- a/lib/routes/tesla/cx.ts +++ b/lib/routes/tesla/cx.ts @@ -132,7 +132,7 @@ async function handler(ctx) { pageSize: limit, pageNumber: 0, benefitCategoryId: categoryObject?.id ?? undefined, - category: categoryObject ? undefined : (category === '充电免停' ? 2 : undefined), + category: categoryObject ? undefined : category === '充电免停' ? 2 : undefined, city, }, }); diff --git a/lib/routes/test/index.ts b/lib/routes/test/index.ts index 1752e2ab9..a4a744fe0 100644 --- a/lib/routes/test/index.ts +++ b/lib/routes/test/index.ts @@ -416,6 +416,6 @@ async function handler(ctx) { item, allowEmpty: ctx.req.param('id') === 'allow_empty', description: - ctx.req.param('id') === 'complicated' ? '' : (ctx.req.param('id') === 'multimedia' ? '' : 'A test route for RSSHub'), + ctx.req.param('id') === 'complicated' ? '' : ctx.req.param('id') === 'multimedia' ? '' : 'A test route for RSSHub', }; } diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index 291447f3f..766c7da68 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -254,7 +254,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { } quote += formatMedia(quoteData); picsPrefix += generatePicsPrefix(quoteData); - quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : (showSymbolForRetweetAndReply ? ' RT ' : ''); + quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : showSymbolForRetweetAndReply ? ' RT ' : ''; quoteInTitle += `${author.name}: ${formatText(quoteData)}`; if (readable) { @@ -286,15 +286,15 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { const isQuote = item.is_quote_status; if (!isRetweet && (!isQuote || showRetweetTextInTitle)) { if (item.in_reply_to_screen_name) { - title += showEmojiForRetweetAndReply ? '↩️ ' : (showSymbolForRetweetAndReply ? 'Re ' : ''); + title += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : ''; } title += replaceBreak(originalItem.full_text); } if (isRetweet) { - title += showEmojiForRetweetAndReply ? '🔁 ' : (showSymbolForRetweetAndReply ? 'RT ' : ''); + title += showEmojiForRetweetAndReply ? '🔁 ' : showSymbolForRetweetAndReply ? 'RT ' : ''; title += item.user.name + ': '; if (item.in_reply_to_screen_name) { - title += showEmojiForRetweetAndReply ? ' ↩️ ' : (showSymbolForRetweetAndReply ? ' Re ' : ''); + title += showEmojiForRetweetAndReply ? ' ↩️ ' : showSymbolForRetweetAndReply ? ' Re ' : ''; } title += replaceBreak(item.full_text); } @@ -330,7 +330,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { } description += ' '; } - description += showEmojiForRetweetAndReply ? '🔁' : (showSymbolForRetweetAndReply ? 'RT' : ''); + description += showEmojiForRetweetAndReply ? '🔁' : showSymbolForRetweetAndReply ? 'RT' : ''; if (!showAuthorInDesc) { description += ' '; if (readable) { @@ -373,7 +373,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { description += `: `; } if (item.in_reply_to_screen_name) { - description += showEmojiForRetweetAndReply ? '↩️ ' : (showSymbolForRetweetAndReply ? 'Re ' : ''); + description += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : ''; } description += item.full_text; diff --git a/lib/routes/whu/swrh.ts b/lib/routes/whu/swrh.ts index 277714e00..7af1dc1db 100644 --- a/lib/routes/whu/swrh.ts +++ b/lib/routes/whu/swrh.ts @@ -94,7 +94,7 @@ async function handler(ctx) { const response = await got(item.link); const $ = load(response.data); - return $('.v_news_content').length ? $('.v_news_content').html().trim() : ($('.prompt').length ? $('.prompt').html() : item.title); + return $('.v_news_content').length ? $('.v_news_content').html().trim() : $('.prompt').length ? $('.prompt').html() : item.title; } catch { return item.title; } diff --git a/lib/routes/xiaoyuzhou/pickup.ts b/lib/routes/xiaoyuzhou/pickup.ts index bce0d1165..2c0aef6df 100644 --- a/lib/routes/xiaoyuzhou/pickup.ts +++ b/lib/routes/xiaoyuzhou/pickup.ts @@ -57,7 +57,7 @@ const ProcessFeed = async () => { return playList.map((item) => { const title = item.episode.title + ' - ' + item.episode.podcast.title; const eid = item.episode.eid; - const itunes_item_image = item.episode.image ? item.episode.image.picUrl : (item.episode.podcast.image ? item.episode.podcast.image.picUrl : ''); + const itunes_item_image = item.episode.image ? item.episode.image.picUrl : item.episode.podcast.image ? item.episode.podcast.image.picUrl : ''; const link = `https://www.xiaoyuzhoufm.com/episode/${eid}`; const pubDate = item.pubDate; const itunes_duration = item.episode.duration;