handlers

package
v0.0.0-...-6f3bd2b Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package handlers provides the functionalities for file web server hosting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheItem

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

type File

type File struct {
	// The name of the file
	Name string `json:"name"`

	// Whether it's a file or directory
	IsDir bool `json:"is_dir"`

	// Size of the file in bytes
	Size string `json:"size"`

	// MimeType of the file
	MimeType string `json:"mimeType"`
}

type Handlers

type Handlers struct {
	Hosts []string
	// contains filtered or unexported fields
}

func NewHandlers

func NewHandlers(
	logCh chan models.ServerLog,
	dir string,
	serverConfig *config.ServerConfig,
	notifConfig *config.NotifConfig,
) *Handlers

func (*Handlers) DownloadFileHandler

func (h *Handlers) DownloadFileHandler(w http.ResponseWriter, r *http.Request)

func (*Handlers) GetAssets

func (h *Handlers) GetAssets(w http.ResponseWriter, r *http.Request)

func (*Handlers) GetFileUpload

func (h *Handlers) GetFileUpload(w http.ResponseWriter, r *http.Request)

func (*Handlers) HandleConnect

func (h *Handlers) HandleConnect(u *websocket.Upgrader, w http.ResponseWriter, r *http.Request)

func (*Handlers) IndexHandler

func (h *Handlers) IndexHandler(w http.ResponseWriter, r *http.Request)

func (*Handlers) ViewFileHandler

func (h *Handlers) ViewFileHandler(w http.ResponseWriter, r *http.Request)

func (*Handlers) WatchFiles

func (h *Handlers) WatchFiles()

type IndexHTML

type IndexHTML struct {
	Files        []File
	CurrentPath  string
	Uid          string
	Hosts        []string
	ServerConfig IndexHTMLConfig
}

IndexHTML defines the data passed to the index.html template file

type IndexHTMLConfig

type IndexHTMLConfig struct {
	Name         string
	AllowUploads bool
}

type ViewHTML

type ViewHTML struct {
	File         string
	MimeType     string
	Hosts        []string
	ServerConfig IndexHTMLConfig
}

ViewHTML defines the data passed to the view.html template file

type Visitor

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

Jump to

Keyboard shortcuts

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