assetserver

package
v0.0.0-...-97b9f3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Code from https://github.com/erikdubbelboer/ringqueue

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	HeaderHost          = "Host"
	HeaderContentType   = "Content-Type"
	HeaderContentLength = "Content-Length"
	HeaderUserAgent     = "User-Agent"
	HeaderCacheControl  = "Cache-Control"
	HeaderUpgrade       = "Upgrade"

	WailsUserAgentValue = "wails.io"
)

Variables

This section is empty.

Functions

func BuildAssetServerConfig

func BuildAssetServerConfig(appOptions *options.App) (assetserver.Options, error)

func FindEmbedRootPath

func FindEmbedRootPath(fsys embed.FS) (string, error)

FindEmbedRootPath finds the root path in the embed FS. It's the directory which contains all the files.

func FindPathToFile

func FindPathToFile(fsys fs.FS, file string) (string, error)

func GetMimetype

func GetMimetype(filename string, data []byte) string

func NewAssetHandler

func NewAssetHandler(options assetserver.Options, log Logger) (http.Handler, error)

func NewExternalAssetsHandler

func NewExternalAssetsHandler(logger Logger, options assetserver.Options, url *url.URL) http.Handler

func NewProxyServer

func NewProxyServer(proxyURL string) http.Handler

Types

type AssetServer

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

func NewAssetServer

func NewAssetServer(bindingsJSON string, options assetserver.Options, servingFromDisk bool, logger Logger, runtime RuntimeAssets) (*AssetServer, error)

func NewAssetServerMainPage

func NewAssetServerMainPage(bindingsJSON string, options *options.App, servingFromDisk bool, logger Logger, runtime RuntimeAssets) (*AssetServer, error)

func NewAssetServerWithHandler

func NewAssetServerWithHandler(handler http.Handler, bindingsJSON string, servingFromDisk bool, logger Logger, runtime RuntimeAssets) (*AssetServer, error)

func (*AssetServer) AddPluginScript

func (d *AssetServer) AddPluginScript(pluginName string, script string)

func (*AssetServer) ServeHTTP

func (d *AssetServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*AssetServer) ServeWebViewRequest

func (d *AssetServer) ServeWebViewRequest(req webview.Request)

ServeWebViewRequest processes the HTTP Request asynchronously by faking a golang HTTP Server. The request will be finished with a StatusNotImplemented code if no handler has written to the response. The AssetServer takes ownership of the request and the caller mustn't close it or access it in any other way.

func (*AssetServer) UseRuntimeHandler

func (d *AssetServer) UseRuntimeHandler(handler RuntimeHandler)

type Logger

type Logger interface {
	Debug(message string, args ...interface{})
	Error(message string, args ...interface{})
}

type RuntimeAssets

type RuntimeAssets interface {
	DesktopIPC() []byte
	WebsocketIPC() []byte
	RuntimeDesktopJS() []byte
}

type RuntimeHandler

type RuntimeHandler interface {
	HandleRuntimeCall(w http.ResponseWriter, r *http.Request)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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