Compare commits
6 commits
d023bb0adf
...
acff254aa5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
acff254aa5 | ||
![]() |
3175c62e6d | ||
![]() |
b31349ec37 | ||
![]() |
4cfb227a1e | ||
![]() |
524baf90d2 | ||
![]() |
c5f0bc509e |
4 changed files with 14 additions and 6 deletions
11
Justfile
11
Justfile
|
@ -11,7 +11,7 @@ start-release: build-container-release remove-podman-containers
|
||||||
# Removes and stops any containers related to the project
|
# Removes and stops any containers related to the project
|
||||||
[private]
|
[private]
|
||||||
remove-podman-containers:
|
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
|
# Saves the release container to a tarball, pigz is just gzip but multithreaded
|
||||||
save-release: build-container-release
|
save-release: build-container-release
|
||||||
|
@ -23,14 +23,14 @@ load-release file:
|
||||||
|
|
||||||
# Tests every part of the project
|
# Tests every part of the project
|
||||||
testall:
|
testall:
|
||||||
cd backend && make test
|
|
||||||
cd backend && make lint
|
|
||||||
cd frontend && npm test
|
cd frontend && npm test
|
||||||
cd frontend && npm run lint
|
cd frontend && npm run lint
|
||||||
|
cd backend && make test
|
||||||
|
cd backend && make lint
|
||||||
|
|
||||||
# Cleans up everything related to the project
|
# Cleans up everything related to the project
|
||||||
clean: remove-podman-containers
|
clean: remove-podman-containers
|
||||||
podman image rm -f ttime-server
|
podman image rm -fi ttime-server
|
||||||
rm -rf frontend/dist
|
rm -rf frontend/dist
|
||||||
rm -rf frontend/node_modules
|
rm -rf frontend/node_modules
|
||||||
rm -f ttime-server.tar.gz
|
rm -f ttime-server.tar.gz
|
||||||
|
@ -41,3 +41,6 @@ clean: remove-podman-containers
|
||||||
[confirm]
|
[confirm]
|
||||||
podman-clean:
|
podman-clean:
|
||||||
podman system reset --force
|
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
|
||||||
|
|
|
@ -69,3 +69,7 @@ lint:
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
|
install-just:
|
||||||
|
@echo "Installing just"
|
||||||
|
@curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
|
||||||
|
|
|
@ -10,8 +10,8 @@ require (
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
|
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
|
||||||
github.com/gofiber/contrib/jwt v1.0.8 // indirect
|
github.com/gofiber/contrib/jwt v1.0.8
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||||
)
|
)
|
||||||
|
|
||||||
// These are all for fiber
|
// These are all for fiber
|
||||||
|
|
|
@ -115,6 +115,7 @@ func (gs *GState) Login(c *fiber.Ctx) error {
|
||||||
|
|
||||||
// LoginRenew is a simple handler that renews the token
|
// LoginRenew is a simple handler that renews the token
|
||||||
func (gs *GState) LoginRenew(c *fiber.Ctx) error {
|
func (gs *GState) LoginRenew(c *fiber.Ctx) error {
|
||||||
|
// For testing: curl localhost:3000/restricted -H "Authorization: Bearer <token>"
|
||||||
user := c.Locals("user").(*jwt.Token)
|
user := c.Locals("user").(*jwt.Token)
|
||||||
claims := user.Claims.(jwt.MapClaims)
|
claims := user.Claims.(jwt.MapClaims)
|
||||||
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
|
claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
|
||||||
|
|
Loading…
Reference in a new issue