Added path for autoresolve

This commit is contained in:
JKamsker 2022-09-19 23:55:06 +02:00
parent 70a4e2a474
commit 73c2360acd
3 changed files with 103 additions and 32 deletions

96
package-lock.json generated
View file

@ -24,6 +24,8 @@
"react-ga": "^3.3.0", "react-ga": "^3.3.0",
"react-google-recaptcha-v3": "^1.10.0", "react-google-recaptcha-v3": "^1.10.0",
"react-notifications-component": "^3.1.0", "react-notifications-component": "^3.1.0",
"react-router": "^6.4.0",
"react-router-dom": "^6.4.0",
"react-scripts": "^4.0.3", "react-scripts": "^4.0.3",
"reactstrap": "^8.9.0", "reactstrap": "^8.9.0",
"typescript": "^4.2.3" "typescript": "^4.2.3"
@ -3006,6 +3008,14 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@remix-run/router": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.0.tgz",
"integrity": "sha512-SCR1cxRSMNKjaVYptCzBApPDqGwa3FGdjVHc+rOToocNPHQdIYLZBfv/3f+KvYuXDkUGVIW9IAzmPNZDRL1I4A==",
"engines": {
"node": ">=14"
}
},
"node_modules/@rollup/plugin-node-resolve": { "node_modules/@rollup/plugin-node-resolve": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz",
@ -18742,6 +18752,35 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/react-router": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.0.tgz",
"integrity": "sha512-B+5bEXFlgR1XUdHYR6P94g299SjrfCBMmEDJNcFbpAyRH1j1748yt9NdDhW3++nw1lk3zQJ6aOO66zUx3KlTZg==",
"dependencies": {
"@remix-run/router": "1.0.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"react": ">=16.8"
}
},
"node_modules/react-router-dom": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.0.tgz",
"integrity": "sha512-4Aw1xmXKeleYYQ3x0Lcl2undHR6yMjXZjd9DKZd53SGOYqirrUThyUb0wwAX5VZAyvSuzjNJmZlJ3rR9+/vzqg==",
"dependencies": {
"react-router": "6.4.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
}
},
"node_modules/react-scripts": { "node_modules/react-scripts": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
@ -26305,8 +26344,7 @@
"@material-ui/types": { "@material-ui/types": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz", "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz",
"integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A==", "integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A=="
"requires": {}
}, },
"@material-ui/utils": { "@material-ui/utils": {
"version": "4.11.2", "version": "4.11.2",
@ -26377,6 +26415,11 @@
} }
} }
}, },
"@remix-run/router": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.0.tgz",
"integrity": "sha512-SCR1cxRSMNKjaVYptCzBApPDqGwa3FGdjVHc+rOToocNPHQdIYLZBfv/3f+KvYuXDkUGVIW9IAzmPNZDRL1I4A=="
},
"@rollup/plugin-node-resolve": { "@rollup/plugin-node-resolve": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz",
@ -26673,8 +26716,7 @@
"@testing-library/user-event": { "@testing-library/user-event": {
"version": "7.2.1", "version": "7.2.1",
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-7.2.1.tgz", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-7.2.1.tgz",
"integrity": "sha512-oZ0Ib5I4Z2pUEcoo95cT1cr6slco9WY7yiPpG+RGNkj8YcYgJnM7pXmYmorNOReh8MIGcKSqXyeGjxnr8YiZbA==", "integrity": "sha512-oZ0Ib5I4Z2pUEcoo95cT1cr6slco9WY7yiPpG+RGNkj8YcYgJnM7pXmYmorNOReh8MIGcKSqXyeGjxnr8YiZbA=="
"requires": {}
}, },
"@types/anymatch": { "@types/anymatch": {
"version": "1.3.1", "version": "1.3.1",
@ -27327,8 +27369,7 @@
"acorn-jsx": { "acorn-jsx": {
"version": "5.3.1", "version": "5.3.1",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng=="
"requires": {}
}, },
"acorn-walk": { "acorn-walk": {
"version": "7.2.0", "version": "7.2.0",
@ -27372,14 +27413,12 @@
"ajv-errors": { "ajv-errors": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
"integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="
"requires": {}
}, },
"ajv-keywords": { "ajv-keywords": {
"version": "3.5.2", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="
"requires": {}
}, },
"alphanum-sort": { "alphanum-sort": {
"version": "1.0.2", "version": "1.0.2",
@ -27889,8 +27928,7 @@
"babel-plugin-named-asset-import": { "babel-plugin-named-asset-import": {
"version": "0.3.7", "version": "0.3.7",
"resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.7.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.7.tgz",
"integrity": "sha512-squySRkf+6JGnvjoUtDEjSREJEBirnXi9NqP6rjSYsylxQxqBTz+pkmf395i9E2zsvmYUaI40BHo6SqZUdydlw==", "integrity": "sha512-squySRkf+6JGnvjoUtDEjSREJEBirnXi9NqP6rjSYsylxQxqBTz+pkmf395i9E2zsvmYUaI40BHo6SqZUdydlw=="
"requires": {}
}, },
"babel-plugin-polyfill-corejs2": { "babel-plugin-polyfill-corejs2": {
"version": "0.1.10", "version": "0.1.10",
@ -30681,8 +30719,7 @@
"eslint-plugin-react-hooks": { "eslint-plugin-react-hooks": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz",
"integrity": "sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==", "integrity": "sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ=="
"requires": {}
}, },
"eslint-plugin-testing-library": { "eslint-plugin-testing-library": {
"version": "3.10.2", "version": "3.10.2",
@ -31532,8 +31569,7 @@
"fork-me-on-github": { "fork-me-on-github": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/fork-me-on-github/-/fork-me-on-github-1.0.6.tgz", "resolved": "https://registry.npmjs.org/fork-me-on-github/-/fork-me-on-github-1.0.6.tgz",
"integrity": "sha512-5R9pXa2JvyBsewGPn8woZGNz5oOb9vi8j1mjMzleHSwBojj/D8O33OEeItIe9/wtRtD4bSU0Egs6Qzp5FU/adA==", "integrity": "sha512-5R9pXa2JvyBsewGPn8woZGNz5oOb9vi8j1mjMzleHSwBojj/D8O33OEeItIe9/wtRtD4bSU0Egs6Qzp5FU/adA=="
"requires": {}
}, },
"fork-ts-checker-webpack-plugin": { "fork-ts-checker-webpack-plugin": {
"version": "4.1.6", "version": "4.1.6",
@ -34500,8 +34536,7 @@
"jest-pnp-resolver": { "jest-pnp-resolver": {
"version": "1.2.2", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz",
"integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w=="
"requires": {}
}, },
"jest-regex-util": { "jest-regex-util": {
"version": "26.0.0", "version": "26.0.0",
@ -38658,8 +38693,7 @@
"react-ga": { "react-ga": {
"version": "3.3.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/react-ga/-/react-ga-3.3.0.tgz", "resolved": "https://registry.npmjs.org/react-ga/-/react-ga-3.3.0.tgz",
"integrity": "sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ==", "integrity": "sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ=="
"requires": {}
}, },
"react-google-recaptcha-v3": { "react-google-recaptcha-v3": {
"version": "1.10.0", "version": "1.10.0",
@ -38682,8 +38716,7 @@
"react-notifications-component": { "react-notifications-component": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/react-notifications-component/-/react-notifications-component-3.1.0.tgz", "resolved": "https://registry.npmjs.org/react-notifications-component/-/react-notifications-component-3.1.0.tgz",
"integrity": "sha512-qq+zgqVIa2zhlw+RvO2QSPk7xHLvZWTHl9VKRO56sMUef/UrcUTqOswL0DSJtRIpZYZhclquQUfDxD6H2w8aWA==", "integrity": "sha512-qq+zgqVIa2zhlw+RvO2QSPk7xHLvZWTHl9VKRO56sMUef/UrcUTqOswL0DSJtRIpZYZhclquQUfDxD6H2w8aWA=="
"requires": {}
}, },
"react-popper": { "react-popper": {
"version": "1.3.11", "version": "1.3.11",
@ -38711,6 +38744,22 @@
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
"integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==" "integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg=="
}, },
"react-router": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.0.tgz",
"integrity": "sha512-B+5bEXFlgR1XUdHYR6P94g299SjrfCBMmEDJNcFbpAyRH1j1748yt9NdDhW3++nw1lk3zQJ6aOO66zUx3KlTZg==",
"requires": {
"@remix-run/router": "1.0.0"
}
},
"react-router-dom": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.0.tgz",
"integrity": "sha512-4Aw1xmXKeleYYQ3x0Lcl2undHR6yMjXZjd9DKZd53SGOYqirrUThyUb0wwAX5VZAyvSuzjNJmZlJ3rR9+/vzqg==",
"requires": {
"react-router": "6.4.0"
}
},
"react-scripts": { "react-scripts": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
@ -42903,8 +42952,7 @@
"ws": { "ws": {
"version": "7.5.7", "version": "7.5.7",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz",
"integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A=="
"requires": {}
}, },
"xml-name-validator": { "xml-name-validator": {
"version": "3.0.0", "version": "3.0.0",

View file

@ -20,6 +20,8 @@
"react-ga": "^3.3.0", "react-ga": "^3.3.0",
"react-google-recaptcha-v3": "^1.10.0", "react-google-recaptcha-v3": "^1.10.0",
"react-notifications-component": "^3.1.0", "react-notifications-component": "^3.1.0",
"react-router": "^6.4.0",
"react-router-dom": "^6.4.0",
"react-scripts": "^4.0.3", "react-scripts": "^4.0.3",
"reactstrap": "^8.9.0", "reactstrap": "^8.9.0",
"typescript": "^4.2.3" "typescript": "^4.2.3"

View file

@ -34,6 +34,7 @@ import {
withGoogleReCaptcha, withGoogleReCaptcha,
} from 'react-google-recaptcha-v3' } from 'react-google-recaptcha-v3'
const useStyles = (theme) => ({ const useStyles = (theme) => ({
paper: { paper: {
marginTop: theme.spacing(8), marginTop: theme.spacing(8),
@ -68,10 +69,24 @@ class ChecksumResolver extends React.Component {
this.state = { this.state = {
checksum: '', checksum: '',
fileName: 'input.aax', fileName: 'input.aax',
activationBytes: '' activationBytes: '',
} }
} }
componentDidMount() {
let path = window.location.pathname;
let checksumMatch = window.location.pathname.match(/([a-fA-F0-9]{40})/)
if(!checksumMatch) return;
let checksum = checksumMatch[1];
// this.setState({});
this.setChecksum(checksum);
this.requestActivationBytes(checksum);
// let { id } = this.props.params
// // this.fetchData(id)
// console.log(id)
// debugger;
}
DarkerDisabledTextField = withStyles({ DarkerDisabledTextField = withStyles({
root: { root: {
marginRight: 8, marginRight: 8,
@ -133,15 +148,17 @@ class ChecksumResolver extends React.Component {
}) })
} }
requestActivationBytes = async () => { requestActivationBytes = async (checksumX) => {
const { checksum } = this.state const checksum = checksumX ? checksumX : this.state.checksum
const { executeRecaptcha } = this.props.googleReCaptchaProps window.history.pushState('page2', 'Title', '/' + checksum);
if (!executeRecaptcha) { let executeRecaptcha = this.props.googleReCaptchaProps.executeRecaptcha
while(!executeRecaptcha) {
console.log('Recaptcha has not been loaded') console.log('Recaptcha has not been loaded')
executeRecaptcha = this.props.googleReCaptchaProps?.executeRecaptcha
return await new Promise(r => setTimeout(r, 100));
} }
const token = await executeRecaptcha('homepage') const token = await executeRecaptcha('homepage')
@ -150,7 +167,7 @@ class ChecksumResolver extends React.Component {
let request = await fetch( let request = await fetch(
`${process.env.REACT_APP_APISERVER}/api/v2/activation/${checksum}`, `${process.env.REACT_APP_APISERVER}/api/v2/activation/${checksum}`,
{ {
headers: new Headers({'x-captcha-result': token}) headers: new Headers({ 'x-captcha-result': token }),
}, },
) )
let result = await request.json() let result = await request.json()
@ -218,6 +235,9 @@ class ChecksumResolver extends React.Component {
render() { render() {
const { classes } = this.props const { classes } = this.props
const { checksum, activationBytes, fileName, file } = this.state const { checksum, activationBytes, fileName, file } = this.state
// const id = this.props.match.params.id;
// let { id } = useParams();
// console.log("IDDDDDD"+ id);
return ( return (
<Container component="main" maxWidth="md"> <Container component="main" maxWidth="md">
@ -326,3 +346,4 @@ class ChecksumResolver extends React.Component {
} }
export default withGoogleReCaptcha(withStyles(useStyles)(ChecksumResolver)) export default withGoogleReCaptcha(withStyles(useStyles)(ChecksumResolver))