feat(config)!: unsafe domain toggle (#11588)

This commit is contained in:
Tony
2023-01-10 11:45:05 +00:00
committed by GitHub
parent ab2f61824d
commit a66cbcf6ee
66 changed files with 338 additions and 15 deletions

View File

@@ -1,7 +1,11 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
const config = require('@/config').value;
module.exports = async (ctx) => {
if (!config.feature.allow_user_supply_unsafe_domain) {
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
}
const url = `http://${ctx.params.url}`;
const res = await got.get(`${url}/archives/`);
const $ = cheerio.load(res.data);