www

package
v7.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Overview

package www implements HTTP handlers for the whosonfirst-browser web application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAssetHandlers

func AppendAssetHandlers(mux *http.ServeMux, opts *BrowserOptions) error

Append all the files in the net/http FS instance containing the embedded Browser assets to an *http.ServeMux instance.

func AppendResourcesHandler

func AppendResourcesHandler(next http.Handler, opts *BrowserOptions) http.Handler

AppendResourcesHandlerWithPrefix will rewrite any HTML produced by previous handler to include the necessary markup to load Browser JavaScript files and related assets ensuring that all URIs are prepended with a prefix.

func CreateFeatureHandler

func CreateFeatureHandler(opts *CreateFeatureHandlerOptions) (http.Handler, error)

func CustomValidationWasmHandler

func CustomValidationWasmHandler(opts *CustomValidationWasmHandlerOptions) (http.Handler, error)

func DataHandler

func DataHandler(root string) (http.Handler, error)

func DefaultRasterSizes

func DefaultRasterSizes() map[string]RasterSize

func DefaultSVGSizes

func DefaultSVGSizes() map[string]SVGSize

func EditGeometryHandler

func EditGeometryHandler(opts *EditGeometryHandlerOptions) (http.Handler, error)

func GeoJSONHandler

func GeoJSONHandler(opts *GeoJSONHandlerOptions) (http.Handler, error)

func GeoJSONLDHandler

func GeoJSONLDHandler(opts *GeoJSONLDHandlerOptions) (http.Handler, error)

func IDHandler

func IDHandler(opts IDHandlerOptions) (http.Handler, error)

func IndexHandler

func IndexHandler(opts IndexHandlerOptions) (http.Handler, error)
func NavPlaceHandler(opts *NavPlaceHandlerOptions) (http.Handler, error)

NavPlaceHandler will return a given record as a FeatureCollection for use by the IIIF navPlace extension, specifically as navPlace "reference" objects.

func NewNullHandler

func NewNullHandler() http.Handler

func RasterHandler

func RasterHandler(opts *RasterHandlerOptions) (http.Handler, error)

func RenderTemplate

func RenderTemplate(rsp gohttp.ResponseWriter, t *template.Template, vars interface{})

func SPRHandler

func SPRHandler(opts *SPRHandlerOptions) (http.Handler, error)

func SVGHandler

func SVGHandler(opts *SVGHandlerOptions) (http.Handler, error)

func SearchHandler

func SearchHandler(opts SearchHandlerOptions) (http.Handler, error)

func SelectHandler

func SelectHandler(opts *SelectHandlerOptions) (http.Handler, error)

func URIsHandler

func URIsHandler(opts *URIsHandlerOptions) (http.Handler, error)

func WebfingerHandler

func WebfingerHandler(opts *WebfingerHandlerOptions) (http.Handler, error)

Types

type Assets

type Assets struct {
	JS  []string
	CSS []string
}

type BrowserOptions

type BrowserOptions struct {
	JS             []string
	CSS            []string
	DataAttributes map[string]string
	// AppendJavaScriptAtEOF is a boolean flag to append JavaScript markup at the end of an HTML document
	// rather than in the <head> HTML element. Default is false
	AppendJavaScriptAtEOF bool
	RollupAssets          bool

	JSRollupURI  []string
	CSSRollupURI []string
	Prefix       string
	Logger       *log.Logger
	// contains filtered or unexported fields
}

BrowserOptions provides a list of JavaScript and CSS link to include with HTML output.

func DefaultBrowserOptions

func DefaultBrowserOptions() *BrowserOptions

Return a *BrowserOptions struct with default paths and URIs.

func (*BrowserOptions) Clone

func (opts *BrowserOptions) Clone() *BrowserOptions

func (*BrowserOptions) WithCreateHandlerAssets

func (opts *BrowserOptions) WithCreateHandlerAssets() *BrowserOptions

func (*BrowserOptions) WithCreateHandlerResources

func (opts *BrowserOptions) WithCreateHandlerResources() *BrowserOptions

func (*BrowserOptions) WithGeometryHandlerAssets

func (opts *BrowserOptions) WithGeometryHandlerAssets() *BrowserOptions

func (*BrowserOptions) WithGeometryHandlerResources

func (opts *BrowserOptions) WithGeometryHandlerResources() *BrowserOptions

func (*BrowserOptions) WithIdHandlerAssets

func (opts *BrowserOptions) WithIdHandlerAssets() *BrowserOptions

func (*BrowserOptions) WithIdHandlerResources

func (opts *BrowserOptions) WithIdHandlerResources() *BrowserOptions

type CreateFeatureHandlerOptions

