Skip to content

Commit

Permalink
✨middleware: add disclaimer message
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalat committed Jul 11, 2023
1 parent d4d0408 commit 0d04b06
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';

const html = `
<html>
<title>Exactly</title>
<body style="max-width: 600px; margin: 32px auto 0 auto">
<h1>Disclaimer</h1>
<p>
Exactly is an open source, non-custodial protocol that operates on both the Ethereum Mainnet (L1)
and Optimism roll-up (L2) networks. The protocol is designed to bring fixed-income solutions for
lenders and borrowers (the "Platform"). The Platform will permit its users, among other things, enter
into certain transaction involving digital assets (including but not limited to digital loans and credit products)
(the "Digital Assets Services").
</p>
<p>
The Platform does not allow it use by, or operates in any way with, US Persons. US Persons are prohibited
from accessing and using the Digital Asset Services in any way. If Exactly has a reasonable suspicion that you
are a US Person, we reserve the right to take whatever action we deem appropriate to prohibit your access to the
Digital Asset Services. For purposes herein "US Person" shall mean any United States citizen or alien admitted for
permanent residence in the United States, and any corporation, partnership, or other organization organized under
the laws of the United States.
</p>
</body>
</html>
`;

export function middleware(req: NextRequest) {
const country = req.geo?.country;

if (country === 'US') {
return new Response('Blocked for legal reasons', { status: 451 });
return new Response(html, { headers: { 'Content-Type': 'text/html' }, status: 451 });
}

return NextResponse.next();
Expand Down

0 comments on commit 0d04b06

Please sign in to comment.