Compare commits

..

6 commits

Author SHA1 Message Date
Imbus
acff254aa5 Indirect -> direct dependency in go.mod 2024-03-07 12:13:29 +01:00
Imbus
3175c62e6d Carmack level testing instructions 2024-03-07 11:33:06 +01:00
Imbus
b31349ec37 Change test order in testall target 2024-03-06 15:44:18 +01:00
Imbus
4cfb227a1e Add install linter target 2024-03-06 15:40:24 +01:00
Imbus
524baf90d2 Hotfix for just errors related to podman 2024-03-06 15:34:43 +01:00
Imbus
c5f0bc509e Makefile target for installing just (hack of doom) 2024-03-06 15:15:41 +01:00
4 changed files with 14 additions and 6 deletions

View file

@ -11,7 +11,7 @@ start-release: build-container-release remove-podman-containers
# Removes and stops any containers related to the project
[private]
remove-podman-containers:
podman container rm -f ttime
podman container rm -fi ttime
# Saves the release container to a tarball, pigz is just gzip but multithreaded
save-release: build-container-release
@ -23,14 +23,14 @@ load-release file:
# Tests every part of the project
testall:
cd backend && make test
cd backend && make lint
cd frontend && npm test
cd frontend && npm run lint
cd backend && make test
cd backend && make lint
# Cleans up everything related to the project
clean: remove-podman-containers
podman image rm -f ttime-server
podman image rm -fi ttime-server
rm -rf frontend/dist
rm -rf frontend/node_modules
rm -f ttime-server.tar.gz
@ -41,3 +41,6 @@ clean: remove-podman-containers
[confirm]
podman-clean:
podman system reset --force
install-linter:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2

View file

@ -69,3 +69,7 @@ lint:
# Default target
default: build
install-just:
@echo "Installing just"
@curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin

View file

@ -10,8 +10,8 @@ require (
require (
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
github.com/gofiber/contrib/jwt v1.0.8 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/gofiber/contrib/jwt v1.0.8
github.com/golang-jwt/jwt/v5 v5.2.1
)
// These are all for fiber

View file

@ -115,6 +115,7 @@ func (gs *GState) Login(c *fiber.Ctx) error {
// LoginRenew is a simple handler that renews the token
func (gs *GState) LoginRenew(c *fiber.Ctx) error {
// For testing: curl localhost:3000/restricted -H "Authorization: Bearer <token>"
user := c.Locals("user").(*jwt.Token)
claims := user.Claims.(jwt.MapClaims)
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()