From e733ec5f0e02bb1fb56605ac042858741f679ec7 Mon Sep 17 00:00:00 2001 From: guibescos <59208140+guibescos@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:52:40 +0000 Subject: [PATCH] close-airdrop (#278) --- frontend/middleware.js | 50 +++++++++--------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/frontend/middleware.js b/frontend/middleware.js index c7286f93..94770993 100644 --- a/frontend/middleware.js +++ b/frontend/middleware.js @@ -1,36 +1,10 @@ -import { NextResponse } from 'next/server' - -// Block visitors from these countries -const BLOCKED_COUNTRIES = [ - 'BY', - 'CF', - 'CD', - 'KP', - 'CU', - 'IR', - 'LY', - 'SO', - 'SD', - 'SY', - 'US', - 'GB', - 'YE', - 'ZW', -] - // Limit middleware pathname config export const config = { matcher: '/', } export function middleware(req) { - // Extract country - const country = req.geo.country - - if (BLOCKED_COUNTRIES.includes(country)) { - // Error 451: Unavailable For Legal Reasons - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451 - const body = ` + const body = ` -

Error 451: Unavailable For Legal Reasons

-

This Site is not available to residents of Belarus, the Central African Republic, The Democratic Republic of Congo, the Democratic People's Republic of Korea, the Crimea, Donetsk People's Republic, and Luhansk People's Republic regions of Ukraine, Cuba, Iran, Libya, Somalia, Sudan, South Sudan, Syria, the USA, the United Kingdom, Yemen, Zimbabwe and any other jurisdiction in which accessing or using the Site is prohibited (the "Prohibited Jurisdictions").

+

The airdrop claim period has ended

+

To stay in touch with future Pyth community initiatives head over to our Discord

` - // NextResponse object does not have a body property so we use Response instead - return new Response(body, { - status: 451, - headers: { - 'Content-Type': 'text/html', - }, - }) - } else { - // Continue with the request if the country is not blocked - return NextResponse.next() - } + // NextResponse object does not have a body property so we use Response instead + return new Response(body, { + status: 200, + headers: { + 'Content-Type': 'text/html', + }, + }) }