Skip to content

Commit 20b666d

Browse files
committed
fix turnstile
1 parent a0d6c21 commit 20b666d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/AppHelmet.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export default function AppHelmet() {
2222
if (
2323
location.pathname.startsWith('/tempPassword') ||
2424
location.pathname.startsWith('/resetPassword') ||
25-
location.pathname === '/register'
25+
location.pathname === '/register' ||
26+
location.pathname === '/turnstile'
2627
) {
2728
return;
2829
} else {

src/pages/TurnstileBridge.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useRef } from 'react';
2+
import { useSearchParams } from 'react-router-dom';
23

3-
const SITE_KEY = import.meta.env.VITE_TURNSTILE_SITE_KEY as string;
4+
const DEFAULT_SITE_KEY = import.meta.env.VITE_TURNSTILE_SITE_KEY as string;
45

56
declare global {
67
interface Window {
@@ -11,6 +12,10 @@ declare global {
1112

1213
export default function TurnstileBridge() {
1314
const containerRef = useRef<HTMLDivElement | null>(null);
15+
const [searchParams] = useSearchParams();
16+
17+
// Получаем sitekey из URL параметров или используем значение по умолчанию
18+
const siteKey = searchParams.get('sitekey') || DEFAULT_SITE_KEY;
1419

1520
useEffect(() => {
1621
const script = document.createElement('script');
@@ -36,7 +41,7 @@ export default function TurnstileBridge() {
3641

3742
if (containerRef.current && ts) {
3843
ts.render(containerRef.current, {
39-
sitekey: SITE_KEY,
44+
sitekey: siteKey,
4045
callback: (token: string) => {
4146
window.location.href =
4247
'ethoraappreactnative://turnstile?token=' +

0 commit comments

Comments
 (0)