-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Improve protection logic #1732
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
'ic-ip-address': | ||
req.headers.get('cf-connecting-ip') ?? | ||
req.headers.get('x-forwarded-for') ?? | ||
undefined, | ||
'ic-ip-country': | ||
req.headers.get('cf-ipcountry') ?? | ||
req.headers.get('x-vercel-ip-country') ?? | ||
undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fallbacks are there so the code works on preview deployments (i.e. not passing through the cloudflare proxy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm. 🔒
@@ -97,10 +103,22 @@ export function SmartTradeButton(props: SmartTradeButtonProps) { | |||
const [warnings, setWarnings] = useState<WarningType[]>([]) | |||
|
|||
useEffect(() => { | |||
if (!isTradablePair && !hiddenWarnings?.includes(WarningType.restricted)) { | |||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im thinking there is no effect here, so instead of an effect and a state you could just use useMemo, and return the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tokdaniel good call, updated to useMemo
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smol comment, otherwise lgtm
Updates the protection provider to leverage the new API endpoint to check for restricted countries/VPN usage, and adds new messaging for VPN users.