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