Getters now return the no_preview status
This commit is contained in:
parent
33d7c94648
commit
e5b8557e4c
|
@ -220,7 +220,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
|
||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exists = await knex.select('shortcode', 'target')
|
const exists = await knex.select('shortcode', 'target', 'no_preview')
|
||||||
.from('urls')
|
.from('urls')
|
||||||
.where('shortcode', '=', shortcode)
|
.where('shortcode', '=', shortcode)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
@ -236,6 +236,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
|
||||||
url: `${config.getBaseUrl()}/${exists[0].shortcode}`,
|
url: `${config.getBaseUrl()}/${exists[0].shortcode}`,
|
||||||
shortcode: exists[0].shortcode,
|
shortcode: exists[0].shortcode,
|
||||||
target: exists[0].target,
|
target: exists[0].target,
|
||||||
|
no_preview: exists[0].no_preview,
|
||||||
visits: visits.length
|
visits: visits.length
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -322,7 +323,7 @@ fastify.after(() => {
|
||||||
|
|
||||||
//Get all urls api route
|
//Get all urls api route
|
||||||
fastify.get('/api', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
fastify.get('/api', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
||||||
urls = await knex.select('target', 'shortcode')
|
urls = await knex.select('target', 'shortcode', 'no_preview')
|
||||||
.from('urls');
|
.from('urls');
|
||||||
|
|
||||||
for (let url of urls) {
|
for (let url of urls) {
|
||||||
|
|
Loading…
Reference in New Issue