style: auto format

This commit is contained in:
github-actions[bot]
2024-07-15 08:48:54 +00:00
parent 3a13acc01b
commit 4946edf97d
9 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ async function handler(ctx) {
}
const meta = JSON.parse($('[type=application/ld+json]').last().text());
item.author = meta.author ? meta.author.name ?? meta.author.map((a) => a.name).join(', ') : null;
item.author = meta.author ? (meta.author.name ?? meta.author.map((a) => a.name).join(', ')) : null;
item.category = meta.keywords;
return item;
+1 -1
View File
@@ -72,7 +72,7 @@ async function handler(ctx) {
? item.catalogNs.mappings[0].pageSlug
: 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;
}
+1 -1
View File
@@ -61,7 +61,7 @@ const processItems = async (apiUrl, limit, ...searchParams) => {
column,
item.event_type,
item.is_hot ? constants.labelHot : undefined,
item.is_important ? item.important_tag?.name ?? constants.labelImportant : '',
item.is_important ? (item.important_tag?.name ?? constants.labelImportant) : '',
item.label,
...(item.tags?.map((c) => c.name) ?? []),
].filter((v, index, self) => v && self.indexOf(v) === index);
+1 -1
View File
@@ -234,7 +234,7 @@ const getFilterByKeyAndKeyword = async (key, keyword) => {
const getFilterKeyForSearchParams = (key, isApi = false) => {
const keys = isApi ? filterApiKeys : filterKeys;
return Object.hasOwn(keys, key) ? keys[key] ?? key : undefined;
return Object.hasOwn(keys, key) ? (keys[key] ?? key) : undefined;
};
/**
+1 -1
View File
@@ -101,7 +101,7 @@ async function handler(ctx: Context): Promise<Data> {
});
return {
title: status ? titleMap[status] ?? 'ZeroDay' : '活動中',
title: status ? (titleMap[status] ?? 'ZeroDay') : '活動中',
link: url,
item: items,
image: 'https://zeroday.hitcon.org/images/favicon/favicon.png',
+1 -1
View File
@@ -376,7 +376,7 @@ const processItems = async (items, limit, tryGet) => {
}),
author: item.user_info?.username ?? item.brief_column?.name ?? item.author_info?.username ?? item.author,
guid,
pubDate: item.publish_time ?? item.dateline ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined,
pubDate: (item.publish_time ?? item.dateline) ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined,
upvotes: Number.parseInt(upvotes, 10),
downvotes: Number.parseInt(downvotes, 10),
comments: Number.parseInt(comments, 10),
+1 -1
View File
@@ -35,7 +35,7 @@ export const route: Route = {
async function handler(ctx) {
const language = ctx.req.param('language') ?? 'china';
const keyword = ctx.req.param('keyword') === 'RSS' ? 'rss' : ctx.req.param('keyword') ?? '';
const keyword = ctx.req.param('keyword') === 'RSS' ? 'rss' : (ctx.req.param('keyword') ?? '');
// raise error for invalid languages
if (!['china', 'tchina'].includes(language)) {
+1 -1
View File
@@ -120,7 +120,7 @@ async function handler(ctx?: Context) {
data = data.filter((item) => item.type === versionType);
}
const title = `Minecraft Java版${versionType === 'all' ? '' : typeName[versionType] ?? versionType}游戏更新`;
const title = `Minecraft Java版${versionType === 'all' ? '' : (typeName[versionType] ?? versionType)}游戏更新`;
return {
title,
+1 -1
View File
@@ -239,7 +239,7 @@ const getFilterByKeyAndKeyword = async (key: string, keyword: string, rootUrl: s
const getFilterKeyForSearchParams = (key: string, isApi: boolean = false): string | undefined => {
const keys = isApi ? filterApiKeys : filterKeys;
return Object.hasOwn(keys, key) ? keys[key] ?? key : undefined;
return Object.hasOwn(keys, key) ? (keys[key] ?? key) : undefined;
};
/**