update repository list on timer instead of generating per request
1 file changed, 4 insertions(+), 4 deletions(-)
changed files
M routes/util.go → routes/util.go
@@ -4,6 +4,7 @@ import ( "bufio" "log" "os" + "path" "path/filepath" "slices" "strings"@@ -11,7 +12,6 @@ "alin.ovh/elgit/data" "alin.ovh/elgit/git" securejoin "github.com/cyphar/filepath-securejoin" - "github.com/dimfeld/httptreemux/v5" "github.com/savsgio/atreugo/v11" )@@ -47,7 +47,7 @@ func (d *deps) GetCleanPath(name string) (string, error) { return securejoin.SecureJoin( filepath.Join(d.c.Repo.Root, "repositories"), - httptreemux.Clean(name)+".git", + path.Clean(name)+".git", ) }@@ -71,7 +71,7 @@ return projects, nil } -func (d *deps) getAllRepos() *data.Entries { +func (d *deps) UpdateRepos() { entries := &data.Entries{ Children: []*data.Entry{}, Map: map[string]*data.Entry{},@@ -111,7 +111,7 @@ } entries.Sort() - return entries + d.repos = entries } func setContentDisposition(rc *atreugo.RequestCtx, name string) {