httphandler

package
v0.0.0-...-757e667 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON

func DecodeJSON(r *http.Request, dest interface{}) error

DecodeJSON decodes JSON request body into the provided struct

func Handle

func Handle(method string, handler HTTPHandler) http.HandlerFunc

Handle wraps a handler with common middleware (method checking, error handling)

func SPAHandler

func SPAHandler(staticFS fs.FS, logger *zap.Logger) http.Handler

SPAHandler creates a handler for serving static files with SPA fallback

func WriteCreated

func WriteCreated(w http.ResponseWriter, data interface{}) error

WriteCreated writes a created JSON response (201)

func WriteJSON

func WriteJSON(w http.ResponseWriter, statusCode int, data interface{}) error

WriteJSON writes a JSON response with the specified status code

func WriteSuccess

func WriteSuccess(w http.ResponseWriter, data interface{}) error

WriteSuccess writes a successful JSON response (200)

Types

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(tokenManager *auth.TokenManager, userStore userstore.Store, registryStore registrystore.Store, logger *zap.Logger, embeddedMode bool) *AuthHandler

func (*AuthHandler) CheckFirstRun

func (h *AuthHandler) CheckFirstRun() http.HandlerFunc

func (*AuthHandler) EmbeddedGuestLogin

func (h *AuthHandler) EmbeddedGuestLogin() http.HandlerFunc

func (*AuthHandler) GuestLogin

func (h *AuthHandler) GuestLogin() http.HandlerFunc

func (*AuthHandler) Login

func (h *AuthHandler) Login() http.HandlerFunc

func (*AuthHandler) RefreshToken

func (h *AuthHandler) RefreshToken() http.HandlerFunc

func (*AuthHandler) Register

func (h *AuthHandler) Register() http.HandlerFunc

func (*AuthHandler) RegisterAdmin

func (h *AuthHandler) RegisterAdmin() http.HandlerFunc

type FirstRunResponse

type FirstRunResponse struct {
	IsFirstRun bool  `json:"isFirstRun"`
	Timestamp  int64 `json:"timestamp"`
}

type HTTPHandler

type HTTPHandler func(w http.ResponseWriter, r *http.Request) error

HTTPHandler represents a simplified handler function

type LicenseHandler

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

func NewLicenseHandler

func NewLicenseHandler(licenseService *license.Service, logger *zap.Logger) *LicenseHandler

func (*LicenseHandler) ActivateLicense

func (h *LicenseHandler) ActivateLicense() http.HandlerFunc

ActivateLicense activates a license with the provided key (no authentication required)

func (*LicenseHandler) GetAdminStatus

func (h *LicenseHandler) GetAdminStatus() http.HandlerFunc

GetAdminStatus returns detailed license status for authenticated admin users

func (*LicenseHandler) GetPublicStatus

func (h *LicenseHandler) GetPublicStatus() http.HandlerFunc

GetPublicStatus returns the public license status (no authentication required)

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Token      string       `json:"token"`
	ExpiresIn  int64        `json:"expiresIn"`
	User       UserResponse `json:"user"`
	PathPrefix string       `json:"pathPrefix,omitempty"`
}

type RefreshTokenRequest

type RefreshTokenRequest struct {
	Token string `json:"token"`
}

type RegisterAdminRequest

type RegisterAdminRequest struct {
	DisplayName string `json:"displayName"`
	Username    string `json:"username"`
	Password    string `json:"password"`
}

type RegisterRequest

type RegisterRequest struct {
	DisplayName string `json:"displayName"`
	Username    string `json:"username"`
	Password    string `json:"password"`
}

type UserResponse

type UserResponse struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	Username    string `json:"username"`
	Role        string `json:"role"`
}

Jump to

Keyboard shortcuts

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