From ca3226abf0f70e8971f9bc01a9b434e816c11aab Mon Sep 17 00:00:00 2001 From: Lee Hanken Date: Sat, 5 Nov 2022 02:58:50 +0000 Subject: [PATCH] refetch stackoverflow rather than parsing supplied url --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ea4c8ef..3bfce13 100755 --- a/index.js +++ b/index.js @@ -17,6 +17,8 @@ const service = new turndown(); const apple_dev_prefix = "https://developer.apple.com"; +const stackoverflow_prefix = "https://stackoverflow.com"; + const rateLimiter = rateLimit({ windowMs: 30 * 1000, max: 5, @@ -68,7 +70,8 @@ app.post('/', function(req, res) { if (links) { 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); return; }