mirror of
https://github.com/elyby/chrly.git
synced 2024-12-27 23:40:30 +05:30
Merge branch 'develop' into statsd
This commit is contained in:
commit
445bd18fbc
33
.gitlab-ci.yml
Normal file
33
.gitlab-ci.yml
Normal file
@ -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
|
@ -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"))
|
|
||||||
}
|
|
@ -94,9 +94,6 @@ func main() {
|
|||||||
// 404
|
// 404
|
||||||
router.NotFoundHandler = http.HandlerFunc(routes.NotFound)
|
router.NotFoundHandler = http.HandlerFunc(routes.NotFound)
|
||||||
|
|
||||||
apiRouter := router.PathPrefix("/api").Subrouter()
|
|
||||||
apiRouter.HandleFunc("/user/{username}/skin", routes.SetSkin).Methods("POST")
|
|
||||||
|
|
||||||
services.Router = router
|
services.Router = router
|
||||||
services.RedisPool = redisPool
|
services.RedisPool = redisPool
|
||||||
services.RabbitMQChannel = rabbitChannel
|
services.RabbitMQChannel = rabbitChannel
|
||||||
|
Loading…
Reference in New Issue
Block a user