diff --git a/lib/v2/javdb/utils.js b/lib/v2/javdb/utils.js index e6dd932762..c44c6bfb20 100644 --- a/lib/v2/javdb/utils.js +++ b/lib/v2/javdb/utils.js @@ -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, }; },