http

package
v0.0.0-...-da0c8bd Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileInfoFasterFunc = files.FileInfoFaster

Functions

func AuthenticateLDAPUser

func AuthenticateLDAPUser(username, password string) (*users.User, error)

AuthenticateLDAPUser attempts LDAP authentication and returns the filebrowser user if successful.

func BuildAndStreamArchive

func BuildAndStreamArchive(w http.ResponseWriter, r *http.Request, d *requestContext, source string, fileList []string) (int, error)

BuildAndStreamArchive resolves paths, creates a zip or tar.gz archive, and streams it to w. It respects access rules and max archive size. Used only by the raw handler for multi-file/directory download.

func GetEmbeddedAssets

func GetEmbeddedAssets() embed.FS

GetEmbeddedAssets returns the embedded assets filesystem

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs each request and its status code.

func StartHttp

func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete chan struct{})

Types

type AuthTokenFrontend

type AuthTokenFrontend struct {
	Token       string            `json:"token"`
	Name        string            `json:"name"`
	IssuedAt    int64             `json:"issuedAt"`
	ExpiresAt   int64             `json:"expiresAt"`
	Permissions users.Permissions `json:"Permissions,omitempty"`
}

type BulkDeleteItem

type BulkDeleteItem struct {
	Source  string `json:"source"`
	Path    string `json:"path"`
	Message string `json:"message,omitempty"`
}

BulkDeleteItem represents a single item in a bulk delete request

type BulkDeleteResponse

type BulkDeleteResponse struct {
	Succeeded []BulkDeleteItem `json:"succeeded"`
	Failed    []BulkDeleteItem `json:"failed"`
}

BulkDeleteResponse represents the response from a bulk delete operation

type DirectDownloadResponse

type DirectDownloadResponse struct {
	Status      string `json:"status"`
	Hash        string `json:"hash"`
	DownloadURL string `json:"url"`
	ShareURL    string `json:"shareUrl"`
}

DirectDownloadResponse represents the response for direct download endpoint

type FileCache

type FileCache interface {
	Store(ctx context.Context, key string, value []byte) error
	Load(ctx context.Context, key string) ([]byte, bool, error)
	Delete(ctx context.Context, key string) error
}

type GroupListResponse

type GroupListResponse struct {
	Groups []string `json:"groups"`
}

type HttpResponse

type HttpResponse struct {
	Status  int    `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
	Token   string `json:"token,omitempty"`
}

type MoveCopyItem

type MoveCopyItem struct {
	FromSource string `json:"fromSource,omitempty"`
	FromPath   string `json:"fromPath,omitempty"`
	ToSource   string `json:"toSource,omitempty"`
	ToPath     string `json:"toPath,omitempty"`
	Message    string `json:"message,omitempty"`
}

MoveCopyItem represents a single item in a move/copy request

type MoveCopyRequest

type MoveCopyRequest struct {
	Items     []MoveCopyItem `json:"items"`
	Action    string         `json:"action"`    // "copy", "move", or "rename"
	Overwrite bool           `json:"overwrite"` // Overwrite if destination exists
	Rename    bool           `json:"rename"`    // Auto-rename if destination exists
}

MoveCopyRequest represents a move/copy operation request

type MoveCopyResponse

type MoveCopyResponse struct {
	Succeeded []MoveCopyItem `json:"succeeded"`
	Failed    []MoveCopyItem `json:"failed"`
}

MoveCopyResponse represents the response from a move/copy operation

type OnlyOfficeAction

type OnlyOfficeAction struct {
	Type   int    `json:"type"`
	UserID string `json:"userid"`
}

type OnlyOfficeCallback

type OnlyOfficeCallback struct {
	Actions       []OnlyOfficeAction `json:"actions,omitempty"`
	ChangesURL    string             `json:"changesurl,omitempty"`
	FileType      string             `json:"filetype,omitempty"`
	ForceSaveType int                `json:"forcesavetype,omitempty"`
	FormsDataURL  string             `json:"formsdataurl,omitempty"`
	History       *OnlyOfficeHistory `json:"history,omitempty"`
	Key           string             `json:"key,omitempty"`
	Status        int                `json:"status,omitempty"`
	URL           string             `json:"url,omitempty"`
	UserData      string             `json:"userdata,omitempty"`
	Users         []string           `json:"users,omitempty"`
}

type OnlyOfficeHistory

type OnlyOfficeHistory struct {
	Changes       interface{} `json:"changes"`
	ServerVersion string      `json:"serverVersion"`
}

type OnlyOfficeJWTPayload

type OnlyOfficeJWTPayload struct {
	Key     string   `json:"key"`
	Status  int      `json:"status"`
	Users   []string `json:"users"`
	Actions []struct {
		Type   int    `json:"type"`
		UserID string `json:"userid"`
	} `json:"actions"`
}

OnlyOfficeJWTPayload represents the JWT payload structure for OnlyOffice callbacks

type OnlyOfficeLogContext

type OnlyOfficeLogContext struct {
	Username   string
	SessionID  string
	DocumentID string
	FilePath   string
	Source     string
	ShareHash  string

	StartTime time.Time
	// contains filtered or unexported fields
}

OnlyOfficeLogContext stores context for OnlyOffice operations

type OnlyOfficeLogEvent

type OnlyOfficeLogEvent struct {
	EventType  string `json:"eventType"`
	DocumentID string `json:"documentId"`
	Username   string `json:"username"`
	SessionID  string `json:"sessionId"`
	LogLevel   string `json:"logLevel"`
	Message    string `json:"message"`
	Timestamp  string `json:"timestamp"`
	Component  string `json:"component"`
}

OnlyOfficeLogEvent represents a log event for SSE

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	http.ResponseWriter
	StatusCode int

	PayloadSize int
	User        string
	// contains filtered or unexported fields
}

ResponseWriterWrapper wraps the standard http.ResponseWriter to capture the status code

func (*ResponseWriterWrapper) Flush

func (w *ResponseWriterWrapper) Flush()

func (*ResponseWriterWrapper) Write

func (w *ResponseWriterWrapper) Write(b []byte) (int, error)

Write is the method to write the response body and ensure WriteHeader is called

func (*ResponseWriterWrapper) WriteHeader

func (w *ResponseWriterWrapper) WriteHeader(statusCode int)

WriteHeader captures the status code and ensures it's only written once

type ShareResponse

type ShareResponse struct {
	*share.Link
	Source     string `json:"source"` // Override embedded field to show source name
	Username   string `json:"username,omitempty"`
	PathExists bool   `json:"pathExists"`
}

ShareResponse represents a share with computed username field and download URL

type TemplateRenderer

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

func (*TemplateRenderer) Render

func (t *TemplateRenderer) Render(w http.ResponseWriter, name string, data interface{}) error

Render renders a template document with headers and data

type UserRequest

type UserRequest struct {
	Which []string   `json:"which"`
	User  users.User `json:"data"`
}

Jump to

Keyboard shortcuts

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