-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Blocked as default } from "../../components/Blocked"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { LinkButton } from "../Button"; | ||
|
||
export const Blocked = () => ( | ||
<main className="grid size-full place-content-center py-20 text-center"> | ||
<h1 className="mb-8 text-4xl font-semibold text-pythpurple-400"> | ||
{"We're sorry"} | ||
</h1> | ||
<p className="mb-20 text-lg"> | ||
This program is currently unavailable to users in your region | ||
</p> | ||
<LinkButton | ||
className="place-self-center px-24 py-3" | ||
href="https://www.pyth.network" | ||
target="_blank" | ||
> | ||
Read More About Pyth | ||
</LinkButton> | ||
</main> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
"use client"; | ||
|
||
import clsx from "clsx"; | ||
import type { HTMLAttributes } from "react"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { type NextRequest, NextResponse } from "next/server"; | ||
|
||
import { BLOCKED_SEGMENT } from "./config/isomorphic"; | ||
import { BLOCKED_REGIONS } from "./config/server"; | ||
|
||
export const middleware = (request: NextRequest) => { | ||
if (blockRequest(request)) { | ||
return NextResponse.rewrite(new URL(`/${BLOCKED_SEGMENT}`, request.url)); | ||
} else if (request.nextUrl.pathname.startsWith("/blocked")) { | ||
return NextResponse.rewrite(new URL("/not-found", request.url)); | ||
} else { | ||
return; | ||
} | ||
}; | ||
|
||
const blockRequest = (request: NextRequest) => | ||
request.geo?.country !== undefined && | ||
BLOCKED_REGIONS.includes(request.geo.country.toLowerCase()); | ||
|
||
export const config = { | ||
matcher: [ | ||
"/((?!_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)", | ||
], | ||
}; |