type CreateFeatureHandlerOptions struct {
	Reader           reader.Reader
	Authenticator    auth.Authenticator
	Logger           *log.Logger
	Template         *template.Template
	MapProvider      string
	URIs             *uris.URIs
	Capabilities     *capabilities.Capabilities
	CustomProperties []browser_properties.CustomProperty
}

type CreateFeatureVars

type CreateFeatureVars struct {
	MapProvider      string
	Paths            *uris.URIs
	Capabilities     *capabilities.Capabilities
	CustomProperties []browser_properties.CustomProperty
	URIPrefix        string
	Account          *auth.Account
}

type CustomValidationWasmHandlerOptions

type CustomValidationWasmHandlerOptions struct {
	CustomValidationWasm *browser_custom.CustomValidationWasm
}

type EditGeometryHandlerOptions

type EditGeometryHandlerOptions struct {
	Reader        reader.Reader
	Authenticator auth.Authenticator
	Logger        *log.Logger
	Template      *template.Template
	MapProvider   string
	URIs          *uris.URIs
	Capabilities  *capabilities.Capabilities
}

type EditGeometryVars

type EditGeometryVars struct {
	MapProvider  string
	Id           int64
	Paths        *uris.URIs
	Capabilities *capabilities.Capabilities
	// To do: Support alternate geometries
	URIPrefix string
	Account   *auth.Account
}

type ErrorVars

type ErrorVars struct {
	Error error
	URIs  *uris.URIs
}

type GeoJSONHandlerOptions

type GeoJSONHandlerOptions struct {
	Reader reader.Reader
	Logger *log.Logger
}

type GeoJSONLDHandlerOptions

type GeoJSONLDHandlerOptions struct {
	Reader reader.Reader
	Logger *log.Logger
}

type IDHandlerOptions

type IDHandlerOptions struct {
	Authenticator auth.Authenticator
	Templates     *template.Template
	Reader        reader.Reader
	Logger        *log.Logger
	MapProvider   string
	URIs          *uris.URIs
	Capabilities  *capabilities.Capabilities
}

type IDVars

type IDVars struct {
	SPR          spr.StandardPlacesResult
	URI          string
	URIArgs      *uri.URIArgs
	IsAlternate  bool
	LastModified string
	Paths        *uris.URIs
	Capabilities *capabilities.Capabilities
	MapProvider  string
	URIPrefix    string
	Account      *auth.Account
}

type IndexHandlerOptions

type IndexHandlerOptions struct {
	Templates    *template.Template
	URIs         *uris.URIs
	Capabilities *capabilities.Capabilities
}

type IndexVars

type IndexVars struct {
	Paths        *uris.URIs
	Capabilities *capabilities.Capabilities
}
type NavPlaceHandlerOptions struct {
	Reader      reader.Reader
	Logger      *log.Logger
	MaxFeatures int
}

type NotFoundVars

type NotFoundVars struct {
	URIs *uris.URIs
}

type RasterHandlerOptions

type RasterHandlerOptions struct {
	Format string
	Sizes  map[string]RasterSize
	Reader reader.Reader
	Logger *log.Logger
}

type RasterSize

type RasterSize struct {
	Label     string
	MaxHeight int
	MaxWidth  int
}

type SPRHandlerOptions

type SPRHandlerOptions struct {
	Reader reader.Reader
	Logger *log.Logger
}

type SVGHandlerOptions

type SVGHandlerOptions struct {
	Sizes  map[string]SVGSize
	Reader reader.Reader
	Logger *log.Logger
}

type SVGSize

type SVGSize struct {
	Label     string
	MaxHeight int
	MaxWidth  int
}

type SearchHandlerOptions

type SearchHandlerOptions struct {
	Templates    *template.Template
	Database     fulltext.FullTextDatabase
	MapProvider  string
	URIs         *uris.URIs
	Capabilities *capabilities.Capabilities
}

type SearchVars

type SearchVars struct {
	Paths        *uris.URIs
	Capabilities *capabilities.Capabilities
	Query        string
	Results      []spr.StandardPlacesResult
}

type SelectHandlerOptions

type SelectHandlerOptions struct {
	Pattern *regexp.Regexp
	Reader  reader.Reader
	Logger  *log.Logger
}

type URIsHandlerOptions

type URIsHandlerOptions struct {
	URIs     *uris.URIs
	Template *template.Template
}

type URIsHandlerVars

type URIsHandlerVars struct {
	URIs string
}

type WebfingerHandlerOptions

type WebfingerHandlerOptions struct {
	Reader       reader.Reader
	Logger       *log.Logger
	Hostname     string
	URIs         *uris.URIs
	Capabilities *capabilities.Capabilities
}

Jump to

Keyboard shortcuts

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