frontend

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package frontend contains the HTTP endpoints for delivering the official web client. In order to register the endpoints you have to call SetupRoutes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePageConfig

type BasePageConfig struct {

	// Version is the tagged source code version of this build. Can be empty for dev
	// builds. Untagged commits will be of format `tag-N-gSHA`.
	Version string `json:"version"`
	// Commit that was deployed, if we didn't deploy a concrete tag.
	Commit string `json:"commit"`
	// RootPath is the path directly after the domain and before the
	// scribble.rs paths. For example if you host scribblers on painting.com
	// but already host a different website, then your API paths might have to
	// look like this: painting.com/scribblers/v1.
	RootPath string `json:"rootPath"`
	// RootURL is similar to RootPath, but contains only the protocol and
	// domain. So it could be https://painting.com. This is required for some
	// non critical functionality, such as metadata tags.
	RootURL string `json:"rootUrl"`
	// CanonicalURL specifies the original domain, in case we are accessing the
	// site via some other domain, such as scribblers.fly.dev
	CanonicalURL string `json:"canonicalUrl"`
	// AllowIndexing will control whether the noindex, nofollow meta tag is
	// added to the home page.
	AllowIndexing bool `env:"ALLOW_INDEXING"`
	// contains filtered or unexported fields
}

BasePageConfig is data that all pages require to function correctly, no matter whether error page or lobby page.

func (*BasePageConfig) Hash added in v0.9.2

func (baseConfig *BasePageConfig) Hash(key string, bytes []byte) error

func (*BasePageConfig) WithCacheBust added in v0.9.2

func (baseConfig *BasePageConfig) WithCacheBust(file string) template.HTMLAttr

type IndexPageData added in v0.9.0

type IndexPageData struct {
	*BasePageConfig
	config.LobbySettingDefaults
	game.SettingBounds

	Translation       translations.Translation
	Locale            string
	Errors            []string
	Languages         map[string]string
	ScoreCalculations []string
}

IndexPageData defines all non-static data for the lobby create page.

type SSRHandler added in v0.8.5

type SSRHandler struct {
	// contains filtered or unexported fields
}

func NewHandler added in v0.8.5

func NewHandler(cfg *config.Config) (*SSRHandler, error)

func (*SSRHandler) SetupRoutes added in v0.8.5

func (handler *SSRHandler) SetupRoutes(register func(string, string, http.HandlerFunc))

SetupRoutes registers the official webclient endpoints with the http package.

Jump to

Keyboard shortcuts

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