#1: Add CHANGELOG.md, update README.md

This commit is contained in:
ErickSkrauch 2019-04-30 01:55:59 +03:00
parent 94b930f388
commit a5daae3cb8
2 changed files with 75 additions and 17 deletions

42
CHANGELOG.md Normal file
View File

@ -0,0 +1,42 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- `CHANGELOG.md` file.
- [#1](https://github.com/elyby/chrly/issues/1): Restored Mojang skins proxy.
- New StatsD metrics:
- Counters:
- `ely.skinsystem.{hostname}.app.mojang_textures.invalid_username`
- `ely.skinsystem.{hostname}.app.mojang_textures.request`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.cache_hit_nil`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.queued`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.cache_hit`
- `ely.skinsystem.{hostname}.app.mojang_textures.already_in_queue`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.uuid_miss`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.uuid_hit`
- `ely.skinsystem.{hostname}.app.mojang_textures.textures.cache_hit`
- `ely.skinsystem.{hostname}.app.mojang_textures.textures.request`
- Gauges:
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.iteration_size`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.queue_size`
- Timers:
- `ely.skinsystem.{hostname}.app.mojang_textures.result_time`
- `ely.skinsystem.{hostname}.app.mojang_textures.usernames.round_time`
- `ely.skinsystem.{hostname}.app.mojang_textures.textures.request_time`
### Changed
- Bumped Go version to 1.12.
### Fixed
- `/textures` request now doesn't proxies request to Mojang in case when there is no information about the skin,
but there is a cape.
### Removed
- `hash` field from `/textures` response because the game doesn't use it and calculates hash by getting filename
from the textures link.
[Unreleased]: https://github.com/elyby/chrly/compare/4.1.1...HEAD

View File

@ -1,8 +1,14 @@
# Chrly # Chrly
Chrly is a lightweight implementation of Minecraft skins system server. It's packaged and distributed as a Docker [![Written in Go][ico-lang]][link-go]
image and can be downloaded from [Dockerhub](https://hub.docker.com/r/elyby/chrly/). App is written in Go, can [![Build Status][ico-build]][link-build]
withstand heavy loads and is production ready. [![Keep a Changelog][ico-changelog]](CHANGELOG.md)
[![Software License][ico-license]](LICENSE)
Chrly is a lightweight implementation of Minecraft skins system server with ability to proxy requests to Mojang's
skins system. It's packaged and distributed as a Docker image and can be downloaded from
[Dockerhub](https://hub.docker.com/r/elyby/chrly/). App is written in Go, can withstand heavy loads and is
production ready.
## Installation ## Installation
@ -33,7 +39,8 @@ services:
- ./data/redis:/data - ./data/redis:/data
``` ```
Chrly will mount some volumes on the host machine to persist storage for capes and Redis database. Chrly uses some volumes to persist storage for capes and Redis database. The configuration above mounts them to
the host machine to do not lose data on container recreations.
### Config ### Config
@ -64,13 +71,13 @@ Each endpoint that accepts `username` as a part of an url takes it case insensit
#### `GET /skins/{username}.png` #### `GET /skins/{username}.png`
This endpoint responds to requested `username` with a skin texture. If user's skin was set as texture's link, then it'll This endpoint responds to requested `username` with a skin texture. If user's skin was set as texture's link, then it'll
respond with the `301` redirect to that url. If there is no record for requested username, it'll redirect to the respond with the `301` redirect to that url. If the skin entry isn't found, it'll request textures information from
Mojang skins system as: `http://skins.minecraft.net/MinecraftSkins/{username}.png` with the original username's case. Mojang's API and if it has a skin, than it'll return a `301` redirect to it.
#### `GET /cloaks/{username}.png` #### `GET /cloaks/{username}.png`
It responds to requested `username` with a cape texture. If user's cape file doesn't exists, then it'll redirect to the It responds to requested `username` with a cape texture. If the cape entry isn't found, it'll request textures
Mojang skins system as: `http://skins.minecraft.net/MinecraftCloaks/{username}.png` with the original username's case. information from Mojang's API and if it has a cape, than it'll return a `301` redirect to it.
#### `GET /textures/{username}` #### `GET /textures/{username}`
@ -79,22 +86,19 @@ This endpoint forms response payloads as if it was the `textures`' property, but
```json ```json
{ {
"SKIN": { "SKIN": {
"url": "http://ely.by/minecraft/skins/skin.png", "url": "http://example.com/skin.png",
"hash": "55d2a8848764f5ff04012cdb093458bd",
"metadata": { "metadata": {
"model": "slim" "model": "slim"
} }
}, },
"CAPE": { "CAPE": {
"url": "http://skinsystem.ely.by/cloaks/username", "url": "http://example.com/cape.png"
"hash": "424ff79dce9940af89c28ad80de8aaad"
} }
} }
``` ```
If record for the requested username wasn't found, cape would be omitted and skin would be formed for Mojang skins If both the skin and the cape entries aren't found, it'll request textures information from Mojang's API and if it has
system. Hash would be formed as the username plus the half-hour-ranged time of request, which is needed to improve a textures property, than it'll return decoded contents.
caching of Mojang skins inside Minecraft.
That request is handy in case when your server implements authentication for a game server (e.g. join/hasJoined That request is handy in case when your server implements authentication for a game server (e.g. join/hasJoined
operation) and you have to respond with hasJoined request with an actual user textures. You have to simply send request operation) and you have to respond with hasJoined request with an actual user textures. You have to simply send request
@ -103,8 +107,8 @@ to the Chrly server and put the result in your hasJoined response.
#### `GET /textures/signed/{username}` #### `GET /textures/signed/{username}`
Actually, it's [Ely.by](http://ely.by) feature called [Server Skins System](http://ely.by/server-skins-system), but if Actually, it's [Ely.by](http://ely.by) feature called [Server Skins System](http://ely.by/server-skins-system), but if
you have your own source of the Mojang signatures, then you can pass it with textures and it'll be displayed in this you have your own source of Mojang's signatures, then you can pass it with textures and it'll be displayed in response
method. Received response should be directly sent to the client without any modification via game server API. of this endpoint. Received response should be directly sent to the client without any modification via game server API.
Response example: Response example:
@ -128,6 +132,10 @@ Response example:
If there is no requested `username` or `mojangSignature` field isn't set, `204` status code will be sent. If there is no requested `username` or `mojangSignature` field isn't set, `204` status code will be sent.
You can adjust URL to `/textures/signed/{username}?proxy=true` to obtain textures information for provided username
from Mojang's API. The textures will contain unmodified json with addition property with name "chrly" as shown in
the example above.
#### `GET /skins?name={username}` #### `GET /skins?name={username}`
Equivalent of the `GET /skins/{username}.png`, but constructed especially for old Minecraft versions, where username Equivalent of the `GET /skins/{username}.png`, but constructed especially for old Minecraft versions, where username
@ -250,3 +258,11 @@ If your Redis instance isn't located at the `localhost`, you can change host by
After all of that `go run main.go serve` should successfully start the application. After all of that `go run main.go serve` should successfully start the application.
To run tests execute `go test ./...`. If your Go version is older than 1.9, then run a `/script/test`. To run tests execute `go test ./...`. If your Go version is older than 1.9, then run a `/script/test`.
[ico-lang]: https://img.shields.io/badge/lang-go%201.12-blue.svg?style=flat-square
[ico-build]: https://img.shields.io/travis/elyby/chrly.svg?style=flat-square
[ico-changelog]: https://img.shields.io/badge/keep%20a-changelog-orange.svg?style=flat-square
[ico-license]: https://img.shields.io/github/license/elyby/chrly.svg?style=flat-square
[link-go]: https://golang.org
[link-build]: https://travis-ci.org/elyby/chrly