Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/lotus-fountain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,21 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

_, _ = w.Write([]byte(smsg.Cid().String()))
// Render the success HTML template
if r.RequestURI == "/send" {
tmplPath := "site/send_success.html"
tmpl, err := template.ParseFiles(tmplPath)
if err != nil {
http.Error(w, "Template error: "+err.Error(), http.StatusInternalServerError)
return
}

w.Header().Set("Content-Type", "text/html")
if err := tmpl.Execute(w, map[string]string{"CID": smsg.Cid().String()}); err != nil {
http.Error(w, "Template execution error: "+err.Error(), http.StatusInternalServerError)
return
}
} else {
_, _ = w.Write([]byte(smsg.Cid().String()))
}
}
9 changes: 8 additions & 1 deletion cmd/lotus-fountain/site/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ header p {
flex-grow: 1;
}

.container {
margin: 2em;

a {
color: #4c7eff;
}
}

.button:hover {
background-color: var(--color-primary-dark);
color: var(--color-white);
Expand Down Expand Up @@ -149,4 +157,3 @@ footer {
width: 100%;
}
}

19 changes: 19 additions & 0 deletions cmd/lotus-fountain/site/send_success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Filecoin Lotus Faucet – Successful Request</title>
<meta name="description" content="Your request for test Filecoin (tFIL) has been processed. View your transaction ID and learn what to expect next from the Lotus Fountain Faucet." />
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<main class="container">
<h2>Successful Request</h2>
<p>Your request has been processed.</p>
<p><strong>Transaction ID:</strong> {{.CID}}</p>
<p>Your tFIL will be available shortly.</p>
<br>
<p>Need help? Check the <a href="https://docs.filecoin.io" target="_blank">docs</a> or <a href="https://github.com/filecoin-project/lotus/issues/new" target="_blank">report an issue</a>.</p>
</main>
</body>
</html>
Loading