From 8ec4dc09baac1338dbac9ff095f8b820f6873531 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Mon, 6 Jan 2020 22:23:18 +0200 Subject: [PATCH] i cant fucking local test this thing --- applications/tempfiles/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/tempfiles/index.js b/applications/tempfiles/index.js index 267d375..6d39ff7 100644 --- a/applications/tempfiles/index.js +++ b/applications/tempfiles/index.js @@ -167,7 +167,7 @@ async function init () { // Simple URL validator try { let a = new URL(url) - if (a.protocol.indexOf('http') !== 0 || a.protocol.indexOf('ftp') !== -1) { + if (a.protocol.indexOf('http') !== 0 && a.protocol.indexOf('ftp') !== -1) { throw new Error('Unsupported protocol') } } catch (e) { @@ -200,6 +200,10 @@ async function init () { res.send(resp) }) + router.get('/shorten', (req, res) => { + res.send('

Basic URL Shortener

') + }) + router.get('/shorten/:hash', async (req, res) => { let hash = req.params.hash let db = await dbPromise @@ -208,10 +212,6 @@ async function init () { res.redirect(get.url) }) - router.get('/shorten', (req, res) => { - res.send('

Basic URL Shortener

') - }) - return router }