mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 21:50:03 +05:30
Removed buildUrl() helper for automatically adding ely.by domain to skin. Now it's universtal
This commit is contained in:
parent
caebac1753
commit
6192a58f63
@ -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"
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user