diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-19 21:01:49 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-19 21:02:35 +0200 |
commit | b8b6d3037c524575f140650ac243c16df6a98a92 (patch) | |
tree | bf9dfb99481389b6714041bc36fd8f23a1db332b /pkg | |
parent | fbcac585cf626917e2baf1d0065c7b632341ba01 (diff) | |
download | lens-b8b6d3037c524575f140650ac243c16df6a98a92.tar.gz lens-b8b6d3037c524575f140650ac243c16df6a98a92.tar.bz2 lens-b8b6d3037c524575f140650ac243c16df6a98a92.zip |
feat: Move last page to qtpl
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/service/filesystem.go | 15 | ||||
-rw-r--r-- | pkg/view/filesystem.go | 17 |
2 files changed, 21 insertions, 11 deletions
diff --git a/pkg/service/filesystem.go b/pkg/service/filesystem.go index 2e4b510..b4479ea 100644 --- a/pkg/service/filesystem.go +++ b/pkg/service/filesystem.go @@ -6,6 +6,7 @@ import ( "net/url" "path" "strings" + "syscall" "git.sr.ht/~gabrielgio/img/pkg/database/repository" "git.sr.ht/~gabrielgio/img/pkg/list" @@ -33,6 +34,20 @@ type ( } ) +func (f *FileParam) GetUid() int { + if stat, ok := f.Info.Sys().(*syscall.Stat_t); ok { + return int(stat.Uid) + } + return 0 +} + +func (f *FileParam) GetGid() int { + if stat, ok := f.Info.Sys().(*syscall.Stat_t); ok { + return int(stat.Gid) + } + return 0 +} + func NewFileSystemController( fsRepository repository.FileSystemRepository, userRepository repository.UserRepository, diff --git a/pkg/view/filesystem.go b/pkg/view/filesystem.go index 7fd7331..6a01117 100644 --- a/pkg/view/filesystem.go +++ b/pkg/view/filesystem.go @@ -3,10 +3,10 @@ package view import ( "github.com/valyala/fasthttp" - "git.sr.ht/~gabrielgio/img" "git.sr.ht/~gabrielgio/img/pkg/database/repository" "git.sr.ht/~gabrielgio/img/pkg/ext" "git.sr.ht/~gabrielgio/img/pkg/service" + "git.sr.ht/~gabrielgio/img/templates" ) type ( @@ -45,17 +45,12 @@ func (self *FileSystemView) Index(ctx *fasthttp.RequestCtx) error { return err } - err = img.Render(ctx, "fs.html", &img.HTMLView[*FilePage]{ - Title: pathValue, - Data: &FilePage{ - Page: page, - ShowMode: settings.ShowMode, - ShowOwner: settings.ShowOwner, - }, + templates.WritePageTemplate(ctx, &templates.FilePage{ + Page: page, + ShowMode: settings.ShowMode, + ShowOwner: settings.ShowOwner, }) - if err != nil { - return err - } + return nil } |