mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-09-25 10:15:40 -05:00
fix: fixed IP fetching for nuxt dev
This commit is contained in:
@@ -39,10 +39,7 @@ export function createRatelimitBucket(ops: RatelimitBucketOptions) {
|
||||
|
||||
export async function enforceRatelimit(event: H3Event, bucket: RateLimiterAbstract): Promise<void> {
|
||||
const config = useRuntimeConfig();
|
||||
const ip = getRequestIP(event, { xForwardedFor: !!config.trustProxy });
|
||||
if (!ip) {
|
||||
throw new Error('Could not get IP for request');
|
||||
}
|
||||
const ip = getRequestIP(event, { xForwardedFor: !!config.trustProxy }) ?? '127.0.0.1'; // nuxt dev returns undefined
|
||||
|
||||
try {
|
||||
await bucket.consume(ip, 1);
|
||||
|
||||
Reference in New Issue
Block a user