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 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) { 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) }