mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): javdb (#12818)
This commit is contained in:
@@ -7,7 +7,8 @@ const allowDomain = ['javdb.com', 'javdb36.com', 'javdb007.com'];
|
||||
module.exports = {
|
||||
ProcessItems: async (ctx, currentUrl, title) => {
|
||||
const domain = ctx.query.domain ?? 'javdb.com';
|
||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(new URL(`https://${domain}/`).hostname)) {
|
||||
const url = new URL(currentUrl, `https://${domain}`);
|
||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(url.hostname)) {
|
||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
}
|
||||
|
||||
@@ -15,7 +16,7 @@ module.exports = {
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${rootUrl}${currentUrl}`,
|
||||
url: url.href,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
@@ -68,11 +69,11 @@ module.exports = {
|
||||
);
|
||||
|
||||
const htmlTitle = $('title').text();
|
||||
const subject = htmlTitle.indexOf('|') === -1 ? '' : htmlTitle.split('|')[0];
|
||||
const subject = htmlTitle.includes('|') ? htmlTitle.split('|')[0] : '';
|
||||
|
||||
return {
|
||||
title: subject === '' ? title : `${subject} - ${title}`,
|
||||
link: `${rootUrl}${currentUrl}`,
|
||||
link: url.href,
|
||||
item: items,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user