added a clear
This commit is contained in:
parent
60c76f1d55
commit
52dd12eec6
2 changed files with 8 additions and 0 deletions
|
|
@ -84,6 +84,11 @@ export async function allHandler(): Promise<string[] | { message: string }> {
|
||||||
return cachedResults.map(result => result.clientIP);
|
return cachedResults.map(result => result.clientIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function clearHandler(): Promise<string[] | { message: string }> {
|
||||||
|
cachedResults.splice(0, cachedResults.length); // Clear the cache and return the cleared results
|
||||||
|
return { message: 'Cache cleared successfully' };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detailed debug endpoint with all possible headers
|
* Detailed debug endpoint with all possible headers
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ export async function registerRoutes(fastify: FastifyInstance) {
|
||||||
// All endpoint for testing
|
// All endpoint for testing
|
||||||
fastify.get('/all', allHandler);
|
fastify.get('/all', allHandler);
|
||||||
|
|
||||||
|
// All endpoint for testing
|
||||||
|
fastify.get('/clear', clearHandler);
|
||||||
|
|
||||||
// Main detection endpoint - extracts all IPs from headers
|
// Main detection endpoint - extracts all IPs from headers
|
||||||
fastify.get('/', mainHandler);
|
fastify.get('/', mainHandler);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue