handlers

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package handlers contains http handlers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API

func API() http.Handler

func APICmd

func APICmd(config configuration.Config) http.Handler

func APIConnections added in v1.3.0

func APIConnections(config configuration.Config, server data.Server) http.Handler

func APILogin

func APILogin(config configuration.Config) http.Handler

func APIUsers

func APIUsers(config configuration.Config) http.Handler

func AccessControlAllow

func AccessControlAllow(next http.Handler) http.Handler

AccessControlAllow is a middleware that sets CORS headers on the response. It allows requests from any origin specified in the request's "Origin" header and supports HTTP methods POST, GET, OPTIONS, PUT, and DELETE. It also sets the allowed headers to "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization". The next handler in the chain is called after setting these headers.

func CastSSE added in v1.0.3

func CastSSE(config configuration.Config) http.Handler

CastSSE returns an HTTP handler that handles server execution of a commands

func Exec

func Exec() http.Handler

func Homepage

func Homepage(iframeHandler http.Handler, config configuration.Config) http.Handler

func IFrame added in v1.0.2

func IFrame(config configuration.Config) http.Handler

func Login

func Login(loginPage []byte) http.Handler

func LoginRedirect added in v1.0.4

func LoginRedirect(w http.ResponseWriter, r *http.Request, origin string)

func NoLayout added in v1.0.2

func NoLayout(config configuration.Config) http.Handler

func Options added in v1.3.0

func Options(optionsPage []byte, config configuration.Config) http.Handler

func SSE added in v1.0.3

func SSE(server data.Server, config configuration.Config) http.Handler

func Stats added in v1.0.4

func Stats(statsPage []byte, config configuration.Config) http.Handler

Stats returns a http.Handler that writes the given statsPage to the response body. The request must have a valid cookie id and either admin privileges or a valid user password to access the page. If the request is unauthenticated, the handler redirects to the login page.

Types

type RequestPayload

type RequestPayload struct {
	Block *int     `json:"block"`
	Code  []string `json:"code"`
	Slide int      `json:"slide"`
}

type User

type User struct {
	LoginTime time.Time           `json:"login_time"`
	Username  string              `json:"username"`
	IP        string              `json:"ip"`
	Hash      string              `json:"-"`
	UA        useragent.UserAgent `json:"ua"`
	Admin     bool                `json:"admin"`
}

Jump to

Keyboard shortcuts

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