refetch stackoverflow rather than parsing supplied url

main
Lee Hanken 2022-11-05 02:58:50 +00:00
parent 5be51ddb7e
commit ca3226abf0
1 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,8 @@ const service = new turndown();
const apple_dev_prefix = "https://developer.apple.com"; const apple_dev_prefix = "https://developer.apple.com";
const stackoverflow_prefix = "https://stackoverflow.com";
const rateLimiter = rateLimit({ const rateLimiter = rateLimit({
windowMs: 30 * 1000, windowMs: 30 * 1000,
max: 5, max: 5,
@ -68,7 +70,8 @@ app.post('/', function(req, res) {
if (links) { if (links) {
ignore_links = (links === 'false'); ignore_links = (links === 'false');
} }
if (url && url.startsWith('https://stackoverflow.com/')) { if (url && validURL(url) && url.startsWith(stackoverflow_prefix)) {
send_headers(res);
read_url(url, res, inline_title, ignore_links); read_url(url, res, inline_title, ignore_links);
return; return;
} }