ship it with all

This commit is contained in:
Bojan Kucera 2025-06-06 23:30:36 -04:00
parent 1e2e25650d
commit 60c76f1d55
2 changed files with 15 additions and 4 deletions

View file

@ -77,6 +77,13 @@ export async function randomHandler(): Promise<ApiResponse | { message: string }
return cachedResults[randomIndex];
}
export async function allHandler(): Promise<string[] | { message: string }> {
if (cachedResults.length === 0) {
return { message: 'No data yet' };
}
return cachedResults.map(result => result.clientIP);
}
/**
* Detailed debug endpoint with all possible headers
*/

View file

@ -6,7 +6,8 @@ import { FastifyInstance } from 'fastify';
import {
healthHandler,
mainHandler,
randomHandler,
randomHandler,
allHandler,
detailedDebugHandler
} from './handlers';
@ -20,9 +21,12 @@ export async function registerRoutes(fastify: FastifyInstance) {
// Detailed debug endpoint (bypasses authentication)
fastify.get('/ip-debug-detailed', detailedDebugHandler);
// Main detection endpoint - extracts all IPs from headers
fastify.get('/', mainHandler);
// Random endpoint for testing
fastify.get('/random', randomHandler);
// All endpoint for testing
fastify.get('/all', allHandler);
// Main detection endpoint - extracts all IPs from headers
fastify.get('/', mainHandler);
}