From 6e26bbbf5f29e4c1eaa56c5dc41ab77c192d0cfb Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 21 Aug 2021 09:53:17 +0200 Subject: [PATCH] Changed the way visits entrys get compiled to enable provider visits count searches over the default api --- src/server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server.js b/src/server.js index 8698218..435dff5 100644 --- a/src/server.js +++ b/src/server.js @@ -75,24 +75,24 @@ fastify.decorate('verifyJWT', function async(request, reply, done) { //Automagic Amazn redirects on /a/ fastify.get('/a/:id', async (req, res) => { res.redirect(302, `https://amazon.de/dp/${req.params.id}`) - await knex('visits').insert({ shortcode: req.params.id, provider: 'a' }); + await knex('visits').insert({ shortcode: `a/${req.params.id}`, provider: 'a' }); }) //Automagic Youtube redirects on /yt/ fastify.get('/yt/:id', async (req, res) => { res.redirect(302, `https://youtu.be/${req.params.id}`) - await knex('visits').insert({ shortcode: req.params.id, provider: 'yt' }); + await knex('visits').insert({ shortcode: `yt/${req.params.id}`, provider: 'yt' }); }) //Automagic Youtube Playlist redirects on /ytpl/ fastify.get('/ytpl/:id', async (req, res) => { res.redirect(302, `https://youtube.com/playlist?list=${req.params.id}`) - await knex('visits').insert({ shortcode: req.params.id, provider: 'ytpl' }); + await knex('visits').insert({ shortcode: `ytpl/${req.params.id}`, provider: 'ytpl' }); }) //Automagic ebay item redirects on /e/ fastify.get('/e/:id', async (req, res) => { res.redirect(302, `https://ebay.de/itm/${req.params.id}`) - await knex('visits').insert({ shortcode: req.params.id, provider: 'e' }); + await knex('visits').insert({ shortcode: `e/${req.params.id}`, provider: 'e' }); }) //Normal shorturls