webdav

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConfigHandlers

func RegisterConfigHandlers(ctx context.Context, configManager *config.Manager, handler *Handler)

RegisterConfigHandlers registers handlers for WebDAV-related configuration changes

Types

type AuthCredentials

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

AuthCredentials holds the current WebDAV authentication credentials

func NewAuthCredentials

func NewAuthCredentials(username, password string) *AuthCredentials

NewAuthCredentials creates new authentication credentials

func (*AuthCredentials) GetCredentials

func (ac *AuthCredentials) GetCredentials() (string, string)

GetCredentials returns the current credentials (thread-safe)

func (*AuthCredentials) UpdateCredentials

func (ac *AuthCredentials) UpdateCredentials(username, password string)

UpdateCredentials updates the credentials (thread-safe)

type AuthUpdater

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

AuthUpdater provides methods to update WebDAV authentication

func NewAuthUpdater

func NewAuthUpdater() *AuthUpdater

NewAuthUpdater creates a new WebDAV auth updater

func (*AuthUpdater) SetAuthCredentials

func (u *AuthUpdater) SetAuthCredentials(credentials *AuthCredentials)

SetAuthCredentials sets the auth credentials reference for dynamic updates

func (*AuthUpdater) UpdateAuth

func (u *AuthUpdater) UpdateAuth(username, password string) error

UpdateAuth updates WebDAV authentication credentials

type Config

type Config struct {
	// Port is the port where the webdav server will be listening
	Port int `yaml:"port" default:"8080" mapstructure:"port"`
	// User is the user to access the webdav server
	User string `yaml:"username" default:"usenet" json:"-" mapstructure:"username"`
	// Pass is the password to access the webdav server
	Pass string `yaml:"password" default:"usenet" json:"-" mapstructure:"password"`
	// Prefix is the URL path prefix for the WebDAV server
	Prefix string `yaml:"prefix" default:"/webdav/" mapstructure:"prefix"`
}

type File

type File interface {
	io.ReadSeekCloser
	Write(p []byte) (n int, err error)
	Readdir(count int) ([]os.FileInfo, error)
	Stat() (os.FileInfo, error)
}

File provides access to a single file or directory.

type FileSystem

type FileSystem interface {
	Mkdir(ctx context.Context, name string, perm os.FileMode) error
	OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error)
	RemoveAll(ctx context.Context, name string) error
	Rename(ctx context.Context, oldName, newName string) error
	Stat(ctx context.Context, name string) (os.FileInfo, error)
}

FileSystem provides virtual filesystem access for WebDAV.

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
	Err        error
}

HTTPError represents an HTTP error with a specific status code

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Unwrap

func (e *HTTPError) Unwrap() error

type Handler

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

Handler provides WebDAV functionality as an HTTP handler

func NewHandler

func NewHandler(
	config *Config,
	fs *nzbfilesystem.NzbFilesystem,
	tokenService *token.Service,
	userRepo *database.UserRepository,
	configGetter config.ConfigGetter,
	streamTracker *api.StreamTracker,
) (*Handler, error)

NewHandler creates a new WebDAV handler that can be used with Fiber adaptor

func (*Handler) GetAuthCredentials

func (h *Handler) GetAuthCredentials() *AuthCredentials

GetAuthCredentials returns the auth credentials for dynamic updates

func (*Handler) GetHTTPHandler

func (h *Handler) GetHTTPHandler() http.Handler

GetHTTPHandler returns the HTTP handler for use with Fiber adaptor

func (*Handler) SyncAuthCredentials

func (h *Handler) SyncAuthCredentials()

SyncAuthCredentials updates auth credentials from current config

Directories

Path Synopsis
xml

Jump to

Keyboard shortcuts

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