Show CF challenge inline

This commit is contained in:
Kieran 2022-02-16 23:37:53 +00:00
parent f47ca6cb5e
commit d4b7e797e9
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,7 @@
background-color: rgba(0,0,0,0.8);
}
.upload .iframe-challenge > iframe {
.upload .iframe-challenge > div {
margin-left: 25vw;
width: 50vw;
height: 100vh;

View File

@ -165,6 +165,12 @@ export function FileUpload(props) {
);
}
}
function getChallengeElement() {
let elm = document.createElement("div");
elm.innerHTML = challenge;
return <div dangerouslySetInnerHTML={{ __html: elm.innerHTML }}/>;
}
useEffect(() => {
console.log(props.file);
@ -186,7 +192,7 @@ export function FileUpload(props) {
</div>
{uState === UploadState.Challenge ?
<div className="iframe-challenge" onClick={() => window.location.reload()}>
<iframe src={`data:text/html;charset=utf-8,${encodeURIComponent(challenge)}`}/>
{getChallengeElement()}
</div>
: null}
</div>