site

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CSPDirectiveDefaultSrc  = "default-src"
	CSPDirectiveConnectSrc  = "connect-src"
	CSPDirectiveChildSrc    = "child-src"
	CSPDirectiveScriptSrc   = "script-src"
	CSPDirectiveFontSrc     = "font-src"
	CSPDirectiveStyleSrc    = "style-src"
	CSPDirectiveObjectSrc   = "object-src"
	CSPDirectiveManifestSrc = "manifest-src"
	CSPDirectiveFrameSrc    = "frame-src"
	CSPDirectiveImgSrc      = "img-src"
	CSPDirectiveReportURI   = "report-uri"
	CSPDirectiveFormAction  = "form-action"
	CSPDirectiveMediaSrc    = "media-src"
	CSPFrameAncestors       = "frame-ancestors"
)

Variables

This section is empty.

Functions

func ExtractOrReadBinFS added in v0.7.4

func ExtractOrReadBinFS(dest string, siteFS fs.FS) (http.FileSystem, error)

ExtractOrReadBinFS checks the provided fs for compressed coder binaries and extracts them into dest/bin if found. As a fallback, the provided FS is checked for a /bin directory, if it is non-empty it is returned. Finally dest/bin is returned as a fallback allowing binaries to be manually placed in dest (usually ${CODER_CACHE_DIRECTORY}/site/bin).

func FS added in v0.6.1

func FS() fs.FS

func Handler added in v0.6.1

func Handler(siteFS fs.FS, binFS http.FileSystem) http.Handler

Handler returns an HTTP handler for serving the static site.

func RenderStaticErrorPage added in v0.9.3

func RenderStaticErrorPage(rw http.ResponseWriter, r *http.Request, data ErrorPageData)

RenderStaticErrorPage renders the static error page. This is used by app requests to avoid dependence on the dashboard but maintain the ability to render a friendly error page on subdomains.

func ShouldCacheFile added in v0.6.1

func ShouldCacheFile(reqFile string) bool

Types

type CSPDirectives added in v0.6.1

type CSPDirectives map[CSPFetchDirective][]string

CSPDirectives is a map of all csp fetch directives to their values. Each directive is a set of values that is joined by a space (' '). All directives are semi-colon separated as a single string for the csp header.

func (CSPDirectives) Append added in v0.6.1

func (s CSPDirectives) Append(d CSPFetchDirective, values ...string)

type CSPFetchDirective added in v0.6.1

type CSPFetchDirective string

CSPFetchDirective is the list of all constant fetch directives that can be used/appended to.

type ErrorPageData added in v0.9.3

type ErrorPageData struct {
	Status       int
	Title        string
	Description  string
	RetryEnabled bool
	DashboardURL string
}

ErrorPageData contains the variables that are found in site/static/error.html.

Jump to

Keyboard shortcuts

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