Fancier faucet

This commit is contained in:
Łukasz Magiera 2019-10-17 16:28:03 +02:00
parent 43e1752816
commit a20255d606
5 changed files with 153 additions and 20 deletions

View File

@ -94,17 +94,17 @@ var runCmd = &cli.Command{
limiter: NewLimiter(LimiterConfig{ limiter: NewLimiter(LimiterConfig{
TotalRate: time.Second, TotalRate: time.Second,
TotalBurst: 20, TotalBurst: 20,
IPRate: 5 * time.Minute, IPRate: time.Minute,
IPBurst: 5, IPBurst: 5,
WalletRate: time.Hour, WalletRate: 15 * time.Minute,
WalletBurst: 1, WalletBurst: 1,
}), }),
colLimiter: NewLimiter(LimiterConfig{ colLimiter: NewLimiter(LimiterConfig{
TotalRate: time.Second, TotalRate: time.Second,
TotalBurst: 20, TotalBurst: 20,
IPRate: 24 * time.Hour, IPRate: 10 * time.Minute,
IPBurst: 1, IPBurst: 1,
WalletRate: 24 * 364 * time.Hour, WalletRate: 1 * time.Hour,
WalletBurst: 1, WalletBurst: 1,
}), }),
} }
@ -206,7 +206,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
return return
} }
log.Infof("mkactoer on %s", owner) log.Infof("mkactor on %s", owner)
// Limit based on wallet address // Limit based on wallet address
limiter = h.colLimiter.GetWalletLimiter(owner.String()) limiter = h.colLimiter.GetWalletLimiter(owner.String())
@ -307,5 +307,5 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(200) w.WriteHeader(200)
fmt.Fprintf(w, "New storage miners address is: %s\n", addr) fmt.Fprintf(w, "New storage miners address is: %s\n", addr)
fmt.Fprintf(w, "Run lotus-storage-miner init --actor=%s -owner=%s", addr, owner) fmt.Fprintf(w, "Run lotus-storage-miner init --actor=%s --owner=%s", addr, owner)
} }

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Sending Funds - Lotus Fountain</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="Index">
<div class="Index-nodes">
<div class="Index-node">
[SENDING FUNDS]
</div>
<div class="Index-node">
<form action='/send' method='get'>
<span>Enter destination address:</span>
<input type='text' name='address' style="width: 300px">
<button type='submit'>Send Funds</button>
</form>
</div>
</div>
<div class="Index-footer">
<div>
<a href="index.html">[Back]</a>
<span style="float: right">Not dispensing real Filecoin tokens</span>
</div>
</div>
</div>
</body>
</html>

View File

@ -2,21 +2,26 @@
<html> <html>
<head> <head>
<title>Lotus Fountain</title> <title>Lotus Fountain</title>
<style> <link rel="stylesheet" type="text/css" href="main.css">
body {
font-family: 'monospace';
background: #1f1f1f;
color: #f0f0f0;
}
</style>
</head> </head>
<body> <body>
<form action='/send' method='get'> <div class="Index">
<span>Enter destination address:</span> <div class="Index-nodes">
<input type='text' name='address' style="width: 300px"> <div class="Index-node">
<button type='submit'>Send Funds</button> [LOTUS DEVNET FAUCET]
<button type='submit'>Create storage miner</button> </div>
</form> <div class="Index-node">
<span>When creating storage miner, DO NOT REFRESH THE PAGE, wait for it to load. This can take more than 5min.</span> <a href="funds.html">[Send Funds]</a>
</div>
<div class="Index-node">
<a href="miner.html">[Create Miner]</a>
</div>
</div>
<div class="Index-footer">
<div>
<span style="float: right">Not dispensing real Filecoin tokens</span>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -0,0 +1,56 @@
body {
font-family: 'monospace';
background: #1f1f1f;
color: #f0f0f0;
padding: 0;
margin: 0;
}
.Index {
width: 100vw;
height: 100vh;
background: #1a1a1a;
color: #f0f0f0;
font-family: monospace;
display: grid;
grid-template-columns: auto 40vw auto;
grid-template-rows: auto auto auto 3em;
grid-template-areas:
". . ."
". main ."
". . ."
"footer footer footer";
}
.Index-footer {
background: #2a2a2a;
grid-area: footer;
}
.Index-footer > div {
padding-left: 0.7em;
padding-top: 0.7em;
}
.Index-nodes {
grid-area: main;
background: #2a2a2a;
}
.Index-node {
margin: 5px;
padding: 15px;
background: #1f1f1f;
}
a:link {
color: #50f020;
}
a:visited {
color: #50f020;
}
a:hover {
color: #30a00a;
}

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title>Creating Storage Miner - Lotus Fountain</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="Index">
<div class="Index-nodes">
<div class="Index-node">
[CREATING STORAGE MINER]
</div>
<div class="Index-node" id="formnd">
<form id="f" action='/mkminer' method='get'>
<span>Enter destination address:</span>
<input type='text' name='address' style="width: 300px">
<button type='submit'>Send Funds</button>
</form>
</div>
<div id="plswait" style="display: none" class="Index-node">
<b>Waiting for transaction on chain..</b>
</div>
<div class="Index-node">
<span>When creating storage miner, DO NOT REFRESH THE PAGE, wait for it to load. This can take more than 5min.</span>
</div>
</div>
<div class="Index-footer">
<div>
<a href="index.html">[Back]</a>
<span style="float: right">Not dispensing real Filecoin tokens</span>
</div>
</div>
</div>
<script>
let f = document.getElementById('f')
f.onsubmit = ev => {
document.getElementById('plswait').style.display = 'block'
document.getElementById('formnd').style.display = 'none'
}
</script>
</body>
</html>