audible-tools.github.io/src/index.js

60 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-09-01 00:00:52 +02:00
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import * as serviceWorker from './serviceWorker'
import ChecksumResolver from './ChecksumResolver'
import ReactNotification from 'react-notifications-component'
2022-09-01 00:00:52 +02:00
import ForkMeOnGithub from 'fork-me-on-github'
2021-05-17 22:24:14 +02:00
2022-09-01 00:00:52 +02:00
import ReactGA from 'react-ga'
import {
GoogleReCaptchaProvider,
GoogleReCaptcha,
} from 'react-google-recaptcha-v3'
2020-08-06 00:06:17 +02:00
2022-09-22 11:44:51 +02:00
WakeUp()
2020-08-06 10:54:49 +02:00
2022-09-20 23:47:28 +02:00
ReactGA.initialize('UA-174657678-1')
ReactGA.pageview(window.location.pathname + window.location.search)
2020-08-06 00:06:17 +02:00
ReactDOM.render(
<div>
2022-09-01 00:00:52 +02:00
<GoogleReCaptchaProvider reCaptchaKey="6LeZhMMhAAAAAH2cwtbCRYys5WawPj4KS5pw-GNd">
{/* <GoogleReCaptcha
onVerify={(a, b, c) => {
console.log(`Token: ${a}`);
}}
/> */}
<div style={{ display: 'flex' }}>
<ReactNotification />
</div>
<ForkMeOnGithub
repo="https://github.com/audible-tools/audible-tools.github.io"
colorOctocat="black"
isPride
/>
<ChecksumResolver />
</GoogleReCaptchaProvider>
</div>,
2022-09-01 00:00:52 +02:00
document.getElementById('root'),
)
2020-08-06 00:06:17 +02:00
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
2022-09-01 00:00:52 +02:00
serviceWorker.unregister()
2022-09-18 23:37:29 +02:00
async function WakeUp() {
2022-09-22 11:44:51 +02:00
while (true) {
let timeout = 1000 * 10; // 10 seconds
try {
await fetch('https://api.audible-converter.ml/api/v2/WakeUpNeo')
console.log('Woke up')
} catch (ex) {
console.log('Error occured: ' + ex)
timeout = 500; // 0.5 seconds
}
await new Promise((r) => setTimeout(r, timeout))
2022-09-18 23:37:29 +02:00
}
}