all repos — legit @ 4447fcda1f06f4d516dfd40e3d306da193aaeeae

web frontend for git, written in go

git: add unlisted repositories

Marco Andronaco andronacomarco@gmail.com
Fri, 04 Oct 2024 15:52:08 +0000
commit

4447fcda1f06f4d516dfd40e3d306da193aaeeae

parent

c75aa9f52fd81f4591ed42882c44d26b04d5b0e2

4 files changed, 16 insertions(+), 7 deletions(-)

jump to
M config/config.goconfig/config.go

@@ -14,6 +14,7 @@ ScanPath string `yaml:"scanPath"`

Readme []string `yaml:"readme"` MainBranch []string `yaml:"mainBranch"` Ignore []string `yaml:"ignore,omitempty"` + Unlisted []string `yaml:"unlisted,omitempty"` } `yaml:"repo"` Dirs struct { Templates string `yaml:"templates"`
M readmereadme

@@ -61,6 +61,7 @@ • dirs: use this to override the default templates and static assets.

• repo.readme: readme files to look for. • repo.mainBranch: main branch names to look for. • repo.ignore: repos to ignore, relative to scanPath. +• repo.unlisted: repos to hide, relative to scanPath. • server.name: used for go-import meta tags and clone URLs.
M routes/routes.goroutes/routes.go

@@ -40,11 +40,12 @@

infos := []info{} for _, dir := range dirs { - if !dir.IsDir() || d.isIgnored(dir.Name()) { + name := dir.Name() + if !dir.IsDir() || d.isIgnored(name) || d.isUnlisted(name) { continue } - path := filepath.Join(d.c.Repo.ScanPath, dir.Name()) + path := filepath.Join(d.c.Repo.ScanPath, name) gr, err := git.Open(path, "") if err != nil { log.Println(err)

@@ -58,14 +59,10 @@ log.Println(err)

return } - name := dir.Name() - - desc := getDescription(path) - infos = append(infos, info{ DisplayName: getDisplayName(name), Name: name, - Desc: desc, + Desc: getDescription(path), Idle: humanize.Time(c.Author.When), d: c.Author.When, })
M routes/util.goroutes/util.go

@@ -30,6 +30,16 @@ }

return } +func (d *deps) isUnlisted(name string) bool { + for _, i := range d.c.Repo.Unlisted { + if name == i { + return true + } + } + + return false +} + func (d *deps) isIgnored(name string) bool { for _, i := range d.c.Repo.Ignore { if name == i {