Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ListenAddr string // address to listen on for HTTP server
Theme string // UI theme (light/dark)
RootDir string // root directory to serve files from
Version string // version information to display in UI
Exclude []string // patterns of files/directories to exclude
Auth string // password for basic authentication
AuthUser string // username for basic authentication (defaults to "weblist")
SessionSecret string // secret key for signing session tokens
Title string // custom title for the site
SFTPUser string // username for SFTP authentication
SFTPAddress string // address to listen for SFTP connections
SFTPKeyFile string // path to SSH private key file
SFTPAuthorized string // path to authorized_keys file for public key authentication
BrandName string // company or organization name for branding
BrandColor string // color for navbar
EnableSyntaxHighlighting bool // whether to enable syntax highlighting for code files
InsecureCookies bool // allow cookies without secure flag
SessionTTL time.Duration // session timeout duration
EnableMultiSelect bool // enable multi-file selection and download
RecursiveMtime bool // calculate directory mtime from newest nested file
EnableUpload bool // enable file upload support
UploadMaxSize int64 // max upload size in bytes
UploadOverwrite bool // allow overwriting existing files on upload
}
Config represents server configuration.
type ContentTypeInfo ¶ added in v0.17.0
type ContentTypeInfo struct {
MIMEType string // MIME type string for the file
IsText bool // true for text-based content (plain text, code, HTML, JSON, XML)
IsHTML bool // true specifically for HTML content
IsPDF bool // true for PDF documents
IsImage bool // true for all image formats
IsMarkdown bool // true for markdown files (.md, .markdown)
IsCSV bool // true for CSV files (.csv)
}
ContentTypeInfo holds content type information for a file
func DetermineContentType ¶ added in v0.8.4
func DetermineContentType(filePath string) ContentTypeInfo
DetermineContentType analyzes a file to determine its content type and common format flags. It uses a multi-step detection process: 1. Checks against a predefined list of known text file extensions 2. Falls back to standard MIME type detection based on file extension 3. Defaults to text/plain if no type could be determined
This is used for deciding how to present files in the UI (view vs. download).
type FileInfo ¶
type FileInfo struct {
Name string
IsDir bool
Size int64
LastModified time.Time
Path string
// contains filtered or unexported fields
}
FileInfo represents a file or directory to be displayed in the list
func (FileInfo) IsViewable ¶ added in v0.4.0
IsViewable checks if the file can be viewed in a browser. Returns false if content detection found binary data despite text-like extension.
func (FileInfo) SizeToString ¶
SizeToString converts file size to human-readable format
func (FileInfo) TimeString ¶
TimeString formats the last modified time
func (FileInfo) TimeStringShort ¶ added in v0.14.3
TimeStringShort formats the last modified time with 2-digit year for mobile