Finalized recaptcha

This commit is contained in:
JKamsker 2022-09-18 23:27:29 +02:00
parent 246a777878
commit 88b10d44ab
6 changed files with 17 additions and 12 deletions

1
.env Normal file
View file

@ -0,0 +1 @@
REACT_APP_APISERVER=https://api.audible-converter.ml

1
.env.development Normal file
View file

@ -0,0 +1 @@
REACT_APP_APISERVER=http://localhost:7172

1
.env.production Normal file
View file

@ -0,0 +1 @@
REACT_APP_APISERVER=https://api.audible-converter.ml

View file

@ -27,7 +27,7 @@
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"

View file

@ -135,20 +135,22 @@ class ChecksumResolver extends React.Component {
requestActivationBytes = async () => {
const { checksum } = this.state
const { executeRecaptcha } = (this.props)
.googleReCaptchaProps;
const { executeRecaptcha } = this.props.googleReCaptchaProps
if (!executeRecaptcha) {
console.log('Recaptcha has not been loaded');
console.log('Recaptcha has not been loaded')
return;
return
}
const token = await executeRecaptcha('homepage');
console.log(`XToken: ${token}`);
const token = await executeRecaptcha('homepage')
console.log(`XToken: ${token}`)
try {
let request = await fetch(
'https://api.audible-converter.ml/api/v2/activation/' + checksum,
`${process.env.REACT_APP_APISERVER}/api/v2/activation/${checksum}`,
{
headers: new Headers({'x-captcha-result': token})
},
)
let result = await request.json()
const { success, activationBytes } = result

View file

@ -12,7 +12,7 @@ import {
GoogleReCaptcha,
} from 'react-google-recaptcha-v3'
fetch('https://api.audible-converter.ml/api/v2/WakeUpNeo').then((data) =>
fetch(`${process.env.REACT_APP_APISERVER}/api/v2/WakeUpNeo`).then((data) =>
console.log('Woke up, im ready to serve :D'),
)