File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,6 +185,12 @@ func (a *ClientAPI) GetClients(ctx *gin.Context) {
185185 if success := successOrAbort (ctx , 500 , err ); ! success {
186186 return
187187 }
188+ now := time .Now ()
189+ for _ , client := range clients {
190+ if client .ElevatedUntil != nil && ! now .Before (* client .ElevatedUntil ) {
191+ client .ElevatedUntil = nil
192+ }
193+ }
188194 ctx .JSON (200 , clients )
189195}
190196
Original file line number Diff line number Diff line change 44 "errors"
55 "fmt"
66 "net/http"
7+ "time"
78
89 "github.com/gin-gonic/gin"
910 "github.com/gotify/server/v2/auth"
@@ -138,7 +139,9 @@ func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
138139 client := auth .GetClient (ctx )
139140 if client != nil {
140141 result .ClientID = client .ID
141- result .ElevatedUntil = client .ElevatedUntil
142+ if client .ElevatedUntil != nil && time .Now ().Before (* client .ElevatedUntil ) {
143+ result .ElevatedUntil = client .ElevatedUntil
144+ }
142145 }
143146 ctx .JSON (200 , result )
144147}
You can’t perform that action at this time.
0 commit comments