photoprism/internal/api/api_request.go

18 lines
445 B
Go
Raw Normal View History

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