Documentation
¶
Index ¶
- Constants
- func ExtractOrReadBinFS(dest string, siteFS fs.FS) (http.FileSystem, error)
- func FS() fs.FS
- func Handler(siteFS fs.FS, binFS http.FileSystem) http.Handler
- func ShouldCacheFile(reqFile string) bool
- func WithAPIResponse(ctx context.Context, apiResponse APIResponse) context.Context
- type APIResponse
- type CSPDirectives
- type CSPFetchDirective
Constants ¶
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
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 ShouldCacheFile ¶ added in v0.6.1
func WithAPIResponse ¶ added in v0.6.2
func WithAPIResponse(ctx context.Context, apiResponse APIResponse) context.Context
WithAPIResponse returns a context with the APIResponse value attached. This is used to inject API response data to the index.html for additional metadata in error pages.
Types ¶
type APIResponse ¶ added in v0.6.2
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.