Removed buildUrl() helper for automatically adding ely.by domain to skin. Now it's universtal

This commit is contained in:
ErickSkrauch 2018-02-01 22:58:34 +03:00
parent caebac1753
commit 6192a58f63
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
5 changed files with 3 additions and 20 deletions

View File

@ -19,9 +19,9 @@ func (cfg *Config) Face(response http.ResponseWriter, request *http.Request) {
hash = rec.Hash
}
http.Redirect(response, request, buildElyUrl(buildFaceUrl(hash)), 301)
http.Redirect(response, request, buildFaceUrl(hash), 301)
}
func buildFaceUrl(hash string) string {
return "/minecraft/skin_buffer/faces/" + hash + ".png"
return "http://ely.by/minecraft/skin_buffer/faces/" + hash + ".png"
}

View File

@ -79,15 +79,6 @@ func parseUsername(username string) string {
return username
}
func buildElyUrl(route string) string {
prefix := "http://ely.by"
if !strings.HasPrefix(route, prefix) {
route = prefix + route
}
return route
}
func waitForSignal() os.Signal {
ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)

View File

@ -16,12 +16,6 @@ func TestParseUsername(t *testing.T) {
assert.Equal("test", parseUsername("test"), "Function should return string itself, if it not contains .png at end")
}
func TestBuildElyUrl(t *testing.T) {
assert := testify.New(t)
assert.Equal("http://ely.by/route", buildElyUrl("/route"), "Function should add prefix to the provided relative url.")
assert.Equal("http://ely.by/test/route", buildElyUrl("http://ely.by/test/route"), "Function should do not add prefix to the provided prefixed url.")
}
type mocks struct {
Skins *mock_interfaces.MockSkinsRepository
Capes *mock_interfaces.MockCapesRepository

View File

@ -18,7 +18,7 @@ func (cfg *Config) Skin(response http.ResponseWriter, request *http.Request) {
return
}
http.Redirect(response, request, buildElyUrl(rec.Url), 301)
http.Redirect(response, request, rec.Url, 301)
}
func (cfg *Config) SkinGET(response http.ResponseWriter, request *http.Request) {

View File

@ -46,8 +46,6 @@ func (cfg *Config) Textures(response http.ResponseWriter, request *http.Request)
skin.Url = "http://skins.minecraft.net/MinecraftSkins/" + username + ".png"
skin.Hash = string(buildNonElyTexturesHash(username))
} else {
skin.Url = buildElyUrl(skin.Url)
}
textures := texturesResponse{