Compare commits

..

No commits in common. "036e9fa4a1048c6d8bf8d8cc4b4b7dd56225fbf9" and "a9e9185b414b95ed770c33a2b9ea12b8e6807b4b" have entirely different histories.

2 changed files with 12 additions and 26 deletions

19
main.go
View File

@ -11,12 +11,8 @@ import (
"time" "time"
"github.com/canhlinh/svg2png" "github.com/canhlinh/svg2png"
"github.com/patrickmn/go-cache"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/compress" "github.com/patrickmn/go-cache"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
) )
//go:embed index.html svg.tmpl //go:embed index.html svg.tmpl
@ -25,11 +21,7 @@ var content embed.FS
func main() { func main() {
app := fiber.New() app := fiber.New()
app.Use(compress.New()) ch := cache.New(5*24*time.Hour, 7*24*time.Hour)
app.Use(cors.New())
app.Use(logger.New())
ch := cache.New(6*time.Hour, 24*time.Hour)
app.Get("/", func(c *fiber.Ctx) error { app.Get("/", func(c *fiber.Ctx) error {
c.Type("html", "UTF8") c.Type("html", "UTF8")
@ -53,14 +45,13 @@ func main() {
key := generateKey(vars) key := generateKey(vars)
png, found := ch.Get(key) png, found := ch.Get(key)
if !found || len(png.([]byte)) == 0 { if !found {
var err error var err error
png, err = generateImage(vars) png, err = generateImage(vars)
if err != nil { if err != nil {
fmt.Println(err) return err
return c.SendStatus(500)
} }
ch.Set(key, png, 0) ch.Set(key, png, -1)
} }
c.Type("png") c.Type("png")

View File

@ -42,19 +42,15 @@
font-family: 'Roboto Bold'; font-family: 'Roboto Bold';
margin: 0; margin: 0;
position: fixed; position: fixed;
top: 100px; top: 80px;
left: 50px; left: 50px;
height: 300px; height: 300px;
width: 800px; width: 800px;
font-size: 80px; font-size: 70px;
font-weight: 900; font-weight: 900;
line-height: 75px; line-height: 70px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box !important;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
white-space: normal;
} }
h2 { h2 {
font-family: 'Roboto Medium'; font-family: 'Roboto Medium';
@ -62,7 +58,6 @@
position: fixed; position: fixed;
top: 50px; top: 50px;
left: 50px; left: 50px;
font-size: 40px;
font-weight: 900; font-weight: 900;
} }
#profilePic { #profilePic {
@ -75,11 +70,11 @@
.tags { .tags {
position: fixed; position: fixed;
left: 50px; left: 50px;
top: 420px; top: 400px;
width: 800px; width: 800px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
font-size: 25px; font-size: 15px;
font-weight: 200; font-weight: 200;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -95,7 +90,7 @@
bottom: 25px; bottom: 25px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
font-size: 20px; font-size: 15px;
font-weight: 200; font-weight: 200;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -104,7 +99,7 @@
fill: var(--foreground-color); fill: var(--foreground-color);
} }
.social span { .social span {
margin: 0 5px; margin: 0 3px;
} }
.social svg:not(:first-of-type) { .social svg:not(:first-of-type) {
margin-left: 20px; margin-left: 20px;