Finalized recaptcha
This commit is contained in:
parent
246a777878
commit
88b10d44ab
6 changed files with 17 additions and 12 deletions
1
.env
Normal file
1
.env
Normal file
|
@ -0,0 +1 @@
|
||||||
|
REACT_APP_APISERVER=https://api.audible-converter.ml
|
1
.env.development
Normal file
1
.env.development
Normal file
|
@ -0,0 +1 @@
|
||||||
|
REACT_APP_APISERVER=http://localhost:7172
|
1
.env.production
Normal file
1
.env.production
Normal file
|
@ -0,0 +1 @@
|
||||||
|
REACT_APP_APISERVER=https://api.audible-converter.ml
|
|
@ -27,7 +27,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"predeploy": "npm run build",
|
"predeploy": "npm run build",
|
||||||
"deploy": "gh-pages -d build",
|
"deploy": "gh-pages -d build",
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts --openssl-legacy-provider start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
|
|
@ -135,20 +135,22 @@ class ChecksumResolver extends React.Component {
|
||||||
requestActivationBytes = async () => {
|
requestActivationBytes = async () => {
|
||||||
const { checksum } = this.state
|
const { checksum } = this.state
|
||||||
|
|
||||||
const { executeRecaptcha } = (this.props)
|
const { executeRecaptcha } = this.props.googleReCaptchaProps
|
||||||
.googleReCaptchaProps;
|
|
||||||
|
|
||||||
if (!executeRecaptcha) {
|
if (!executeRecaptcha) {
|
||||||
console.log('Recaptcha has not been loaded');
|
console.log('Recaptcha has not been loaded')
|
||||||
|
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = await executeRecaptcha('homepage');
|
const token = await executeRecaptcha('homepage')
|
||||||
console.log(`XToken: ${token}`);
|
console.log(`XToken: ${token}`)
|
||||||
try {
|
try {
|
||||||
let request = await fetch(
|
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()
|
let result = await request.json()
|
||||||
const { success, activationBytes } = result
|
const { success, activationBytes } = result
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
GoogleReCaptcha,
|
GoogleReCaptcha,
|
||||||
} from 'react-google-recaptcha-v3'
|
} 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'),
|
console.log('Woke up, im ready to serve :D'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue