routes

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 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
)

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 Manifest added in v0.15.0

func Manifest(c echo.Context) error

Manifest generates and returns a web app manifest JSON response based on the request referer URL. It sets appropriate headers and formats the manifest data according to the Web App Manifest spec.

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 ManifestIcons added in v0.15.0

type ManifestIcons struct {
	Src   string `json:"src"`   // Path to the icon file
	Sizes string `json:"sizes"` // Dimensions of the icon
	Type  string `json:"type"`  // MIME type of the icon
}

ManifestIcons represents the icon information in the web app manifest

type ManifestJSON added in v0.15.0

type ManifestJSON struct {
	Name            string          `json:"name"`             // Full name of the web application
	ShortName       string          `json:"short_name"`       // Short name for the app, used on home screens
	Description     string          `json:"description"`      // Description of the web application
	StartURL        string          `json:"start_url"`        // URL that loads when app is launched
	Scope           string          `json:"scope"`            // Navigation scope that remains within the app
	Display         string          `json:"display"`          // Preferred display mode for the website
	BackgroundColor string          `json:"background_color"` // Background color for splash screen
	ThemeColor      string          `json:"theme_color"`      // Theme color for the application
	Icons           []ManifestIcons `json:"icons"`            // Array of icons for different sizes
}

ManifestJSON represents the JSON structure for a web app manifest

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