feat(api): deprecate v1 endpoints
This commit is contained in:
parent
c230bf1c4d
commit
fd5ad33219
@ -1,17 +1,14 @@
|
|||||||
import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
||||||
import fetch from 'node-fetch';
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This API route is no longer supported. Please use a newer version
|
||||||
|
*/
|
||||||
export default (server: FastifyInstance, options: RouteShorthandOptions, done: () => void) => {
|
export default (server: FastifyInstance, options: RouteShorthandOptions, done: () => void) => {
|
||||||
server.get('/entries/', async (request, reply) => {
|
server.get('/entries/', async (request, reply) => {
|
||||||
try {
|
reply.send({
|
||||||
const repositoryUrl = 'https://raw.githubusercontent.com/wanhose/cookie-dialog-monster/main';
|
success: false,
|
||||||
const dataUrl = `${repositoryUrl}/data/elements.txt`;
|
errors: ['This API route is no longer supported. Please use a newer version'],
|
||||||
const entriesLength = (await (await fetch(dataUrl)).text()).split('\n').length;
|
});
|
||||||
|
|
||||||
reply.send({ entries: entriesLength, success: true });
|
|
||||||
} catch {
|
|
||||||
reply.send({ success: false });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -1,31 +1,15 @@
|
|||||||
import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
||||||
|
|
||||||
type PostReportBody = {
|
/**
|
||||||
html?: string;
|
* @deprecated This API route is no longer supported. Please use a newer version
|
||||||
subject: string;
|
*/
|
||||||
text?: string;
|
|
||||||
to: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default (server: FastifyInstance, options: RouteShorthandOptions, done: () => void) => {
|
export default (server: FastifyInstance, options: RouteShorthandOptions, done: () => void) => {
|
||||||
server.post<{ Body: PostReportBody }>(
|
server.post('/report/', {}, async (_request, reply) => {
|
||||||
'/report/',
|
reply.send({
|
||||||
{
|
success: false,
|
||||||
schema: {
|
errors: ['This API route is no longer supported. Please use a newer version'],
|
||||||
body: {
|
});
|
||||||
properties: {},
|
});
|
||||||
required: [],
|
|
||||||
type: 'object',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
async (_request, reply) => {
|
|
||||||
reply.status(500).send({
|
|
||||||
success: false,
|
|
||||||
errors: ['This API route is no longer supported. Please upgrade to the latest version'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user