From 96df52ed8133d2ab9d960ce253b8fab8d7a58007 Mon Sep 17 00:00:00 2001 From: ae Date: Tue, 22 Apr 2025 21:30:21 +0300 Subject: [PATCH] feat: rebrand + favicon pack --- docker-compose-dev-backend.yml | 32 +++++++++--------- docker-compose.yml | 36 ++++++++++----------- scripts/purge.sh | 4 +-- scripts/run_backend_dev.sh | 6 ++-- scripts/run_full_dev.sh | 6 ++-- server/Dockerfile | 6 ++-- server/go.mod | 2 +- server/internal/service/auth.go | 8 ++--- server/internal/service/middleware.go | 2 +- server/internal/service/middleware_test.go | 4 +-- server/internal/service/notes.go | 2 +- server/internal/service/service.go | 2 +- server/main.go | 4 +-- web/nginx.conf | 2 +- web/package-lock.json | 4 +-- web/package.json | 2 +- web/src/app.html | 6 +++- web/src/lib/client.ts | 2 +- web/static/apple-touch-icon.png | Bin 0 -> 5903 bytes web/static/favicon-96x96.png | Bin 0 -> 3531 bytes web/static/favicon.ico | Bin 0 -> 15086 bytes web/static/favicon.png | Bin 1571 -> 0 bytes web/static/favicon.svg | 9 ++++++ 23 files changed, 76 insertions(+), 63 deletions(-) create mode 100644 web/static/apple-touch-icon.png create mode 100644 web/static/favicon-96x96.png create mode 100644 web/static/favicon.ico delete mode 100644 web/static/favicon.png create mode 100644 web/static/favicon.svg diff --git a/docker-compose-dev-backend.yml b/docker-compose-dev-backend.yml index 4caffd8..5bb83ca 100644 --- a/docker-compose-dev-backend.yml +++ b/docker-compose-dev-backend.yml @@ -1,7 +1,7 @@ services: - notatest-psql: + qnote-psql: image: postgres:16-alpine - container_name: notatest-psql + container_name: qnote-psql restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] @@ -10,30 +10,30 @@ services: retries: 5 timeout: 5s volumes: - - notatest-data:/var/lib/postgresql/data + - qnote-data:/var/lib/postgresql/data networks: - - notatest + - qnote environment: - POSTGRES_USER: ${PG_USER:-notatest} + POSTGRES_USER: ${PG_USER:-qnote} POSTGRES_PASSWORD: ${PG_PASS:?db password required} - POSTGRES_DB: ${PG_DB:-notatest} + POSTGRES_DB: ${PG_DB:-qnote} - notatest-server: - container_name: notatest-server + qnote-server: + container_name: qnote-server build: context: ${PWD}/server dockerfile: ${PWD}/server/Dockerfile - image: notatest-server:latest + image: qnote-server:latest networks: - - notatest + - qnote ports: - 8080:8080 # ! depends_on: - notatest-psql: + qnote-psql: condition: service_healthy environment: JWT_SECRET: ${JWT_SECRET:?jwt secret required} - DB_URL: postgres://${PG_USER:-notatest}:${PG_PASS:?db password required}@notatest-psql/${PG_DB:-notatest}?sslmode=disable + DB_URL: postgres://${PG_USER:-qnote}:${PG_PASS:?db password required}@qnote-psql/${PG_DB:-qnote}?sslmode=disable CSRF_SECRET: ${CSRF_SECRET:?csrf secret required} ADMIN_USERNAME: ${ADMIN_USERNAME:?init admin username required} ADMIN_PASSWORD: ${ADMIN_PASSWORD:?init admin password required} @@ -43,10 +43,10 @@ services: FRONTEND_URL: http://localhost:5173 networks: - notatest: + qnote: external: false - name: notatest + name: qnote volumes: - notatest-data: - name: notatest-data + qnote-data: + name: qnote-data diff --git a/docker-compose.yml b/docker-compose.yml index 57cfc67..ef97c78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: - notatest-psql: + qnote-psql: image: postgres:16-alpine - container_name: notatest-psql + container_name: qnote-psql restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] @@ -12,26 +12,26 @@ services: volumes: - ${PWD}/data:/var/lib/postgresql/data networks: - - notatest + - qnote environment: - POSTGRES_USER: ${PG_USER:-notatest} + POSTGRES_USER: ${PG_USER:-qnote} POSTGRES_PASSWORD: ${PG_PASS:?db password required} - POSTGRES_DB: ${PG_DB:-notatest} + POSTGRES_DB: ${PG_DB:-qnote} - notatest-server: - container_name: notatest-server + qnote-server: + container_name: qnote-server build: context: ${PWD}/server dockerfile: ${PWD}/server/Dockerfile - image: notatest-server:latest + image: qnote-server:latest networks: - - notatest + - qnote depends_on: - notatest-psql: + qnote-psql: condition: service_healthy environment: JWT_SECRET: ${JWT_SECRET:?jwt secret required} - DB_URL: postgres://${PG_USER:-notatest}:${PG_PASS:?db password required}@notatest-psql/${PG_DB:-notatest}?sslmode=disable + DB_URL: postgres://${PG_USER:-qnote}:${PG_PASS:?db password required}@qnote-psql/${PG_DB:-qnote}?sslmode=disable CSRF_SECRET: ${CSRF_SECRET:?csrf secret required} ADMIN_USERNAME: ${ADMIN_USERNAME:?init admin username required} ADMIN_PASSWORD: ${ADMIN_PASSWORD:?init admin password required} @@ -40,25 +40,25 @@ services: DOMAIN: ${DOMAIN:-localhost} FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000} - notatest-web: - container_name: notatest-web + qnote-web: + container_name: qnote-web build: context: ${PWD}/web dockerfile: ${PWD}/web/Dockerfile - image: notatest-web:latest + image: qnote-web:latest networks: - - notatest + - qnote # Add potential reverse proxy's local network here ports: - 3000:80 # Container port defined in nginx.conf (bound to 3000 for dev.) depends_on: - - notatest-server + - qnote-server environment: VITE_VIEW_COOKIE_PATH: ${VITE_VIEW_COOKIE_PATH:-/} VITE_VIEW_COOKIE_DOMAIN: ${DOMAIN:-localhost} VITE_COOKIE_SAME_SITE: ${VITE_COOKIE_SAME_SITE:-strict} networks: - notatest: + qnote: external: false - name: notatest + name: qnote diff --git a/scripts/purge.sh b/scripts/purge.sh index d822417..2ea8c44 100755 --- a/scripts/purge.sh +++ b/scripts/purge.sh @@ -2,5 +2,5 @@ # Delete all Docker artifacts (e.g. DB) from previous test runs -docker stop notatest-server notatest-psql && docker rm -f notatest-server notatest-psql -docker volume rm -f notatest-data +docker stop qnote-server qnote-psql && docker rm -f qnote-server qnote-psql +docker volume rm -f qnote-data diff --git a/scripts/run_backend_dev.sh b/scripts/run_backend_dev.sh index 4a64074..fbbe338 100755 --- a/scripts/run_backend_dev.sh +++ b/scripts/run_backend_dev.sh @@ -2,9 +2,9 @@ DEV_COMPOSE_FILE="docker-compose-dev-backend.yml" -[ "$( docker container inspect -f '{{.State.Status}}' notatest-psql )" = "running" ] || docker compose up notatest-psql -d +[ "$( docker container inspect -f '{{.State.Status}}' qnote-psql )" = "running" ] || docker compose up qnote-psql -d # Shutdown, rebuild, & restart -docker compose stop notatest-server && docker compose rm -f notatest-server +docker compose stop qnote-server && docker compose rm -f qnote-server docker compose -f $DEV_COMPOSE_FILE build -docker compose -f $DEV_COMPOSE_FILE up notatest-server +docker compose -f $DEV_COMPOSE_FILE up qnote-server diff --git a/scripts/run_full_dev.sh b/scripts/run_full_dev.sh index 9697275..37048f1 100755 --- a/scripts/run_full_dev.sh +++ b/scripts/run_full_dev.sh @@ -2,9 +2,9 @@ DEV_COMPOSE_FILE="docker-compose.yml" -[ "$( docker container inspect -f '{{.State.Status}}' notatest-psql )" = "running" ] || docker compose up notatest-psql -d +[ "$( docker container inspect -f '{{.State.Status}}' qnote-psql )" = "running" ] || docker compose up qnote-psql -d # Shutdown, rebuild, & restart -docker compose stop notatest-server notatest-web && docker compose rm -f notatest-server notatest-web +docker compose stop qnote-server qnote-web && docker compose rm -f qnote-server qnote-web docker compose -f $DEV_COMPOSE_FILE build -docker compose -f $DEV_COMPOSE_FILE up notatest-server notatest-web +docker compose -f $DEV_COMPOSE_FILE up qnote-server qnote-web diff --git a/server/Dockerfile b/server/Dockerfile index cbc2f48..b5bfd96 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -7,13 +7,13 @@ RUN go mod download COPY . . # Optionally we could also strip debug symbols with `-ldflags '-s'` -RUN CGO_ENABLED=0 GOOS=linux go build -o /notatest . +RUN CGO_ENABLED=0 GOOS=linux go build -o /qnote . # Final stage (optimized image size) FROM alpine:latest WORKDIR /app -COPY --from=builder /notatest /app/notatest +COPY --from=builder /qnote /app/qnote EXPOSE 8080 -CMD ["/app/notatest"] +CMD ["/app/qnote"] diff --git a/server/go.mod b/server/go.mod index d73c586..fb7c3d0 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,4 +1,4 @@ -module git.umbrella.haus/ae/notatest +module git.umbrella.haus/ae/qnote go 1.24.1 diff --git a/server/internal/service/auth.go b/server/internal/service/auth.go index 2fce071..a5d8022 100644 --- a/server/internal/service/auth.go +++ b/server/internal/service/auth.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "git.umbrella.haus/ae/notatest/internal/data" + "git.umbrella.haus/ae/qnote/internal/data" "github.com/go-chi/chi/v5" "github.com/golang-jwt/jwt/v5" "github.com/google/uuid" @@ -26,8 +26,8 @@ const ( accessTokenDuration = 15 * time.Minute refreshTokenDuration = 7 * 24 * time.Hour - authCookieName = "notatest.refresh_token" - viewCookieName = "notatest.expires_at" + authCookieName = "qnote.refresh_token" + viewCookieName = "qnote.expires_at" authCookiePath = "/api/auth/cookie" viewCookiePath = "/" ) @@ -694,7 +694,7 @@ func getTokenFromHeader(r *http.Request) (string, error) { // Parse the JWT token from the request's cookies (httpOnly cookie). func getTokenFromCookie(r *http.Request) (string, error) { - cookie, err := r.Cookie("notatest.refresh_token") + cookie, err := r.Cookie("qnote.refresh_token") if err != nil { return "", err } diff --git a/server/internal/service/middleware.go b/server/internal/service/middleware.go index 6db7ba9..213d5ff 100644 --- a/server/internal/service/middleware.go +++ b/server/internal/service/middleware.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "git.umbrella.haus/ae/notatest/internal/data" + "git.umbrella.haus/ae/qnote/internal/data" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/golang-jwt/jwt/v5" diff --git a/server/internal/service/middleware_test.go b/server/internal/service/middleware_test.go index 97d01a0..2e87ec1 100644 --- a/server/internal/service/middleware_test.go +++ b/server/internal/service/middleware_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "git.umbrella.haus/ae/notatest/internal/data" + "git.umbrella.haus/ae/qnote/internal/data" "github.com/go-chi/chi/v5" "github.com/golang-jwt/jwt/v5" "github.com/google/uuid" @@ -110,7 +110,7 @@ func TestRequireRTMiddleware(t *testing.T) { req := httptest.NewRequest("GET", "/", nil) if tc.token != "" { req.AddCookie(&http.Cookie{ - Name: "notatest.refresh_token", + Name: "qnote.refresh_token", Value: tc.token, HttpOnly: true, }) diff --git a/server/internal/service/notes.go b/server/internal/service/notes.go index 773ca6b..39e5873 100644 --- a/server/internal/service/notes.go +++ b/server/internal/service/notes.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "git.umbrella.haus/ae/notatest/internal/data" + "git.umbrella.haus/ae/qnote/internal/data" "github.com/go-chi/chi/v5" "github.com/google/uuid" ) diff --git a/server/internal/service/service.go b/server/internal/service/service.go index 341a9a5..52f1257 100644 --- a/server/internal/service/service.go +++ b/server/internal/service/service.go @@ -3,7 +3,7 @@ package service import ( "net/http" - "git.umbrella.haus/ae/notatest/internal/data" + "git.umbrella.haus/ae/qnote/internal/data" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/go-chi/cors" diff --git a/server/main.go b/server/main.go index 2d7f2d2..1ead809 100644 --- a/server/main.go +++ b/server/main.go @@ -6,8 +6,8 @@ import ( "fmt" "os" - "git.umbrella.haus/ae/notatest/internal/data" - "git.umbrella.haus/ae/notatest/internal/service" + "git.umbrella.haus/ae/qnote/internal/data" + "git.umbrella.haus/ae/qnote/internal/service" "github.com/caarlos0/env/v10" "github.com/golang-migrate/migrate/v4" _ "github.com/golang-migrate/migrate/v4/database/postgres" diff --git a/web/nginx.conf b/web/nginx.conf index a5e0f56..7e34938 100644 --- a/web/nginx.conf +++ b/web/nginx.conf @@ -26,7 +26,7 @@ server { gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; location /api { - proxy_pass http://notatest-server:8080; # Internal Docker DNS + proxy_pass http://qnote-server:8080; # Internal Docker DNS proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/web/package-lock.json b/web/package-lock.json index 7f8c458..0db28fe 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,11 +1,11 @@ { - "name": "sveltetest", + "name": "qnote", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "sveltetest", + "name": "qnote", "version": "0.0.1", "dependencies": { "marked": "^15.0.7" diff --git a/web/package.json b/web/package.json index cd1dd67..f343cde 100644 --- a/web/package.json +++ b/web/package.json @@ -1,5 +1,5 @@ { - "name": "sveltetest", + "name": "qnote", "private": true, "version": "0.0.1", "type": "module", diff --git a/web/src/app.html b/web/src/app.html index 15a2adf..79683ea 100644 --- a/web/src/app.html +++ b/web/src/app.html @@ -2,7 +2,11 @@ - + + + + + %sveltekit.head%