API: Move handling of HTTP auth headers to pkg/header #808 #3943 #3959

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2024-01-09 10:58:47 +01:00
parent 881bc4cb28
commit 3e924b70c7
21 changed files with 234 additions and 158 deletions

View File

@@ -0,0 +1,17 @@
package api
import (
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/pkg/header"
)
// ClientIP returns the client IP address from the request context or a placeholder if it is unknown.
func ClientIP(c *gin.Context) (ip string) {
return header.ClientIP(c)
}
// UserAgent returns the user agent from the request context or an empty string if it is unknown.
func UserAgent(c *gin.Context) string {
return header.UserAgent(c)
}