Compare commits

...

4 Commits

Author SHA1 Message Date
Yurii Vlasov 92cf9b9341 Merge branch 'main' into main 2023-01-30 11:20:38 +00:00
clos f660badc3d feat(background): add Last-Modified header (#1376)
Reviewed-on: vikunja/api#1376
Co-authored-by: clos <clos@noreply.kolaente.de>
Co-committed-by: clos <clos@noreply.kolaente.de>
2023-01-29 22:07:46 +00:00
kolaente 491a142378
fix: lint 2023-01-29 22:42:24 +01:00
kolaente 46b261c9fe
chore(docs): adjust docs about frontend docker container 2023-01-29 15:53:10 +01:00
4 changed files with 13 additions and 6 deletions

View File

@ -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. 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 The docker container runs as an unprivileged user and does not mount anything.
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.
### API URL configuration in docker ### API URL configuration in docker

View File

@ -20,12 +20,12 @@ import (
"fmt" "fmt"
"os" "os"
"testing" "testing"
"xorm.io/builder"
"code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/log"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xorm.io/builder"
"xorm.io/xorm" "xorm.io/xorm"
"xorm.io/xorm/names" "xorm.io/xorm/names"
) )

View File

@ -19,13 +19,13 @@ package models
import ( import (
"testing" "testing"
"time" "time"
"xorm.io/builder"
"code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/events" "code.vikunja.io/api/pkg/events"
"code.vikunja.io/api/pkg/user" "code.vikunja.io/api/pkg/user"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xorm.io/builder"
) )
func TestTask_Create(t *testing.T) { func TestTask_Create(t *testing.T) {

View File

@ -295,6 +295,11 @@ func GetListBackground(c echo.Context) error {
_ = s.Rollback() _ = s.Rollback()
return handler.HandleHTTPError(err, c) 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. // 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. // 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) 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 // Serve the file
return c.Stream(http.StatusOK, "image/jpg", bgFile.File) return c.Stream(http.StatusOK, "image/jpg", bgFile.File)
} }