mirror of
https://github.com/elyby/chrly.git
synced 2024-12-25 14:39:55 +05:30
26 lines
531 B
Go
26 lines
531 B
Go
|
package routes
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/gorilla/mux"
|
||
|
|
||
|
"elyby/minecraft-skinsystem/lib/tools"
|
||
|
)
|
||
|
|
||
|
func Cape(w http.ResponseWriter, r *http.Request) {
|
||
|
username := tools.ParseUsername(mux.Vars(r)["username"])
|
||
|
http.Redirect(w, r, "http://skins.minecraft.net/MinecraftCloaks/" + username + ".png", 301)
|
||
|
}
|
||
|
|
||
|
func CapeGET(w http.ResponseWriter, r *http.Request) {
|
||
|
username := r.URL.Query().Get("name")
|
||
|
if username == "" {
|
||
|
w.WriteHeader(http.StatusBadRequest)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
mux.Vars(r)["username"] = username
|
||
|
Cape(w, r)
|
||
|
}
|