Skip to content

Commit 0005e4d

Browse files
committed
feat: improves frontend behaviour
1 parent 33d8242 commit 0005e4d

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

public/index.html

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
3232
margin-bottom: 30px;
3333
}
34+
hr {
35+
border-color: rgba(255, 255, 255, 0.1);
36+
}
3437
.challenge-info {
3538
background-color: rgba(0, 0, 0, 0.3);
3639
border-radius: 15px;
@@ -92,6 +95,9 @@
9295

9396
function getFunds() {
9497
const address = document.getElementById("address").value;
98+
const button = document.getElementById("getmagic");
99+
button.disabled = true;
100+
button.innerHTML = "Please wait getting you some magic...";
95101
fetch("/get-funds", {
96102
method: "POST",
97103
headers: {
@@ -102,10 +108,14 @@
102108
.then(async (data) => {
103109
document.getElementById("response").style.display = "block";
104110
document.getElementById("response").innerHTML = await data.text();
111+
button.disabled = false;
112+
button.innerHTML = "Get Magic";
105113
})
106114
.catch((err) => {
107115
document.getElementById("response").style.display = "block";
108116
document.getElementById("response").innerHTML = err;
117+
button.disabled = false;
118+
button.innerHTML = "Get Magic 🎁";
109119
});
110120
}
111121
</script>
@@ -124,8 +134,8 @@ <h1>🎅 Crypto Christmas Challenge 🎁</h1>
124134

125135
<p>
126136
While you're settling in, Santa's been spreading some holiday cheer
127-
- distributing 0.5 ETH to wallets that need a
128-
little Christmas magic. 🎁
137+
- distributing 0.5 ETH to wallets that need a little Christmas
138+
magic. 🎁
129139
</p>
130140

131141
<p>
@@ -141,23 +151,24 @@ <h1>🎅 Crypto Christmas Challenge 🎁</h1>
141151
sleigh? 🕵️‍♂️❄️
142152
</p>
143153
</div>
144-
145-
<h3>Wallet Locations</h3>
154+
<hr />
155+
<h3>Useful information</h3>
146156
<p>🧝 Wallet 1: {{WALLET1}}</p>
147157
<p>🧝 Wallet 2: {{WALLET2}}</p>
148158
<p>🧝 Wallet 3: {{WALLET3}}</p>
149159
<p>🛡️ Proxy: {{PROXY}}</p>
150-
160+
<p>📡 RPC: <span id="rpc"></span></p>
161+
<hr />
151162
<h3>Your Private Key</h3>
152163
<p>
153164
0xbae59a37d25cba3c346674ed6ce224d9eb3b88ad081774961769f9c94a3ce969
154165
</p>
155-
156-
<h3>Receive gift</h3>
157-
<p><input id="address" /></p>
166+
<hr />
167+
<h3>Magic Funds</h3>
158168
<p>
159-
<button class="validate-btn" onclick="getFunds()">
160-
Get funds 🎁
169+
<input id="address" placeholder="0x..." type="text" />
170+
<button id="getmagic" class="validate-btn" onclick="getFunds()">
171+
Get some magic 🎁
161172
</button>
162173
</p>
163174
</div>
@@ -195,6 +206,9 @@ <h3>Receive gift</h3>
195206
document.head.appendChild(style);
196207

197208
createSnowflakes();
209+
210+
const rpc = document.getElementById("rpc");
211+
rpc.innerText = document.location.href + "rpc";
198212
</script>
199213
</body>
200214
</html>

server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ async function expressServer() {
4343
}
4444
const admin = await contract.getAdmin397fa();
4545
if (admin === USER_PUBLIC_KEY) {
46-
res.status(200).send("Nice");
46+
res.status(200).send("Congratulations on mining through the challenge and unwrapping the truth of the blockchain! Here's your well-earned flag: HV24{SANT4_MIN3S_BL0CKS_4_MERRYC01NS} – a festive reward for your cleverness!");
4747
} else {
48-
res.status(500).send("Nope!");
48+
res.status(500).send("Oops! 🎅 The blockchain elves couldn’t verify your transaction. Looks like you didn’t quite crack the code this time. Double-check your hashes and try again – the flag is still waiting for you under the tree! 🎄🔗");
4949
}
5050
});
5151
app.post("/get-funds", async (req: Request, res: Response) => {

0 commit comments

Comments
 (0)