diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-04 18:38:10 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-04 18:40:02 +0200 |
commit | 311ab744fe1bf278b18c25892497271988399e9a (patch) | |
tree | 89f956f521000ac0d22f815e91cab4cf00a8b70f /pkg/view | |
parent | c2d666b43477ea7042b574ad940c508216cb0e83 (diff) | |
download | lens-311ab744fe1bf278b18c25892497271988399e9a.tar.gz lens-311ab744fe1bf278b18c25892497271988399e9a.tar.bz2 lens-311ab744fe1bf278b18c25892497271988399e9a.zip |
feat: Add user based files
Now files follow user path configuration
Diffstat (limited to 'pkg/view')
-rw-r--r-- | pkg/view/filesystem.go | 11 | ||||
-rw-r--r-- | pkg/view/media.go | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/pkg/view/filesystem.go b/pkg/view/filesystem.go index d598b88..7fd7331 100644 --- a/pkg/view/filesystem.go +++ b/pkg/view/filesystem.go @@ -11,8 +11,8 @@ import ( type ( FileSystemView struct { - controller service.FileSystemController - settings repository.SettingsRepository + fsService service.FileSystemController + settings repository.SettingsRepository } FilePage struct { Page *service.Page @@ -26,15 +26,16 @@ func NewFileSystemView( settingsRepository repository.SettingsRepository, ) *FileSystemView { return &FileSystemView{ - controller: controller, - settings: settingsRepository, + fsService: controller, + settings: settingsRepository, } } func (self *FileSystemView) Index(ctx *fasthttp.RequestCtx) error { pathValue := string(ctx.FormValue("path")) + token := ext.GetTokenFromCtx(ctx) - page, err := self.controller.GetPage(pathValue) + page, err := self.fsService.GetPage(ctx, token.UserID, pathValue) if err != nil { return err } diff --git a/pkg/view/media.go b/pkg/view/media.go index 0b588f4..bea515d 100644 --- a/pkg/view/media.go +++ b/pkg/view/media.go @@ -98,7 +98,9 @@ func (self *MediaView) GetThumbnail(ctx *fasthttp.RequestCtx) error { path, err := self.mediaRepository.GetThumbnailPath(ctx, pathHash) if err != nil { - return self.GetImage(ctx) + ctx.Redirect("/media/image?path_hash="+pathHash, 307) + // nolint: nilerr + return nil } ctx.Request.Header.SetContentType("image/jpeg") |