Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	cmd/petpet-go/main.go
  • Loading branch information
wavy-cat committed Sep 26, 2024
2 parents d8c083a + 3935ba1 commit e8ad772
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
67 changes: 67 additions & 0 deletions http/handler/index/handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package index

import (
"go.uber.org/zap"
"net/http"
"strings"
)

type Handler struct{}

const pageContent = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PetPet-Go</title>
<meta content="PetPet GIF Generator" property="og:title"/>
<meta content="To use send 'https://pet.wavycat.ru/ds/user_id.gif'" property="og:description"/>
<meta content="https://github.com/wavy-cat/petpet-go" property="og:url"/>
<meta content="#AF47DC" data-react-helmet="true" name="theme-color"/>
<link href="https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap" rel="stylesheet">
<style>
body {
font-family: "Pixelify Sans", sans-serif;
font-optical-sizing: auto;
font-weight: bold;
font-style: normal;
color: white;
background-color: black;
height: 100%;
text-align: center;
}
.outer {
display: table;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
.middle {
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="outer">
<div class="middle">
<p>Waiting for something to happen?</p>
<a href="https://github.com/wavy-cat/petpet-go">Click</a>
</div>
</div>
</body>
</html>`

func (Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
logger := r.Context().Value("logger").(*zap.Logger)

w.Header().Set("Content-Type", "text/html")

_, err := w.Write([]byte(strings.ReplaceAll(pageContent, "'", "`")))
if err != nil {
logger.Error("Error sending response", zap.Error(err))
}
}
2 changes: 1 addition & 1 deletion http/handler/petpet.go → http/handler/petpet/handler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package petpet

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion http/handler/utils.go → http/handler/petpet/utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package petpet

import (
"github.com/wavy-cat/petpet-go/pkg/discord"
Expand Down

0 comments on commit e8ad772

Please sign in to comment.