Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcc7c6705c |
@@ -15,8 +15,8 @@
|
||||
<script src="https://unpkg.com/kjua@0.6.0/dist/kjua.min.js"></script>
|
||||
<style>
|
||||
body {
|
||||
background: rgb({{.RGBStart}});
|
||||
background: radial-gradient(circle, rgba({{.RGBStart}},1) 0%, rgba({{.RGBEnd}},1) 100%);
|
||||
background: rgb(36,71,247);
|
||||
background: radial-gradient(circle, rgba(36,71,247,1) 0%, rgba(249,42,84,1) 100%);
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
font-family: monospace;
|
||||
|
||||
@@ -5,12 +5,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"math/bits"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/LightningTipBot/LightningTipBot/internal"
|
||||
"github.com/LightningTipBot/LightningTipBot/internal/str"
|
||||
"github.com/LightningTipBot/LightningTipBot/internal/telegram"
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/fiatjaf/go-lnurl"
|
||||
@@ -80,20 +78,11 @@ func (s Service) UserPageHandler(w http.ResponseWriter, r *http.Request) {
|
||||
log.Errorln("[UserPage]", err)
|
||||
image = "https://telegram.org/img/t_logo.png"
|
||||
}
|
||||
|
||||
// generate random color
|
||||
i := str.Int32Hash(username)
|
||||
rgb_start := fmt.Sprintf("%d, %d, %d", i%256, bits.RotateLeft32(i, 1)%256, bits.RotateLeft32(i, 2)%256)
|
||||
rgb_end := fmt.Sprintf("%d, %d, %d", bits.RotateLeft32(i, 3)%256, bits.RotateLeft32(i, 4)%256, bits.RotateLeft32(i, 5)%256)
|
||||
|
||||
log.Infof(rgb_start, rgb_end)
|
||||
if err := tmpl.ExecuteTemplate(w, "userpage", struct {
|
||||
Username string
|
||||
Image string
|
||||
LNURLPay string
|
||||
RGBStart string
|
||||
RGBEnd string
|
||||
}{username, image, lnurlEncode, rgb_start, rgb_end}); err != nil {
|
||||
}{username, image, lnurlEncode}); err != nil {
|
||||
log.Errorf("failed to render template")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user