diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..96ed414 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +image: docker:latest + +stages: + - build + - push + +before_script: + - docker login -u gitlab-ci -p $CI_BUILD_TOKEN registry.ely.by + +variables: + CONTAINER_IMAGE: registry.ely.by/elyby/skinsystem + +build: + stage: build + script: + - export IMAGE_NAME="$CONTAINER_IMAGE:dev" + - docker build --pull -t $IMAGE_NAME . + - docker push $IMAGE_NAME + only: + - develop + +push_tags: + stage: push + variables: + GIT_STRATEGY: none + script: + - export IMAGE_NAME="$CONTAINER_IMAGE:$CI_BUILD_TAG" + - docker tag $CONTAINER_IMAGE:dev $CONTAINER_IMAGE:latest + - docker tag $CONTAINER_IMAGE:latest $IMAGE_NAME + - docker push $IMAGE_NAME + - docker push $CONTAINER_IMAGE:latest + only: + - tags diff --git a/lib/routes/SetSkin.go b/lib/routes/SetSkin.go deleted file mode 100644 index b1acb87..0000000 --- a/lib/routes/SetSkin.go +++ /dev/null @@ -1,29 +0,0 @@ -package routes - -import ( - "net/http" - "strconv" - - "elyby/minecraft-skinsystem/lib/data" -) - -func SetSkin(w http.ResponseWriter, r *http.Request) { - key := r.Header.Get("X-Ely-key") - if key != "43fd2ce61b3f5704dfd729c1f2d6ffdb" { - w.WriteHeader(http.StatusForbidden) - w.Write([]byte("Nice try")) - return - } - - skin := new(data.SkinItem) - skin.Username = r.PostFormValue("username") - skin.UserId, _ = strconv.Atoi(r.PostFormValue("userId")) - skin.SkinId, _ = strconv.Atoi(r.PostFormValue("skinId")) - skin.Hash = r.PostFormValue("hash") - skin.Is1_8, _ = strconv.ParseBool(r.PostFormValue("is1_8")) - skin.IsSlim, _ = strconv.ParseBool(r.PostFormValue("isSlim")) - skin.Url = r.PostFormValue("url") - skin.Save() - - w.Write([]byte("OK")) -} diff --git a/minecraft-skinsystem.go b/minecraft-skinsystem.go index 989f7a8..8f93a9a 100644 --- a/minecraft-skinsystem.go +++ b/minecraft-skinsystem.go @@ -94,9 +94,6 @@ func main() { // 404 router.NotFoundHandler = http.HandlerFunc(routes.NotFound) - apiRouter := router.PathPrefix("/api").Subrouter() - apiRouter.HandleFunc("/user/{username}/skin", routes.SetSkin).Methods("POST") - services.Router = router services.RedisPool = redisPool services.RabbitMQChannel = rabbitChannel