Skip to content

Commit

Permalink
thongs
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Nov 15, 2023
1 parent b56ddb5 commit d116849
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
12 changes: 10 additions & 2 deletions validator_fingerprint.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
package berghain

import "net/http"

const validatorFingerprintResponse = `{"t": 2}`

func validatorFingerprint(b *Berghain, req *ValidatorRequest, resp *ValidatorResponse) error {
copy(resp.Body.WriteNBytes(len(validatorFingerprintResponse)), validatorFingerprintResponse)
switch req.Method {
case http.MethodGet:
copy(resp.Body.WriteNBytes(len(validatorFingerprintResponse)), validatorFingerprintResponse)
return nil
case http.MethodPost:
return req.Identifier.ToCookie(b, resp.Token)
}

return req.Identifier.ToCookie(b, resp.Token)
return nil
}
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ <h3 class="heading">Request on Hold</h3>
</g>
</svg>
</div>
<div class="error-container"></div>
</div>
</body>
7 changes: 6 additions & 1 deletion web/src/challange/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
*/
export function start() {
const loader = /** @type {HTMLDivElement} */ (document.querySelector(".circle-loader"));
loader.style.display = "inline-block";
loader.style.visibility = "visible";
}

export function showError(error) {
const errors = /** @type {HTMLDivElement} */ (document.querySelector(".error-container"));
errors.insertAdjacentHTML("beforeend", `<p>Error: ${error}</p>`)
}

/**
Expand Down
16 changes: 11 additions & 5 deletions web/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ import * as loader from "./challange/loader.js";
}

loader.start();
const result = await doChallenge()
loader.stop(!!result);

if (!result) {
setTimeout(() => {window.location.reload();}, 1000);
try {
const result = await doChallenge()
loader.stop(!!result);
} catch (e) {
loader.showError(e)
loader.stop(true);
return;
}

setTimeout(() => {
window.location.reload();
}, 1000);
});
})();
22 changes: 13 additions & 9 deletions web/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
> .heading {
font-size: 3em;
font-weight: bold;
margin-bottom: 1.5em;
}
}
}
Expand All @@ -42,19 +41,23 @@
flex-direction: row;
justify-content: center;
align-items: center;
margin: .5em 0 .5em 0;
}

$circleSize: 3em;

.circle-loader {
margin-bottom: 1.5em;
visibility: hidden;
margin-left: auto;
border: 1px solid rgba(0, 0, 0, 0.2);
border-left-color: #000;
animation: loader-spin 1.2s infinite linear;
position: relative;
display: none;
display: inline-block;
vertical-align: top;
border-radius: 50%;
width: 7em;
height: 7em;
width: $circleSize;
height: $circleSize;

&.load-complete {
-webkit-animation: none;
Expand Down Expand Up @@ -88,6 +91,7 @@
}
}


.cross {
display: none;
transform: rotate(45deg);
Expand All @@ -99,11 +103,11 @@
content: '';
position: absolute;
width: 3px;
height: 5em;
height: $circleSize;
background: #000;
top: 50%;
left: 50%;
margin-top: -2.5em;
margin-top: calc($circleSize / 2 * -1);
margin-left: -1.5px;
}

Expand Down Expand Up @@ -152,9 +156,9 @@

@keyframes drawCross {
0% {
height: 0;
scale: 0;
}
100% {
height: 5em;
scale: 1;
}
}

0 comments on commit d116849

Please sign in to comment.