2022-12-06 18:37:14 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<title>Flag Submission Page</title>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
|
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
2022-12-06 22:46:02 +00:00
|
|
|
<script src="dist/bundle.js"></script>
|
2022-12-06 18:37:14 +00:00
|
|
|
</head>
|
|
|
|
<body style="height:1500px">
|
|
|
|
|
|
|
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<a class="navbar-brand" href="#">Flag Submission Page</a>
|
|
|
|
</div>
|
|
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li><a href="leaderboard.html">Leaderboard</a></li>
|
|
|
|
<li class="active"><a href="sendflag.html">Send Flag</a></li>
|
|
|
|
</ul>
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
|
|
|
|
2022-12-06 23:36:25 +00:00
|
|
|
<li><button class="btn btn-default navbar-btn" id="metamask-login" type="button" style="margin-right:20px"><span class="glyphicon glyphicon-log-in"></span> Connect Wallet</button></li>
|
2022-12-06 18:37:14 +00:00
|
|
|
<!--<button class="btn btn-danger navbar-btn">Button</button>-->
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<div class="container" style="margin-top:50px">
|
|
|
|
<h1>Send the flag</h1>
|
2022-12-06 23:36:25 +00:00
|
|
|
<form class="form-inline" id="flag-form" style="display:none">
|
2022-12-06 18:37:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="flagbox">Flag:</label>
|
|
|
|
<input type="text" class="form-control" id="flagbox">
|
|
|
|
</div>
|
2022-12-06 23:36:25 +00:00
|
|
|
<button id="submitFlagBtn" type="button" class="btn btn-default">Submit Flag</button>
|
2022-12-06 18:37:14 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
2022-12-06 23:36:25 +00:00
|
|
|
<script type='module'>
|
|
|
|
window.addEventListener("load", function () {
|
|
|
|
let loginbutton = document.getElementById('metamask-login');
|
|
|
|
let accounts;
|
|
|
|
ethereum.request({method: 'eth_requestAccounts'}).then(accounts => {
|
|
|
|
console.log(accounts);
|
|
|
|
if (accounts.length > 0) {
|
|
|
|
document.getElementById('flag-form').style.display = "block";
|
|
|
|
loginbutton.textContent = accounts[0];
|
|
|
|
loginbutton.disabled = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2022-12-06 18:37:14 +00:00
|
|
|
|
2022-12-06 23:36:25 +00:00
|
|
|
let loginbutton = document.getElementById('metamask-login');
|
|
|
|
loginbutton.addEventListener('click', event => {
|
|
|
|
let account;
|
|
|
|
ethereum.request({method: 'eth_requestAccounts'}).then(accounts =>{
|
|
|
|
account = accounts[0];
|
|
|
|
document.getElementById('flag-form').style.display = "block";
|
|
|
|
loginbutton.textContent = account;
|
|
|
|
loginbutton.disabled = true;
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
2022-12-06 18:37:14 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|