routes

package
v0.14.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package routes provides HTTP endpoint handlers for the Kiosk application.

It includes functions for rendering pages, handling API requests, and managing caching of page data. This package is responsible for defining the web routes and their corresponding handler functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	KioskVersion string

	ViewDataCache *cache.Cache
)

Functions

func Clock

func Clock(baseConfig *config.Config) echo.HandlerFunc

Clock clock endpoint

func DrawFaceOnImage

func DrawFaceOnImage(img image.Image, i *immich.ImmichAsset) image.Image

func FlushCache

func FlushCache(baseConfig *config.Config) echo.HandlerFunc

func Home

func Home(baseConfig *config.Config) echo.HandlerFunc

Home home endpoint

func InitializeRequestData

func InitializeRequestData(c echo.Context, baseConfig *config.Config) (*common.RouteRequestData, error)

InitializeRequestData processes incoming request context and configuration to create RouteRequestData. It handles kiosk version checks, client configuration overrides, and request metadata.

Parameters:

  • c: Echo context containing the HTTP request and response data
  • baseConfig: Base configuration to be used as template for request-specific config

Returns:

  • *common.RouteRequestData: Processed request data and configuration
  • error: Any errors encountered during initialization

func NewImage

func NewImage(baseConfig *config.Config) echo.HandlerFunc

NewImage returns an echo.HandlerFunc that handles requests for new images. It manages image processing, caching, and prefetching based on the configuration.

func NewRawImage

func NewRawImage(baseConfig *config.Config) echo.HandlerFunc

NewRawImage returns an echo.HandlerFunc that handles requests for raw images. It processes the image without any additional transformations and returns it as a blob.

func PreviousImage

func PreviousImage(baseConfig *config.Config) echo.HandlerFunc

PreviousImage returns an echo.HandlerFunc that handles requests for previous images. It retrieves the previous images from the history and renders them.

func ProcessViewImageData

func ProcessViewImageData(requestConfig config.Config, c echo.Context, isPrefetch bool) (common.ViewImageData, error)

func ProcessViewImageDataWithRatio

func ProcessViewImageDataWithRatio(imageOrientation immich.ImageOrientation, requestConfig config.Config, c echo.Context, isPrefetch bool) (common.ViewImageData, error)

func Redirect

func Redirect(baseConfig *config.Config) echo.HandlerFunc

Redirect returns an echo.HandlerFunc that handles URL redirections based on configured redirect paths. It takes a baseConfig parameter containing the application configuration including redirect mappings.

If the requested redirect name exists in the RedirectsMap, it redirects to the mapped URL. Otherwise, it redirects to the root path "/".

The function returns a temporary (307) redirect in both cases.

func RefreshCheck

func RefreshCheck(baseConfig *config.Config) echo.HandlerFunc

RefreshCheck endpoint to check if device requires a refresh

func Render

func Render(ctx echo.Context, statusCode int, t templ.Component) error

This custom Render replaces Echo's echo.Context.Render() with templ's templ.Component.Render().

func RenderError

func RenderError(c echo.Context, err error, message string) error

func ShouldDrawFacesOnImages

func ShouldDrawFacesOnImages() bool

func Sleep

func Sleep(baseConfig *config.Config) echo.HandlerFunc

Sleep sleep mode endpoint

func Weather

func Weather(baseConfig *config.Config) echo.HandlerFunc

func Webhooks

func Webhooks(baseConfig *config.Config) echo.HandlerFunc

Types

type PersonOrAlbum

type PersonOrAlbum struct {
	Type string
	ID   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL