mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 05:03:44 +08:00
fix(route): invalid url (#11597)
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||||||
starred: 'Most stars',
|
starred: 'Most stars',
|
||||||
all: 'All',
|
all: 'All',
|
||||||
};
|
};
|
||||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowHost.includes(new URL(host).hostname)) {
|
if (!config.feature.allow_user_supply_unsafe_domain && !allowHost.includes(new URL(`https://${host}/`).hostname)) {
|
||||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ const { parseDate } = require('@/utils/parse-date');
|
|||||||
const { art } = require('@/utils/render');
|
const { art } = require('@/utils/render');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const config = require('@/config').value;
|
const config = require('@/config').value;
|
||||||
const allowDomain = ['btbtt15.com'];
|
const allowDomain = ['2btjia.com', '88btbtt.com', 'btbtt15.com', 'btbtt20.com'];
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
let category = ctx.params.category ?? '';
|
let category = ctx.params.category ?? '';
|
||||||
let domain = ctx.query.domain ?? 'btbtt15.com';
|
let domain = ctx.query.domain ?? 'btbtt15.com';
|
||||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(new URL(domain).hostname)) {
|
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(new URL(`http://${domain}/`).hostname)) {
|
||||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
|||||||
const rootUrl = `https://www.${domain}`;
|
const rootUrl = `https://www.${domain}`;
|
||||||
const westernUrl = `https://www.${westernDomain}`;
|
const westernUrl = `https://www.${westernDomain}`;
|
||||||
|
|
||||||
if (!config.feature.allow_user_supply_unsafe_domain && (!allowDomain.includes(new URL(domain).hostname) || !allowDomain.includes(new URL(westernDomain).hostname))) {
|
if (!config.feature.allow_user_supply_unsafe_domain && (!allowDomain.includes(new URL(`https://${domain}/`).hostname) || !allowDomain.includes(new URL(`https://${westernDomain}/`).hostname))) {
|
||||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const allowDomain = ['javdb.com', 'javdb36.com', 'javdb007.com'];
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
ProcessItems: async (ctx, currentUrl, title) => {
|
ProcessItems: async (ctx, currentUrl, title) => {
|
||||||
const domain = ctx.query.domain ?? 'javdb.com';
|
const domain = ctx.query.domain ?? 'javdb.com';
|
||||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(new URL(domain).hostname)) {
|
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(new URL(`https://${domain}/`).hostname)) {
|
||||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user