style: auto format
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user