2024-12-27 14:04:18 -03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2025-01-07 23:42:16 -03:00
|
|
|
"io"
|
2024-12-27 14:04:18 -03:00
|
|
|
"net/http"
|
2025-01-21 22:11:24 -03:00
|
|
|
"strings"
|
2024-12-27 14:04:18 -03:00
|
|
|
)
|
|
|
|
|
2025-01-08 20:16:19 -03:00
|
|
|
func root(w http.ResponseWriter, r *http.Request) {
|
2025-01-07 23:42:16 -03:00
|
|
|
io.WriteString(w, "WIP Vanity Tester Backend")
|
2024-12-27 14:04:18 -03:00
|
|
|
}
|
2025-01-08 20:16:19 -03:00
|
|
|
|
|
|
|
func getAllBadges(w http.ResponseWriter, r *http.Request) {
|
2025-01-20 18:35:25 -03:00
|
|
|
io.WriteString(w, formatAllBadges())
|
2025-01-08 20:16:19 -03:00
|
|
|
}
|
|
|
|
|
2025-01-21 22:11:24 -03:00
|
|
|
func getSevenTvPaints(w http.ResponseWriter, r *http.Request) {
|
|
|
|
io.WriteString(w, formatSevenTvPaints())
|
|
|
|
}
|
|
|
|
|
|
|
|
func getSevenTvBadges(w http.ResponseWriter, r *http.Request) {
|
|
|
|
io.WriteString(w, formatSevenTvBadges())
|
|
|
|
}
|
|
|
|
|
|
|
|
func sevenTvUserCosmetics(w http.ResponseWriter, r *http.Request) {
|
|
|
|
svt := &SevenTv{}
|
|
|
|
user := strings.TrimPrefix(r.URL.Path, "/7tv/cosmetics/")
|
|
|
|
userID, err := svt.getUserID(user)
|
|
|
|
if err != nil {
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
logger.Trace().Msg("sevenTvUserCosmetics: user: " + userID)
|
|
|
|
|
|
|
|
io.WriteString(w, formatSevenTvUserCosmetics(userID))
|
|
|
|
}
|
|
|
|
|
2025-01-08 20:16:19 -03:00
|
|
|
// func sevenTvPaints(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// svt := &SevenTv{}
|
|
|
|
// badges, err := svt.getPaints()
|
|
|
|
// if err != nil {
|
|
|
|
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
// io.WriteString(w, badges)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// func sevenTvBadges(w http.ResponseWriter, r *http.Request) {
|
|
|
|
// svt := &SevenTv{}
|
|
|
|
// badges, err := svt.getBadges()
|
|
|
|
// if err != nil {
|
|
|
|
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
// io.WriteString(w, badges)
|
|
|
|
// }
|