feat(ui): show user's lastAccess (#3342)

* feat(server): update user's lastAccess

* feat(ui): show user's lastAccess
This commit is contained in:
Deluan Quintão
2024-09-30 20:46:10 -04:00
committed by GitHub
parent 5e8085bf3c
commit a9334b7787
10 changed files with 148 additions and 11 deletions
+3 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/navidrome/navidrome/log"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/scanner"
"github.com/navidrome/navidrome/server"
"github.com/navidrome/navidrome/server/events"
"github.com/navidrome/navidrome/server/subsonic/responses"
"github.com/navidrome/navidrome/utils/req"
@@ -71,7 +72,8 @@ func (api *Router) routes() http.Handler {
r.Use(postFormToQueryParams)
r.Use(checkRequiredParameters)
r.Use(authenticate(api.ds))
// TODO Validate version
r.Use(server.UpdateLastAccessMiddleware(api.ds))
// TODO Validate API version?
// Subsonic endpoints, grouped by controller
r.Group(func(r chi.Router) {
-8
View File
@@ -119,14 +119,6 @@ func authenticate(ds model.DataStore) func(next http.Handler) http.Handler {
return
}
// TODO: Find a way to update LastAccessAt without causing too much retention in the DB
//go func() {
// err := ds.User(ctx).UpdateLastAccessAt(usr.ID)
// if err != nil {
// log.Error(ctx, "Could not update user's lastAccessAt", "user", usr.UserName)
// }
//}()
ctx = request.WithUser(ctx, *usr)
next.ServeHTTP(w, r.WithContext(ctx))
})