From f9863d9dfb58f1f46a1cc6b5d13b9da1a622b161 Mon Sep 17 00:00:00 2001 From: Arkaprabha Chakraborty Date: Fri, 13 Feb 2026 00:17:17 +0530 Subject: [PATCH] fix: patch version 2.1 --- backend/.gitignore | 8 +------- backend/Makefile | 29 +++++++++++++++++++++++++++++ backend/auth.go | 2 ++ frontend/src/pages/User.tsx | 1 - 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 backend/Makefile diff --git a/backend/.gitignore b/backend/.gitignore index 3dbcb26..648e157 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,5 +1,5 @@ -# Go bin/ +data/ pkg/ *.exe *.dll @@ -7,9 +7,3 @@ pkg/ *.test *.prof .env - -# Database -reduce.db* - -# Binary -reduce \ No newline at end of file diff --git a/backend/Makefile b/backend/Makefile new file mode 100644 index 0000000..ab7255c --- /dev/null +++ b/backend/Makefile @@ -0,0 +1,29 @@ +.PHONY: build run clean fmt install + +# Build the Go application +build: + GOOS=linux \ + GOARCH=amd64 \ + CGO_ENABLED=1 \ + CC=x86_64-unknown-linux-gnu-gcc \ + CGO_CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE" \ + go build -ldflags="-s -w" -o bin/reduce . + +# Run the application +run: + go run . + +# Clean build artifacts +clean: + rm -rf bin/ + +# Format code +fmt: + go fmt ./... + +# Install dependencies +install: + go mod tidy + +# Default target +all: clean install build diff --git a/backend/auth.go b/backend/auth.go index 765d2dd..23e3e77 100644 --- a/backend/auth.go +++ b/backend/auth.go @@ -187,6 +187,7 @@ func login(c echo.Context) error { // Set httpOnly cookie cookie := &http.Cookie{ + Domain: os.Getenv("COOKIE_DOMAIN"), Name: "token", Value: token, Path: "/", @@ -210,6 +211,7 @@ func logout(c echo.Context) error { Path: "/", HttpOnly: true, MaxAge: -1, // Delete cookie + Domain: os.Getenv("COOKIE_DOMAIN"), } c.SetCookie(cookie) diff --git a/frontend/src/pages/User.tsx b/frontend/src/pages/User.tsx index 35dc518..840e6d6 100644 --- a/frontend/src/pages/User.tsx +++ b/frontend/src/pages/User.tsx @@ -62,7 +62,6 @@ export default function User() { setUpdatingUsername(true); try { - const res = await api.put('/user/username', { username: newUsername }); setSuccess('Username updated successfully'); // Update the user in context would require refetching /auth/me window.location.reload(); // Simple way to update context