Private
Public Access
1
0

chg: usr: add ReCaptcha overlay again to protect the game #7

This commit is contained in:
2026-04-19 21:31:08 +02:00
parent db37ab45b2
commit 51bd909879
5 changed files with 135 additions and 90 deletions

View File

@@ -7,14 +7,18 @@
* file that was distributed with this source code.
*/
import React from 'react';
import React, { useState } from 'react';
import { useGame } from '@mine-contexts';
import { useServerCommunication } from '@mine-hooks';
import CaptchaOverlay from './CaptchaOverlay';
import GridControl from './grid/GridControl';
export const GameBoard = ({ gameAssoc, gameInherited, opponentName = '', isEnvDev }) => {
const { gridReady } = useGame();
const { onClick, resign } = useServerCommunication(gameAssoc, gameInherited, opponentName, isEnvDev);
const [captchaVerified, setCaptchaVerified] = useState(false);
const siteKey = document.getElementById('mine-wrapper')?.dataset.recaptchaSiteKey;
if (!gridReady) {
return (
@@ -24,6 +28,12 @@ export const GameBoard = ({ gameAssoc, gameInherited, opponentName = '', isEnvDe
);
}
if (!captchaVerified && siteKey) {
return (
<CaptchaOverlay siteKey={siteKey} onVerified={() => setCaptchaVerified(true)} />
);
}
return (
<GridControl
gameAssoc={gameAssoc}