From 46b261c9fe27c03f1210057f6be283b665efb605 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 29 Jan 2023 15:53:10 +0100 Subject: [PATCH 1/3] chore(docs): adjust docs about frontend docker container --- docs/content/doc/setup/install-frontend.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/content/doc/setup/install-frontend.md b/docs/content/doc/setup/install-frontend.md index 77c2a610c..0a7130de6 100644 --- a/docs/content/doc/setup/install-frontend.md +++ b/docs/content/doc/setup/install-frontend.md @@ -47,10 +47,7 @@ which will run the docker image and expose port 80 on the host. See [full docker example]({{< ref "full-docker-example.md">}}) for more varations of this config. -### Setting user and group id of the user running vikunja - -You can set the user and group id of the user running vikunja with the `PUID` and `PGID` evironment variables. -This follows the pattern used by [the linuxserver.io](https://docs.linuxserver.io/general/understanding-puid-and-pgid) docker images. +The docker container runs as an unprivileged user and does not mount anything. ### API URL configuration in docker From 491a1423788b76f236d070071cb46f5b2f5d3fd0 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 29 Jan 2023 22:42:24 +0100 Subject: [PATCH 2/3] fix: lint --- pkg/db/test.go | 2 +- pkg/models/tasks_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/db/test.go b/pkg/db/test.go index 7a5ff4f40..146643ffb 100644 --- a/pkg/db/test.go +++ b/pkg/db/test.go @@ -20,12 +20,12 @@ import ( "fmt" "os" "testing" - "xorm.io/builder" "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/log" "github.com/stretchr/testify/assert" + "xorm.io/builder" "xorm.io/xorm" "xorm.io/xorm/names" ) diff --git a/pkg/models/tasks_test.go b/pkg/models/tasks_test.go index 96ac031bf..a6bbc71c4 100644 --- a/pkg/models/tasks_test.go +++ b/pkg/models/tasks_test.go @@ -19,13 +19,13 @@ package models import ( "testing" "time" - "xorm.io/builder" "code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/events" "code.vikunja.io/api/pkg/user" "github.com/stretchr/testify/assert" + "xorm.io/builder" ) func TestTask_Create(t *testing.T) { From f660badc3d947ecf8300b7316b57e4274d20af4c Mon Sep 17 00:00:00 2001 From: clos Date: Sun, 29 Jan 2023 22:07:46 +0000 Subject: [PATCH 3/3] feat(background): add Last-Modified header (#1376) Reviewed-on: https://kolaente.dev/vikunja/api/pulls/1376 Co-authored-by: clos Co-committed-by: clos --- pkg/modules/background/handler/background.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/modules/background/handler/background.go b/pkg/modules/background/handler/background.go index dc57b23b5..6dfd74437 100644 --- a/pkg/modules/background/handler/background.go +++ b/pkg/modules/background/handler/background.go @@ -295,6 +295,11 @@ func GetListBackground(c echo.Context) error { _ = s.Rollback() return handler.HandleHTTPError(err, c) } + stat, err := bgFile.File.Stat() + if err != nil { + _ = s.Rollback() + return handler.HandleHTTPError(err, c) + } // Unsplash requires pingbacks as per their api usage guidelines. // To do this in a privacy-preserving manner, we do the ping from inside of Vikunja to not expose any user details. @@ -306,6 +311,11 @@ func GetListBackground(c echo.Context) error { return handler.HandleHTTPError(err, c) } + // Set Last-Modified header if we have the file stat, so clients can decide whether to use cached files + if stat != nil { + c.Response().Header().Set(echo.HeaderLastModified, stat.ModTime().UTC().Format(http.TimeFormat)) + } + // Serve the file return c.Stream(http.StatusOK, "image/jpg", bgFile.File) }