2016-07-07 15:40:39 +05:30
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
2016-08-27 02:15:55 +05:30
|
|
|
"log"
|
2016-07-07 15:40:39 +05:30
|
|
|
"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"])
|
2016-08-27 02:15:55 +05:30
|
|
|
log.Println("request cape for username " + username)
|
2016-07-07 15:40:39 +05:30
|
|
|
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)
|
|
|
|
}
|