fix(route): normalize Bilibili mall image URLs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
|
||||
const resolveImageUrl = (imageUrl: string) => (imageUrl.startsWith('//') ? `https:${imageUrl}` : imageUrl);
|
||||
|
||||
export const route: Route = {
|
||||
path: '/mall/new/:category?',
|
||||
categories: ['social-media'],
|
||||
@@ -46,7 +48,7 @@ async function handler(ctx) {
|
||||
link: 'https://mall.bilibili.com/newdate.html?noTitleBar=1&page=new&from=new_product&loadingShow=1',
|
||||
item: items.map((item) => ({
|
||||
title: item.name,
|
||||
description: `${item.name}<br>${item.priceDesc ? `${item.pricePrefix}${item.priceSymbol}${item.priceDesc[0]}` : ''}<br><img src="https:${item.img}"><br><a href="${item.itemUrl}">APP 内打开</a>`,
|
||||
description: `${item.name}<br>${item.priceDesc ? `${item.pricePrefix}${item.priceSymbol}${item.priceDesc[0]}` : ''}<br><img src="${resolveImageUrl(item.img)}"><br><a href="${item.itemUrl}">APP 内打开</a>`,
|
||||
link: item.itemUrlForH5,
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user