manager

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCommand = exec.Command

ExecCommand is exec.Command by default, but can be overridden in tests.

Functions

func AppendYearLocal

func AppendYearLocal(noYearPath string) (string, error)

func CleanupOld

func CleanupOld(prefix, rmDir string, retentionDays int, user *database.User) error

func CleanupUserTempDir added in v1.4.0

func CleanupUserTempDir(userID uuid.UUID) error

CleanupUserTempDir removes old temp files for a user

func DefaultRmDir

func DefaultRmDir() string

func FoldersHandler added in v1.0.0

func FoldersHandler(c *gin.Context)

FoldersHandler writes a JSON {"folders": ["/path", ...]}.

func GetUserDataDir added in v1.4.0

func GetUserDataDir(userID uuid.UUID) (string, error)

GetUserDataDir returns the data directory for a specific user In multi-user mode, creates /data/users/{user_id}/ In single-user mode, returns /data/

func GetUserPDFDir added in v1.4.0

func GetUserPDFDir(userID uuid.UUID, prefix string) (string, error)

GetUserPDFDir returns the PDF directory for a specific user In multi-user mode, creates /data/users/{user_id}/pdfs/ In single-user mode, returns the PDF_DIR env var or /data/pdfs/

func GetUserRmapiConfigPath added in v1.4.0

func GetUserRmapiConfigPath(userID uuid.UUID) (string, error)

GetUserRmapiConfigPath returns the path to the rmapi configuration file for a user. In multi-user mode it is stored under the user's data directory. The necessary directory structure is created if missing.

func GetUserTempDir added in v1.4.0

func GetUserTempDir(userID uuid.UUID) (string, error)

GetUserTempDir returns the temp directory for a specific user In multi-user mode, creates /data/users/{user_id}/temp/ In single-user mode, returns system temp directory

func GetUserUploadDir added in v1.4.0

func GetUserUploadDir(userID uuid.UUID) (string, error)

GetUserUploadDir returns the upload directory for a specific user In multi-user mode, creates /data/users/{user_id}/uploads/ In single-user mode, returns ./uploads/

func InitializeUserFolderCache added in v1.4.0

func InitializeUserFolderCache(db *gorm.DB)

InitializeUserFolderCache initializes the user folder cache service

func IsSingleUserPaired added in v1.4.0

func IsSingleUserPaired() bool

IsSingleUserPaired checks if rmapi.conf exists for single-user mode

func IsUserPaired added in v1.4.0

func IsUserPaired(userID uuid.UUID) bool

IsUserPaired checks whether the rmapi configuration file exists and is non-empty for the given user.

func ListFolders added in v1.0.0

func ListFolders(user *database.User) ([]string, error)

ListFolders returns a slice of all folder paths on the reMarkable device. Paths are returned with a leading slash, e.g. "/Books/Fiction".

func Logf

func Logf(format string, v ...interface{})

func LogfWithUser added in v1.4.0

func LogfWithUser(user *database.User, format string, v ...interface{})

LogfWithUser logs a message with username prefix in multi-user mode

func RefreshFolderCache added in v1.4.0

func RefreshFolderCache() error

RefreshFolderCache manually triggers a folder cache refresh (single-user mode)

func RefreshUserFolderCache added in v1.4.0

func RefreshUserFolderCache(userID string) error

RefreshUserFolderCache manually triggers a folder cache refresh for a specific user

func RenameAndUpload

func RenameAndUpload(path, prefix, rmDir string, user *database.User) (string, error)

RenameAndUpload renames locally, uploads via rmapi, and returns the name on the device.

func RenameLocal

func RenameLocal(path, prefix string) (string, error)

func RenameLocalNoYear

func RenameLocalNoYear(src, prefix string) (string, error)

func SanitizePrefix added in v1.0.0

func SanitizePrefix(p string) (string, error)

SanitizePrefix ensures prefix is a simple directory name with no path separators, leading slashes, or parent directory components.

func SimpleUpload

func SimpleUpload(path, rmDir string, user *database.User) (string, error)

SimpleUpload calls `rmapi put` and returns the uploaded filename or a detailed error.

func StartFolderCache added in v1.1.0

func StartFolderCache()

StartFolderCache begins a goroutine that periodically refreshes the cached folder listing. It also performs an initial refresh so the first user request can be served quickly.

Types

type UserFolderCacheService added in v1.4.0

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

UserFolderCacheService manages per-user folder caching

func NewUserFolderCacheService added in v1.4.0

func NewUserFolderCacheService(db *gorm.DB) *UserFolderCacheService

NewUserFolderCacheService creates a new user folder cache service

func (*UserFolderCacheService) GetUserFolders added in v1.4.0

func (s *UserFolderCacheService) GetUserFolders(userID uuid.UUID, force bool) ([]string, error)

GetUserFolders returns the cached folders for a user, refreshing if necessary

func (*UserFolderCacheService) InvalidateUserCache added in v1.4.0

func (s *UserFolderCacheService) InvalidateUserCache(userID uuid.UUID)

InvalidateUserCache invalidates the cache for a specific user

func (*UserFolderCacheService) LoadFolderCacheFromDatabase added in v1.4.0

func (s *UserFolderCacheService) LoadFolderCacheFromDatabase(userID uuid.UUID) ([]string, error)

LoadFolderCacheFromDatabase loads cached folders from the database

func (*UserFolderCacheService) StartBackgroundRefresh added in v1.4.0

func (s *UserFolderCacheService) StartBackgroundRefresh()

StartBackgroundRefresh starts a background goroutine that periodically refreshes user caches

Jump to

Keyboard shortcuts

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