github.com/waltonchain/waltonchain_gwtc_src@v1.1.4-0.20201225072101-8a298c95a819/cmd/faucet/faucet.html (about)

     1  <!DOCTYPE html>
     2  <html lang="en">
     3  	<head>
     4  		<meta charset="utf-8">
     5  		<meta http-equiv="X-UA-Compatible" content="IE=edge">
     6  		<meta name="viewport" content="width=device-width, initial-scale=1">
     7  
     8  		<title>{{.Network}}: GitHub Faucet</title>
     9  
    10  		<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    11  		<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    12  
    13  		<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    14  		<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-noty/2.4.1/packaged/jquery.noty.packaged.min.js"></script>
    15  		<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    16  		<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.0/moment.min.js"></script>
    17  
    18  		<style>
    19  			.vertical-center {
    20  				min-height: 100%;
    21  				min-height: 100vh;
    22  				display: flex;
    23  				align-items: center;
    24  			}
    25  			.progress {
    26  				position: relative;
    27  			}
    28  			.progress span {
    29  				position: absolute;
    30  				display: block;
    31  				width: 100%;
    32  				color: white;
    33  			 }
    34  			 pre {
    35  				 padding: 6px;
    36  				 margin: 0;
    37  			 }
    38  		</style>
    39  	</head>
    40  
    41  	<body>
    42  		<div class="vertical-center">
    43  			<div class="container">
    44  				<div class="row" style="margin-bottom: 16px;">
    45  					<div class="col-lg-12">
    46  						<h1 style="text-align: center;"><i class="fa fa-bath" aria-hidden="true"></i> {{.Network}} GitHub Authenticated Faucet <i class="fa fa-github-alt" aria-hidden="true"></i></h1>
    47  					</div>
    48  				</div>
    49  				<div class="row">
    50  					<div class="col-lg-8 col-lg-offset-2">
    51  						<div class="input-group">
    52  							<input id="gist" type="text" class="form-control" placeholder="GitHub Gist URL containing your Wtc address...">
    53  							<span class="input-group-btn">
    54  								<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Give me Ether	<i class="fa fa-caret-down" aria-hidden="true"></i></button>
    55  				        <ul class="dropdown-menu dropdown-menu-right">{{range $idx, $amount := .Amounts}}
    56  				          <li><a style="text-align: center;" onclick="tier={{$idx}}; {{if $.Recaptcha}}grecaptcha.execute(){{else}}submit({{$idx}}){{end}}">{{$amount}} / {{index $.Periods $idx}}</a></li>{{end}}
    57  				        </ul>
    58  							</span>
    59  						</div>{{if .Recaptcha}}
    60  						<div class="g-recaptcha" data-sitekey="{{.Recaptcha}}" data-callback="submit" data-size="invisible"></div>{{end}}
    61  					</div>
    62  				</div>
    63  				<div class="row" style="margin-top: 32px;">
    64  						<div class="col-lg-6 col-lg-offset-3">
    65  						<div class="panel panel-small panel-default">
    66  							<div class="panel-body" style="padding: 0; overflow: auto; max-height: 300px;">
    67  								<table id="requests" class="table table-condensed" style="margin: 0;"></table>
    68  							</div>
    69  							<div class="panel-footer">
    70  								<table style="width: 100%"><tr>
    71  									<td style="text-align: center;"><i class="fa fa-rss" aria-hidden="true"></i> <span id="peers"></span> peers</td>
    72  									<td style="text-align: center;"><i class="fa fa-database" aria-hidden="true"></i> <span id="block"></span> blocks</td>
    73  									<td style="text-align: center;"><i class="fa fa-heartbeat" aria-hidden="true"></i> <span id="funds"></span> Ethers</td>
    74  									<td style="text-align: center;"><i class="fa fa-university" aria-hidden="true"></i> <span id="funded"></span> funded</td>
    75  								</tr></table>
    76  							</div>
    77  						</div>
    78  					</div>
    79  				</div>
    80  				<div class="row" style="margin-top: 32px;">
    81  					<div class="col-lg-12">
    82  						<h3>How does this work?</h3>
    83  						<p>This Ether faucet is running on the {{.Network}} network. To prevent malicious actors from exhausting all available funds or accumulating enough Ether to mount long running spam attacks, requests are tied to GitHub accounts. Anyone having a GitHub account may request funds within the permitted limits.</p>
    84  						<p>To request funds, simply create a <a href="https://gist.github.com/" target="_about:blank">GitHub Gist</a> with your Wtc address pasted into the contents (the file name doesn't matter), copy paste the gists URL into the above input box and fire away! You can track the current pending requests below the input field to see how much you have to wait until your turn comes.</p>
    85  						{{if .Recaptcha}}<em>The faucet is running invisible reCaptcha protection against bots.</em>{{end}}
    86  					</div>
    87  				</div>
    88  			</div>
    89  		</div>
    90  
    91  		<script>
    92  			// Global variables to hold the current status of the faucet
    93  			var attempt = 0;
    94  			var server;
    95  			var tier = 0;
    96  
    97  			// Define the function that submits a gist url to the server
    98  			var submit = function({{if .Recaptcha}}captcha{{end}}) {
    99  				server.send(JSON.stringify({url: $("#gist")[0].value, tier: tier{{if .Recaptcha}}, captcha: captcha{{end}}}));{{if .Recaptcha}}
   100  				grecaptcha.reset();{{end}}
   101  			};
   102  			// Define a method to reconnect upon server loss
   103  			var reconnect = function() {
   104  				if (attempt % 2 == 0) {
   105  					server = new WebSocket("wss://" + location.host + "/api");
   106  				} else {
   107  					server = new WebSocket("ws://" + location.host + "/api");
   108  				}
   109  				attempt++;
   110  
   111  				server.onmessage = function(event) {
   112  					var msg = JSON.parse(event.data);
   113  					if (msg === null) {
   114  						return;
   115  					}
   116  
   117  					if (msg.funds !== undefined) {
   118  						$("#funds").text(msg.funds);
   119  					}
   120  					if (msg.funded !== undefined) {
   121  						$("#funded").text(msg.funded);
   122  					}
   123  					if (msg.peers !== undefined) {
   124  						$("#peers").text(msg.peers);
   125  					}
   126  					if (msg.number !== undefined) {
   127  						$("#block").text(parseInt(msg.number, 16));
   128  					}
   129  					if (msg.error !== undefined) {
   130  						noty({layout: 'topCenter', text: msg.error, type: 'error'});
   131  					}
   132  					if (msg.success !== undefined) {
   133  						noty({layout: 'topCenter', text: msg.success, type: 'success'});
   134  					}
   135  					if (msg.requests !== undefined && msg.requests !== null) {
   136  						var content = "";
   137  						for (var i=0; i<msg.requests.length; i++) {
   138  							content += "<tr><td><div style=\"background: url('https://github.com/" + msg.requests[i].username + ".png?size=64'); background-size: cover; width:32px; height: 32px; border-radius: 4px;\"></div></td><td><pre>" + msg.requests[i].account + "</pre></td><td style=\"width: 100%; text-align: center; vertical-align: middle;\">" + moment.duration(moment(msg.requests[i].time).unix()-moment().unix(), 'seconds').humanize(true) + "</td></tr>";
   139  						}
   140  						$("#requests").html("<tbody>" + content + "</tbody>");
   141  					}
   142  				}
   143  				server.onclose = function() { setTimeout(reconnect, 3000); };
   144  			}
   145  			// Establish a websocket connection to the API server
   146  			reconnect();
   147  		</script>{{if .Recaptcha}}
   148  		<script src="https://www.google.com/recaptcha/api.js" async defer></script>{{end}}
   149  	</body>
   150  </html>