diff --git a/cmds/liter-server/api_v1.go b/cmds/liter-server/api_v1.go index 665053c..3c2dd97 100644 --- a/cmds/liter-server/api_v1.go +++ b/cmds/liter-server/api_v1.go @@ -41,12 +41,14 @@ func checkTokenId(id string) (ok bool) { } func (s *Server) checkToken(ctx *gin.Context, token string) (ok bool) { - t, err := jwt.Parse(token, func(t *jwt.Token) (interface{}, error) { - if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { - return nil, fmt.Errorf("Unexpected signing method: %v", t.Header["alg"]) - } - return s.hmacKey, nil - }, + t, err := jwt.Parse( + token, + func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("Unexpected signing method: %v", t.Header["alg"]) + } + return s.hmacKey, nil + }, jwt.WithSubject("optk"), jwt.WithIssuedAt(), jwt.WithIssuer(jwtIssuer), diff --git a/cmds/liter-server/litermc.service b/cmds/liter-server/litermc.service index eb14593..252b016 100644 --- a/cmds/liter-server/litermc.service +++ b/cmds/liter-server/litermc.service @@ -1,6 +1,7 @@ [Unit] Description=A reverse proxy for minecraft server -After=network.target nss-lookup.target +Documentation=https://github.com/kmcsr/go-liter +Requires=network.target nss-lookup.target [Service] Type=forking @@ -8,12 +9,12 @@ PIDFile=/var/run/litermc.pid WorkingDirectory=/opt/litermc ExecStart=/usr/sbin/litermc daemon /var/run/litermc.pid ExecReload=/usr/sbin/litermc reload /var/run/litermc.pid -ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /var/run/litermc.pid +ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry TERM/5 --pidfile /var/run/litermc.pid TimeoutStopSec=10 KillMode=mixed Restart=on-failure -RestartSec=5 +RestartSec=10 [Install] WantedBy=multi-user.target -Alias=litermc.service +Alias=litermc