Compare commits
No commits in common. "567ac07612092c4acfa133690f07098fa629522f" and "55d6b91cc252ee6676d13df9abd8b61283a07f0f" have entirely different histories.
567ac07612
...
55d6b91cc2
3
.env
3
.env
@ -1,4 +1,3 @@
|
||||
SSL=true
|
||||
DOMAIN=kauft.es
|
||||
SSL=false
|
||||
DISABLE_PROVIDERS=false
|
||||
ENABLE_REGISTER=true
|
@ -221,7 +221,7 @@ fastify.after(() => {
|
||||
});
|
||||
|
||||
//Get url api route
|
||||
fastify.delete('/api/:shortcode', { onRequest: fastify.basicAuth }, async (req, res) => {
|
||||
fastify.delete('/api/:shortcode', async (req, res) => {
|
||||
const shortcode = req.params.shortcode;
|
||||
|
||||
//This should never happen but better safe than 500
|
||||
@ -237,23 +237,6 @@ fastify.after(() => {
|
||||
return true;
|
||||
});
|
||||
|
||||
//Get all urls api route
|
||||
fastify.get('/api', { onRequest: fastify.basicAuth }, async (req, res) => {
|
||||
urls = await knex.select('target', 'shortcode')
|
||||
.from('urls');
|
||||
|
||||
for (let url of urls) {
|
||||
url.url = `${config.getBaseUrl()}/${url.shortcode}`
|
||||
if(req.query.showVisits){
|
||||
url.visits = (await knex.select('timestamp')
|
||||
.from('visits')
|
||||
.where('shortcode', '=', url.shortcode)).length;
|
||||
}
|
||||
}
|
||||
|
||||
return urls;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user