Skip to content

Commit 4a47be9

Browse files
authored
[Human App FE] fix: added custom props for hcaptcha labeling widget (#3698)
1 parent 50b92e0 commit 4a47be9

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/apps/human-app/frontend/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ VITE_DAILY_SOLVED_CAPTCHA_LIMIT=0
1515
VITE_HMT_DAILY_SPENT_LIMIT=0
1616

1717
# hCaptcha annotation tool
18+
VITE_H_CAPTCHA_EXCHANGE_URL=replace_me
19+
VITE_H_CAPTCHA_LABELING_BASE_URL=replace_me
1820
VITE_H_CAPTCHA_ORACLE_ADDRESS=replace_me
1921
VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL=hcaptcha
2022
VITE_H_CAPTCHA_ORACLE_ROLE=hcaptcha

packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,13 @@ export function HcaptchaLabelingPage() {
145145
<Grid container sx={{ width: '100%', justifyContent: 'center' }}>
146146
<HCaptcha
147147
custom
148-
sitekey={user.site_key || env.VITE_H_CAPTCHA_SITE_KEY}
149-
theme={isDarkMode ? 'dark' : 'light'}
148+
// @ts-expect-error -- this props are not defined by TS by are used for enterprise version: https://github.com/hCaptcha/react-hcaptcha?tab=readme-ov-file#references
149+
endpoint={env.VITE_H_CAPTCHA_EXCHANGE_URL}
150150
onVerify={hcaptchaOnSuccess}
151151
ref={captchaRef}
152+
reportapi={env.VITE_H_CAPTCHA_LABELING_BASE_URL}
153+
sitekey={user.site_key ?? ''}
154+
theme={isDarkMode ? 'dark' : 'light'}
152155
/>
153156
</Grid>
154157
) : (

packages/apps/human-app/frontend/src/shared/env.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const envSchema = z.object({
1818
.string()
1919
.transform((value) => Number(value))
2020
.pipe(z.number()),
21+
VITE_H_CAPTCHA_EXCHANGE_URL: z.string(),
22+
VITE_H_CAPTCHA_LABELING_BASE_URL: z.string(),
2123
VITE_WALLET_CONNECT_PROJECT_ID: z.string(),
2224
VITE_DAPP_META_NAME: z.string(),
2325
VITE_DAPP_META_DESCRIPTION: z.string(),

0 commit comments

Comments
 (0)